container_key_wraps API Postgres table
Recipient envelopes for a container KEK epoch.
Declared in packages/api-shared/src/schema/containerKeying.ts
Description
Each row stores one encrypted wrap of a container KEK to a recipient principal. User recipients are backed by users; managed recipients such as organizations and groups are backed by their current principalStates key. The verifier treats the wrap set for a current KEK state as exact, so stale rows are removed when a same-epoch recipient target is replaced.
Indexes:
(containerKeyEpochId, recipientKind, recipientId, recipientKeyEpochId)is unique so one recipient key has one wrap for an epoch. It also serves loading the full wrap set for an epoch.(recipientKind, recipientId)supports recipient-oriented lookup.
Columns
iduuid- primary key
- not null
- default gen_random_uuid()
Surrogate database primary key.
container_key_epoch_idtext- not null
Container KEK epoch whose key material is wrapped.
recipient_kindtext- not null
Recipient principal kind for the envelope.
recipient_iduuid- not null
Stable id of the recipient principal.
recipient_key_epoch_idtext- not null
Recipient key epoch identifier used to encrypt the wrap. User recipient records supply this value and are checked by fingerprint; managed principal recipient ids are derived from their referenced principal head.
recipient_key_fingerprinttext- not null
Principal public-key fingerprint, or the signed parent epoch-record hash for a container recipient.
kem_cipher_texttext- not null
ML-KEM-1024 ciphertext for every recipient. Principal wraps use
tearleads.container-kek-wrap.ml-kem-1024-aes-256-gcm; parent-container wraps usetearleads.container-kek-wrap.ml-kem-1024-aes-256-gcm-parent-kek.wrapped_keytext- not null
Encrypted container KEK material for this recipient.
wrap_manifest_hashtext- not null
Access manifest hash whose current target set authorized this wrap.
Indexes
container_key_wraps_epoch_recipient_idx(container_key_epoch_id, recipient_kind, recipient_id, recipient_key_epoch_id)- unique
container_key_wraps_recipient_idx(recipient_kind, recipient_id)