+
    :iae  c                  s   ^ RI Ht ^ RIt^ RIt^ RIt^ RIt^ RIHtHt ^ RI	H
t
HtHt ^ RIHt ^ RIHt ^RIHtHtHtHtHtHtHtHtHtHt ^RIHt ^R	IH t H!t!H"t"H#t#H$t$ ^R
I%H&t&H't'H(t(H)t) ]PT                  ! ]+4      t,] ! R R]4      4       t] ! R R]
4      4       t-] ! R R]4      4       t.] ! R R]
4      4       t/^t0^t1^t2^t3^t4^t5^t6^t7^	t8^
t9^t:^t;^t<^t=^t>^t?^t@^tA^tB^tC^tD^tE^tF^tG^tH^ tI^!tJ] ! R R4      4       tK]! RR7       ! R R4      4       tL]L! ]! ^ ^ ^ 4      4      tM] ! R R4      4       tN]P                  ]P                  ]P                  ]P                  ,          ]P                  ]P                  ]P                  ,          ]P                  ]P                  ,          ]P                  ]P                  ,          ]P                  ,          .tR]! RRR7       ! R R4      4       tS^tT^tU^tV ! R R ]P                  4      tX ! R! R"]X4      tY^tZ^t[^t\^t]^t^ ! R# R$]X4      t_^@t`]`ta]`^,           tb]`^,           tc ! R% R&]X4      td ! R' R(4      teR# ))    )annotationsN)	dataclassfield)IntEnumIntFlagunique)Mapping)
CAPABILITY)
	TRANSPORTUSB_INTERFACEApplicationNotAvailableErrorBadResponseErrorNotSupportedErrorTlvVersion	bytes2int	int2bytesrequire_version)FidoConnection)STATUS_OFFSET_PROG_SEQCommandRejectedErrorOtpConnectionOtpProtocol	check_crc)AIDScpKeyParamsSmartCardConnectionSmartCardProtocolc                  s    ] tR t^AtRt^t^tRt^ t^t	^t
R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R# )r   z YubiKey Application identifiers.i   i   c                	sb   a  R P                  V 3R l\         4       4      pV R\        S 4       2# )Z|c              3  sr   <"   T F,  qS9   g   K  VP                   ;'       g    \        V4      x  K.  	  R # 5iN)namestr).0cself   & 7/usr/lib/python3.14/site-packages/yubikit/management.py	<genexpr>Z%CAPABILITY.__str__.<locals>.<genexpr>N   s+     J*QT	(((#a&(*s   777z: )joinr   Zhex)r"   r   s   f r$   __str__ZCAPABILITY.__str__M   s,    xxJ*JJr#d)%%    c                    V ^8  d   QhRRRR/# )   fipsintreturnr    Zformat   "r$   __annotate__CAPABILITY.__annotate__R   s      c j r(   c                	s   \        ^ 4      pV^,          '       d   V\         P                  ,          pV^,          '       d   V\         P                  ,          pV^,          '       d   V\         P                  ,          pV^,          '       d   V\         P                  ,          pV^,          '       d   V\         P
                  ,          pV# r    )r   FIDO2PIVOPENPGPOATHHSMAUTH)clsr+   r!      && r$   
_from_fipsZCAPABILITY._from_fipsQ   s    qM6??!!!A6??A6??###A6?? A6??###Ar(   c               r)   )r*   aidr   r-   r   r.   r/   r0   r$   r1   r2   a   s     * *C *J *r(   c                	s     \        \        VP                  4      #   \         d     Mi ; iT\        P
                  8X  d   \        P                  # \        R 4      h)zUnhandled AID)Zgetattrr   r   ZAttributeErrorr   FIDOr4   
ValueError)r9   r<      &&r$   	_from_aidZCAPABILITY._from_aid`   sL    	:sxx00 		#((?###))s    **c                   V ^8  d   QhRR/# r*   r-   r   r.   r/   r0   r$   r1   r2   l   s     3 3c 3r(   c                	s   V ^ 8X  d   R# \        V 4      P                  R4      ^8  dY   ^p. pW8  d>   W,          '       d%   VP                  \        V4      P                  4       V^,          pKC  RP                  V4      # V \        P                  8X  d   R# V \        P                  8X  d   R# V \        P                  8X  d   R# V \        P                  8X  d   R# V P                  ;'       g    RV R	 R
2# )r    NoneZ1z, z
Yubico OTPzFIDO U2FZOpenPGPzYubiHSM Authz
Unknown(0xZxZ))ZbinZcountZappendr   display_namer&   OTPU2Fr6   r8   r   )r"   ZiZnamess   &  r$   rD   ZCAPABILITY.display_namek   s    19t9??3!#AE(88LLA!;!;<a99U##:>>!Z^^#Z'''Z'''!yy22ja22r(   c               rA   )r*   r-   r
   r.   r/   r0   r$   r1   r2      s       r(   c                	s
   \        ^ 4      pV \        P                  ,          '       d   V\         P                  ,          pV \        P                  \        P                  ,          ,          '       d   V\         P
                  ,          pV R\        P                  ,          \        P                  ,          \        P                  ,          \        P                  ,          ,          '       d   V\         P                  ,          pV# )r    i  )r
   r   rE   rF   r4   r=   r7   r5   r6   r8   CCID)r"   Zifacess   & r$   usb_interfacesZCAPABILITY.usb_interfaces   s    q!*..  m'''F:>>J$4$4455m(((Foo nn   	!
   !
 
 m(((Fr(   r.   N)__name__
__module____qualname____firstlineno____doc__rE   rF   r4   r7   r5   r6   r8   r'   classmethodr;   r@   propertyrD   rH   __static_attributes__r.   r(   r$   r   r   A   s}    *
C
CED
CGG&   * * 3 3,  r(   r   c                  sV    ] tR t^tRt^ t^t^t^t^t	^t
^t^tR t]R R l4       tRtR# )FORM_FACTORzYubiKey device form factors.c                	sH   V \         P                  8X  d   R # V \         P                  8X  d   R# V \         P                  8X  d   R# V \         P                  8X  d   R# V \         P
                  8X  d   R# V \         P                  8X  d   R# V \         P                  8X  d   R# R# )zKeychain (USB-A)zNano (USB-A)zKeychain (USB-C)zNano (USB-C)zKeychain (USB-C, Lightning)zBio (USB-A)zBio (USB-C)ZUnknown)rQ   USB_A_KEYCHAIN
USB_A_NANOUSB_C_KEYCHAIN
USB_C_NANOUSB_C_LIGHTNING	USB_A_BIO	USB_C_BIOr"      &r$   r'   ZFORM_FACTOR.__str__   s|    ;---%[+++![///%[+++![0000[*** [*** r(   c               r)   )r*   coder,   r-   rQ   r.   r/   r0   r$   r1   ZFORM_FACTOR.__annotate__   s     N NS N[ Nr(   c                	s    V'       d%   \        V\        4      '       g   \        R V 24      hV^,          pWP                  P	                  4       9   d	   V ! V4      # V P
                  # )zInvalid form factor code: )
isinstancer,   r>   Z__members__ZvaluesUNKNOWNr9   r[   r?   r$   	from_codeZFORM_FACTOR.from_code   sR    
4--9$@AA OO$:$:$<<s4yM#++Mr(   r.   N)rI   rJ   rK   rL   rM   r]   rR   rS   rT   rU   rV   rW   rX   r'   rN   r_   rP   r.   r(   r$   rQ   rQ      sH    &GNJNJOII$ N Nr(   rQ   c                  s"    ] tR t^tRt^@t^tRtR# )DEVICE_FLAGzConfiguration flags.r.   N)rI   rJ   rK   rL   rM   ZREMOTE_WAKEUPEJECTrP   r.   r(   r$   r`   r`      s    MEr(   r`   c                  s,    ] tR t^tRt^ t^t^tR tRt	R# )RELEASE_TYPEzYubiKey release type.c                	s6    V P                   P                  4       # r   )r   ZlowerrY   rZ   r$   r'   ZRELEASE_TYPE.__str__   s    yy  r(   r.   N)
rI   rJ   rK   rL   rM   ZALPHAZBETAFINALr'   rP   r.   r(   r$   rb   rb      s    EDE!r(   rb   c                  s    ] tR t^t$ Rt]! ]R7      tR]R&   Rt	R]R&   Rt
R]R&   RtR	]R
&   RtR]R&   RR R lltRtR# )DeviceConfigzDManagement settings for YubiKey which can be configured by the user.)Zdefault_factoryzdict[TRANSPORT, CAPABILITY]enabled_capabilitiesN
int | Noneauto_eject_timeoutchallenge_response_timeoutzDEVICE_FLAG | Nonedevice_flagszbool | Nonenfc_restrictedc               s(    V ^8  d   QhRRRRRRRR/# )r*   rebootboolcur_lock_codebytes | Nonenew_lock_coder-   bytesr.   r/   r0   r$   r1   ZDeviceConfig.__annotate__   s2     ) )) $) $	)
 
)r(   c                	s   R pV'       d   V\        \        4      ,          pV'       d   V\        \        V4      ,          pV P                  P	                  \
        P                  4      pVe"   V\        \        \        V^4      4      ,          pV P                  P	                  \
        P                  4      pVe"   V\        \        \        V^4      4      ,          pV P                  e,   V\        \        \        V P                  ^4      4      ,          pV P                  e+   V\        \        \        V P                  4      4      ,          pV P                  e+   V\        \         \        V P                  4      4      ,          pV'       d   V\        \"        V4      ,          pV P$                  '       d   V\        \&        R4      ,          p\)        V4      ^8  d   \+        R4      h\        \)        V4      4      V,           # )r(      zDeviceConfiguration too large)r   
TAG_REBOOT
TAG_UNLOCKre   getr	   USBTAG_USB_ENABLEDr   NFCTAG_NFC_ENABLEDrg   TAG_AUTO_EJECT_TIMEOUTrh   TAG_CHALRESP_TIMEOUTri   TAG_DEVICE_FLAGSTAG_CONFIG_LOCKrj   TAG_NFC_RESTRICTEDlenr   )r"   rk   rm   ro   Zbufusb_enabledZnfc_enabled   &&&&   r$   	get_bytesZDeviceConfig.get_bytes   sy    3z?"C3z=11C//33IMMB"3	+q(ABBC//33IMMB"3	+q(ABBC"".3-y9P9PRS/TUUC**63+Yt7V7V-WXXC(3'43D3D)EFFC366C3)511Cs8d?#$CDDS"S((r(   r.   )NN)rI   rJ   rK   rL   rM   r   Zdictre   __annotations__rg   rh   ri   rj   r   rP   r.   r(   r$   rd   rd      sK    N8=d8S5S%)
)-1
1'+L$+"&NK&) )r(   rd   T)Zfrozenc                  s\    ] tR tRt$ RtR]R&   ]P                  tR]R&   ^ t	R]R&   R	 t
R
tR# )VersionQualifieri  zFully qualified YubiKey versionr   versionrb   typer,   	iterationc                	sR    V P                    R V P                   R V P                   2# )Z.)r   r   r   rY   rZ   r$   r'   ZVersionQualifier.__str__  s&    ,,q1T^^,<==r(   r.   N)rI   rJ   rK   rL   rM   r   rb   rc   r   r   r'   rP   r.   r(   r$   r   r     s*    )%++D,+Is>r(   r   c                  sl   ] tR tRt$ RtR]R&   R]R&   R]R&   R	]R
&   R]R&   R]R&   RtR]R&   RtR]R&   RtR]R&   ]	! ^ 4      t
R]R&   ]	! ^ 4      tR]R&   RtR]R&   ]	! ^ 4      tR]R&   RtR]R&   RtR]R&   ]tR]R&   ]R R  l4       tR! R" lt]R# R$ l4       t]R% R& l4       t]R' R( l4       tR)tR# )*
DeviceInfoi&  zAInformation about a YubiKey readable using the ManagementSession.rd   configrf   serialr   r   rQ   form_factorzMapping[TRANSPORT, CAPABILITY]supported_capabilitiesrl   Z	is_lockedFis_fipsis_skyNz
str | Nonepart_numberr   fips_capablefips_approvedpin_complexityreset_blockedzVersion | Nonefps_versionstm_versionr   version_qualifierc               rA   )r*   r-   rl   r.   r/   r0   r$   r1   DeviceInfo.__annotate__<  s     R R Rr(   c                	s\    V P                   \        P                  \        P                  39   # r   )r   rQ   rW   rX   rY   rZ   r$   _is_bioZDeviceInfo._is_bio;  s$    K$9$9;;P;P#QQQr(   c               r)   )r*   	transportr	   r-   rl   r.   r/   r0   r$   r1   r   ?  s     8 8y 8T 8r(   c                	s    WP                   9   # r   )r   )r"   r   r?   r$   has_transportZDeviceInfo.has_transport?  s    7777r(   c               rA   rB   r.   r/   r0   r$   r1   r   C  s     
 
c 
r(   c                s    V P                   P                  \        P                  8w  d   \	        V P                   4      # V P
                  '       d   \	        V P
                  4      # R# )z'The version of the YubiKey as a string.Zunknown)r   r   rb   rc   r   r   rY   rZ   r$   version_nameZDeviceInfo.version_nameB  s[    
 %%**l.@.@@ &&'	
 ||| T\\"	

 	
r(   c               $    V ^8  d   QhRRRRRR/# )r*   encodedrp   default_versionr   r-   r   r.   r/   r0   r$   r1   r   N  s&     L LE LG L
 Lr(   c                	s    \        V4      ^,
          V^ ,          8w  d   \        R4      hV P                  \        P                  ! VR,          4      V4      # )   Invalid lengthr   NN)r~   r   
parse_tlvsr   
parse_dict)r9   r   r      &&&r$   parseZDeviceInfo.parseM  sA    w<!wqz)"#344~~cnnWR[9?KKr(   c               r   )r*   datazMapping[int, bytes]r   r   r-   r   r.   r/   r0   r$   r1   r   T  s)     N
 N
&N
9@N
	N
r(   c                	sl	   VP                  \        4      R 8H  p\        VP                  \        R4      4      ;'       g    Rp\        VP                  \        R4      4      p\
        P                  V4      p\        V^,          4      p\        V^@,          4      p\        V9   d#   \        P                  ! V\        ,          4      p	MTp	\        VP                  \        R4      4      p
\        VP                  \        R4      4      p\        \        VP                  \        R4      4      4      p/ p/ pV	R8X  d   \        ^?4      V\         P"                  &   M0\        \        V\$        ,          4      4      V\         P"                  &   \&        V9   dB   RT	u;8:  d   R8  g3   M \        \        V\&        ,          4      4      V\         P"                  &   \(        V9   da   \        \        V\(        ,          4      4      V\         P*                  &   \        \        V\,        ,          4      4      V\         P*                  &   VP                  \.        R4      R 8H  p VP                  \0        R4      P3                  4       ;'       g    Rp\        P7                  \        VP                  \8        R4      4      4      p\        P7                  \        VP                  \:        R4      4      4      pVP                  \<        R4      R 8H  p\        \        VP                  \>        R4      4      4      pVP                  \@        4      pV'       d   \B        PD                  ! V4      p\G        \        P                  ! V^,          4      \I        \        V^,          4      4      \        V^,          4      4      pVPJ                  \H        PL                  8w  d/   \N        PQ                  RVPR                   24       VPR                  p	M\G        V	\H        PL                  ^ 4      p\        P                  ! VP                  \T        R4      4      p\        P                  ! VP                  \V        R4      4      pT ! \Y        WWV4      TT	TTTTTTTTTTT;'       g    RT;'       g    RV4      #   \4         d    Rp EL,i ; i)	rq   s    Nr(   z#Overriding behavioral version with s      )   r*   r   )r   r    r    i   r    r    )-rt   r|   r   
TAG_SERIALTAG_FORM_FACTORrQ   r_   rl   TAG_VERSIONr   
from_bytesry   rz   r`   r{   r   r	   ru   TAG_USB_SUPPORTEDrv   TAG_NFC_SUPPORTEDrw   rx   r}   TAG_PART_NUMBERdecodeZUnicodeDecodeErrorr;   TAG_FIPS_CAPABLETAG_FIPS_APPROVEDTAG_PIN_COMPLEXITYTAG_RESET_BLOCKEDTAG_VERSION_QUALIFIERr   r   r   rb   r   rc   loggerinfor   TAG_FPS_VERSIONTAG_STM_VERSIONrd   )r9   r   r   Zlockedr   Zff_valuer   r+   Zskyr   Zauto_eject_toZchal_resp_toZflags	supportedZenabledrj   r   r   r   r   r   ZvqZvq_datar   r   r   s   &&&                       r$   r   ZDeviceInfo.parse_tlvsS  s    /*e3488J67??4TXXou=>!++H5HtO$8d?#$((k):;G%G!$((+A5"IJ *>!FGIdhh/?&GHI	i'1$'7Iimm$'1)DAR<S2T'UIimm$d"494)3Id?>S4T)U	&$'1)DAR<S2T'UIimm$%/	$:O0P%QGIMM""4e<E	((?C8??AIITK ",,dhh/78
 #--dhh0%89
 "4e<E"9TXX6G-O#PQXX+,nnR(G 0""74=1Ywt}56'$-(!
 !%%););;9:K:S:S9TU ,33 0,:L:La P((/9)MN((/9)MNnU44!
 	
9 " 	K	s   *R" R" "R32R3r.   )rI   rJ   rK   rL   rM   r   r   r   r   r   r   r   r   r   r   r   	_DUMMY_VQr   rO   r   r   r   rN   r   r   rP   r.   r(   r$   r   r   &  s    K::OGTFD"K")!}L*, *1M:- ND  *1M:-"&K&"&K&*3'3R R8 
 
 L L
 N
 N
r(   r   F)ZinitZreprc                  sX    ] tR tRt$ RtR]R&   R]R&   R R ltR	 t]R
 R l4       t	Rt
R# )Modei  z>YubiKey USB Mode configuration for use with YubiKey NEO and 4.r,   r[   r
   
interfacesc               rA   )r*   r   r
   r.   r/   r0   r$   r1   Mode.__annotate__  s     . .= .r(   c                	s     \         P                  V4      V n        \        V4      V n        R#   \
         d    \        R 4      hi ; i)zInvalid mode!N)_MODESZindexr[   r
   r   r>   )r"   r   r?   r$   __init__ZMode.__init__  s=    	.Z0DI+J7DO 	._--	.s	   *. Ac                	sB   a  R P                  V 3R l\         4       4      # )Z+c              3  s   <"   T F6  qSP                   9   g   K  VP                  ;'       g    \        V4      x  K8  	  R # 5ir   )r   r   r   )r    Ztr"   r#   r$   r%   Z Mode.__repr__.<locals>.<genexpr>  s0     X-QCW(((#a&(-s   AAA)r&   r
   rY   s   fr$   __repr__ZMode.__repr__  s    xxX-XXXr(   c               r)   )r*   r[   r,   r-   r   r.   r/   r0   r$   r1   r     s     2 2S 2T 2r(   c                	sl     V ! \         V^,          ,          4      #   \         d    \        R4      hi ; i)i   zInvalid mode code)r   Z
IndexErrorr>   r^   r?   r$   r_   ZMode.from_code  s7    	2vdZ/011 	2011	2s    3)r[   r   N)rI   rJ   rK   rL   rM   r   r   r   rN   r_   rP   r.   r(   r$   r   r     s/    H
I.Y 2 2r(   r   c                  s    ] tR tRt$ R]R&   ]P                  R R l4       t]P                  R R l4       t]P                  RR R	 ll4       t	]P                  R
 R l4       t
RtR# )_Backendi  r   r   c               rA   r*   r-   rC   r.   r/   r0   r$   r1   _Backend.__annotate__  s      t r(   c                	    R # r   r.   rY   rZ   r$   closeZ_Backend.close  s     r(   c               r)   )r*   r   rp   r-   rC   r.   r/   r0   r$   r1   r     s    00U0t0r(   c                	r   r   r.   r"   r   r?   r$   set_modeZ_Backend.set_mode  s    -0r(   c               r)   )r*   pager,   r-   rp   r.   r/   r0   r$   r1   r     s    666E6r(   c                	r   r   r.   r"   r   r?   r$   read_configZ_Backend.read_config      36r(   c               r)   )r*   r   rp   r-   rC   r.   r/   r0   r$   r1   r     s    6656T6r(   c                	r   r   r.   r"   r   r?   r$   write_configZ_Backend.write_config  r   r(   r.   Nr3   )rI   rJ   rK   rL   r   abcZabstractmethodr   r   r   r   rP   r.   r(   r$   r   r     sX       0 06 66 6r(   r   c                  >    ] tR tRtR tR tR tR
R R lltR tRt	R	# )_ManagementOtpBackendi  c                	s    \        V4      V n        V P                  P                  V n        RV P                  u;8:  d   R8  d    \        4       h R# R# )r   N)r   r    r       r    r    )r   protocolr   r   )r"   Zotp_connectionr?   r$   r   Z_ManagementOtpBackend.__init__  s>    #N3}},,0y0.00 1r(   c                	:    V P                   P                  4        R # r   r   r   rY   rZ   r$   r   Z_ManagementOtpBackend.close      r(   c                	s    V P                   P                  4       \        ,          ^ 8H  p V P                   P                  \        V4       R#   \
         d    T'       d    R# h i ; ir    N)r   Zread_statusr   send_and_receiveSLOT_DEVICE_CONFIGr   )r"   r   Zemptyr:   r$   r   Z_ManagementOtpBackend.set_mode  sQ    ))+,BCqH	MM**+=tD# 		s    A A$"A$c               rA   r*   r   r,   r.   r/   r0   r$   r1   Z"_ManagementOtpBackend.__annotate__  s     3 3 3r(   c                	s    V P                   P                  \        \        V4      4      pV^ ,          p\	        VRV^,           ^,            4      '       d   VRV^,            # \        R4      h)r    NzInvalid checksum)r   r   SLOT_YK4_CAPABILITIESr   r   r   )r"   r   ZresponseZr_lens   &&  r$   r   Z!_ManagementOtpBackend.read_config  sa    ==11!9T?
 Xo	A.//Keai((122r(   c                	F    V P                   P                  \        V4       R # r   )r   r   SLOT_YK4_SET_DEVICE_INFOr   r?   r$   r   Z"_ManagementOtpBackend.write_config  s    &&'?Hr(   r   r   Nr3   
rI   rJ   rK   rL   r   r   r   r   r   rP   r.   r(   r$   r   r     s    13Ir(   r   c                  sD    ] tR tRtR tR tR tRR R lltR tR t	R	t
R
# )_ManagementSmartCardBackendi  c                	sT   \        V4      V n         V P                  P                  \        P                  4      pVRR R8X  d   VRR pVP                  4       p\        P                  ! V4      V n        V P                  ^ ,          ^8X  dN   VP                  R4       V'       d   \        R4      hV P                  P                  \        P                  4       T P                  P#                  T P                  4       T'       d   T P                  P%                  T4       R# R#   \         dw    TP                  \        P                  8X  dV   T'       gN   T P                  P                  \        P                  4      p\        P                   ! TR,          4      T n         Lh i ; i)r*   Ns    s    zSCP is not supported:Nr   Ni)r   r   Zselectr   Z
MANAGEMENTr   r   Zfrom_stringr   r   r>   rE   r   r   r	   rw   r   Z	configureZinit_scp)r"   Zsmartcard_connectionscp_key_paramsZselect_bytesZ
select_strZstatuss   &&&   r$   r   Z$_ManagementSmartCardBackend.__init__  s3   )*>?	==//?LBC K/+CR0%,,.J"..z:DL||A!#$556IJ!$%;<<$$SWW- 	-MM"">2  , 	#-->~--cgg6&11&*=	s   BD& &4D& &1F'AF'%F'c                	r   r   r   rY   rZ   r$   r   Z!_ManagementSmartCardBackend.close$  r   r(   c                	s    V P                   ^ ,          ^8X  d&   V P                  P                  ^ ^\        ^ V4       R# V P                  P                  ^ \        \
        ^ V4       R# r   )r   r   	send_apdur   INS_SET_MODEP1_DEVICE_CONFIGr   r?   r$   r   Z$_ManagementSmartCardBackend.set_mode'  sH    <<?aMM##At-?DIMM##A|5Eq$Or(   c               rA   r   r.   r/   r0   r$   r1   Z(_ManagementSmartCardBackend.__annotate__-  s     D D Dr(   c                	sF    V P                   P                  ^ \        V^ 4      # r3   )r   r   INS_READ_CONFIGr   r?   r$   r   Z'_ManagementSmartCardBackend.read_config-  s    }}&&q/4CCr(   c                	sL    V P                   P                  ^ \        ^ ^ V4       R# r   )r   r   INS_WRITE_CONFIGr   r?   r$   r   Z(_ManagementSmartCardBackend.write_config0  s    #3Q6Br(   c                	sJ    V P                   P                  ^ \        ^ ^ 4       R# r   )r   r   INS_DEVICE_RESETrY   rZ   r$   device_resetZ(_ManagementSmartCardBackend.device_reset3  s    #3Q:r(   r   Nr3   )rI   rJ   rK   rL   r   r   r   r   r   r   rP   r.   r(   r$   r   r     s#    3:PDC;r(   r   c                  r   )_ManagementCtapBackendi=  c                	s    Wn         VP                  pV^ ,          ^8  d?   VR8w  d8   V^ ,          ^ 8X  d(   VP                  \        P                  ,          '       g   Rp\        V!  V n        R# )r    Nr    r    r   r   )ctapZdevice_versionZcapabilitiesCTAP_CAPABILITYZCBORr   r   )r"   Zfido_connectionr   r:   r$   r   Z_ManagementCtapBackend.__init__>  sV    #	!001:>g2
aO$@$@?CWCW$W$W#(r(   c                	r   r   )r   r   rY   rZ   r$   r   Z_ManagementCtapBackend.closeI  s    		r(   c                	r   r   )r   callCTAP_YUBIKEY_DEVICE_CONFIGr   r?   r$   r   Z_ManagementCtapBackend.set_modeL  s    		148r(   c               rA   r   r.   r/   r0   r$   r1   Z#_ManagementCtapBackend.__annotate__O  s     A A Ar(   c                	sT    V P                   P                  \        \        V4      4      # r   )r   r   CTAP_READ_CONFIGr   r   r?   r$   r   Z"_ManagementCtapBackend.read_configO  s    yy~~.	$@@r(   c                	r   r   )r   r   CTAP_WRITE_CONFIGr   r?   r$   r   Z#_ManagementCtapBackend.write_configR  s    		(&1r(   )r   r   Nr3   r   r.   r(   r$   r   r   =  s    	)9A2r(   r   c                  s    ] tR tRtRR R lltR R lt]R R l4       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tR# )ManagementSessioniV  Nc               r)   )r*   
connectionz4OtpConnection | SmartCardConnection | FidoConnectionr   zScpKeyParams | Noner.   r/   r0   r$   r1   ManagementSession.__annotate__W  s     
 
H
 ,
r(   c                	s   \        V\        4      '       d%   V'       d   \        R 4      h\        V4      V n        Ml\        V\
        4      '       d   \        W4      V n        ME\        V\        4      '       d%   V'       d   \        R 4      h\        V4      V n        M\        R4      hV P                  P                  R8X  dI   \        P                  R4       V P                  4       P                  P                  V P                  n
        \        P                  R\        V4      P                    RV P                   24       R# )z-SCP can only be used with SmartCardConnectionzUnsupported connection typez!Overriding development version...z.Management session initialized for connection=z
, version=Nr   )r\   r   r>   r   backendr   r   r   r   Z	TypeErrorr   r   debug_do_read_device_infor   r   rI   )r"   r   r   r   r$   r   ZManagementSession.__init__W  s    
 j-00 !PQQ%::%FDL
$7886zRDL
N33 !PQQ1*=DL9::<<9,LL<=#'#<#<#>#P#P#X#XDLL z*334Jt||nN	
r(   c               rA   r   r.   r/   r0   r$   r1   r   r  s     	 	t 	r(   c                sp    \         P                  ! R\        4       V P                  P	                  4        R# )zcClose the underlying connection.

:deprecated: call .close() on the underlying connection instead.
z?Deprecated: call .close() on the underlying connection instead.N)warningsZwarnZDeprecationWarningr   r   rY   rZ   r$   r   ZManagementSession.closer  s(    
 	M	
 	r(   c               rA   )r*   r-   r   r.   r/   r0   r$   r1   r   ~  s     $ $ $r(   c                s.    V P                   P                  # )z#The firmware version of the YubiKey)r   r   rY   rZ   r$   r   ZManagementSession.version}  s     ||###r(   c               rA   r*   r-   r   r.   r/   r0   r$   r1   r     s     + +* +r(   c                sN    \        V P                  R4       V P                  4       # )z+Get detailed information about the YubiKey.)r   r   r    )r   r   r   rY   rZ   r$   read_device_infoZ"ManagementSession.read_device_info  s    i0((**r(   c               rA   r   r.   r/   r0   r$   r1   r     s     9 9j 9r(   c                	s   R p/ p^ pV'       d   \         P                  RV 24       V P                  P                  V4      p\	        V4      ^,
          V^ ,          8w  d   \        R4      h\        P                  ! VR,          4      pVP                  \        ^ 4      R8H  pVP                  V4       V^,          pK  \        P                  W P                  4      # )TzReading DeviceInfo page: r   r   rq   )r   r   r   r   r~   r   r   r   ZpopTAG_MORE_DATAZupdater   r   r   )r"   Z	more_dataZtlvsr   r   r   s   &     r$   r   Z&ManagementSession._do_read_device_info  s    	LL4TF;<ll..t4G7|a71:-&'788>>'"+.D2e;IKKAID$$T<<88r(   c          
     s,    V ^8  d   QhRRRRRRRRRR	/# )
r*   r   zDeviceConfig | Nonerk   rl   rm   rn   ro   r-   rC   r.   r/   r0   r$   r1   r     s<     - -#- - $	-
 $- 
-r(   c                s   \        V P                  R4       Ve   \        V4      ^8w  d   \        R4      hVe   \        V4      ^8w  d   \        R4      hT;'       g    \	        4       p\
        P                  RV RV RVRJ RVRJ 24       V P                  P                  VP                  W#V4      4       \
        P                  R4       R# )	zWrite configuration settings for YubiKey.

:param config: The device configuration.
:param reboot: If True the YubiKey will reboot.
:param cur_lock_code: Current lock code.
:param new_lock_code: New lock code.
NzLock code must be 16 byteszWriting device config: z
, reboot: z, current lock code: z, new lock code: zDevice config writtenr   )r   r   r~   r>   rd   r   r   r   r   r   r   )r"   r   rk   rm   ro   s   &&&&&r$   write_device_configZ%ManagementSession.write_device_config  s     	i0$]);r)A9::$]);r)A9::))<>%fXZx @""/t";!< =+478:	

 	!!VMB	
 	+,r(   c               s(    V ^8  d   QhRRRRRRRR/# )	r*   moder   chalresp_timeoutr,   rg   rf   r-   rC   r.   r/   r0   r$   r1   r     s2     ;6 ;6;6 ;6 '	;6
 
;6r(   c           	     s   \         P                  RV RV RV 24       V P                  R
8  Ed   \        ^ 4      p\        P
                  VP                  9   d   V\        P
                  ,          p\        P                  VP                  9   d^   V\        P                  \        P                  ,          \        P                  ,          \        P                  ,          R,          ,          p\        P                  VP                  9   d-   V\        P                  \        P                  ,          ,          pV P                  4       P                   P#                  \$        P&                  ^ 4      pWE,          p\         P                  RV 24       V P)                  \+        \$        P&                  V/VV4      4       R# VP,                  pVeC   VP                  \        P                  8X  d   V\.        P0                  ,          pM\3        R4      hV P4                  P7                  \8        P:                  ! RYbT;'       g    ^ 4      4       \         P=                  R	4       R# )a(  Write connection modes (USB interfaces) for YubiKey.

:param mode: The connection modes (USB interfaces).
:param chalresp_timeout: The timeout when waiting for touch
    for challenge response.
:param auto_eject_timeout: When set, the smartcard will
    automatically eject after the given time.
z
Set mode: z, chalresp_timeout: z, auto_eject_timeout: i   z-Delegating to DeviceConfig with usb_enabled: Nz*Touch-eject only applicable for mode: CCIDz<BBHzMode configuration writtenr   )r   r   r   r   r
   rE   r   rG   r7   r5   r6   r8   r=   rF   r4   r   r   rt   r	   ru   r   rd   r[   r`   ra   r>   r   r   structZpackr   )r"   r   r   rg   r   r   r[   r   r$   r   ZManagementSession.set_mode  s    	23C2D E##5"68	
 <<9$$Q-K  DOO3z~~-!!T__4OO nn% (() !(() 	 !!T__4z~~
0@0@@@ --/FFJJqI &1KLLHVW$$]]K0&$ 99D!-??m&8&88K---D$%QRRLL!!FD<N<S<SRST KK45r(   c               rA   r   r.   r/   r0   r$   r1   r     s     . .d .r(   c                s    \        V P                  \        4      '       g   \        R4      h\        P                  R4       V P                  P                  4        \        P                  R4       R# )zGlobal factory reset.

This is only available for YubiKey Bio, which has a PIN that is shared between
applications. This will factory reset the global PIN as well as the associated
applications.
z,Device reset can only be performed over CCIDzPerforming device resetzDevice reset performedN)r\   r   r   r   r   r   r   r   rY   rZ   r$   r   ZManagementSession.device_reset  sL     $,,(CDD#$RSS./!!#,-r(   )r   r   )NFNNr   )rI   rJ   rK   rL   r   r   rO   r   r   r   r   r   r   rP   r.   r(   r$   r   r   V  s?    
6	 $ $+
9 -<;6z. .r(   r   )fZ
__future__r   r   Zloggingr   r   Zdataclassesr   r   Zenumr   r   r   Ztypingr   Z	fido2.hidr   r   Zcorer	   r
   r   r   r   r   r   r   r   r   Z	core.fidor   Zcore.otpr   r   r   r   r   Zcore.smartcardr   r   r   r   Z	getLoggerrI   r   rQ   r`   rb   r   r   rv   r   r   ry   rz   r{   ZTAG_APP_VERSIONSr|   rs   rr   r   rx   ZTAG_IAP_DETECTIONr   ZTAG_FREE_FORMZTAG_HID_INIT_DELAYr   r   r   r   r}   r   r   r   r   rd   r   r   r   rE   rG   r=   r   r   r   r   r   ZABCr   r   r   r   r   r   r   r   ZCTAP_VENDOR_FIRSTr   r   r   r   r   r.   r(   r$   <module>r      s
  8 # 
    ( ) )  3   &  V U			8	$ P P Pf #N' #N #NL '   !7 ! !  
    

          &) &) &)R $> > > WQ1-.	 {
 {
 {
~ ******+++***]-?-??
 E"2 2 #22    7sww 7 IH I@    .;( .;b  . $q( %) 2X 22g. g.r(   