+
    :i`1  c                  s   ^ RI Ht ^ RIt^ RIt^ RIt^ RIHt ^ RIHtH	t	H
t
Ht ^ RIHt ^ RIHtHtHtHtHt ]P(                  ! ]4      t]P.                  ! R4      t ! R R	]4      t] ! R
 R]]4      4       t] ! R R]
4      4       t] ! R R]4      4       t ! R R]P<                  4      t] ! R R]	4      4       t ]! R]R7      t! ! R R]P<                  4      t" ! R R]#4      t$ ! R R]$4      t% ! R R]$4      t& ! R R]$4      t' ! R  R!](4      t) ! R" R#]$](4      t* ! R$ R%4      t+]+! 4       t,R2R& R' llt-R3R( R) llt.R* R+ lt/R4R, lt0 ! R- R.]14      t2 ! R/ R0]14      t3]R1 4       t4R# )5    )annotationsN)contextmanager)EnumIntEnumIntFlagunique)Timer)CallableClassVarHashable
NamedTupleTypeVarz.\b(?P<major>\d+).(?P<minor>\d).(?P<patch>\d)\bc                  sr    ] tR t^2t$ RtR]R&   R]R&   R]R&   R tR t]R R	 l4       t	]R
 R l4       t
RtR# )Versionz3-digit version tuple.intmajorminorpatchc                	s    R V ,          # )z%d.%d.%d self   &:/usr/lib/python3.14/site-packages/yubikit/core/__init__.py__str__ZVersion.__str__9   s    D      c                	s    \        V 4      # N)Zanyr   r   r   __bool__ZVersion.__bool__<   s    4yr   c                    V ^8  d   QhRRRR/# )   databytesreturnr   r   Zformat   "r   __annotate__Version.__annotate__@   s      e  r   c                	s    V ! V!  # r   r   clsr      &&r   
from_bytesZVersion.from_bytes?   s    Dzr   c               r   )r   r   strr   r   r   r    r!   r   r"   r#   D   s     7 7s 7w 7r   c           	     	s    \         P                  V4      pV'       dS   V ! \        VP                  R 4      4      \        VP                  R4      4      \        VP                  R4      4      4      # \	        R4      h)r   r   r   zNo version found in string)_VERSION_STRING_PATTERNZsearchr   Zgroup
ValueError)r%   r   Zm   && r   from_stringZVersion.from_stringC   sa    #**40AGGG$%s1777+;'<c!'''BR>S  566r   r   N)__name__
__module____qualname____firstlineno____doc____annotations__r   r   classmethodr'   r,   __static_attributes__r   r   r   r   r   2   sF     JJJ!   7 7r   r   c                  s4   a  ] tR t^MtRtRtRtV 3R ltRtV ;t	# )	TRANSPORTz'YubiKey physical connection transports.ZusbZnfcc                	s<   < \         SV `  4       P                  4       # r   )superr   Zupper)r   	__class__s   &r   r   ZTRANSPORT.__str__T   s    w &&((r   r   )
r-   r.   r/   r0   r1   ZUSBZNFCr   r4   __classcell__r7      @r   r5   r5   M   s    1
C
C) )r   r5   c                  s&    ] tR t^XtRt^t^t^tRtR# )USB_INTERFACEz"YubiKey USB interface identifiers.r   N)	r-   r.   r/   r0   r1   ZOTPZFIDOZCCIDr4   r   r   r   r;   r;   X   s    ,
CDDr   r;   c                  s.    ] tR t^atRtRtRtRtRtRt	Rt
R# )	YUBIKEYzYubiKey hardware platforms.zYubiKey StandardzYubiKey NEOzSecurity Key by YubicozYubiKey PlusZYubiKeyr   N)r-   r.   r/   r0   r1   ZYKSZNEOZSKYZYKPZYK4r4   r   r   r   r<   r<   a   s    %
C
C
"C
C
Cr   r<   c                  sN    ] tR t^lt$ Rt]! ^ 4      tR]R&   R R ltR t	R t
RtR	# )

ConnectionzA connection to a YubiKeyzClassVar[USB_INTERFACE]usb_interfacec                   V ^8  d   QhRR/# )r   r   Noner   r    r!   r   r"   ZConnection.__annotate__q   s     > >t >r   c                    R# )z/Close the device, releasing any held resources.Nr   r   r   r   closeZConnection.closeq   s    r   c                	s    V # r   r   r   r   r   	__enter__ZConnection.__enter__t   s    r   c                	s&    V P                  4        R # r   )rB   )r   ZtypvalueZ	tracebacks   &&&&r   __exit__ZConnection.__exit__w   s    

r   r   N)r-   r.   r/   r0   r1   r;   r>   r2   rB   rC   rE   r4   r   r   r   r=   r=   l   s$    #-:1-=M*=>r   r=   c                  s    ] tR t^{tRt^tRtRtRtRt	Rt
RtRtR	tR
tRtRtRtRtRtRtRt]R R l4       t]R R l4       t]R R l4       tR R ltRtR# )PIDz*USB Product ID values for YubiKey devices.i  i  i  i  i  i  i  i   i  i  i  i  i  i  i  i  c               r?   )r   r   r<   r   r    r!   r   r"   PID.__annotate__   s     3 3g 3r   c                	s^    \         V P                  P                  R ^4      ^ ,          ,          # )_)r<   namesplitr   r   r   yubikey_typeZPID.yubikey_type   s!    tyysA.q122r   c               r?   )r   r   r;   r   r    r!   r   r"   rG      s     V V Vr   c                	sx    \        \        R  V P                  P                  R4      R,           4       4      4      # )c              3  s<   "   T F  p\         V,          x  K  	  R # 5ir   )r;   .0x   & r   	<genexpr>Z%PID.usb_interfaces.<locals>.<genexpr>   s      T;Saq!1!1;Ss   rH      NN)r;   ZsumrI   rJ   r   r   r   usb_interfacesZPID.usb_interfaces   s+    S T499??3;OPR;S TTUUr   c               $    V ^8  d   QhRRRRRR/# )r   key_typer<   
interfacesr;   r   rF   r   r    r!   r   r"   rG      s!     1 1' 1} 1 1r   c                	s   a R P                  V3R l\         4       4      pWP                  R ,           V,           ,          # )rH   c              3  sr   <"   T F,  qS9   g   K  VP                   ;'       g    \        V4      x  K.  	  R # 5ir   )rI   r(   )rM   ZtrV   s   & r   rP   ZPID.of.<locals>.<genexpr>   s+     UMq*_*!&&**CF*Ms   777)joinr;   rI   )r%   rU   rV   Zsuffixs   &&f r   ofZPID.of   s.    UMUU==3&/00r   c               r   r   connection_typeztype[Connection]r   Zboolr   r    r!   r   r"   rG      s     D D3C D Dr   c                	s4    VP                   V P                  9   # r   )r>   rS   r   rZ   r&   r   supports_connectionZPID.supports_connection   s    ,,0C0CCCr   r   N)r-   r.   r/   r0   r1   ZYKS_OTPZNEO_OTPZNEO_OTP_CCIDZNEO_CCIDZNEO_FIDOZNEO_OTP_FIDOZNEO_FIDO_CCIDZNEO_OTP_FIDO_CCIDZSKY_FIDOZYK4_OTPZYK4_FIDOZYK4_OTP_FIDOZYK4_CCIDZYK4_OTP_CCIDZYK4_FIDO_CCIDZYK4_OTP_FIDO_CCIDZYKP_OTP_FIDOpropertyrK   rS   r3   rX   r\   r4   r   r   r   rF   rF   {   s    4GGLHHLMHGHLHLML3 3 V V 1 1D Dr   rF   T_Connection)Zboundc                  s|    ] tR t^tRtR R lt]R R l4       tR R ltR R	 lt	]R
 R l4       t
R tR tR tRtR# )YubiKeyDevicezYubiKey device referencec               r   )r   	transportr5   fingerprintr
   r   r    r!   r   r"   YubiKeyDevice.__annotate__   s     ( () (( (r   c                	s    Wn         W n        R # r   )
_transport_fingerprint)r   r`   ra      &&&r   __init__ZYubiKeyDevice.__init__   s    #'r   c               r?   )r   r   r5   r   r    r!   r   r"   rb      s      9 r   c                    V P                   # )z7Get the transport used to communicate with this YubiKey)rc   r   r   r   r`   ZYubiKeyDevice.transport   s     r   c               r   rY   r   r    r!   r   r"   rb      s      3C  r   c                rA   )z<Check if a YubiKeyDevice supports a specific Connection typeFr   r[   r&   r   r\   Z!YubiKeyDevice.supports_connection   s    r   c               r   )r   rZ   z0type[T_Connection] | Callable[..., T_Connection]r   r^   r   r    r!   r   r"   rb      s     8 8O8	8r   c                s    \        R4      h)z!Opens a connection to the YubiKeyzUnsupported Connection type)r*   r[   r&   r   open_connectionZYubiKeyDevice.open_connection   s     677r   c               r?   )r   r   r
   r   r    r!   r   r"   rb      s     ! !X !r   c                rg   )zUsed to identify that device references from different enumerations represent
the same physical YubiKey. This fingerprint is not stable between sessions, or
after un-plugging, and re-plugging a device.)rd   r   r   r   ra   ZYubiKeyDevice.fingerprint   s    
    r   c                	sn    \        V\        V 4      4      ;'       d    V P                  VP                  8H  # r   )
isinstancetypera   )r   Zotherr&   r   __eq__ZYubiKeyDevice.__eq__   s,    %d,VV1A1AUEVEV1VVr   c                	s,    \        V P                  4      # r   )Zhashra   r   r   r   __hash__ZYubiKeyDevice.__hash__   s    D$$%%r   c                	sN    \        V 4      P                   R V P                  : R2# )z(fingerprint=))rj   r-   ra   r   r   r   __repr__ZYubiKeyDevice.__repr__   s'    t*%%&mD4D4D3GqIIr   )rd   rc   N)r-   r.   r/   r0   r1   rf   r]   r`   r\   rh   ra   rk   rl   rn   r4   r   r   r   r_   r_      sM    "(  
8 ! !W&Jr   r_   c                  s    ] tR t^tRtRtR# )CommandErrorz An error response from a YubiKeyr   Nr-   r.   r/   r0   r1   r4   r   r   r   ro   ro      s    *r   ro   c                  s    ] tR t^tRtRtR# )BadResponseErrorz&Invalid response data from the YubiKeyr   Nrp   r   r   r   rq   rq      s    0r   rq   c                  s    ] tR t^tRtRtR# )TimeoutErrorz,An operation timed out waiting for somethingr   Nrp   r   r   r   rr   rr      s    6r   rr   c                  s    ] tR t^tRtRtR# )ApplicationNotAvailableErrorzCThe application is either disabled or not supported on this YubiKeyr   Nrp   r   r   r   rs   rs      s    Mr   rs   c                  s    ] tR t^tRtRtR# )NotSupportedErrorz:Attempting an action that is not supported on this YubiKeyr   Nrp   r   r   r   rt   rt      s    Dr   rt   c                  s6   a  ] tR t^tRtRR V 3R llltRtV ;t# )InvalidPinErrorzAn incorrect PIN/PUK was used, with the number of attempts now remaining.

WARNING: This exception currently inherits from ValueError for
backwards-compatibility reasons. This will no longer be the case with the next major
version of the library.
c               r   )r   attempts_remainingr   messagez
str | Noner   r    r!   r   r"   ZInvalidPinError.__annotate__   s     5 53 5 5r   c                	sN   < \         ST `  T;'       g    R V R24       Wn        R# )zInvalid PIN/PUK, z
 remainingN)r6   rf   rv   )r   rv   rw   r7   s   &&&r   rf   ZInvalidPinError.__init__   s*    VV&78J7K:$VW"4r   )rv   r   )r-   r.   r/   r0   r1   rf   r4   r8   r9   r:   r   ru   ru      s    5 5 5r   ru   c                  s4    ] tR t^tR tR R ltR R ltRtR# )_OverrideVersionc                	s    R V n         R # r   _versionr   r   r   rf   Z_OverrideVersion.__init__   s	    (,r   c               r   )r   rD   r   r   r@   r   r    r!   r   r"   _OverrideVersion.__annotate__   s      g $ r   c                	sB    \         P                  R V 24       Wn        R# )z6Overriding version check for development devices with N)loggerZinforz   )r   rD   r&   r   __call__Z_OverrideVersion.__call__   s    LUGTUr   c               s     V ^8  d   QhRRRR/# )r   versionr   r   r   r    r!   r   r"   r{      s     N NW N Nr   c                	sP    VR8H  ;'       d    \         P                  ;'       g    T# )r    )r    r    rR   )_override_versionrz   )r   r~   r&   r   r   Z_OverrideVersion.patch   s$    )#BB(9(B(BMMgMr   ry   N)r-   r.   r/   r0   rf   r}   r   r4   r   r   r   rx   rx      s    -N Nr   rx   c               r   )r   
my_versionr   min_versionztuple[int, int, int]r   r    r!   r   r"   r"      s     ) ))&:)r   c                sJ    W8  g   V'       g
   RV,          p\        V4      hR# )z)Ensure a version is at least min_version.z.This action requires YubiKey %d.%d.%d or laterN)rt   )r   r   rw   re   r   require_versionr      s'     $FTG(( %r   c               s$    V ^8  d   QhRRRRRR/# )r   rD   r   min_lenr   r   r   r    r!   r   r"   r"     s!     * *S *3 *u *r   c                st    \        WP                  4       ^,           ^,          4      pV P                  VR4      # )i   big)ZmaxZ
bit_lengthZto_bytes)rD   r   r&   r   	int2bytesr     s0    ',,.2q89G>>'5))r   c               r   )r   r   r   r   r   r   r    r!   r   r"   r"     s     ' 'E 'c 'r   c                s.    \         P                  V R 4      # )r   )r   r'   )r   r   r   	bytes2intr     s    >>$&&r   c                sF    W,          pV^,          pV^,          ^8X  dO   V^,          W,          ,          pV^,          pV^,          ^8X  d"   V^,          W,          ,          pV^,          pK/  W,          pV^,          pV^8X  dL   TpW,          '       g   W^,           ,          '       d   \        W4      ^,          pK7  WA,
          pV^,          pM3V^8  d%   V^,
          p\        WW,            4      pW,          pW,           pW!W43#   \         d    \        R4      hi ; i)rR   zInvalid encoding of tag/length)
_tlv_parser   Z
IndexErrorr*   )r   ZoffsettaglnendZn_bytes   &&    r   r   r     s   ;l!:(T\)CaKF*$Qh-!\!:C))t!G}} +A.B1HCDyt)tV-=>?!+CB## ;9::;s   DD	 	D c                  s   a  ] tR tRt]R R l4       t]R R l4       t]R R l4       tRR V 3R	 llltRR
 R llt	R t
]R R l4       t]R R l4       t]R R l4       t]R R l4       tRtV ;t# )Tlvi0  c               r?   r   r   r   r   r    r!   r   r"   Tlv.__annotate__2  s      S r   c                	rg   r   )_tagr   r   r   r   ZTlv.tag1  s    yyr   c               r?   r   r   r    r!   r   r"   r   6  s       r   c                	rg   r   )	_value_lnr   r   r   lengthZ
Tlv.length5  s    ~~r   c               r?   )r   r   r   r   r    r!   r   r"   r   :  s     N Nu Nr   c                	sT    W P                   V P                   V P                  ,            # r   )_value_offsetr   r   r   r   rD   Z	Tlv.value9  s"    &&););dnn)LMMr   c               r   r   tag_or_datazint | bytesrD   zbytes | Noner   r    r!   r   r"   r   =  s     2 2+ 2l 2r   c                s  < \        V\        4      '       d   Tp\        4       pVP                  \	        V4      4       T;'       g    Rp\        V4      pV^8  d   VP                  V4       M=\	        V4      pVP                  ^\        V4      ,          4       VP                  V4       VP                  V4       \        V4      pMVe   \        R4      hTp\        \        V `/  W4      # )zEThis allows creation by passing either binary data, or tag and value.r   z2value can only be provided if tag_or_data is a tag)ri   r   	bytearrayextendr   lenappendr   r*   r6   r   __new__)	r%   r   rD   r   bufr   Zln_bytesr   r7   s	   &&&     r   r   ZTlv.__new__=  s    k3''C +CJJy~&LLSEZF}

6"$V,

4#h-/0

8$JJu:D  !UVVDS#&s11r   c               r   r   r   r    r!   r   r"   r   V  s     5 5K 5 5r   c                	sz    \        V 4      w  V n        V n        V n        p\	        V 4      V8w  d   \        R 4      hR# )zIncorrect TLV lengthN)r   r   r   r   r   r*   )r   r   rD   r      &&& r   rf   ZTlv.__init__V  s9    =G=M:	4%t~st9344 r   c                	sZ    R V P                   R RV P                  P                  4        R2# )z
Tlv(tag=0x02xz, value=rm   )r   rD   Zhexr   r   r   rn   ZTlv.__repr__[  s)    DHHS>$**..2B1C1EEr   c               rT   )r   r%   	type[Tlv]r   r   r   ztuple[Tlv, bytes]r   r    r!   r   r"   r   _  s"     + +	 + +3D +r   c                	s<    \        V4      w  r#rEV ! VR V 4      WR  3# r   )r   )r%   r   r   Zoffsr   r   r   r   
parse_fromZTlv.parse_from^  s*    '-24:T
**r   c               rT   )r   r%   r   r   r   r   z	list[Tlv]r   r    r!   r   r"   r   d  s!      	  9 r   c                	sf    . pV'       d'   V P                  V4      w  r1VP                  V4       K.  V# r   )r   r   )r%   r   Zrestlvs   &&  r   
parse_listZTlv.parse_listc  s*    t,ICJJsO
r   c               rT   )r   r%   r   r   r   r   zdict[int, bytes]r   r    r!   r   r"   r   l  s'     J J	 J J3C Jr   c                	sD    \        R  V P                  V4       4       4      # )c              3  sP   "   T F  qP                   VP                  3x  K  	  R # 5ir   )r   rD   )rM   r   rO   r   rP   Z!Tlv.parse_dict.<locals>.<genexpr>m  s     I4HSWWcii(4Hs   $&)Zdictr   r$   r&   r   
parse_dictZTlv.parse_dictk  s    ICNN44HIIIr   c               s(    V ^8  d   QhRRRRRRRR/# )r   r%   r   r   r   r   r   r   r   r    r!   r   r"   r   p  s(      I C u  r   c                	s    V ! V4      pVP                   V8w  d   \        R VP                   R RVR 24      hVP                  # )zWrong tag, got 0xr   z expected 0x)r   r*   rD   )r%   r   r   r   r   r   unpackZ
Tlv.unpacko  sA    $i77c>0\#cSTTyyr   )r   r   r   r   )r-   r.   r/   r0   r]   r   r   rD   r   rf   rn   r3   r   r   r   r   r4   r8   r9   r:   r   r   r   0  s        N N2 225
F + +   J J  r   r   c                  sZ    ] tR tRt]R R l4       t]R R l4       tR R ltR R	 lt	R
t
R# )Oidiw  c               r?   r   r   r(   r   r    r!   r   r"   Oid.__annotate__y  s     	/ 	/s 	/r   c                	s   V ^ ,          ^(,          V ^ ,          ^(,          .p^ pV R,           F>  pV^,          V^,          ,          p^V,          '       d   K+  VP                  V4       ^ pK@  	  RP                  R V 4       4      # )r    rQ   .c              3  s8   "   T F  p\        V4      x  K  	  R # 5ir   )r(   rL   rO   r   rP   Z$Oid.dotted_string.<locals>.<genexpr>  s     .1As   )r   rW   )r   partsZnumrN   s   &   r   dotted_stringZOid.dotted_stringx  st    aBQ"-bA!8D)C!88S!	  xx....r   c               r   )r   r   r(   r   r   r   r    r!   r   r"   r     s      s s r   c                	s    VP                  R 4       Uu. uF  p\        V4      NK  	  pp\        V4      ^8  d   \        R4      h\	        V^ ,          ^(,          V^,          ,           .4      pVR,           F  pV^ 8  d   \        R4      h\	        4       pV^8  d%   VP                  ^ V^,          4       V^,          pK+  VP                  ^ V4       VP                  R V 4       4       VR;;,          ^,          uu&   K  	  V ! V4      # u upi )r   zOID must have at least two arcs:r   NNzOID parts must be non-negativec              3  s4   "   T F  p^V,          x  K  	  R# 5i)i   Nr   )rM   ZbrO   r   rP   Z"Oid.from_string.<locals>.<genexpr>  s     1Ataxxs   i)rJ   r   r   r*   r   Zinsertr   )r%   r   rN   r   r   ZpartZpartbufs   &&     r   r,   ZOid.from_string  s    !%C1AQ1u:>>??%(R-58345"IIDax !ABBkG+q$+.
NN1d#JJ111GtOG  3x# 2s   Dc               r?   r   r   r    r!   r   r"   r     s     , ,# ,r   c                	s"    R V P                    R2# )zOid(rm   r   r   r   r   rn   ZOid.__repr__  s    d(()++r   c               r?   r   r   r    r!   r   r"   r     s     " " "r   c                	rg   r   r   r   r   r   r   ZOid.__str__  s    !!!r   r   N)r-   r.   r/   r0   r]   r   r3   r,   rn   r   r4   r   r   r   r   r   w  s7    	/ 	/  (," "r   r   c              #  s   "   \        W4      p VP                  4        R x  VP                  4        R #   TP                  4        i ; i5ir   )r   ZstartZcancel)ZfZtimeoutZtimerr+   r   _timeoutr     s4     'E
s   A
5 A
AA
r   )rR   )r    )5Z
__future__r   ZabcZloggingZreZ
contextlibr   Zenumr   r   r   r   Z	threadingr   Ztypingr   r	   r
   r   r   Z	getLoggerr-   r|   Zcompiler)   r   r(   r5   r;   r<   ZABCr=   rF   r^   r_   Z	Exceptionro   rq   rr   rs   r*   rt   ru   rx   r   r   r   r   r   r   r   r   r   r   r   r   <module>r      s  8 # 
  	 % / /   
		8	$ **%VW 7j 76 )T ) ) G   d    #D' #D #DL ~Z8%JCGG %JP+9 +1| 17< 7N< NE
 E
5lJ 
5	N 	N %& )*
';>D% DN&"% &"R  r   