Seal.ts overview

The session cookie’s seal: AES-256-GCM under a key HKDF-derived from the cookie password, written w1~<key id>~<base64url(iv ‖ tag ‖ ciphertext)>. The key id names which password sealed it, so a rotated password keeps opening its cookies until it is dropped. Anything that does not open is refused; there is no plaintext fallback.

Since v0.1.0


Exports Grouped by Category


constructors

make

A Sealer over passwords: the first seals, every one opens. Fails with CookiePasswordError for a password under 32 bytes.

Signature

declare const make: (
  passwords: ReadonlyArray<Redacted.Redacted>
) => Effect.Effect<Sealer, CookiePasswordError, Aead.Aead | Kdf.Kdf | SecureRandom.SecureRandom>

Source

Since v0.1.0

errors

CookiePasswordError (class)

A cookie password shorter than MIN_COOKIE_PASSWORD_BYTES, found when the layer is built.

Signature

declare class CookiePasswordError

Source

Since v0.1.0

models

Sealer (interface)

Seal and open session cookie values.

Signature

export interface Sealer {
  readonly seal: (plaintext: string) => Effect.Effect<string>
  /** The plaintext, or `None` for a value that is malformed, tampered with or sealed by an unknown key. */
  readonly open: (sealed: string) => Effect.Effect<Option.Option<string>>
}

Source

Since v0.1.0

utils

The shortest cookie password accepted, in UTF-8 bytes.

Signature

declare const MIN_COOKIE_PASSWORD_BYTES: 32

Source


This site uses Just the Docs, a documentation theme for Jekyll.