cadrumo.adapters.persistence.storage.custody._kdf_codec module

Canonical codecs and framed transport for the supervised profile KDF.

KDF_TRANSPORT_ENCODING: Final

Text encoding of every string crossing the supervised-KDF boundary.

Declared here rather than taken from core.external_constants: the worker is started for every wrap and unwrap, and that module’s import graph is several times the cost of the hash itself.

canonical_frame_bytes(payload)[source]

Encode one supervised-KDF frame body under the canonical encoding.

Return type:

bytes

Parameters:

payload (object)

canonical_frame_digest(payload)[source]

Digest one supervised-KDF frame body under the canonical encoding.

Return type:

str

Parameters:

payload (object)

decode_canonical_b64(value, *, field_name, expected_bytes)[source]
Return type:

bytes

Parameters:
  • value (str)

  • field_name (str)

  • expected_bytes (int | None)

read_kdf_frame_to_queue(fd, result_queue)[source]
Return type:

None

Parameters:
read_kdf_frame(fd)[source]
Return type:

tuple[int, bytes]

Parameters:

fd (int)

write_kdf_frame(fd, value, *, kind)[source]
Return type:

None

Parameters:
close_fd(fd)[source]
Return type:

None

Parameters:

fd (int | None)

windows_available_memory_bytes()[source]

Return available physical bytes from GlobalMemoryStatusEx.

The sys.platform == "win32" block, rather than a guard at the call site or an early return, is what establishes the platform for the Windows API below: it is the only guard shape every checker this project runs narrows on, so those references resolve when the tree is analysed for a platform that does not ship them.

Return type:

int