"""Logical keys for encrypted AEAT browser-session objects.:func:`aeat_auth_session_storage_state_path` composes the active bucket idand provider storage stem into the durable logical key consumed by the encryptedAEAT browser-session store. The returned :class:`~pathlib.Path` is an objectkey, not a plaintext filesystem destination.This module is the core-side authority for the auth-session object-key grammarintroduced when AEAT browser sessions moved from plaintext token-directorypaths to encrypted secure-object storage. Application probes and provideradapters call the same helper so certificate and Cl@ve Móvil session reads,writes, and deletes agree on one active-bucket/provider partition. The key isdeliberately independent of ``Settings.aeat_token_dir``; the secure repositorydigests the logical key before persistence."""from__future__importannotationsfrompathlibimportPathAEAT_AUTH_SESSION_LOGICAL_ROOT=Path(".aeat")/"auth"/"sessions""""Stable logical root for encrypted AEAT browser-session object keys.The root is part of the secure-object logical key. It names the auth-sessionnamespace for humans and tests, but it is not a directory this module creates orwrites."""
[docs]defaeat_auth_session_storage_state_path(bucket_id:str,storage_stem:str)->Path:"""Return the stable logical session key for ``bucket_id`` and provider stem. The returned path is not a filesystem destination. It is a durable logical object key consumed by the encrypted browser-session store. The caller owns resolving the active bucket id and selecting the provider stem (for example ``"storage"`` for certificate auth or ``"clave-movil-storage"`` for Cl@ve Móvil). Args: bucket_id: Active bucket/profile identifier that partitions session state between operator profiles. storage_stem: Provider-specific storage-state stem. Returns: A :class:`~pathlib.Path` under :data:`AEAT_AUTH_SESSION_LOGICAL_ROOT` suitable for the encrypted browser-session store. """returnAEAT_AUTH_SESSION_LOGICAL_ROOT/f"{bucket_id}-{storage_stem}.json"