
    `gj4                    ^    d Z ddlmZ ddlZddlmZ ddlmZmZ ddl	m
Z
 dZdZdd	Zddd
Zy)aR  Hermes-managed Camofox state helpers.

Provides profile-scoped identity and state directory paths for Camofox
persistent browser profiles.  When managed persistence is enabled, Hermes
sends a deterministic userId derived from the active profile so that
Camofox can map it to the same persistent browser profile directory
across restarts.
    )annotationsN)Path)DictOptional)get_hermes_homebrowser_authcamofoxc                 2    t               t        z  t        z  S )zAReturn the profile-scoped root directory for Camofox persistence.)r   CAMOFOX_STATE_DIR_NAMECAMOFOX_STATE_SUBDIR     N/root/.hermes/venv/lib/python3.12/site-packages/tools/browser_camofox_state.pyget_camofox_state_dirr      s    558LLLr   c                    t        t                     }| xs d}t        j                  t        j                  d|       j
                  dd }t        j                  t        j                  d| d|       j
                  dd }d| d	| d
S )a$  Return the stable Hermes-managed Camofox identity for this profile.

    The user identity is profile-scoped (same Hermes profile = same userId).
    The session key is scoped to the logical browser task so newly created
    tabs within the same profile reuse the same identity contract.
    defaultzcamofox-user:N
   zcamofox-session::   hermes_task_)user_idsession_key)strr   uuiduuid5NAMESPACE_URLhex)task_id
scope_rootlogical_scopeuser_digestsession_digests        r   get_camofox_identityr$      s     *,-J(yM**

|$ 
c#2K ZZ
:,a7 
c#2N
 [M*~./ r   )returnr   )N)r   zOptional[str]r%   zDict[str, str])__doc__
__future__r   r   pathlibr   typingr   r   hermes_constantsr   r   r   r   r$   r   r   r   <module>r+      s2    #   ! ,'   M
r   