/** * @dotdo/oauth - Durable Object SQLite Storage * * SQLite-based storage adapter for Cloudflare Durable Objects. * Implements the OAuthStorage interface for persistent storage. */ import type { OAuthStorage, ListOptions } from './storage.js'; import type { OAuthUser, OAuthOrganization, OAuthClient, OAuthAuthorizationCode, OAuthAccessToken, OAuthRefreshToken, OAuthGrant } from './types.js'; /** * Cloudflare Durable Object SqlStorage interface * This matches the Cloudflare Workers runtime API */ export interface SqlStorage { exec>(query: string, ...bindings: unknown[]): SqlStorageResult; } export interface SqlStorageResult { toArray(): T[]; raw(): R[]; columnNames: string[]; rowsRead: number; rowsWritten: number; } /** * Extended user type with Stripe integration */ export interface OAuthUserWithStripe extends OAuthUser { stripeCustomerId?: string; } /** * DO SQLite Storage implementation */ export declare class DOSQLiteStorage implements OAuthStorage { private sql; constructor(sql: SqlStorage); /** * Initialize database schema */ private initSchema; getUser(id: string): Promise; getUserByEmail(email: string): Promise; getUserByProvider(provider: string, providerId: string): Promise; saveUser(user: OAuthUser): Promise; deleteUser(id: string): Promise; listUsers(options?: ListOptions): Promise; getOrganization(id: string): Promise; getOrganizationBySlug(slug: string): Promise; getOrganizationByDomain(domain: string): Promise; saveOrganization(org: OAuthOrganization): Promise; deleteOrganization(id: string): Promise; listOrganizations(options?: ListOptions): Promise; getClient(clientId: string): Promise; saveClient(client: OAuthClient): Promise; deleteClient(clientId: string): Promise; listClients(options?: ListOptions): Promise; saveAuthorizationCode(code: OAuthAuthorizationCode): Promise; consumeAuthorizationCode(code: string): Promise; saveAccessToken(token: OAuthAccessToken): Promise; getAccessToken(token: string): Promise; revokeAccessToken(token: string): Promise; saveRefreshToken(token: OAuthRefreshToken): Promise; getRefreshToken(token: string): Promise; revokeRefreshToken(token: string): Promise; revokeAllUserTokens(userId: string): Promise; revokeAllClientTokens(clientId: string): Promise; getGrant(userId: string, clientId: string): Promise; saveGrant(grant: OAuthGrant): Promise; revokeGrant(userId: string, clientId: string): Promise; listUserGrants(userId: string): Promise; getSigningKeys(): Promise; getCurrentSigningKey(): Promise; saveSigningKey(key: { kid: string; alg: string; privateKeyJwk: JsonWebKey; publicKeyJwk: JsonWebKey; createdAt: number; isCurrent?: boolean; }): Promise; getUserByStripeCustomerId(stripeCustomerId: string): Promise; updateUserStripeCustomerId(userId: string, stripeCustomerId: string): Promise; private rowToUser; private rowToOrganization; private rowToClient; private rowToAuthCode; private rowToAccessToken; private rowToRefreshToken; private rowToGrant; } export interface SerializedSigningKeyRow { kid: string; alg: string; private_key_jwk: string; public_key_jwk: string; created_at: number; is_current: number; } //# sourceMappingURL=storage-do.d.ts.map