export type SealKeyStatus = 'strong' | 'missing' | 'too-short' | 'publicly-known'; export type OpenSealedResult = { ok: true; text: string; } | { ok: false; reason: 'keys-differ' | 'malformed'; }; /** * Values that ship in the repository: the dev fallback and the METADATA_ENCRYPTION_KEY lines of * services/admin/.env.sample and services/gateway/.env.sample (a test keeps this list in step). */ export declare const PUBLICLY_KNOWN_SEAL_SECRETS: readonly string[]; /** * Precedence when several apply: missing, then publicly-known, then too-short. * Judged on the trimmed value (padding adds no strength); the key itself is derived from the value as given. */ export declare function sealKeyStatus(env: NodeJS.ProcessEnv): SealKeyStatus; export declare function sealText(plain: string, env: NodeJS.ProcessEnv): string; /** * Whether a value has the shape sealText gives: JSON of exactly {v: 1, iv, tag, ct}, each a base64 * string, a 12-byte IV and a 16-byte tag. Opens nothing; lets a store refuse a value that cannot be a seal. */ export declare function isSealEnvelope(value: unknown): boolean; /** Never throws. A wrong key and a changed byte are indistinguishable (GCM), both are 'keys-differ'. */ export declare function openSealed(envelope: string, env: NodeJS.ProcessEnv): OpenSealedResult;