UNPKG

@atproto/oauth-client

Version:

OAuth client for ATPROTO PDS. This package serves as common base for environment-specific implementations (NodeJS, Browser, React-Native).

23 lines 1.17 kB
import type { Keyset } from '@atproto/jwk'; import { type OAuthAuthorizationServerMetadata, type OAuthClientCredentials } from '@atproto/oauth-types'; import type { Runtime } from './runtime.js'; import type { ClientMetadata } from './types.js'; import type { Awaitable } from './util.js'; export type ClientAuthMethod = { method: 'none'; } | { method: 'private_key_jwt'; kid: string; }; export declare function negotiateClientAuthMethod(serverMetadata: OAuthAuthorizationServerMetadata, clientMetadata: ClientMetadata, keyset?: Keyset): ClientAuthMethod; export type ClientCredentialsFactory = () => Awaitable<{ headers?: Record<string, string>; payload?: OAuthClientCredentials; }>; /** * @throws {AuthMethodUnsatisfiableError} if the authentication method is no * long usable (either because the AS changed, of because the key is no longer * available in the keyset). */ export declare function createClientCredentialsFactory(authMethod: ClientAuthMethod, serverMetadata: OAuthAuthorizationServerMetadata, clientMetadata: ClientMetadata, runtime: Runtime, keyset?: Keyset): ClientCredentialsFactory; //# sourceMappingURL=oauth-client-auth.d.ts.map