@analog-tools/session
Version:
Session management for AnalogJS server-side applications
19 lines (18 loc) • 743 B
TypeScript
/**
* Crypto utilities for session package
* Essential HMAC-SHA256 operations for cookie signing
*/
/**
* Sign a cookie value with HMAC-SHA256
* @param value The value to sign
* @param secret The secret key for signing
* @returns Signed cookie value in format `s:value.signature`
*/
export declare function signCookie(value: string, secret: string): Promise<string>;
/**
* Unsign a cookie value, trying multiple secrets for rotation support
* @param signedValue The signed cookie value to verify
* @param secrets Array of secrets to try (supports key rotation)
* @returns Original value if valid, null if invalid or tampered
*/
export declare function unsignCookie(signedValue: string, secrets: string[]): Promise<string | null>;