import { Keychain } from '@vltpkg/keychain'; export type Token = `Bearer ${string}` | `Basic ${string}`; /** * Normalize a registry URL into a stable key that preserves the * path prefix. The result is `origin + pathname` with trailing * slashes stripped so that * `https://r.io/luke/` and `https://r.io/luke` * both produce the same key. * * For plain-origin registries the result is identical to the old * `new URL(url).origin` behaviour (e.g. `https://registry.npmjs.org`). */ export declare const normalizeRegistryKey: (url: string) => string; /** * Ensure a registry URL ends with `/` so that `new URL(path, base)` * appends under the full path instead of replacing the last segment. * * registryBase('https://r.io/scope/name') * // → 'https://r.io/scope/name/' */ export declare const registryBase: (url: string) => string; export declare const keychains: Map>; /** * In-memory token store for OIDC-exchanged tokens. * These take precedence over env vars and keychain. */ export declare const runtimeTokens: Map; export declare const setRuntimeToken: (registry: string, token: Token) => void; export declare const clearRuntimeTokens: () => void; export declare const getKC: (identity: string) => Keychain; export declare const isToken: (t: any) => t is Token; export declare const deleteToken: (registry: string, identity: string) => Promise; export declare const setToken: (registry: string, token: Token, identity: string) => Promise; export declare const getToken: (registry: string, identity: string) => Promise; /** * Find the best matching token for a request URL by performing a * longest-prefix match against all known registry keys (runtime * tokens, env-var registries, and keychain entries). * * This is used by `RegistryClient.request()` which only has the * full request URL — not the configured registry URL that was used * to construct it. */ export declare const getTokenByURL: (requestUrl: string, identity: string) => Promise;