access_manifests API Postgres table
Content-addressed access manifests for containers and document link sets.
Declared in packages/api-shared/src/schema/accessManifests.ts
Description
An access manifest is the verified access state produced from an accessEvents row. It is the durable history for an access-controlled object: each epoch commits the object identity, previous manifest link, originating event, structural state, direct grant state, referenced principal policy heads, and access-key target state. The crypto layer derives manifestHash from the normalized manifest fields; the store persists the object-specific verifier state alongside those fields so APIs can return complete manifest bundles without re-deriving state from event bodies.
The signed columns are append-only. Inserts are idempotent by manifestHash: replaying the same verified manifest is accepted, while conflicting data for an existing hash is rejected. Only verificationMac is ever updated. Separate projection tables expand dependencies such as referenced principal heads and document link-set container membership for indexed reads.
Indexes:
manifestHashis unique because it is the content address.eventHashis unique because one verified access event produces one accepted manifest.(objectKind, objectId, epoch)is unique so an object cannot fork at the same epoch. It also serves object-history and current-head validation queries.organizationIdsupports organization purge.
Columns
iduuid- primary key
- not null
- default gen_random_uuid()
Surrogate database primary key. Domain identity is
manifestHash.versioninteger- not null
Access manifest wire format version.
object_kindtext- not null
Kind of object whose access state this manifest describes, currently container or document link-set access state.
object_iduuid- not null
Stable id of the object whose access state this manifest describes.
organization_iduuid- not null
Organization boundary for the object.
epochinteger- not null
Monotonic access-manifest version for this object. One object can have only one accepted manifest per epoch.
previous_manifest_hashtext- nullable
Previous manifest in the object's hash chain, or
nullfor the initial manifest.event_hashtext- not null
Hash of the signed access event that produced this manifest. It joins to
accessEvents.eventHash.structural_hashtext- not null
Hash of object-specific structural state. For containers this includes parent/metadata fields; for document link sets this includes linked container ids.
grant_roottext- not null
Hash commitment for direct access grants. Container manifests commit their direct grants here; document link-set manifests currently use the empty document-link-set grant root.
referenced_principal_headsjsonb- not null
Principal policy heads that were verified and committed while deriving this manifest. These heads are expanded into
accessManifestPrincipalHeadProjection.referenced_user_device_headsjsonb- not null
User device-chain states the manifest's direct user grants and user KEK wraps cite, one per user: the user id, the cited
userDeviceStates.stateHash, its user key epoch, and its user encryption key fingerprint. Document link-set manifests commit an empty list.key_target_hashtext- not null
Hash commitment for access-key target state. Container manifests commit the container key epoch; document link-set manifests commit the "current linked container KEKs" target mode.
manifest_hashtext- not null
Content hash of the normalized access manifest. This is the stable reference used by current heads, dependencies, content-key bundles, and API manifest bundles.
statejsonb- not null
Object-specific verified state used to rehydrate a complete container/document manifest bundle. It is checked for consistency on replay but is not the generic access manifest itself.
verification_mactext- nullable
Tamper-evident record that stored-history verification accepted this manifest after accepting every manifest it depends on, or
nulluntil it has. The database is not a trust boundary, so the marker is honored only when it verifies under a key derived from a server secret the database never holds. The MAC binds the manifest hash, a digest of the complete stored bundle (manifest, state and signed event), the signer's stored public key and the current verification rule revisions. Changed bytes, a changed signer key, a forged or copied marker, a rotated secret or changed rules therefore fall back to full verification of that manifest. Written by mutations for what they store and after reads that verified unmarked history; it is not part of the manifest hash.created_attimestamp- not null
- default now()
Server-side insertion timestamp. It is not part of the manifest hash.
Indexes
access_manifests_manifest_hash_idx(manifest_hash)- unique
access_manifests_event_hash_idx(event_hash)- unique
access_manifests_object_epoch_idx(object_kind, object_id, epoch)- unique
access_manifests_organization_idx(organization_id)