/** * Authentication Configuration Constants * Issue #331: Shared constants for auth.ts and middleware.ts * * CONSTRAINT: This module must be Edge Runtime compatible. * No Node.js-specific imports (crypto, fs, etc.) are allowed. */ /** Cookie name for authentication token */ export declare const AUTH_COOKIE_NAME: "cm_auth_token"; /** * Validate that a CM_AUTH_TOKEN_HASH value is a well-formed SHA-256 hex string. * Used by both auth.ts and middleware.ts to ensure consistent auth-enabled detection. * Returns a type predicate so callers can narrow the type after checking. * * @param hash - The hash string to validate * @returns true if the hash is a valid 64-character hex string */ export declare function isValidTokenHash(hash: string | undefined): hash is string; /** * Paths excluded from authentication check. * S002: Must use === for matching (no startsWith - bypass attack prevention) */ export declare const AUTH_EXCLUDED_PATHS: readonly ["/login", "/api/auth/login", "/api/auth/logout", "/api/auth/status", "/api/remote/pair", "/manifest.webmanifest", "/sw.js", "/offline"]; /** Default token expiration duration (24 hours) */ export declare const DEFAULT_EXPIRE_DURATION_MS: number; /** * Parse a duration string into milliseconds. * Supported formats: Nh (hours), Nd (days), Nm (minutes) * Minimum: 1h, Maximum: 30d * * @param s - Duration string (e.g., "24h", "7d", "90m") * @returns Duration in milliseconds * @throws Error if format is invalid or out of range */ export declare function parseDuration(s: string): number; /** * Compute token expiration timestamp from environment variables. * Used by both auth.ts (Node.js) and middleware.ts (Edge Runtime). * * @returns Expiration timestamp (ms since epoch), or null if auth is not enabled */ export declare function computeExpireAt(): number | null; //# sourceMappingURL=auth-config.d.ts.map