Tearleads

blob_content_key_epochs API Postgres table

Content-key epochs for encrypted blob payloads.

Declared in packages/api-shared/src/schema/blobContentKeys.ts

Description

A blob content-key bundle says which symmetric content key protects a blob and which current attachment/container KEK targets can unwrap it. Blobs are immutable in this model. Permission and KEK changes refresh the key-package targets for the existing payload epoch; callers only replace the blob when the encrypted bytes themselves change.

Indexes:

  • (blobId, contentKeyEpoch) is unique because a blob can have one accepted bundle per epoch. It also serves the latest-bundle lookup, which orders a blob's epochs descending.

Columns

  • iduuid
    • primary key
    • not null
    • default gen_random_uuid()

    Surrogate database primary key. Target rows reference this id. Domain identity is (blobId, contentKeyEpoch).

  • blob_iduuid
    • not null

    Blob whose encrypted content key this bundle describes.

  • content_key_epochinteger
    • not null

    Blob content-key epoch used by the encrypted payload.

  • target_hashtext
    • not null

    Hash of the normalized target rows in blobContentKeyTargets.

Indexes

  • blob_content_key_epochs_blob_epoch_idx(blob_id, content_key_epoch)
    • unique

Referenced by