/** * SQLite-backed authorization-server stores. * * Implements the same five interfaces as `auth-store.ts` (AuthCodeStore, * RefreshTokenStore, ClientRegistry, ConsentStore, PendingAuthorizationStore) * with persistent storage across process restarts. * * Runtime-agnostic via `src/shared/sqlite-runtime.ts`: * - Under Bun: uses built-in `bun:sqlite` (zero install). * - Under Node: falls back to `better-sqlite3` (optional peer dep). * * All five stores share a single database handle. Schema is created on first * use. TTL enforcement happens at read time (stale rows are ignored and * sweep() deletes them). */ import type { AuthorizationCode, RefreshToken, RegisteredClient, ConsentRecord } from '../types/index.js'; import type { AuthCodeStore, RefreshTokenStore, ClientRegistry, ConsentStore, PendingAuthorizationStore, PendingAuthorization } from './auth-store.js'; import { type SqliteDatabase } from '../../shared/sqlite-runtime.js'; /** * Open the AS SQLite database at `path` with all schema created. */ export declare function openAuthDatabase(path: string): Promise; export declare class SqliteAuthCodeStore implements AuthCodeStore { private db; private insert; private select; private remove; private sweepStmt; constructor(db: SqliteDatabase); save(code: AuthorizationCode): Promise; peek(code: string): Promise; consume(code: string): Promise; sweep(now?: Date): Promise; } export declare class SqliteRefreshTokenStore implements RefreshTokenStore { private db; private insert; private select; private remove; private sweepStmt; constructor(db: SqliteDatabase); save(token: RefreshToken): Promise; private insertRow; find(token: string): Promise; rotate(oldToken: string, newToken: RefreshToken): Promise; revoke(token: string): Promise; sweep(now?: Date): Promise; } export declare class SqliteClientRegistry implements ClientRegistry { private upsert; private select; private touchStmt; private remove; private sweepStmt; constructor(db: SqliteDatabase); save(client: RegisteredClient): Promise; find(clientId: string): Promise; touch(clientId: string, now?: Date): Promise; delete(clientId: string): Promise; sweep(maxIdleMs: number, now?: Date): Promise; } export declare class SqliteConsentStore implements ConsentStore { private upsert; private select; private remove; private sweepStmt; constructor(db: SqliteDatabase); save(record: ConsentRecord): Promise; covers(userId: string, tenantId: string, clientId: string, scopes: string[]): Promise; revoke(userId: string, tenantId: string, clientId: string): Promise; sweep(now?: Date): Promise; } export declare class SqlitePendingAuthorizationStore implements PendingAuthorizationStore { private db; private insert; private select; private remove; private sweepStmt; constructor(db: SqliteDatabase); save(req: PendingAuthorization): Promise; peek(id: string): Promise; consume(id: string): Promise; sweep(now?: Date): Promise; } //# sourceMappingURL=sqlite-stores.d.ts.map