cadrumo.adapters.persistence.storage.sql.secure_object_records module

Pydantic records for SQL secure object persistence.

Secure object read/write records carry SensitivityClass so repository policy can enforce the expected storage classification.

class SecureObjectRecord(**data)[source]

Bases: BaseModel

One decrypted sensitive object loaded from the SQL backend.

Parameters:

data (Any)

namespace: str
object_key: bytes
classification: SensitivityClass
schema_version: int
written_at: datetime
payload: bytes
revision_id: ContentDigest
class SecureObjectMetadata(**data)[source]

Bases: BaseModel

Row-level metadata for one stored secure object, decryption-free.

Parameters:

data (Any)

namespace: str
classification: str
schema_version: int
written_at: datetime
byte_length: NonNegativeInt
class SecureObjectDeletion(**data)[source]

Bases: BaseModel

One secure-object row removal addressed by its raw HMAC digest.

Deletions are addressed by the stored object_key digest (the HashedLookup column value) rather than the natural key, because a diff-based writer enumerates the stored rows by digest and cannot recover their natural keys (those are recoverable only by decrypting each payload). The 32-byte digest passes straight through the HashedLookup column comparison without re-hashing, the same convention save_with_raw_key() and exists_by_raw_key() use.

Parameters:

data (Any)

namespace: str
hashed_object_key: bytes
class SecureObjectUnreadable(**data)[source]

Bases: BaseModel

One stored secure object that cannot be decrypted under the current master key.

Parameters:

data (Any)

namespace: str
row_id: NonNegativeInt
object_key: bytes
classification: str
schema_version: int
written_at: datetime
reason: str
class SecureObjectRawRow(**data)[source]

Bases: BaseModel

One stored row surfaced without classification / version validation or decryption.

Parameters:

data (Any)

row_id: NonNegativeInt
namespace: str
object_key: bytes
classification: str
schema_version: int
written_at: datetime
payload: bytes
revision_id: ContentDigest | None
previous_revision_id: ContentDigest | None
revision_ancestor_ids: tuple[ContentDigest, ...]
previous_payload_hash: ContentDigest | None
payload_hash: ContentDigest | None
ciphertext_hash: ContentDigest | None
revision_written_at: datetime | None
write_provenance: str | None
source_event_id: str | None
class SecureObjectNamespaceIntegrity(**data)[source]

Bases: BaseModel

Per-namespace decryptability counts for the integrity diagnostic.

Parameters:

data (Any)

namespace: str
readable: NonNegativeInt
unreadable: NonNegativeInt
class SecureObjectDecryptabilityRow(**data)[source]

Bases: BaseModel

Row-level decryptability metadata without plaintext payload disclosure.

Parameters:

data (Any)

namespace: str
row_id: NonNegativeInt
object_key: bytes
classification: str
schema_version: int
written_at: datetime
readable: bool
reason: str | None