Tearleads

blob_content_write_headers API Postgres table

Verified write headers for encrypted blob payload records.

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

Description

Committed encrypted blob bytes live in blobs; this table stores the keying write header that authorizes and describes those bytes. Blob writes currently use content-key epoch 1 and store one header per blob record. Replays for the same recordId are accepted only when headerHash matches, and every write fails unless the stored header equals the signed header verbatim.

Indexes:

  • (organizationId, blobId) lists an organization's blobs, for data usage and for scoping an organization purge.
  • headerHash is unique because it content-addresses the write header.
  • (blobId, contentKeyEpoch, contentRecordId) prevents duplicate content record ids for an epoch.
  • (blobId, contentKeyEpoch, nonceDomainHash) prevents nonce-domain reuse for an epoch.

Columns

  • record_iduuid
    • primary key
    • not null

    Primary key for the blob content record. Staged blob promotion uses the blob id as the record id.

  • blob_iduuid
    • not null

    Blob whose encrypted payload this header describes.

  • organization_iduuid
    • not null

    Organization boundary from the verified header.

  • content_key_epochinteger
    • not null

    Blob content-key epoch used for the payload.

  • content_record_idtext
    • not null

    Client content record id inside the header. For blob payloads this is unique within (blobId, contentKeyEpoch).

  • nonce_domain_hashtext
    • not null

    Nonce-domain commitment; uniqueness prevents nonce domain reuse within the same blob content-key epoch.

  • header_hashtext
    • not null

    Hash of the canonical write header.

  • headerjsonb
    • not null

    Full canonical write header JSON.

  • authorizationjsonb
    • not null

    Exact verified blob KEK projection committed by the header when the write was accepted. Required for every stored write.

  • created_attimestamp
    • not null
    • default now()

    Server-side insertion timestamp.

Indexes

  • blob_content_write_headers_organization_blob_idx(organization_id, blob_id)
    • blob_content_write_headers_header_hash_idx(header_hash)
      • unique
    • blob_content_write_headers_content_record_idx(blob_id, content_key_epoch, content_record_id)
      • unique
    • blob_content_write_headers_nonce_domain_idx(blob_id, content_key_epoch, nonce_domain_hash)
      • unique