+
     h1  c                  s    ^ RI Ht ^ RIt^ RIt^ RIHtHt ^ RIHt ^ RI	H
t
HtHt ^RIHt ^RIHt ^RIHtHt ^R	IHt ]P,                  ! ]4      t ! R
 R4      t ! R R]4      t ! R R4      t ! R R]4      tR# )i    )annotationsN)IntEnumunique)Event)AnyCallableMapping)cbor)	CtapError)Ctap2Info)PinProtocolc                  s    ] tR t^,t] ! R R]4      4       t] ! R R]4      4       t] ! R R]4      4       t]	R R l4       t
R	 R
 ltR R ltRtR# )BioEnrollmentc                  s6    ] tR t^-t^t^t^t^t^t^t	^t
^tRtR# )BioEnrollment.RESULT N)__name__
__module____qualname____firstlineno__MODALITYZFINGERPRINT_KINDZMAX_SAMPLES_REQUIREDTEMPLATE_IDLAST_SAMPLE_STATUSREMAINING_SAMPLESTEMPLATE_INFOSZMAX_TEMPLATE_FRIENDLY_NAME__static_attributes__r       4/usr/lib/python3.14/site-packages/fido2/ctap2/bio.pyRESULTr   -   s/    #! %)"r   r   c                  s    ] tR t^8t^t^tRtR# )BioEnrollment.TEMPLATE_INFOr   N)r   r   r   r   IDNAMEr   r   r   r   TEMPLATE_INFOr   8   s    r   r   c                  s    ] tR t^=t^tRtR# )BioEnrollment.MODALITYr   N)r   r   r   r   FINGERPRINTr   r   r   r   r   r    =   s    r   r   c                    V ^8  d   QhRRRR/# )   infor
   returnZboolr   Zformat   "r   __annotate__BioEnrollment.__annotate__B   s     	 	4 	D 	r   c                	st    R V P                   9   d   R# RV P                  9   d   RV P                   9   d   R# R# )Z	bioEnrollTZFIDO_2_1_PREZuserVerificationMgmtPreviewF)ZoptionsZversions)r$      &r   is_supportedZBioEnrollment.is_supportedA   s1    $,,& dmm+-=r   c               r"   )r#   ctapr	   modalityr   r   r&   r'   r   r(   r)   M   s     F FU Fh Fr   c                	s    V P                  VP                  4      '       g   \        R 4      hWn        V P	                  4       V n        W P
                  8w  d   \        RVR 24      hR# )z(Authenticator does not support BioEnrollzDevice does not support ZsN)r+   r$   Z
ValueErrorr,   get_modalityr-   )selfr,   r-      &&&r   __init__ZBioEnrollment.__init__M   s\      ++GHH	))+}}$7|DEE %r   c                   V ^8  d   QhRR/# )r#   r%   intr   r&   r'   r   r(   r)   V   s     
 
c 
r   c                sx    V P                   P                  RR7      \        P                  P                  ,          # )zQGet bio modality.

:return: The type of modality supported by the authenticator.
T)r.   )r,   bio_enrollmentr   r   r   r/   r*   r   r.   ZBioEnrollment.get_modalityV   s2    
 yy''T':  ))
 	
r   )r,   r-   N)r   r   r   r   r   r   r   r   r   Zstaticmethodr+   r1   r.   r   r   r   r   r   r   ,   su    * * *    7   	 	F
 
r   r   c                  s.   a  ] tR t^`tR V 3R lltRtV ;t# )CaptureErrorc               r2   )r#   coder3   r   r&   r'   r   r(   ZCaptureError.__annotate__a   s     ? ?S ?r   c                	s8   < Wn         \        SV `	  R V 24       R# )zFingerprint capture error: N)r7   superr1   )r/   r7   	__class__s   &&r   r1   ZCaptureError.__init__a   s    	6tf=>r   )r7   )r   r   r   r   r1   r   __classcell__r9      @r   r6   r6   `   s    ? ?r   r6   c                  sF    ] tR t^ftRtR
R R lltRR R lltR R ltR	tR# )FPEnrollmentContextaR  Helper object to perform fingerprint enrollment.

:param bio: An instance of FPBioEnrollment.
:param timeout: Optional timeout for fingerprint captures (ms).
:ivar remaining: The number of (estimated) remaining samples needed.
:ivar template_id: The ID of the new template (only available after the initial
    sample has been captured).
Nc               r"   )r#   bioz'FPBioEnrollment'timeout
int | Noner   r&   r'   r   r(    FPEnrollmentContext.__annotate__p   s     * *- *
 *r   c                	s:    Wn         W n        R V n        R V n        R # N)_bior?   template_id	remaining)r/   r>   r?   r0   r   r1   ZFPEnrollmentContext.__init__p   s    	)-%)r   c               $    V ^8  d   QhRRRRRR/# )r#   eventEvent | Noneon_keepaliveCallable[[int], None] | Noner%   zbytes | Noner   r&   r'   r   r(   rA   v   s(       3 
	r   c                s   V P                   f5   V P                  P                  V P                  W4      w  V n         q0n        M8V P                  P                  V P                   V P                  W4      w  q0n        V\        P                  P                  8w  d   \        V4      hV P                  ^ 8X  d   V P                   # R# )a$  Capture a fingerprint sample.

This call will block for up to timeout milliseconds (or indefinitely, if
timeout not specified) waiting for the user to scan their fingerprint to
collect one sample.

:return: None, if more samples are needed, or the template ID if enrollment is
    completed.
N)
rD   rC   enroll_beginr?   rE   enroll_capture_nextFPBioEnrollmentFEEDBACKFP_GOODr6   )r/   rG   rI   Zstatuss   &&& r   captureZFPEnrollmentContext.capturev   s     #7;yy7M7Me84Dfn &*YY%B%B  $,,&"FN _--555v&&>>Q###r   c               r2   r#   r%   Noner   r&   r'   r   r(   rA      s          r   c                sH    V P                   P                  4        RV n        R# )zCancels ongoing enrollment.N)rC   enroll_cancelrD   r5   r*   r   cancelZFPEnrollmentContext.cancel   s    		!r   )rC   rE   rD   r?   rB   )NN)	r   r   r   r   __doc__r1   rP   rT   r   r   r   r   r=   r=   f   s    *8   r   r=   c                  s  a  ] tR t^tRt] ! R R]4      4       t] ! R R]4      4       t] ! R R]4      4       t	R V 3R	 llt
RR
 ltR R ltRR R lltRR R lltR R ltRR R lltR R ltR R ltR R ltRtV ;t# )rM   ar  Implementation of the bio enrollment API.

NOTE: The get_fingerprint_sensor_info method does not require authentication, and
can be used by setting pin_uv_protocol and pin_uv_token to None.

:param ctap: An instance of a CTAP2 object.
:param pin_uv_protocol: The PIN/UV protocol version used.
:param pin_uv_token: A valid PIN/UV Auth Token for the current CTAP session.
c                  s2    ] tR t^t^t^t^t^t^t^t	^t
RtR# )FPBioEnrollment.CMDr   N)r   r   r   r   ENROLL_BEGINENROLL_CAPTURE_NEXTENROLL_CANCELENUMERATE_ENROLLMENTSSET_NAMEREMOVE_ENROLLMENTGET_SENSOR_INFOr   r   r   r   CMDrV      s(    " $ r   r^   c                  s"    ] tR t^t^t^t^tRtR# )FPBioEnrollment.PARAMr   N)r   r   r   r   r   ZTEMPLATE_NAME
TIMEOUT_MSr   r   r   r   PARAMr_      s    
r   ra   c                  sX    ] tR t^t^ t^t^t^t^t^t	^t
^t^t^	t^
t^t^t^t^tR tRtR# )FPBioEnrollment.FEEDBACKc                	s<    R V P                   R RV P                   2# )Z0xZ02Xz - )Zvaluenamer5   r*   r   __str__Z FPBioEnrollment.FEEDBACK.__str__   s     

3's499+66r   r   N)r   r   r   r   rO   ZFP_TOO_HIGHZ
FP_TOO_LOWZFP_TOO_LEFTZFP_TOO_RIGHTZFP_TOO_FASTZFP_TOO_SLOWZFP_POOR_QUALITYZFP_TOO_SKEWEDZFP_TOO_SHORTZFP_MERGE_FAILUREZ	FP_EXISTSZFP_DATABASE_FULLZNO_USER_ACTIVITYZNO_UP_TRANSITIONrd   r   r   r   r   rN   rb      sV    
		7r   rN   c               rF   )r#   r,   r	   pin_uv_protocolr   pin_uv_tokenbytesr   r&   r'   r   r(   FPBioEnrollment.__annotate__   s"     ) )U )[ )PU )r   c                	sp   < \         SV `  V\        P                  P                  4       W n        W0n        R # rB   )r8   r1   r   r   r!   re   rf   )r/   r,   re   rf   r9   s   &&&&r   r1   ZFPBioEnrollment.__init__   s*    }55AAB.(r   c           
     	s   R V P                   RVRVRVRV/pV'       d   \        P                  ! RV P                   V4      pVe   V\        P                  ! V4      ,          pV P
                  P                  VR&   V P
                  P                  V P                  V4      VR&   V P                  P                  ! R/ VB # )	r-   sub_cmdZsub_cmd_paramsrG   rI   z>BBre   Zpin_uv_paramr   )r-   structZpackr   Zencodere   ZVERSIONZauthenticaterf   r,   r4   )r/   ri   paramsauthrG   rI   ZkwargsZmsgs   &&&&&&  r   _callZFPBioEnrollment._call   s    wfUL
 ++eT]]G<C!t{{6**(,(<(<(D(DF$%%)%9%9%F%F!!3&F>" yy''1&11r   c               r2   )r#   r%   zMapping[int, Any]r   r&   r'   r   r(   rh      s     K K-> Kr   c                sX    V P                  \        P                  P                  RR7      # )zdGet fingerprint sensor info.

:return: A dict containing FINGERPRINT_KIND and MAX_SAMPLES_REQUIRES.
Frl   )rm   rM   r^   r]   r5   r*   r   get_fingerprint_sensor_infoZ+FPBioEnrollment.get_fingerprint_sensor_info   s#    
 zz/--==EzJJr   c               s(    V ^8  d   QhRRRRRRRR/# )	r#   r?   r@   rG   rH   rI   rJ   r%   z+tuple[bytes, FPBioEnrollment.FEEDBACK, int]r   r&   r'   r   r(   rh      s2     
 

 
 3	

 
5
r   c                s   \         P                  RV R24       T P                  \        P                  P
                  Ve   \        P                  P                  V/MRVVR7      p\         P                  RV 24       V\        P                  P                  ,          \        P                  V\        P                  P                  ,          4      V\        P                  P                  ,          3# )ae  Start fingerprint enrollment.

Starts the process of enrolling a new fingerprint, and will wait for the user
to scan their fingerprint once to provide an initial sample.

:param timeout: Optional timeout in milliseconds.
:return: A tuple containing the new template ID, the sample status, and the
    number of samples remaining to complete the enrollment.
z)Starting fingerprint enrollment (timeout=)NrG   rI   Sample capture result: )loggerdebugrm   rM   r^   rW   ra   r`   r   r   r   rN   r   r   )r/   r?   rG   rI   results   &&&& r   rK   ZFPBioEnrollment.enroll_begin   s     	@	KL,, & !&&117;%  	
 	.vh78=''334$$VM,@,@,S,S%TU=''99:
 	
r   c          
     s,    V ^8  d   QhRRRRRRRRR	R
/# )r#   rD   rg   r?   r@   rG   rH   rI   rJ   r%   z$tuple[FPBioEnrollment.FEEDBACK, int]r   r&   r'   r   r(   rh     s<      
  
 
  
 	 

 3 
 
. 
r   c                s   \         P                  RV R24       \        P                  P                  V/pVe   W%\        P                  P
                  &   V P                  \        P                  P                  VVVR7      p\         P                  RV 24       \        P                  V\        P                  P                  ,          4      V\        P                  P                  ,          3# )a  Continue fingerprint enrollment.

Continues enrolling a new fingerprint and will wait for the user to scan their
fingerpring once to provide a new sample.
Once the number of samples remaining is 0, the enrollment is completed.

:param template_id: The template ID returned by a call to `enroll_begin`.
:param timeout: Optional timeout in milliseconds.
:return: A tuple containing the sample status, and the number of samples
    remaining to complete the enrollment.
z$Capturing next sample with (timeout=rp   rq   rr   )rs   rt   rM   ra   r   r`   rm   r^   rX   rN   r   r   r   r   )r/   rD   r?   rG   rI   rk   ru   s   &&&&&  r   rL   Z#FPBioEnrollment.enroll_capture_next  s    $ 	;G9AFG"1"7"7"C"C[!Q7>?((33433%	  
 	.vh78$$VM,@,@,S,S%TU=''99:
 	
r   c               r2   rQ   r   r&   r'   r   r(   rh   )  s     B Bt Br   c                s    \         P                  R4       V P                  \        P                  P
                  RR7       R# )z*Cancel any ongoing fingerprint enrollment.z"Cancelling fingerprint enrollment.Frn   N)rs   rt   rm   rM   r^   rY   r5   r*   r   rS   ZFPBioEnrollment.enroll_cancel)  s+    9:

?&&445
Ar   c               r"   )r#   r?   r@   r%   r=   r   r&   r'   r   r(   rh   .  s     2 2j 24G 2r   c                s    \        W4      # )zConvenience wrapper for doing fingerprint enrollment.

See FPEnrollmentContext for details.
:return: An initialized FPEnrollmentContext.
)r=   )r/   r?      &&r   enrollZFPBioEnrollment.enroll.  s     #411r   c               r2   )r#   r%   zMapping[bytes, str | None]r   r&   r'   r   r(   rh   6  s      'A r   c                s    V P                  \        P                  P                  4      \        P
                  P                  ,           Uu/ uFD  pV\        P                  P                  ,          V\        P                  P                  ,          bKF  	  up# u upi   \         d7   pTP                  \        P                  P                  8X  d   / u Rp?# h Rp?ii ; i)zGet a dict of enrolled fingerprint templates which maps template ID's to
their friendly names.

:return: A dict of enrolled template_id -> name pairs.
N)rm   rM   r^   rZ   r   r   r   r   r   r   r   r7   ZERRZINVALID_OPTION)r/   ZtZes   &  r   enumerate_enrollmentsZ%FPBioEnrollment.enumerate_enrollments6  s    
	 O$7$7$M$MN!((77A ---0011]5P5P5U5U3VV    	vv555		s7   A
B A
BB B C)*CCCCc               rF   )r#   rD   rg   rc   Zstrr%   rR   r   r&   r'   r   r(   rh   H  s!     4 4E 4 4 4r   c                s>   \         P                  RVP                  4        RV 24       V P                  \        P
                  P                  \        P                  P                  V\        P                  P                  V/4       \         P                  R4       R# )zSet/Change the friendly name of a previously enrolled fingerprint template.

:param template_id: The ID of the template to change.
:param name: A friendly name to give the template.
zChanging name of template: z to zFingerprint template renamedN)rs   rt   hexrm   rM   r^   r[   r   r   r   r   r$   )r/   rD   rc   r0   r   set_nameZFPBioEnrollment.set_nameH  sw     	2;??3D2ET$PQ

((++..++00$	
 	23r   c               r"   )r#   rD   rg   r%   rR   r   r&   r'   r   r(   rh   X  s     
4 
4U 
4t 
4r   c                s   \         P                  RVP                  4        24       V P                  \        P
                  P                  \        P                  P                  V/4       \         P                  R4       R# )zjRemove a previously enrolled fingerprint template.

:param template_id: The Id of the template to remove.
zDeleting template: zFingerprint template deletedN)rs   rt   ry   rm   rM   r^   r\   r   r   r   r$   )r/   rD   rv   r   remove_enrollmentZ!FPBioEnrollment.remove_enrollmentX  s^    
 	*;??+<*=>?

11((++[9	
 	23r   )re   rf   )NTNN)NNNrB   )r   r   r   r   rU   r   r   r^   ra   rN   r1   rm   ro   rK   rL   rS   rw   rx   rz   r{   r   r:   r;   r<   r   rM   rM      s     g     
 77 7 7() )
2$K
B 
DB
2$4 
4 
4r   rM   )Z
__future__r    Zloggingrj   Zenumr   r   Z	threadingr   Ztypingr   r   r   Z r   r,   r   Zbaser	   r
   Zpinr   Z	getLoggerr   rs   r   Z	Exceptionr6   r=   rM   r   r   r   <module>r|      sh   8 #      ) )    			8	$1
 1
h?9 ?/  / dJ4m J4r   