@atproto/oauth-client
Version:
OAuth client for ATPROTO PDS. This package serves as common base for environment-specific implementations (NodeJS, Browser, React-Native).
25 lines • 1.37 kB
TypeScript
import { type OAuthProtectedResourceMetadata } from '@atproto/oauth-types';
import { type Fetch } from '@atproto-labs/fetch';
import { CachedGetter, type GetCachedOptions, type SimpleStore, type StoreErrorHandler } from '@atproto-labs/simple-store';
export type { GetCachedOptions, OAuthProtectedResourceMetadata };
export type ProtectedResourceMetadataCache = SimpleStore<string, OAuthProtectedResourceMetadata | null>;
export type OAuthProtectedResourceMetadataResolverConfig = {
allowHttpResource?: boolean;
/**
* Called when the metadata cache throws. The cache is best-effort: failures
* are logged (by default) and degrade to a cache miss + refetch, rather than
* being propagated.
*/
onCacheError?: StoreErrorHandler<string>;
};
/**
* @see {@link https://www.rfc-editor.org/rfc/rfc9728.html}
*/
export declare class OAuthProtectedResourceMetadataResolver extends CachedGetter<string, OAuthProtectedResourceMetadata | null> {
private readonly fetch;
private readonly allowHttpResource;
constructor(cache: ProtectedResourceMetadataCache, fetch?: Fetch, config?: OAuthProtectedResourceMetadataResolverConfig);
get(resource: string | URL, options?: GetCachedOptions): Promise<OAuthProtectedResourceMetadata | null>;
private fetchMetadata;
}
//# sourceMappingURL=oauth-protected-resource-metadata-resolver.d.ts.map