
    Y j                         S SK r S SKJrJr  S SKJr  S SKJr   " S S\\5      r	 " S S\\5      r
 " S	 S
5      r " S S5      rS rS rg)    N)urlsafe_b64decodeurlsafe_b64encode)Enum)Anyc                        \ rS rSrSrSrSrSrg)Protocol   z/Protocol to communicate with the authenticator.ctap2z	ctap1/u2f N)__name__
__module____qualname____firstlineno____doc__CTAP2U2F__static_attributes__r       ڀ/root/GenerationalWealth/GenerationalWealth/venv/lib/python3.13/site-packages/selenium/webdriver/common/virtual_authenticator.pyr   r      s    9E
Cr   r   c                   (    \ rS rSrSrSrSrSrSrSr	g)		Transport   z7Transport method to communicate with the authenticator.bleusbnfcinternalr   N)
r   r   r   r   r   BLEUSBNFCINTERNALr   r   r   r   r   r      s    A
C
C
CHr   r   c                       \ rS rSr\r\r\R                  \R                  SSSS4S\S\S\	S\	S\	S	\	S
S4S jjr
S
\\\\	-  4   4S jrSrg)VirtualAuthenticatorOptions(   FTprotocol	transporthas_resident_keyhas_user_verificationis_user_consentingis_user_verifiedreturnNc                 L    Xl         X l        X0l        X@l        XPl        X`l        g)z=Constructor.

Initialize VirtualAuthenticatorOptions object.
Nr$   r%   r&   r'   r(   r)   )selfr$   r%   r&   r'   r(   r)   s          r   __init__$VirtualAuthenticatorOptions.__init__.   s&     &'&6+@"(:&6r   c                     U R                   U R                  U R                  U R                  U R                  U R
                  S.$ )N)r$   r%   hasResidentKeyhasUserVerificationisUserConsentingisUserVerifiedr,   r-   s    r   to_dict#VirtualAuthenticatorOptions.to_dictB   s>    "33#'#=#= $ 7 7"33
 	
r   )r&   r'   r(   r)   r$   r%   )r   r   r   r   r   r   r   r   strboolr.   dictr6   r   r   r   r   r"   r"   (   s     HI !"!&&+#'!&77 7 	7
  $7 !7 7 
7(
c3:o. 
r   r"   c                      \ rS rSrS\S\S\S-  S\S-  S\S\4S	 jr\	S
\4S j5       r
\	S
\4S j5       r\	S
\S-  4S j5       r\	S
\S-  4S j5       r\	S
\4S j5       r\	S
\4S j5       r\S\S\S\S\S
S 4
S j5       r\S\S\S\S-  S\S\S
S 4S j5       rS
\\\4   4S jr\S\\\4   S
S 4S j5       rS
\4S jrSrg)
CredentialM   credential_idis_resident_credentialrp_idNuser_handleprivate_key
sign_countc                 L    Xl         X l        X0l        X@l        XPl        X`l        g)a  Constructor. A credential stored in a virtual authenticator.

https://w3c.github.io/webauthn/#credential-parameters.

Args:
    credential_id (bytes): Unique base64 encoded string.
    is_resident_credential (bool): Whether the credential is client-side discoverable.
    rp_id (str): Relying party identifier.
    user_handle (bytes): userHandle associated to the credential. Must be Base64 encoded string. Can be None.
    private_key (bytes): Base64 encoded PKCS#8 private key.
    sign_count (int): initial value for a signature counter.
N)_id_is_resident_credential_rp_id_user_handle_private_key_sign_count)r-   r>   r?   r@   rA   rB   rC   s          r   r.   Credential.__init__N   s&    * !'=$''%r   r*   c                 H    [        U R                  5      R                  5       $ N)r   rE   decoder5   s    r   idCredential.idj   s     *1133r   c                     U R                   $ rM   )rF   r5   s    r   r?   !Credential.is_resident_credentialn   s    +++r   c                     U R                   $ rM   )rG   r5   s    r   r@   Credential.rp_idr   s    {{r   c                 l    U R                   (       a#  [        U R                   5      R                  5       $ g rM   )rH   r   rN   r5   s    r   rA   Credential.user_handlev   s(    $T%6%67>>@@r   c                 H    [        U R                  5      R                  5       $ rM   )r   rI   rN   r5   s    r   rB   Credential.private_key|   s     !2!23::<<r   c                     U R                   $ rM   )rJ   r5   s    r   rC   Credential.sign_count   s    r   rO   c                     U " USUSX45      $ )a3  Creates a non-resident (i.e. stateless) credential.

Args:
    id (bytes): Unique base64 encoded string.
    rp_id (str): Relying party identifier.
    private_key (bytes): Base64 encoded PKCS
    sign_count (int): initial value for a signature counter.

Returns:
    Credential: A non-resident credential.
FNr   )clsrO   r@   rB   rC   s        r   create_non_resident_credential)Credential.create_non_resident_credential   s     2ueT;CCr   c                     U " USX#XE5      $ )a  Creates a resident (i.e. stateful) credential.

Args:
    id (bytes): Unique base64 encoded string.
    rp_id (str): Relying party identifier.
    user_handle (bytes): userHandle associated to the credential. Must be Base64 encoded string.
    private_key (bytes): Base64 encoded PKCS
    sign_count (int): initial value for a signature counter.

Returns:
    Credential: A resident credential.
Tr   )r\   rO   r@   rA   rB   rC   s         r   create_resident_credential%Credential.create_resident_credential   s      2tUIIr   c                     U R                   U R                  U R                  U R                  U R                  S.nU R
                  (       a  U R
                  US'   U$ )N)credentialIdisResidentCredentialrpId
privateKey	signCount
userHandle)rO   rF   r@   rB   rC   rA   )r-   credential_datas     r   r6   Credential.to_dict   sQ     GG$($@$@JJ**
 ,0,<,<OL)r   datac                 
   [        US    S35      n[        US   5      nUR                  SS 5      n[        US    S35      n[        US   5      nUR                  SS 5      (       a  [        US    S35      OS nU " X#XGXV5      $ )Nrc   z==rd   re   rf   rg   rh   )r   r9   getint)r\   rk   rE   r?   r@   rB   rC   rA   s           r   	from_dictCredential.from_dict   s    4#7"8 ;<!%d+A&B!C&'4+=*>b(ABk*+
FJhh|]aFbFb'4+=*>b(ABhl3K\\r   c                     SU R                    SU R                   SU R                   SU R                   SU R                   SU R
                   S3$ )NzCredential(id=z, is_resident_credential=z, rp_id=z,            user_handle=z, private_key=z, sign_count=))rO   r?   r@   rA   rB   rC   r5   s    r   __str__Credential.__str__   sf    y(A$B]B]A^^fgkgqgqfr s))*.9I9I8J-X\XgXgWhhik 	kr   )rE   rF   rI   rG   rJ   rH   )r   r   r   r   bytesr9   r8   rn   r.   propertyrO   r?   r@   rA   rB   rC   classmethodr]   r`   r:   r   r6   ro   rs   r   r   r   r   r<   r<   M   s   && !%& Tz	&
 T\& & &8 4C 4 4 , , , sTz   S4Z  
 =S = =  C     D Dc DPU Dcf Dkw D D JJ"J16JLQJ_bJ	J J"c3h  ]T#s(^ ] ] ]k kr   r<   c                 F   ^  [         R                  " T 5      U 4S j5       nU$ )zEDecorator to ensure that the client used is a chromium-based browser.c                 l   > U R                   S   R                  5       S;  d   S5       eT" U /UQ70 UD6$ )NbrowserName)firefoxsafariz4This only currently works in Chromium based browsers)capslowerr-   argskwargsfuncs      r   wrapper0required_chromium_based_browser.<locals>.wrapper   sP    yy'--/ 8
 
 	B B	B 
 D*4*6**r   )	functoolswrapsr   r   s   ` r   required_chromium_based_browserr      s'     __T+ + Nr   c                 X   ^  [         R                  " T 5      [        U 4S j5       5       nU$ )zMDecorator to ensure that the function is called with a virtual authenticator.c                 T   > U R                   (       d  [        S5      eT" U /UQ70 UD6$ )Nz9This function requires a virtual authenticator to be set.)virtual_authenticator_id
ValueErrorr   s      r   r   /required_virtual_authenticator.<locals>.wrapper   s/     ,,XYYD*4*6**r   )r   r   r   r   s   ` r   required_virtual_authenticatorr      s/     __T$+ % +
 Nr   )r   base64r   r   enumr   typingr   r8   r   r   r"   r<   r   r   r   r   r   <module>r      sS   $  7  sD T "
 "
Jsk skl
r   