Tearleads

blob_content_key_targets API Postgres table

Recipient target envelopes for one blob content-key epoch.

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

Description

Each row stores the blob content key wrapped for one active attachment target: a binding, the document that owns that binding, and one linked container KEK reached through that document's current link-set manifest. The target fields hash to the parent epoch row's targetHash; wrappedKey and wrappingMetadata are encrypted material needed by clients.

Indexes:

  • (blobContentKeyEpochId, bundleTargetHash, bindingId, documentId, containerId) is unique so an epoch has at most one envelope for each binding/document/container target.

Columns

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

    Surrogate database primary key. Domain identity is (blobContentKeyEpochId, bundleTargetHash, bindingId, documentId, containerId).

  • blob_content_key_epoch_iduuid

    Parent blob content-key epoch row.

  • bundle_target_hashtext
    • not null

    Immutable target-set identity; older sets remain retained.

  • binding_iduuid
    • not null

    Active attachment binding that makes this blob reachable.

  • document_iduuid
    • not null

    Document containing the attachment binding.

  • container_iduuid
    • not null

    Linked container recipient for this target.

  • container_manifest_hashtext
    • not null

    Current container access manifest hash used when deriving the target.

  • container_key_epoch_idtext
    • not null

    Container KEK epoch id that wraps this blob content key.

  • container_key_epochinteger
    • not null

    Numeric container KEK epoch corresponding to containerKeyEpochId.

  • wrapped_keytext
    • not null

    Blob content key encrypted/wrapped for the container KEK.

  • wrapping_metadatajsonb
    • not null

    Canonical metadata needed by the client to unwrap wrappedKey; current clients use suite tearleads.blob.content-key-wrap.ml-kem-1024-aes-256-gcm-container-kek with a canonical 1,568-byte ML-KEM-1024 kemCipherText encapsulated to the target container's signed containerKeyPublicKey. The wrap's HKDF info and AES-GCM authenticated data bind the suite, blob id, content-key epoch, target container epoch, and container public-key fingerprint, so it opens for no other blob, epoch, or target; bindings of the same blob share the key.

Keys and constraints

Indexes

  • blob_content_key_targets_epoch_binding_container_idx(blob_content_key_epoch_id, bundle_target_hash, binding_id, document_id, container_id)
    • unique