
    'hH                         S SK r S SKJrJr  S SKJr  S SKJrJr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)AnyOptionalUnionc                        \ 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       x/var/www/home/psychics-availability/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   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_dictC   s>    "33#'#=#= $ 7 7"33
 	
r   )r(   r)   r*   r+   r&   r'   )r   r   r   r   r
   r   r   r    strboolr0   dictr   r8   r   r   r   r   r$   r$   (   s     HI !"!&&+#'!&77 7 	7
  $7 !7 7 
7*
c5d#334 
r   r$   c                   x   \ rS rSrS\S\S\S\\   S\S\4S jr	\
S	\4S
 j5       r\
S	\4S j5       r\
S	\4S j5       r\
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 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)
CredentialN   credential_idis_resident_credentialrp_id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@   rA   rB   rC   rD   rE   s          r   r0   Credential.__init__O   s&    ( !'=$''%r   r,   c                 H    [        U R                  5      R                  5       $ N)r   rG   decoder7   s    r   idCredential.idj   s     *1133r   c                     U R                   $ rO   )rH   r7   s    r   rA   !Credential.is_resident_credentialn   s    +++r   c                     U R                   $ rO   )rI   r7   s    r   rB   Credential.rp_idr   s    {{r   c                 l    U R                   (       a#  [        U R                   5      R                  5       $ g rO   )rJ   r   rP   r7   s    r   rC   Credential.user_handlev   s(    $T%6%67>>@@r   c                 H    [        U R                  5      R                  5       $ rO   )r   rK   rP   r7   s    r   rD   Credential.private_key|   s     !2!23::<<r   c                     U R                   $ rO   )rL   r7   s    r   rE   Credential.sign_count   s    r   rQ   c                     U " USUSX45      $ )a5  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   )clsrQ   rB   rD   rE   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^   rQ   rB   rC   rD   rE   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)rQ   rH   rB   rD   rE   rC   )r/   credential_datas     r   r8   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      $ )Nre   z==rf   rg   rh   ri   rj   )r   r;   getint)r^   rm   rG   rA   rB   rD   rE   rC   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=))rQ   rA   rB   rC   rD   rE   r7   s    r   __str__Credential.__str__   sf    y(A$B]B]A^^fgkgqgqfr s))*.9I9I8J-X\XgXgWhhik 	kr   )rG   rH   rK   rI   rL   rJ   N)r   r   r   r   bytesr;   r:   r   rp   r0   propertyrQ   rA   rB   rC   rD   rE   classmethodr_   rb   r<   r   r8   rq   ru   r   r   r   r   r>   r>   N   s   && !%& 	&
 e_& & &6 4C 4 4 , , , s   Xc]  
 =S = =  C     D Dc DPU Dcf Dkw D D JJ"J19%JOTJbeJ	J J"c3h  ]T#s(^ ] ] ]k kr   r>   c                 F   ^  [         R                  " T 5      U 4S j5       nU$ )zGA decorator 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$ )zOA decorator 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   r   r   r:   r
   r   r$   r>   r   r   r   r   r   <module>r      sV   $  7  ' 'sD T #
 #
Lrk rkjr   