cadrumo.adapters.persistence.storage.custody.kdf_supervision module¶
Supervised Argon2id work for current-format profile custody.
- class ProfileCustodyKdfResources(available_memory_bytes, cpu_count)[source]¶
Bases:
objectExplicit local resources used to decide whether one grid point is safe.
- class ProfileCustodyKdfCalibration(version, parameters, source, median_seconds)[source]¶
Bases:
objectVersioned result of deterministic finite-grid enrollment calibration.
- Parameters:
version (Literal[1])
parameters (ProfileCustodyKdfParameters)
source (Literal['measured', 'fallback'])
median_seconds (float | None)
-
parameters:
ProfileCustodyKdfParameters¶
- class ProfileCustodyUnlock(profile_id, envelope_digest, kdf, dek)[source]¶
Bases:
objectA DEK accepted only after a parent-owned sentinel proof.
- profile_password_wrap_aad(*, profile_id, password_generation, dek_epoch, kdf)[source]¶
Build the canonical password-wrap AAD for one current custody envelope.
- profile_kdf_grid(*, salt)[source]¶
Return the complete deterministic Argon2id v1 grid, strongest first.
- Return type:
- Parameters:
salt (bytes)
- fixed_profile_kdf_fallback(*, salt)[source]¶
Return the sole eligible fallback point without weakening its parameters.
- Return type:
- Parameters:
salt (bytes)
- profile_kdf_resources()[source]¶
Read the portable resources that bound a local KDF worker.
- Return type:
- profile_kdf_is_eligible(parameters, *, resources)[source]¶
Return whether one finite-grid point fits the explicit local envelope.
- Return type:
- Parameters:
parameters (ProfileCustodyKdfParameters)
resources (ProfileCustodyKdfResources)
- calibrate_profile_kdf(*, salt, settings=None)[source]¶
Calibrate a fresh profile KDF with bounded real child-process samples.
- Return type:
- Parameters:
- unlock_profile_custody(envelope, password, *, sentinel, settings=None, timeout_seconds=15.0)[source]¶
Return a DEK only after supervised unwrap and parent sentinel proof.
- Return type:
- Parameters:
envelope (ProfileCustodyEnvelope)
password (str)
sentinel (ProfileCustodySentinelRecord)
settings (Settings | None)
timeout_seconds (float)
- unlock_profile_custody_password_material(*, profile_id, dek_epoch, kdf, wrapped_dek, secret, associated_data, sentinel, settings=None, timeout_seconds=15.0)[source]¶
Supervise one current-format wrapper unwrap and prove its immutable DEK.
The caller owns one closed wrapper AAD domain. This adapter owns password representation, process supervision, and the non-optional capsule proof. It never returns an unproved key.
- Return type:
- Parameters:
profile_id (UUID)
dek_epoch (str)
wrapped_dek (ProfileCustodyWrappedDek)
secret (str)
associated_data (bytes)
sentinel (ProfileCustodySentinelRecord)
settings (Settings | None)
timeout_seconds (float)
- wrap_profile_custody_password_material(*, secret, dek, kdf, associated_data, settings=None, timeout_seconds=15.0)[source]¶
Build one wrapper only inside the existing supervised KDF boundary.
- Return type:
- Parameters:
- unlock_profile_custody_recovery_material(*, profile_id, dek_epoch, kdf, wrapped_dek, secret, associated_data, sentinel, settings=None, timeout_seconds=15.0)[source]¶
Unlock the DEK using the recovery secret, inside the same supervised KDF boundary.
The recovery-path sibling of the password unlock above it: same supervised worker and lease, but authenticated against the recovery secret rather than the login password, so a wrong recovery secret raises
ProfileCustodyRecoverySecretErrorrather than the password error a caller further up must distinguish.- Return type:
- Parameters:
profile_id (UUID)
dek_epoch (str)
wrapped_dek (ProfileCustodyWrappedDek)
secret (str)
associated_data (bytes)
sentinel (ProfileCustodySentinelRecord)
settings (Settings | None)
timeout_seconds (float)
- wrap_profile_custody_recovery_material(*, secret, dek, kdf, associated_data, settings=None, timeout_seconds=15.0)[source]¶
Wrap the DEK under the recovery secret, inside the same supervised KDF boundary.
The recovery-path sibling of the password wrap above it — same supervised worker and lease, but the resulting wrapper is unlocked later by
unlock_profile_custody_recovery_material()with the recovery secret, never the login password.- Return type:
- Parameters:
- profile_kdf_lease(*, deadline, settings=None)[source]¶
Acquire the one OS-released KDF permit for a canonical installation root.
The descriptor stays open for the operation, so an abnormal owner death releases its permit at the operating-system boundary instead of leaving a process-local or persistent ownership record behind.