cadrumo.adapters.persistence.storage.custody.acceleration_receipt_crypto module¶
Authenticated cryptographic record contract for an acceleration receipt.
The profile receipt lifecycle owns keychain coordination and local-record publication. This module owns the immutable AEAD record it publishes: its strict model, metadata binding, wrap, unwrap, and idle-deadline rewrap. Consumers that need the cryptographic contract import it directly rather than reaching through the lifecycle coordinator.
- PROFILE_SESSION_SCHEMA_VERSION: Final[int]¶
Current persisted-session record schema version.
A record carrying any other version is a revocable cache from another build: resume deletes it and refuses so the operator re-logs-in. This cache is not a durability-preserved product record.
- PROFILE_SESSION_KEY_BYTES: Final[int]¶
Exact AES-256 key width used for the OS-keychain receipt secret.
- validate_profile_session_metadata(*, profile_id, custody_generation, dek_epoch, issued_at)[source]¶
Validate immutable receipt metadata before durable coordination.
- class PersistedProfileSession(**data)[source]¶
Bases:
BaseModelFrozen session-wrapped-DEK record for one bucket’s profile receipt.
- Parameters:
data (Any)
- schema_version: int¶
- profile_id: UUID¶
- session_id: UUID¶
- custody_generation: int¶
- dek_epoch: str¶
- issued_at: datetime¶
- idle_deadline: datetime¶
- absolute_deadline: datetime¶
- nonce: bytes¶
- ciphertext: bytes¶
- tag: bytes¶
- wrap_profile_session_dek(*, session_key, dek, profile_id, session_id, custody_generation, dek_epoch, issued_at, idle_deadline, absolute_deadline)[source]¶
Wrap
dekundersession_keywith all metadata bound as AAD.
- unwrap_profile_session_dek(*, session_key, record)[source]¶
Recover a wipeable 32-byte DEK after authenticating every metadata field.
- Return type:
- Parameters:
session_key (bytes)
record (PersistedProfileSession)
- advance_profile_session_idle_deadline(*, record, session_key, new_idle_deadline)[source]¶
Re-wrap a receipt with a clamped idle deadline and a fresh nonce.
- Return type:
- Parameters:
record (PersistedProfileSession)
session_key (bytes)
new_idle_deadline (datetime)