import { Request } from 'express'; /** * Authentication challenge stored in database */ export interface Challenge { id: string; did: string; nonce: string; expiresAt: Date; used: boolean; createdAt: Date; } /** * JWT payload for authenticated sessions */ export interface JWTPayload { sub: string; scope: string; iss: string; iat: number; exp: number; } /** * Extended Express Request with authenticated user info */ export interface AuthenticatedRequest extends Request { auth?: { did: string; scope: string; issuer: string; issuedAt: number; expiresAt: number; }; } /** * Challenge storage adapter interface * Implement this interface to support different databases */ export interface ChallengeAdapter { /** * Store a new challenge */ createChallenge(challenge: Challenge): Promise; /** * Get a challenge by ID */ getChallenge(id: string): Promise; /** * Mark a challenge as used */ markChallengeUsed(id: string): Promise; /** * Clean up expired challenges */ cleanupExpired(): Promise; /** * Close database connection (if applicable) */ close?(): Promise; } /** * Server configuration options */ export interface ServerConfig { /** * Port to listen on */ port: number; /** * JWT secret for signing tokens */ jwtSecret: string; /** * JWT issuer (your server's identifier) */ jwtIssuer: string; /** * JWT expiration time in seconds */ jwtExpiresIn: number; /** * Challenge expiration time in seconds */ challengeExpiresIn: number; /** * Audience identifier */ audience: string; /** * Domain for authentication */ domain: string; /** * Challenge adapter */ adapter: ChallengeAdapter; /** * Enable CORS */ cors?: boolean; /** * CORS origin (if cors is enabled) */ corsOrigin?: string | string[]; } //# sourceMappingURL=types.d.ts.map