import { type AccessToken, type AuthorizationCodeAuthConfig, type CantonAuthConfig, type CantonAuthProvider, type CantonAuthProviderOptions } from '@chainlink/ccip-sdk/src/index.ts'; /** * Merge `CANTON_CLIENT_ID` / `CANTON_CLIENT_SECRET` env vars into an * {@link AuthConfig} when the `auth` block omits them. * * This allows config files to specify the non-secret OIDC parameters (`type`, * `authUrl`, `audience`, `scopes`) while credentials come from environment * variables — keeping secrets out of version-controlled JSON files. */ export declare function mergeAuthEnvVars(auth: CantonAuthConfig): CantonAuthConfig; /** * Open a URL in the default browser (cross-platform best-effort). * * Uses `execFile` (not `exec`) to avoid spawning a shell, preventing command * injection through the URL string. */ export declare function openBrowser(url: string): Promise; /** * Run the full authorization-code + PKCE flow on Node: start a local callback * server, open the browser, wait for the callback, and exchange the code for * tokens. * * Composes the SDK protocol helpers ({@link buildAuthorizationRequest}, * {@link validateAuthorizationCallback}, {@link exchangeAuthorizationCode}) * with the Node-only callback server and browser launching. * * @param config - Authorization code config (with `authUrl`, `clientId`). * @param options - Optional fetch override, abort signal, and flow controls * (`callbackUrl`, `openBrowser`, `timeoutMs`). * @returns The obtained {@link AccessToken}. * @throws {@link CCIPError} (CANTON_AUTH_ERROR) on timeout, callback errors, * state mismatch, or token exchange failure. */ export declare function runAuthorizationCodeFlow(config: AuthorizationCodeAuthConfig, options?: CantonAuthProviderOptions & { /** Local redirect URI. Defaults to `http://localhost:8400/callback`. */ callbackUrl?: string; /** Open the browser automatically (default `true`). */ openBrowser?: boolean; /** Overall flow timeout in ms (default 120_000). */ timeoutMs?: number; /** Override the PKCE state parameter (for deterministic testing). */ stateOverride?: string; /** Override the PKCE code verifier (for deterministic testing). */ verifierOverride?: string; }): Promise; /** * Build an {@link AuthProvider} for the CLI from a discriminated * {@link AuthConfig}, resolving `CANTON_CLIENT_ID` / `CANTON_CLIENT_SECRET` * from env vars and orchestrating the authorization-code flow on Node. * * - `static` / `clientCredentials`: delegated to the SDK's * {@link createAuthProvider} (runtime-agnostic). * - `authorizationCode`: orchestrated here via {@link runAuthorizationCodeFlow} * and wrapped in a caching provider that refreshes via the SDK's * `refreshAuthorizationCodeToken` helper. * * @param auth - Auth config (static, clientCredentials, or authorizationCode). * @param options - Optional fetch override, abort signal, and flow controls. * @returns An {@link AuthProvider} whose `token()` yields valid JWTs. * @throws {@link CCIPError} (CANTON_AUTH_ERROR) on invalid config or auth failure. */ export declare function createCliAuthProvider(auth: CantonAuthConfig, options?: CantonAuthProviderOptions & { callbackUrl?: string; openBrowser?: boolean; timeoutMs?: number; }): Promise; /** * Resolve a JWT (or token getter) for a {@link CantonConfig} from an * {@link AuthConfig}, suitable for `cantonConfig.jwt`. * * The CLI calls this upfront (before `CantonChain.fromUrl`) so auth is resolved * once. When the auth config is `static`, a static JWT string is returned; for * refreshable flows (clientCredentials / authorizationCode), a * `() => Promise` getter is returned so the SDK clients refresh per * request. * * The resolved provider is memoized process-wide by auth-config fingerprint, so * repeated calls within one process (e.g. `send` → `showRequests` both calling * `fetchChainsFromRpcs`) reuse the same cached token instead of re-running the * interactive flow. * * @param auth - Auth config (static, clientCredentials, or authorizationCode). * @param options - Optional fetch override, abort signal, and flow controls. * @returns A `string` for static auth, or a `() => Promise` getter for * refreshable flows (clientCredentials / authorizationCode). * @throws {@link CCIPError} (CANTON_AUTH_ERROR) on invalid config or auth failure. * * @example * ```ts * const jwt = await resolveCantonTokenGetter(auth) * const cantonConfig = { ...rest, jwt } * ``` */ export declare function resolveCantonTokenGetter(auth: CantonAuthConfig, options?: CantonAuthProviderOptions & { callbackUrl?: string; openBrowser?: boolean; timeoutMs?: number; }): Promise Promise)>; //# sourceMappingURL=auth.d.ts.map