import type { BrightDb } from '@brightchain/db'; /** * Shape of a session document stored in BrightDB. * Exported so consumers (tests, controllers) can reference the type. */ export interface ISessionDocument { /** UUID v4 identifying this session. */ sessionId: string; /** Hex-encoded member ID. */ memberId: string; /** SHA-256 hex digest of the JWT token. */ tokenHash: string; /** Epoch-ms when the session was created. */ createdAt: number; /** Epoch-ms when the session expires. */ expiresAt: number; } /** * Manages user sessions backed by a BrightDB `sessions` collection. * * Token hashes use SHA-256 (not bcrypt) so that `validateToken` can * query by hash without a per-row compare. */ export declare class BrightChainSessionAdapter { private readonly db; constructor(db: BrightDb); /** * Create a new session for the given member. * * @param memberId Hex string of the member's ID. * @param token The raw JWT token (will be SHA-256 hashed for storage). * @param ttlMs Time-to-live in milliseconds. * @returns The generated UUID session ID. */ createSession(memberId: string, token: string, ttlMs: number): Promise; /** * Retrieve a session by its ID. * * @returns The session document, or `null` if not found or expired. */ getSession(sessionId: string): Promise; /** * Validate a raw JWT token against stored sessions. * * Hashes the token with SHA-256, looks up the matching session, * and checks expiration. * * @returns The session document, or `null` if invalid / expired / missing. */ validateToken(token: string): Promise; /** * Delete a session by its ID. */ deleteSession(sessionId: string): Promise; /** * Remove all expired sessions. * * @returns The number of sessions removed. */ cleanExpired(): Promise; } //# sourceMappingURL=sessionAdapter.d.ts.map