+
     h  c                  s   ^ RI Ht ^ RIt^ RIt^ RIHt ^ RIHtHt ^ RI	H
t
Ht ^ RIHtHtHtHtHt ^ RIHt ^RIHt ^R	IHtHt ^R
IHtHtHt ^RIHtHtH t  ^RI!H"t"H#t#H$t$H%t% ^RI&H't'H(t( ^RI)H*t* ^RI+H,t, ^RI-H.t. ^RI/H0t0H1t1H2t2H3t3H4t4H5t5H6t6H7t7H8t8H9t9H:t:H;t;H<t<H=t=H>t>H?t?H@t@HAtA ]P                  ! ]C4      tD ! R R]E4      tF]F3R ltG ! R R]F4      tHR tI ! R R4      tJ ! R R]P                  4      tL ! R R4      tM ! R R]P                  4      tN ! R  R!]N4      tOR" tP ! R# R$]P                  4      tQ ! R% R&]Q4      tR ! R' R(]J4      tS]R) R* l4       tT]R+ R, l4       tTR- tT ! R. R/]Q4      tU ! R0 R1]L4      tVR# )2i    )annotationsN)replace)IntEnumunique)EventTimer)AnyCallableMappingSequenceoverload)urlparse)ES256)
CtapDevice	CtapError)APDU	ApduErrorCtap1)AssertionResponseCtap2Info)_DEFAULT_EXTENSIONS AuthenticationExtensionProcessorCtap2ExtensionRegistrationExtensionProcessor)	ClientPinPinProtocol)STATUS)verify_rp_id)sha256)AaguidAttestationConveyancePreferenceAttestationObject%AuthenticationExtensionsClientOutputsAuthenticationResponseAuthenticatorAssertionResponseAuthenticatorAttachment AuthenticatorAttestationResponseAuthenticatorSelectionCriteriaCollectedClientData"PublicKeyCredentialCreationOptionsPublicKeyCredentialDescriptor!PublicKeyCredentialRequestOptionsPublicKeyCredentialTypeRegistrationResponseResidentKeyRequirementUserVerificationRequirement_as_cborc                  sJ    ] tR t^LtRt] ! R R]4      4       tRR ltR t	Rt
R# )	ClientErrorzBase error raised by clients.c                  s8    ] tR t^OtRt^t^t^t^t^t	RR lt
RtR# )ClientError.ERRzError codes for ClientError.Nc                	s    \        W4      # N)r0   )selfcause   &&:/usr/lib/python3.14/site-packages/fido2/client/__init__.py__call__ZClientError.ERR.__call__Y   s    t++     r2   )__name__
__module____qualname____firstlineno____doc__OTHER_ERRORBAD_REQUESTCONFIGURATION_UNSUPPORTEDDEVICE_INELIGIBLETIMEOUTr7   __static_attributes__r9   r8   r6   ERRr1   O   s*    *$%!	, 	,r8   rE   Nc                	sF    \         P                  V4      V n        W n        R # r2   )r0   rE   coder4   )r3   rF   r4      &&&r6   __init__ZClientError.__init__\   s    OOD)	
r8   c                	s    R P                  V P                  4      pV P                  '       d   VRV P                   R2,          pV# )zClient error: {0} - {0.name}z	 (cause: Z))formatrF   r4   )r3   Zr   & r6   __repr__ZClientError.__repr__`   s;    *11$))<:::9TZZL**Ar8   )r4   rF   r2   )r:   r;   r<   r=   r>   r   r   rE   rH   rK   rD   r9   r8   r6   r0   r0   L   s(    '
,g 
, 
,r8   r0   c                s*   V P                   \        P                  P                  \        P                  P                  39   d   \
        P                  P                  pEMV P                   \        P                  P                  \        P                  P                  \        P                  P                  39   d   \
        P                  P                  pEM5V P                   \        P                  P                  \        P                  P                  \        P                  P                  39   d   \
        P                  P                  pEMV P                   \        P                  P                  \        P                  P                   \        P                  P"                  \        P                  P$                  \        P                  P&                  \        P                  P(                  \        P                  P*                  \        P                  P,                  \        P                  P.                  \        P                  P0                  \        P                  P2                  \        P                  P4                  \        P                  P6                  \        P                  P8                  \        P                  P:                  39   d   \
        P                  P<                  pM\
        P                  P>                  pV! W 4      # r2   ) rF   r   rE   ZCREDENTIAL_EXCLUDEDNO_CREDENTIALSr0   rB   ZKEEPALIVE_CANCELZACTION_TIMEOUTZUSER_ACTION_TIMEOUTrC   ZUNSUPPORTED_ALGORITHMUNSUPPORTED_OPTIONZKEY_STORE_FULLrA   ZINVALID_COMMANDZCBOR_UNEXPECTED_TYPEZINVALID_CBORZMISSING_PARAMETERZINVALID_OPTIONPUAT_REQUIREDPIN_INVALIDZPIN_BLOCKEDPIN_NOT_SETZPIN_POLICY_VIOLATIONZPIN_TOKEN_EXPIREDPIN_AUTH_INVALIDPIN_AUTH_BLOCKEDZREQUEST_TOO_LARGEZOPERATION_DENIEDr@   r?   )eZerr_clsZce   && r6   _ctap2client_errrU   g   s   vv)--33Y]]5Q5QRR__..	
&&$$)) 

 __$$	
++(($$ 

 __66	
%%**""''$$##!!!!!!**''&&&&''&& 
" __((__((2>r8   c                  s\   a  ] tR t^tRt]P                  P                  R3V 3R lltRt	V ;t
# )PinRequiredErrorz=Raised when a call cannot be completed without providing PIN.zPIN required but not providedc                	s&   < \         SV `  W4       R # r2   )superrH   )r3   rF   r4   	__class__s   &&&r6   rH   ZPinRequiredError.__init__   s     	%r8   r9   )r:   r;   r<   r=   r>   r0   rE   r@   rH   rD   __classcell__rX      @r6   rV   rV      s"    G ??..6U& &r8   rV   c                s   T;'       g    \        4       pVP                  4       '       g
    V! V/ VB # \        P                  P                  4       h  \         d{   pTP                  \        P
                  8X  d8   T'       d   T! \        P                  4       R pTP                  T 4        R p?K  \        P                  P                  T4      hR p?i\         d   p\        T4      hR p?ii ; ir2   )r   Zis_setr   rF   r   USE_NOT_SATISFIEDr   UPNEEDEDZwaitr0   rE   r?   r   rU   rC   )Z
poll_delayeventon_keepaliveZfuncZargsZkwargsrS   s   &&&&*, r6   _call_pollingr`      s    UWEllnn	&((( //
!
!
##  	5vv/// 1#'L

:&&!oo11!44 	&"1%%	&s5   A C0&C)C3CC0C0 C++C0c                  sP    ] tR t^tRt/ 3R R lltR R ltR R ltR R	 ltR
t	R# )AssertionSelectionzGetAssertion result holding one or more assertions.

Since multiple assertions may be retured by Fido2Client.get_assertion, this result
is returned which can be used to select a specific response to get.
c               $    V ^8  d   QhRRRRRR/# )   client_datar'   
assertionsSequence[AssertionResponse]extension_resultsMapping[str, Any]r9   rI      "r6   __annotate__AssertionSelection.__annotate__   s(     4 4(4 04 -	4r8   c                	s*    Wn         W n        W0n        R # r2   )_client_data_assertions_extension_results)r3   rd   re   rg      &&&&r6   rH   ZAssertionSelection.__init__   s     (%"3r8   c                   V ^8  d   QhRR/# )rc   returnrf   r9   ri   rj   r6   rk   rl      s         ;  r8   c                    V P                   # )zIGet the raw AssertionResponses available to inspect before selecting one.)rn   r3      &r6   get_assertionsZ!AssertionSelection.get_assertions   s    r8   c                    V ^8  d   QhRRRR/# )rc   	assertionr   rr   rh   r9   ri   rj   r6   rk   rl      s     ' '0A 'FW 'r8   c                	rs   r2   )ro   )r3   rx   r5   r6   _get_extension_resultsZ)AssertionSelection._get_extension_results   s    &&&r8   c               rw   )rc   indexZintrr   r"   r9   ri   rj   r6   rk   rl      s     
 
# 
*@ 
r8   c           
     sr   V P                   V,          p\        VP                  R,          \        V P                  VP
                  VP                  VP                  '       d   VP                  R,          MRR7      \        P                  \        V P                  V4      4      \        P                  R7      # )zGet a single response.idN)rd   Zauthenticator_data	signatureZuser_handleZraw_idZresponseZauthenticator_attachmentZclient_extension_resultstype)rn   r"   
credentialr#   rm   	auth_datar|   userr$   CROSS_PLATFORMr!   ry   r+   
PUBLIC_KEY)r3   rz   rx   rT   r6   get_responseZAssertionSelection.get_response   s    $$U+	%''-3 --#,#6#6#--4=NNNINN40	 &=%K%K%J++I6& )33
 	
r8   )rn   rm   ro   N)
r:   r;   r<   r=   r>   rH   rv   ry   r   rD   r9   r8   r6   ra   ra      s%     02	4 '
 
r8   ra   c                  sv    ] tR t^tRt]P                  RR R ll4       t]P                  RR R ll4       tRt	R# )	WebAuthnClientzMBase class for a WebAuthn client, supporting registration and authentication.Nc               rb   rc   optionsr(   r^   Event | Nonerr   r,   r9   ri   rj   r6   rk   WebAuthnClient.__annotate__   s(     
$ 
$3
$ 
$ 
	
$r8   c                    \        4       h)Creates a credential.

:param options: PublicKeyCredentialCreationOptions data.
:param threading.Event event: (optional) Signal to abort the operation.
ZNotImplementedErrorr3   r   r^   rG   r6   make_credentialZWebAuthnClient.make_credential        "##r8   c               rb   rc   r   r*   r^   r   rr   ra   r9   ri   rj   r6   rk   r      s(     
$ 
$2
$ 
$ 
	
$r8   c                r   )Get an assertion.

:param options: PublicKeyCredentialRequestOptions data.
:param threading.Event event: (optional) Signal to abort the operation.
r   r   rG   r6   get_assertionZWebAuthnClient.get_assertion   r   r8   r9   r2   )
r:   r;   r<   r=   r>   abcabstractmethodr   r   rD   r9   r8   r6   r   r      s7    W
$ 
$ 	
$ 
$r8   r   c                  s>    ] tR t^tRtR R ltR R ltR R ltRtR	# )
UserInteractionzProvides user interaction to the Client.

Users of Fido2Client should subclass this to implement asking the user to perform
specific actions, such as entering a PIN or touching theirc               rq   )rc   rr   Noner9   ri   rj   r6   rk   UserInteraction.__annotate__   s     5 54 5r8   c                0    \         P                  R4       R# )z@Called when the authenticator is awaiting a user presence check.zUser Presence check required.Nloggerinfort   ru   r6   	prompt_upZUserInteraction.prompt_up   s    34r8   c               $    V ^8  d   QhRRRRRR/# )rc   permissionsClientPin.PERMISSIONrp_id
str | Nonerr   r9   ri   rj   r6   rk   r      s$      /8B	r8   c                r   )zcCalled when the client requires a PIN from the user.

Should return a PIN, or None/Empty to cancel.z7PIN requested, but UserInteraction does not support it.Nr   r3   r   r   rG   r6   request_pinZUserInteraction.request_pin   s     	MNr8   c               rb   )rc   r   r   r   r   rr   Zboolr9   ri   rj   r6   rk   r     s#      &: : RV r8   c                r   )zpCalled when the client is about to request UV from the user.

Should return True if allowed, or False to cancel.zUser Verification requested.Tr   r   rG   r6   
request_uvZUserInteraction.request_uv  s     	23r8   r9   N)	r:   r;   r<   r=   r>   r   r   r   rD   r9   r8   r6   r   r      s    B
5 r8   r   c                  sD    ] tR tRtRt]P                  R R l4       tRtR# )ClientDataCollectori  zProvides client data and logic to the Client.

Users should subclass this to implement custom behavior for determining the origin,
validating the RP ID, and providing client data for a request.
c               rw   )rc   r   FPublicKeyCredentialCreationOptions | PublicKeyCredentialRequestOptionsrr   ztuple[CollectedClientData, str]r9   ri   rj   r6   rk   Z ClientDataCollector.__annotate__  s      W 
)r8   c                s    R# )zCalled when the client is preparing a request.

Should return a CollectedClientData object with the client data for the request,
as well as the RP ID of the credential.
Nr9   r3   r   r5   r6   collect_client_dataZ'ClientDataCollector.collect_client_data  s    r8   r9   N)	r:   r;   r<   r=   r>   r   r   r   rD   r9   r8   r6   r   r     s!     	 r8   r   c                  sV    ] tR tRtRt]3R R lltR R ltR R ltR	 R
 ltR t	Rt
R# )DefaultClientDataCollectori!  zDefault implementation of ClientDataProvider.

This implementation uses a fixed origin, it can be subclassed to customize specific
behavior.
c               rw   )rc   originstrverifyzCallable[[str, str], bool]r9   ri   rj   r6   rk   'DefaultClientDataCollector.__annotate__(  s      s ,F r8   c                	s    Wn         W n        R # r2   _origin_verify)r3   r   r   rG   r6   rH   Z#DefaultClientDataCollector.__init__(  s    r8   c               r   )rc   r   r   r   r   rr   r9   ri   rj   r6   rk   r   ,  s(      W  
	r8   c                sv   \        V\        4      '       d   VP                  P                  pM.\        V\        4      '       d   VP
                  pM\        R4      hVfZ   \        V4      pVP                  R8w  g   VP                  '       g    \        P                  P                  R4      hVP                  # V# )z/Get the RP ID for the given options and origin.Invalid options type.Zhttpsz$RP ID required for non-https origin.)
isinstancer(   rpr{   r*   r   
ValueErrorr   ZschemeZnetlocr0   rE   r@   )r3   r   r   r   Zurls   &&&  r6   	get_rp_idZ$DefaultClientDataCollector.get_rp_id,  s     gABBJJMME!BCCMME455=6"CzzW$CJJJ!oo11:  ::Lr8   c               s$    V ^8  d   QhRRRRRR/# )rc   r   r   r   rr   r   r9   ri   rj   r6   rk   r   C  s!     , ,# ,s ,t ,r8   c                s     V P                  W4      '       d   R#  \        P                  P	                  4       h  \         d     L+i ; i)z&Verify the RP ID for the given origin.N)r   	Exceptionr0   rE   r@   )r3   r   r   rG   r6   r   Z'DefaultClientDataCollector.verify_rp_idC  sG    	||E** + oo))++  		s   : AAc               rq   )rc   rr   r   r9   ri   rj   r6   rk   r   L  s     6 63 6r8   c                s    \        V\        4      '       d   \        P                  P                  # \        V\
        4      '       d   \        P                  P                  # \        R4      h)z+Get the request type for the given options.r   )r   r(   r'   ZTYPEZCREATEr*   ZGETr   r   r5   r6   get_request_typeZ+DefaultClientDataCollector.get_request_typeL  sN    gABB&++222!BCC&++///455r8   c                	s    V P                  WP                  4      pV P                  W P                  4       \        P                  ! V P                  V4      V P                  VP                  R 7      V3# ))r~   r   	challenge)r   r   r   r'   creater   r   )r3   r   r   rT   r6   r   Z.DefaultClientDataCollector.collect_client_dataU  sc    w5%.  &&**73||!++
 
 	
r8   r   N)r:   r;   r<   r=   r>   r   rH   r   r   r   rD   r9   r8   r6   r   r   !  s'     JV .,6
r8   r   c                s   a  V 3R  lpV# )c                sV   < V \         P                  8X  d   SP                  4        R # R # r2   )r   r]   r   )Zstatususer_interactions   &r6   r_   Z%_user_keepalive.<locals>.on_keepaliveg  s     V__$&&( %r8   r9   )r   r_   s   f r6   _user_keepaliver   f  s    ) r8   c                  s    ] tR tRt$ R]R&   ]P                  R R l4       t]P                  R R l4       t]P                  R R	 l4       t	R
t
R# )_ClientBackendin  r   r   c               rw   rc   r^   r   rr   r   r9   ri   rj   r6   rk   _ClientBackend.__annotate__r  s     $ $| $ $r8   c                	r   r2   r   r3   r^   r5   r6   	selectionZ_ClientBackend.selectionq  s    !##r8   c               s0    V ^8  d   QhRRRRRRRRR	R
RR/# )rc   r   r(   rd   r'   r   r   enterprise_rpid_listzSequence[str] | Noner^   r   rr   r,   r9   ri   rj   r6   rk   r   v  sF     $ $3$ )$ 	$
 3$ $ 
$r8   c                	r   r2   r   )r3   r   rd   r   r   r^   s   &&&&&&r6   do_make_credentialZ!_ClientBackend.do_make_credentialu  s     "##r8   c          
     s,    V ^8  d   QhRRRRRRRRR	R
/# )rc   r   r*   rd   r'   r   r   r^   r   rr   ra   r9   ri   rj   r6   rk   r     s<     $ $2$ )$ 	$
 $ 
$r8   c                	r   r2   r   )r3   r   rd   r   r^      &&&&&r6   do_get_assertionZ_ClientBackend.do_get_assertion  s     "##r8   r9   N)r:   r;   r<   r=   Z__annotations__r   r   r   r   r   rD   r9   r8   r6   r   r   n  sS    
J$ $ 	$ $ 	$ $r8   r   c                  s4    ] tR tRtR R ltR tR tR tRtR# )	_Ctap1ClientBackendi  c               rw   )rc   devicer   r   r   r9   ri   rj   r6   rk   Z _Ctap1ClientBackend.__annotate__  s     ? ?z ?_ ?r8   c                	s    \        V4      V n        \        R .. \        P                  R7      V n        RV n        \        V4      V n        R# )ZU2F_V2)versions
extensionsZaaguidg      ?N)	r   ctap1r   r   ZNONEr   _poll_delayr   _on_keepalive)r3   r   r   rG   r6   rH   Z_Ctap1ClientBackend.__init__  s9    6]
8*FKKP	,-=>r8   c                	sb    \        V P                  VR V P                  P                  RR4       R # )N                                    )r`   r   r   registerr   r5   r6   r   Z_Ctap1ClientBackend.selection  s,    JJ	
r8   c                	sB   VP                   pVP                  pVP                  ;'       g    \        4       pVP                  p	VP
                  p
V	'       gc   V
\        P                  8X  gN   \        P                  V Uu. uF  qP                  NK  	  up9  g    VP                  \        P                  8X  d$   \        \        P                  P                   4      h\#        VP%                  4       4      pRpT;'       g    .  FI  pVP&                  p V P(                  P+                  WVR4       \,        P                  P/                  4       h	  \B        PD                  ! V\9        V P:                  VV P<                  V P(                  P>                  VPF                  V4      4      pVPH                  PJ                  pVf   Q h\M        VPN                  \Q        VVR7      \R        PT                  \W        / 4      \X        PZ                  R7      # u upi   \0         d   pTP2                  \4        P6                  8X  dW   \9        T P:                  TT P<                  T P(                  P>                  TT4       \,        P                  PA                  4       h Rp?EK  Rp?ii ; i)    TNrd   Zattestation_objectr}   r   ).pub_key_cred_paramsexclude_credentialsauthenticator_selectionr&   Zrequire_resident_keyuser_verificationr.   REQUIREDr   Z	ALGORITHMalgattestationr   
ENTERPRISEr   rE   rM   r   encoder{   r   authenticater0   r?   r   rF   r   r\   r`   r   r   r   rB   r    
from_ctap1hashr   credential_datar,   credential_idr%   r$   r   r!   r+   r   )r3   r   rd   r   r   r^   
key_paramsexclude_listr   rkr   Zp	app_paramZdummy_paramcredZ
key_handlerS   att_objr   s   &&&&&&             r6   r   Z&_Ctap1ClientBackend.do_make_credential  s"    00
2233WW7U7W	++%77  $?$H$HHj&Ajuuj&AA""&E&P&PPIMM<<==5<<>*	  &&B&DJ>

''
DQ!oo1133	 '" $..  ""

##  

 &&66
%%%#++5'G &=%K%K%J2%N(33
 	
O 'B  
>66T333!((**

++## &//;;== 4
>s   ?H;HJA5JJc           
     	s   VP                   pVP                  pV\        P                  8X  g	   V'       g$   \	        \        P
                  P                  4      h\        VP                  4       4      pVP                  pV Ft  p	 \        V P                  VV P                  V P                  P                  VVV	P                  4      p
\         P"                  ! V\%        V	4      V
4      .p\'        W+4      u # 	  \(        P
                  P/                  4       h  \(         d6   pTP*                  \(        P
                  P,                  8X  d   h  R p?K  R p?ii ; ir2   )allow_credentialsr   r.   r   r   rE   rM   r   r   r   r`   r   r   r   r   r{   r   r   r/   ra   r0   rF   rC   rB   )r3   r   rd   r   r^   
allow_listr   r   Zclient_paramr   Z	auth_respre   rS   s   &&&&&        r6   r   Z$_Ctap1ClientBackend.do_get_assertion  s    ..
#55 ; D DDJIMM<<==5<<>*	"''D)$$&&JJ++ GG	 &00HTNIV
 *+BB $ oo//11  66[__444 5s   A/DE!*EE)r   r   r   r   N)	r:   r;   r<   r=   rH   r   r   r   rD   r9   r8   r6   r   r     s    ?
@
D!2r8   r   c                  s4   a  ] tR tRtR V 3R lltR tRtV ;t# )_Ctap2ClientAssertionSelectioni  c               (    V ^8  d   QhRRRRRRRR/# )	rc   rd   r'   re   rf   r   z*Sequence[AuthenticationExtensionProcessor]	pin_tokenzbytes | Noner9   ri   rj   r6   rk   Z+_Ctap2ClientAssertionSelection.__annotate__  s2     	$ 	$(	$ 0	$ ?		$
  	$r8   c                	s>   < \         SV `  W4       W0n        W@n        R # r2   )rW   rH   _extensions
_pin_token)r3   rd   re   r   r   rX   s   &&&&&r6   rH   Z'_Ctap2ClientAssertionSelection.__init__  s     	1%#r8   c                	s   / p V P                    F9  pVP                  WP                  4      pV'       g   K(  VP                  V4       K;  	  V#   \         d%   p\
        P                  P                  T4      hR p?ii ; ir2   )r   prepare_outputsr   updater   r0   rE   rA   )r3   rx   extension_outputsextoutputrS   s   &&    r6   ry   Z5_Ctap2ClientAssertionSelection._get_extension_results  ss    	?'',,YH6%,,V4 ( !   	?//;;A>>	?s   /A A A>A99A>)r   r   )r:   r;   r<   r=   rH   ry   rD   rY   rZ   r[   r6   r   r     s    	$ 	$
! 
!r8   r   c               rw   )rc   valuesr	   rr   Zlistr9   ri   rj   r6   rk   rk     s     - -x -D -r8   c                    R # r2   r9   r   ru   r6   
_cbor_listr     s    *-r8   c               s     V ^8  d   QhRRRR/# )rc   r   r   rr   r9   ri   rj   r6   rk   rk      s     ) )t ) )r8   c                r   r2   r9   r   ru   r6   r   r     s    &)r8   c                sV    V '       g   R # V  Uu. uF  p\        V4      NK  	  up# u upi r2   )r/   )r   ZvrJ   r6   r   r   #  s$    !'(AHQK(((s   &c                  sL    ] tR tRtR R ltR tR tR tR tR t	R	 t
R
 tRtR# )_Ctap2ClientBackendi)  c               rb   )rc   r   r   r   r   r   Sequence[Ctap2Extension]r9   ri   rj   r6   rk   Z _Ctap2ClientBackend.__annotate__*  s(     	1 	1	1 *	1 -		1r8   c                	st    \        V4      V n        V P                  P                  V n        W0n        W n        R # r2   )r   ctap2r   r   r   )r3   r   r   r   rp   r6   rH   Z_Ctap2ClientBackend.__init__*  s*     6]
JJOO	% 0r8   c                	s   V P                   P                  4       pVP                  pV'       d.   V U	u. uF!  p	\        V	P                  4      V8:  g   K  V	NK#  	  pp	VP
                  ;'       g    ^p
\        ^ \        V4      V
4       Uu. uF  qWV
,            NK  	  ppRpV'       d   VP                  WM4      pVP                  pMRpRpV Fj  p V P                   P                  VV\        V4      RRR/VVVVR7	      p\        V4      ^8X  d   V^ ,          u # \        R/ V^ ,          P                  B u # 	  R# u up	i u upi   \         d6   pTP                  \        P                  P                   8X  d    Rp?K  h Rp?ii ; i)i   NZupF)r^   r_   r   r9   )r   get_infoZmax_cred_id_lengthZlenr{   Zmax_creds_in_listZranger   VERSIONrv   r   r)   r   r   rF   rE   rL   )r3   r   Z	cred_listpin_protocolr   r^   r_   r   Zmax_lenZcZ	max_credsZiZchunksclient_data_hashpin_authZversionZchunkre   rS   s   &&&&&&&            r6   _filter_credsZ!_Ctap2ClientBackend._filter_creds5  sx    zz""$ ))$-FIqQTTg1EIIF**//a	273y>92U
2UQai-(2U 	 
 &#00MH"**GHGE!ZZ66$u%5M!- 7 

 u:? 8O8T:a=;S;STT# 2 Q G
<  66Y]]999	s6   D=D=
EAEEF)FFFc           	     	s   R V P                   P                  P                  9   d   V P                   P                  VR7       R#  V P                   P	                  RRRRR/RRRR/RRR	R/.R
VR7       R#   \
         di   pTP                  \
        P                  P                  \
        P                  P                  \
        P                  P                  39   d    Rp?R# h Rp?ii ; i)ZFIDO_2_1)r^   r{   zexample.comZnames   dummyZdummyr~   z
public-keyr   r8   )Zpin_uv_paramr^   Nr   i)r   r   r   r   r   r   rF   rE   rP   rO   rQ   r3   r^   rS   rT   r6   r   Z_Ctap2ClientBackend.selectionh  s    111JJ  u -

**=&-@8VW5lE267!$ +   66MM--MM--MM22 
 s   .A5 5C( AC#"C##C(c                	s@  a \         ;QJ d    V3R  lR 4       F  '       g   K   RM	  RM! V3R  lR 4       4      p\         ;QJ d    V3R lR 4       F  '       g   K   RM	  RM! V3R lR 4       4      p\        P                  P                  V,          ^ 8g  pV\        P                  P                  \        P                  P                  ,          ( ,          pV\
        P                  8X  gA   V\
        P                  R39   d	   V'       g"   SP                  P                  R4      '       d*   V'       g    \        P                  P                  R4      hR# V'       d,   V'       d$   SP                  P                  R4      '       g   R# V'       d   V'       d   R# R# )	c              3  s@   <"   T F  qSP                   9   x  K  	  R # 5ir2   )r   Z.0Zkr      & r6   	<genexpr>5_Ctap2ClientBackend._should_use_uv.<locals>.<genexpr>  s     W6V,6Vs   TFc              3  sZ   <"   T F   pSP                   P                  V4      x  K"  	  R # 5ir2   )r   getr   r   r6   r   r    s'      
)IADLLQ)Is   (+NZalwaysUvz*User verification not configured/supportedZmakeCredUvNotRqd)uv	clientPinZ	bioEnroll)Zanyr   
PERMISSIONMAKE_CREDENTIALGET_ASSERTIONr.   r   	PREFERREDr   r  r0   rE   rA   )r3   r   r   r   Zuv_supportedZuv_configuredZmcZadditional_permss   &f&&    r6   _should_use_uvZ"_Ctap2ClientBackend._should_use_uv  s&   sW6VWsssW6VWW 
)I
 
)I
 
 !!11K?1D&  0093G3G3U3UU*
 

 !<!E!EE!&A&K&KT%RR ||
++ !oo??@  M$,,*:*:;M*N*N/r8   c                	s8   VP                   P                  R 4      '       d|   \        P                  ! V4      '       d5   V P                  P                  W44      '       d   VP                  W4WV4      # M+V'       d$   V P                  P                  W44      '       d   R# VP                   P                  R4      '       d@   V P                  P                  W44      pV'       d   VP                  WV4      # \        4       h\        P                  P                  R4      h)r  Nr  z User verification not configured)r   r  r   Zis_token_supportedr   r   Zget_uv_tokenr   Zget_pin_tokenrV   r0   rE   rA   )	r3   r   
client_pinr   r   r^   r_   allow_internal_uvZpins	   &&&&&&&& r6   
_get_tokenZ_Ctap2ClientBackend._get_token  s     <<D!!++D11((33KGG%22#E  H #((33KGG <<K((''33KGC!//%HH"$$ oo77.
 	
r8   c           	     	sj   V P                   P                  4       pR pRp	V P                  WsV4      '       d|   \        V P                   V4      p
V\        P                  P
                  \        P                  P                  ,          ( ,          ^ 8H  pV P                  VV
VVVVV4      pV'       g   Rp	W3# )NFT)r   r   r	  r   r  r  r  r  )r3   r   r   r   r   r^   r_   r   r   internal_uvr
  r  s   &&&&&&&     r6   _get_auth_paramsZ$_Ctap2ClientBackend._get_auth_params  s     zz""$	tDD"4::|<J((88**889
   !I "%%r8   c                	sN  a aaaaaaaaaaaaaa SP                   oSP                  oSP                  oSP                  ;'       g    \	        4       oSP
                  o\        S P                  4      oS P                  P                  4       oR oSP                  \        P                  8X  d2   SP                  P                  R4      '       d   Ve   SV9   d   ^oM^o\        P                    F'  pVP"                  SP$                  9   g   K   V! 4       o M	  R o. oVVVVVVVVVVVV VVV3R lpS P                  P&                  pRp	  V! 4       w  r / p S F+  pTP=                  Y4      pTf   K  TP?                  T4       K-  	  \F        PH                  ! T
PJ                  T
PL                  T
PN                  4      pTPL                  PP                  pTf   Q h\S        TPT                  \W        STR7      \X        PZ                  \]        T4      \^        P`                  R7      #   \(         d   pTP*                  \(        P,                  P.                  8X  d-   S\0        P2                  8X  d   \0        P4                  o R p?EK<  \7        TRR 4      pTP*                  \(        P,                  P8                  8X  d1   T'       d)   T	'       g!   TP;                  4        T! 4        Rp	 R p?EK  h R p?ii ; i  \@         d%   p\B        P,                  PE                  T4      hR p?ii ; i)NZepc            
     s  < \         P                  P                  p S'       d"   V \         P                  P                  ,          p SP	                  4        SP
                   FM  pVP                  SP                  SS4      pV'       g   K*  SP                  V4       WP                  ,          p KO  	  SP                  SSSV SS4      w  r4S'       d   SP                  SSSVSS4      pMR p/ p S F/  pVP                  V4      pV'       g   K  VP                  V4       K1  	  SP$                  P'                  R4      pSP(                  \*        P,                  8H  ;'       g(    SP(                  \*        P.                  8H  ;'       d    Tp	T	'       g   T'       g   R p
MC/ p
T	'       d-   T'       g    \        P                   P#                  R4      hRT
R&   T'       d   RT
R&   SP0                  pS'       d'   T'       d   SP3                  Y;4      SP4                  3pMRpSP                  P                  ! T\7        \9        SP:                  SR7      4      \7        S4      \=        S4      T'       d   \7        T4      .MR T;'       g    R T
.TOSN5RSRS/ T3#   \         d%   p\        P                   P#                  T4      hR p?ii ; i)	Nr   zResident key not supportedTr  )r{   r^   r_   NN)r   r  r  r  Zclearr   r   r   appendr   r  r   prepare_inputsr   r   r0   rE   rA   r   r  Zresident_keyr-   r   r  r   r   r   r/   r   r   r   )r   rS   r   r   r  Zexclude_credextension_inputsZ
auth_inputZcan_rkr   optsr   r   rd   enterprise_attestationr^   r   r   r   r_   r   r   r   r   r3   used_extensionsr   r   s                r6   _do_makeZ8_Ctap2ClientBackend.do_make_credential.<locals>._do_make  s   #..>>Ky33AAA !!#%%''

G\J3#**3/??2K	 & &*%:%:e%6UL&"I #11<y%   $  "C*C!$!3!3I!>J!z(//
; + \\%%d+F''+A+J+JJ  &&*@*J*JJUUv  +!)ooGG8  "&DJ!%DJ  +//	 --iJ ((=
 ( 

**$WWZZE:;TNz*0<Xl+,$$,,  +   ".  A  C!oo??BBCs   .J J K!K  KFTconnectr   r}   )1r   r   r   r   r&   r   r   r   r   r   r   r   r   r   r  r   	PROTOCOLSr   pin_uv_protocolsr   r   rF   rE   rN   r.   DISCOURAGEDr   getattrrR   closer   r   r   r0   rA   r    r   Zfmtr   Zatt_stmtr   r,   r   r%   r$   r   r!   r+   r   )r3   r   rd   r   r   r^   protor  devreconnectedZatt_respr   rS   r  r   r   r   r   r   r  r   r   r   r_   r   r   r  r   r   s   ffff&f             @@@@@@@@@@r6   r   Z&_Ctap2ClientBackend.do_make_credential  s    ||00
2233WW7U7W	%77&t'<'<=zz""$ "&"A"L"LL||%%'3 4412. ./* ((E}} 5 55387 )
  L@BT	 T	 T	l jj&.j#. 	?&,,XA%%,,V4 ' $**LL(,,h.?.?
 &&66
%%%#++5'G &=%K%K%J!& )33

 
	
M   FFimm999)-H-T-TT(C(L(L%!#y$7FFimm<<<'IIKI"&K'8  	?//;;A>>	?sO   	H& K5 5K5 &K21AK-=K-K-K-,K--K25L$ LL$c           	     	s  a aaaaaaaa SP                   oSP                  oSP                  o\        S P                  4      o\
        P                   F1  pVP                  S P                  P                  9   g   K*  V! 4       o M	  R oVVVVVVVV V3	R lpS P                  P                  pRp  V! 4       #   \         d   p	T	P                  \        P                  P                  8X  d,   S\         P"                  8X  d   \         P$                  o R p	?	Kh  \'        TRR 4      p
T	P                  \        P                  P(                  8X  d0   T
'       d(   T'       g    TP+                  4        T
! 4        Rp R p	?	K  h R p	?	ii ; i)Nc                 s  <	 \         P                  P                  p . pSP                   FM  pVP	                  SP
                  SS4      pV'       g   K*  VP                  V4       WP                  ,          p KO  	  SP                  SSSV SS4      w  rES'       d   SP                  SSSVSS4      pMR p/ p V F/  pVP                  Wd4      pV'       g   K  VP                  V4       K1  	  T'       d   RR/MR p	SP                   p
S'       d'   T'       d   SP#                  YJ4      SP$                  3pMRpS'       d'   T'       g   \'        S^ ,          P(                  RR7      pSP
                  P*                  ! ST
T'       d   \-        T4      .MR T;'       g    R T	.TO5RSRS/ p\/        SYT4      #   \         d%   p\        P                  P                  T4      hR p?ii ; i)Nr  Tr   )r~   r{   r^   r_   r  )r   r  r  r   r   r   r  r   r  r   r  r   r   r0   rE   rA   r   r   r   r)   r~   rv   r/   r   )r   r  rS   r   r   r  Zselected_credr  Zinputsr  r   r   re   r   rd   r^   r_   r   r   r   r3   r   s                r6   _do_authZ6_Ctap2ClientBackend.do_get_assertion.<locals>._do_auth  s   #..<<K !O%%oodjj'<H3#**3/??2K	 & &*%:%:e%6UL&"I  $ 2 2:|Y|! !%  "C*C //IFv(//7 + $/D$<DD  +//	 --iJ ((=
 (- !>#A++!
 22 -:-() ((D	 	 	 *	J 2Z) E  C!oo??BBCs   7F5 F5 5G$ GG$FTr  )r   r   r   r   r   r   r  r   r   r  r   r   r   rF   rE   rN   r.   r  r   r  rR   r  )r3   r   rd   r   r^   r  r   r  r  rS   r  r   r_   r   r   s   fffff      @@@@r6   r   Z$_Ctap2ClientBackend.do_get_assertion  s+    ..
#55&t'<'<= ((E}}		 : ::387 )
  LF	 F	P jjz!  FFimm999)-H-T-TT(C(L(L%!#y$7FFimm<<<'IIKI"&K's1   2B9 9FAE>=E>E>E>=E>>F)r   r   r   r   N)r:   r;   r<   r=   rH   r   r   r	  r  r  r   r   rD   r9   r8   r6   r   r   )  s/    	11f.:
B&<s
jur8   r   c                  s~    ] tR tRtRt]! 4       ]3R R llt]R R l4       t	RR R	 llt
RR
 R lltRR R lltRtR# )Fido2Clienti  a&  WebAuthn-like client implementation.

The client allows registration and authentication of WebAuthn credentials against
an Authenticator using CTAP (1 or 2).

:param device: CtapDevice to use.
:param str origin: The origin to use.
:param verify: Function to verify an RP ID for a given origin.
c               r   )	rc   r   r   client_data_collectorr   r   r   r   r   r9   ri   rj   r6   rk   Fido2Client.__annotate__  s8     J JJ  3J *	J
 -Jr8   c                	s    W n         R V n         \        WV4      V n        R #   \        \
        3 d    \        Y4      T n         R # i ; ir2   )_client_data_collector_enterprise_rpid_listr   _backendr   r   r   )r3   r   r"  r   r   r   r6   rH   ZFido2Client.__init__  sP     '<# <@"	J,?*-DM I& 	J/IDM	Js   " !AAc               rq   )rc   rr   r   r9   ri   rj   r6   rk   r#  '  s     " "d "r8   c                	s.    V P                   P                  # r2   )r&  r   rt   ru   r6   r   ZFido2Client.info&  s    }}!!!r8   Nc               rw   r   r9   ri   rj   r6   rk   r#  *  s     & &| &t &r8   c                	sz     V P                   P                  V4       R #   \         d   p\        T4      hR p?ii ; ir2   )r&  r   r   rU   r   rT   r6   r   ZFido2Client.selection*  s4    	&MM##E* 	&"1%%	&s    :5:c               rb   r   r9   ri   rj   r6   rk   r#  0  s(     $ $3$ $ 
	$r8   c                sd   \         P                  ! V4      pT;'       g    \        4       pVP                  '       d@   \	        VP                  R,          VP
                  4      pRVn        VP                  4        MRpV P                  P                  V4      w  rE\        P                  RV 24        V P                  P                  VVVV P                  V4      V'       d   VP                  4        # #   \          d   p\#        T4      hRp?ii ; i  T'       d   TP                  4        i i ; i)r     TNz%Register a new credential for RP ID: )r(   	from_dictr   timeoutr   setdaemonstartr$  r   r   debugr&  r   r%  cancelr   rU   r3   r   r^   Ztimerrd   r   rS      &&&    r6   r   ZFido2Client.make_credential0  s     5>>wG  ???'//D0%))<EELKKME "88LLWU<UGDE	==33**    	&"1%%	&  s$   4(C6 6DDDD D/c               rb   r   r9   ri   rj   r6   rk   r#  V  s(     # #2# # 
	#r8   c                sN   \         P                  ! V4      pT;'       g    \        4       pVP                  '       d@   \	        VP                  R,          VP
                  4      pRVn        VP                  4        MRpV P                  P                  V4      w  rE\        P                  RV 24        V P                  P                  VVVV4      V'       d   VP                  4        # #   \         d   p\!        T4      hRp?ii ; i  T'       d   TP                  4        i i ; i)r   r'  TNzAssert a credential for RP ID: )r*   r(  r   r)  r   r*  r+  r,  r$  r   r   r-  r&  r   r.  r   rU   r/  r0  r6   r   ZFido2Client.get_assertionV  s     4==gF  ???'//D0%))<EELKKME "88LLWU6ug>?	==11	    	&"1%%	&  s$   4C+ +D6DDD	 	D$)r&  r$  r%  r2   )r:   r;   r<   r=   r>   r   r   rH   Zpropertyr   r   r   r   rD   r9   r8   r6   r!  r!    sA     -<,=/BJ& " "&$L# #r8   r!  )WZ
__future__r    r   ZloggingZdataclassesr   Zenumr   r   Z	threadingr   r   Ztypingr   r   r   r	   r
   Zurllib.parser   Zcoser   Zctapr   r   r   r   r   r   r   r   r   r   Zctap2.extensionsr   r   r   r   Z	ctap2.pinr   r   Zhidr   Zrpidr   Zutilsr   Zwebauthnr   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   Z	getLoggerr:   r   r   r0   rU   rV   r`   ra   ZABCr   r   r   r   r   r   r   r   r   r   r!  r9   r8   r6   <module>r1     sW  8 # 
     " = = !  ( * * 2 2  /       * 
		8	$) 6 !, $N&{ &$$)
 )
X$SWW $< 6#'' &B
!4 B
J$SWW $:t2. t2n!%7 !2 
 - 
 - 
 ) 
 ))\. \~q. qr8   