cadrumo.application.user_profile.login_session_port module¶
Typed application boundary for profile login-session infrastructure.
The login transaction owns ordering, rollback, and operator-facing outcomes. Persistence owns the live bucket session, throttle record, acceleration receipt, and key-buffer wipe. This module is the single dependency boundary between those responsibilities: it declares the exact structural DTOs the application observes and binds one concrete port for an explicit host lifetime.
- class ProfileBucketSessionPort(*args, **kwargs)[source]¶
Bases:
ProtocolLive bucket-session capability exposed across the application boundary.
- class ProfilePersistedSessionPort(*args, **kwargs)[source]¶
Bases:
ProtocolPersisted acceleration-receipt fields needed by login orchestration.
- class ProfileSessionResumeOutcomePort(*args, **kwargs)[source]¶
Bases:
ProtocolFail-closed persisted-session evaluation result.
- property refusal: ProfileSessionRefusalReason | None¶
The typed reason a resume was refused, if it was.
- property record: ProfilePersistedSessionPort | None¶
The evaluated receipt, present whether or not it was accepted.
- class ProfileLoginThrottleEvaluationPort(*args, **kwargs)[source]¶
Bases:
ProtocolFailed-login backoff decision exposed to the application.
- class ProfileLoginSessionPort(*args, **kwargs)[source]¶
Bases:
ProtocolComplete infrastructure capability used by the login-session aggregate.
Methods return the persistence substrate’s existing DTOs through structural protocols. The boundary never copies them: live-session identity is part of rollback and the exact receipt instance anchors idle-deadline renewal.
- load_handover_journal(*, storage_root)[source]¶
Load the durable profile-switch witness, if present.
- Return type:
- Parameters:
storage_root (Path)
- save_handover_journal(*, storage_root, journal)[source]¶
Persist one monotonic profile-switch witness.
- Return type:
- Parameters:
storage_root (Path)
journal (ProfileLoginHandoverJournal)
- clear_handover_journal(*, storage_root, journal)[source]¶
Compare and clear the completed profile-switch witness.
- Return type:
- Parameters:
storage_root (Path)
journal (ProfileLoginHandoverJournal)
- open_resumed_session(*, bucket_id, dek, idle_minutes, opened_at, idle_deadline, absolute_deadline, storage_root)[source]¶
Open one live session over the supplied authenticated DEK.
- bind_session(session)[source]¶
Bind one authenticated session to the process context.
- Return type:
- Parameters:
session (ProfileBucketSessionPort)
- session_serves_bucket(session, bucket_id)[source]¶
Return whether
sessionserves the exact profile UUID.- Return type:
- Parameters:
session (ProfileBucketSessionPort | None)
bucket_id (str)
- evaluate_throttle(*, storage_root, bucket_id, now)[source]¶
Evaluate failed-login backoff before password derivation.
- Return type:
- Parameters:
- record_login_failure(*, storage_root, bucket_id, now)[source]¶
Record one refused password proof without replacing its refusal.
- acceleration_receipt_path(*, storage_root, profile_id)[source]¶
Return the exact local receipt locator for one profile.
- mint_acceleration_receipt(*, storage_root, profile_id, custody_generation, dek_epoch, dek, now, idle_minutes, absolute_minutes)[source]¶
Mint and return the canonical persisted acceleration receipt.
- resume_acceleration_receipt(*, storage_root, profile_id, custody_generation, dek_epoch, now)[source]¶
Evaluate one receipt and return its owned wipeable DEK buffer.
- delete_acceleration_receipt(*, storage_root, profile_id)[source]¶
Revoke one profile’s split-knowledge acceleration receipt.
- advance_acceleration_idle_deadline(*, storage_root, profile_id, record, new_idle_deadline)[source]¶
Advance a receipt while preserving its concrete DTO identity.
- Return type:
- Parameters:
storage_root (Path)
profile_id (UUID)
record (ProfilePersistedSessionPort)
new_idle_deadline (datetime)
- is_persisted_receipt(record)[source]¶
Narrow a resume record to the canonical persisted receipt DTO.
- Return type:
TypeGuard[ProfilePersistedSessionPort]- Parameters:
record (object)
- bind_profile_login_session_port(port)[source]¶
Bind one outward-composed port for the current host execution context.
- Return type:
- Parameters:
port (ProfileLoginSessionPort)
- profile_login_session_port()[source]¶
Resolve the explicitly composed port for the current host context.
- Return type:
- profile_session_serves_bucket(session, bucket_id)[source]¶
Return whether a live bucket session serves the exact profile UUID.
- Return type:
- Parameters:
session (ProfileBucketSessionPort | None)
bucket_id (str)