
    +g                         S SK r S SKJr  S SKJr  S SKJr  S SKJr  S SK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)Any)Dict)Optional)Unionc                   6    \ rS rSr% SrSr\\S'   Sr\\S'   Sr	g)	Protocol   z/Protocol to communicate with the authenticator.ctap2CTAP2z	ctap1/u2fU2F N)
__name__
__module____qualname____firstlineno____doc__r   str__annotations__r   __static_attributes__r       w/Users/Alptekin/Desktop/izin_takip/venv/lib/python3.13/site-packages/selenium/webdriver/common/virtual_authenticator.pyr   r      s    9E3Cr   r   c                   R    \ rS rSr% SrSr\\S'   Sr\\S'   Sr	\\S'   S	r
\\S
'   Srg)	Transport#   z7Transport method to communicate with the authenticator.bleBLEusbUSBnfcNFCinternalINTERNALr   N)r   r   r   r   r   r   r   r   r!   r#   r%   r   r   r   r   r   r   #   s-    ACCCHcr   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__2   s&     &'&6+@"(:&6r   c                     U R                   U R                  U R                  U R                  U R                  U R
                  S.$ )N)r)   r*   hasResidentKeyhasUserVerificationisUserConsentingisUserVerifiedr1   r2   s    r   to_dict#VirtualAuthenticatorOptions.to_dictG   s>    "33#'#=#= $ 7 7"33
 	
r   )r+   r,   r-   r.   r)   r*   )r   r   r   r   r   r   r   r!   r   boolr3   r   r	   r;   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)
CredentialR   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): intital value for a signature counter.
N)_id_is_resident_credential_rp_id_user_handle_private_key_sign_count)r2   rA   rB   rC   rD   rE   rF   s          r   r3   Credential.__init__S   s&    ( !'=$''%r   r/   c                 H    [        U R                  5      R                  5       $ N)r   rH   decoder:   s    r   idCredential.idn   s     *1133r   c                     U R                   $ rP   )rI   r:   s    r   rB   !Credential.is_resident_credentialr   s    +++r   c                     U R                   $ rP   )rJ   r:   s    r   rC   Credential.rp_idv   s    {{r   c                 l    U R                   (       a#  [        U R                   5      R                  5       $ g rP   )rK   r   rQ   r:   s    r   rD   Credential.user_handlez   s(    $T%6%67>>@@r   c                 H    [        U R                  5      R                  5       $ rP   )r   rL   rQ   r:   s    r   rE   Credential.private_key   s     !2!23::<<r   c                     U R                   $ rP   )rM   r:   s    r   rF   Credential.sign_count   s    r   rR   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): intital value for a signature counter.

:Returns:
  - Credential: A non-resident credential.
FNr   )clsrR   rC   rE   rF   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): intital value for a signature counter.

:returns:
  - Credential: A resident credential.
Tr   )r_   rR   rC   rD   rE   rF   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)rR   rI   rC   rE   rF   rD   )r2   credential_datas     r   r;   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      $ )Nrf   z==rg   rh   ri   rj   rk   )r   r=   getint)r_   rn   rH   rB   rC   rE   rF   rD   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=))rR   rB   rC   rD   rE   rF   r:   s    r   __str__Credential.__str__   sf    y(A$B]B]A^^fgkgqgqfr s))*.9I9I8J-X\XgXgWhhik 	kr   )rH   rI   rL   rJ   rM   rK   N)r   r   r   r   bytesr=   r   r   rq   r3   propertyrR   rB   rC   rD   rE   rF   classmethodr`   rc   r   r   r;   rr   rv   r   r   r   r   r?   r?   R   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r2   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   r   <module>r      s_   $  $ $     sD T #
 #
Lrk rkjr   