UNPKG

agentfootprint

Version:

The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.

37 lines • 2.05 kB
/** * hosting/signin/seal — the sealed transaction cookie: a sign-in attempt's * secrets kept in the BROWSER that started it, readable only by this server. * * An OIDC sign-in needs `state`, `nonce`, the PKCE verifier and `returnTo` to * survive the trip to the identity provider and back. Keeping them on the * server would be state an unauthenticated `GET /auth/login` loop can grow * without bound, and state a second replica does not have. So they are SEALED * (AES-256-GCM, authenticated encryption) into a per-attempt cookie: * * - nothing is written on the server — the transaction is bounded by the * cookie's own lifetime (10 minutes); * - the cookie name is bound into the seal (GCM additional data), so a sealed * value moved to another attempt's cookie does not open; * - it binds the login to the browser that started it, which is what stops * login forgery (an attacker's own callback URL, completed in a victim's * browser, finds no cookie to open); * - one cookie per attempt, so two tabs signing in at once do not break each * other. * * The key is `IDENTITY_COOKIE_KEY_FILE` (32 bytes, shared by replicas) or, * unset, random per process — a restart then invalidates logins in progress, * and the banner says so. */ /// <reference types="node" /> /// <reference types="node" /> /** The sealing key: 32 bytes. */ export type SealKey = Buffer; /** A fresh random key, for a process that was given none. */ export declare function randomSealKey(): SealKey; /** Check a key read from a file: exactly 32 bytes, raw or base64/base64url/hex text. */ export declare function sealKeyFrom(bytes: Buffer): SealKey; /** Seal a JSON value; `bound` (the cookie name) must match when it is opened. */ export declare function seal(key: SealKey, bound: string, value: unknown): string; /** Open a sealed value, or `undefined` when it was not sealed by this key for `bound`. */ export declare function unseal(key: SealKey, bound: string, sealed: string): unknown; //# sourceMappingURL=seal.d.ts.map