aeat.adapters.outbound.aeat.auth._session_store module¶
Encrypted persistence for AEAT browser session state.
This module is the concrete adapter behind
application.auth._protocols.SessionStoreProtocol. It stores
PersistedBrowserSession payloads in
adapters.persistence.storage.AEAT_BROWSER_SESSION_NAMESPACE,
whose registry entry pins the records to bucket-local
SESSION SensitivityClass
storage, schema version, process-local custody, and logical-path object-key
grammar.
SecureObjectRepository encrypts
payload bytes and digests the logical object key at the column boundary, so
Playwright cookies, local storage, and provider metadata never appear as
plaintext files.
- class PersistedBrowserSession(**data)[source]¶
Bases:
BaseModelEncrypted Playwright storage state plus provider-owned metadata.
This is the typed payload stored under
adapters.persistence.storage.AEAT_BROWSER_SESSION_NAMESPACE.storage_statecarries the payload returned byBrowserContext.storage_state().metadataremains a provider-owned mapping so certificate auth and Cl@ve Móvil can persist different validated metadata models while exposing the same encrypted envelope to callers.- Parameters:
- schema_version: int¶
- storage_state: PlaywrightStorageState¶
- metadata: ProviderSessionMetadata¶
- written_at: datetime¶
- exists(path)[source]¶
Return whether an encrypted session exists for logical
path.pathis the logical storage-state identifier produced bystorage_state_paths()or provider-specific helpers, not a plaintext file path to inspect.
- save(path, *, storage_state, metadata)[source]¶
Persist
storage_stateandmetadatain the browser-session namespace.The values are wrapped in a
PersistedBrowserSessionenvelope beforeSecureObjectRepositoryencrypts the serialized JSON payload. The namespace definition supplies theSESSIONSensitivityClassclassification and schema version.storage_state/metadataare validated JSON-safe here (mirroring_storage_state_sha256()) so the caller-facing boundary stays the wideMapping[str, object]shapeBrowserContextLikeexposes.
- load(path)[source]¶
Load the
PersistedBrowserSessionfor logicalpath.Returns
Nonewhen the logical key is absent. A present record is read fromadapters.persistence.storage.AEAT_BROWSER_SESSION_NAMESPACEwith the expectedSensitivityClassand current namespace schema version.- Return type:
- Parameters:
path (Path)
- storage_state_sha256(storage_state)[source]¶
Return the canonical SHA-256 for a Playwright storage-state payload.
Certificate auth and Cl@ve Móvil metadata store this fingerprint so resume paths can reject a metadata envelope that no longer matches the encrypted storage-state payload.
- logical_object_key(path)[source]¶
Return the natural secure-object key for a browser-session
path.The key shape follows
adapters.persistence.storage.AEAT_BROWSER_SESSION_NAMESPACE.SecureObjectRepositoryHMAC-digests this value before writing the row, so callers can use the same logical key without exposing it on disk.