import type { FetchHandlerObject } from '@atcute/client'; import type { Did } from '@atcute/lexicons'; import type { AtprotoOAuthScope } from '@atcute/oauth-types'; import type { OAuthServerAgent } from './oauth-server-agent.ts'; import type { SessionGetter } from './session-getter.ts'; /** * token information for external use. */ export interface TokenInfo { /** token expiration time */ expiresAt?: Date; /** whether the token is expired */ expired?: boolean; /** granted scope */ scope: AtprotoOAuthScope; /** authorization server issuer */ iss: string; /** resource server (PDS) URL */ aud: string; /** user's DID */ sub: Did; } /** * represents an authenticated user session. * * provides methods for making authenticated requests to the user's PDS * and managing the session lifecycle. */ export declare class OAuthSession implements FetchHandlerObject { private readonly dpopFetch; /** server agent for this session's AS */ readonly server: OAuthServerAgent; /** user's DID */ readonly sub: Did; /** session getter for token management */ private readonly sessionGetter; constructor(server: OAuthServerAgent, sub: Did, sessionGetter: SessionGetter, fetch?: typeof globalThis.fetch); /** * user's DID. */ get did(): Did; private getTokenSet; /** * gets information about the current token. * * @param refresh true to force refresh, false to allow stale, 'auto' for normal * @returns token information */ getTokenInfo(refresh?: boolean | 'auto'): Promise; /** * signs out and revokes the session. */ signOut(): Promise; /** * makes an authenticated request to the user's PDS. * * automatically refreshes tokens if needed and retries on auth failure. * * @param pathname path relative to the PDS URL * @param init fetch init options * @returns fetch response */ handle(pathname: string, init?: RequestInit): Promise; } //# sourceMappingURL=oauth-session.d.ts.map