/** * @dotdo/oauth - JWT Signing Key Management * * Manages RSA-2048 signing keys for JWT token issuance. * Supports key generation, storage/retrieval, and JWKS export. */ /** * JWT Signing Key with public/private key pair */ export interface SigningKey { /** Key identifier */ kid: string; /** Algorithm (always RS256) */ alg: 'RS256'; /** Private key for signing */ privateKey: CryptoKey; /** Public key for verification */ publicKey: CryptoKey; /** When the key was created */ createdAt: number; } /** * JWKS format for public key exposure */ export interface JWKSPublicKey { kty: 'RSA'; kid: string; use: 'sig'; alg: 'RS256'; n: string; e: string; } /** * JWKS document format */ export interface JWKS { keys: JWKSPublicKey[]; } /** * Serialized key for storage */ export interface SerializedSigningKey { kid: string; alg: 'RS256'; privateKeyJwk: JsonWebKey; publicKeyJwk: JsonWebKey; createdAt: number; } /** * JWT Claims for access tokens */ export interface AccessTokenClaims { /** Subject (user ID) */ sub: string; /** Client ID */ client_id: string; /** Scopes */ scope?: string; /** Additional claims */ [key: string]: unknown; } /** * Generate a new RSA-2048 signing key pair */ export declare function generateSigningKey(kid?: string): Promise; /** * Export a signing key to serializable format for storage */ export declare function serializeSigningKey(key: SigningKey): Promise; /** * Import a signing key from serialized format */ export declare function deserializeSigningKey(serialized: SerializedSigningKey): Promise; /** * Export public key to JWKS format */ export declare function exportPublicKeyToJWKS(key: SigningKey): Promise; /** * Export multiple keys to JWKS document */ export declare function exportKeysToJWKS(keys: SigningKey[]): Promise; /** * Sign a JWT with the given claims */ export declare function signAccessToken(key: SigningKey, claims: AccessTokenClaims, options: { issuer: string; audience?: string; expiresIn?: number; }): Promise; /** * Signing Key Manager - handles key storage and rotation */ export declare class SigningKeyManager { private options; private keys; private currentKeyIndex; constructor(options?: { maxKeys?: number; }); /** * Get the current signing key, generating one if needed */ getCurrentKey(): Promise; /** * Get all keys (for JWKS endpoint) */ getAllKeys(): SigningKey[]; /** * Rotate to a new key */ rotateKey(): Promise; /** * Load keys from serialized format */ loadKeys(serializedKeys: SerializedSigningKey[]): Promise; /** * Export keys to serializable format */ exportKeys(): Promise; /** * Export to JWKS format */ toJWKS(): Promise; /** * Sign an access token with the current key */ signAccessToken(claims: AccessTokenClaims, options: { issuer: string; audience?: string; expiresIn?: number; }): Promise; } //# sourceMappingURL=jwt-signing.d.ts.map