UNPKG

@atproto/oauth-client

Version:

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

34 lines 1.51 kB
import { Fetch } from '@atproto-labs/fetch'; import { AtprotoDid } from '@atproto/did'; import { OAuthAuthorizationServerMetadata } from '@atproto/oauth-types'; import { AtprotoScope } from './atproto-token-response.js'; import { OAuthServerAgent, TokenSet } from './oauth-server-agent.js'; import { SessionGetter } from './session-getter.js'; export type TokenInfo = { expiresAt?: Date; expired?: boolean; scope: AtprotoScope; iss: string; aud: string; sub: AtprotoDid; }; export declare class OAuthSession { readonly server: OAuthServerAgent; readonly sub: AtprotoDid; private readonly sessionGetter; protected dpopFetch: Fetch<unknown>; constructor(server: OAuthServerAgent, sub: AtprotoDid, sessionGetter: SessionGetter, fetch?: Fetch); get did(): AtprotoDid; get serverMetadata(): Readonly<OAuthAuthorizationServerMetadata>; /** * @param refresh When `true`, the credentials will be refreshed even if they * are not expired. When `false`, the credentials will not be refreshed even * if they are expired. When `undefined`, the credentials will be refreshed * if, and only if, they are (about to be) expired. Defaults to `undefined`. */ protected getTokenSet(refresh: boolean | 'auto'): Promise<TokenSet>; getTokenInfo(refresh?: boolean | 'auto'): Promise<TokenInfo>; signOut(): Promise<void>; fetchHandler(pathname: string, init?: RequestInit): Promise<Response>; } //# sourceMappingURL=oauth-session.d.ts.map