import type { DidDocument } from '@atproto/did';
import type { InternalStateData, Session } from '@atproto/oauth-client';
import type { OAuthAuthorizationServerMetadata, OAuthProtectedResourceMetadata } from '@atproto/oauth-types';
import type { ResolvedHandle } from '@atproto-labs/handle-resolver';
import type { SimpleStore, Value } from '@atproto-labs/simple-store';
import { type DBObjectStore } from './indexed-db/index.js';
type Item<V> = {
    value: V;
    expiresAt?: string;
};
type EncodedKey = {
    keyId: string;
    keyPair: CryptoKeyPair;
};
export type Schema = {
    state: Item<Omit<InternalStateData, 'dpopKey'> & {
        dpopKey: EncodedKey;
    }>;
    session: Item<Omit<Session, 'dpopKey'> & {
        dpopKey: EncodedKey;
    }>;
    didCache: Item<DidDocument>;
    dpopNonceCache: Item<string>;
    handleCache: Item<ResolvedHandle>;
    authorizationServerMetadataCache: Item<OAuthAuthorizationServerMetadata>;
    protectedResourceMetadataCache: Item<OAuthProtectedResourceMetadata | null>;
};
export type DatabaseStore<V extends Value> = SimpleStore<string, V>;
export type BrowserOAuthDatabaseOptions = {
    name?: string;
    durability?: 'strict' | 'relaxed';
    cleanupInterval?: number;
};
export declare class BrowserOAuthDatabase {
    #private;
    constructor(options?: BrowserOAuthDatabaseOptions);
    protected run<N extends keyof Schema, R>(storeName: N, mode: 'readonly' | 'readwrite', fn: (s: DBObjectStore<Schema[N]>) => R | Promise<R>): Promise<R>;
    protected createStore<N extends keyof Schema, V extends Value>(name: N, { encode, decode, expiresAt, }: {
        encode: (value: V) => Schema[N]['value'] | PromiseLike<Schema[N]['value']>;
        decode: (encoded: Schema[N]['value']) => V | PromiseLike<V>;
        expiresAt: (value: V) => null | Date;
    }): DatabaseStore<V>;
    getSessionStore(): DatabaseStore<Session>;
    getStateStore(): DatabaseStore<InternalStateData>;
    getDpopNonceCache(): DatabaseStore<string>;
    getDidCache(): DatabaseStore<DidDocument>;
    getHandleCache(): DatabaseStore<ResolvedHandle>;
    getAuthorizationServerMetadataCache(): undefined | DatabaseStore<OAuthAuthorizationServerMetadata>;
    getProtectedResourceMetadataCache(): undefined | DatabaseStore<OAuthProtectedResourceMetadata | null>;
    cleanup(): Promise<void>;
    [Symbol.asyncDispose](): Promise<void>;
}
export {};
//# sourceMappingURL=browser-oauth-database.d.ts.map