+
    :iR  c                   s   ^ RI t ^ RIt^ RIt^ RIt^ RIHtHt ^ RIHt ^ RI	H
t
 ^ RIHt ^ RIHtHtHtHtHtHt ^RIHtHtHtHtHtHt ] P6                  ! ]4      tRMtR t]! ]]
].R	7      ]P@                  ]R
 4       4       4       t!R t"]!PG                  4       ]P@                  ]R 4       4       4       t$]!PG                  R4      ]P@                  ]]PJ                  ! RRRRR7      ]PJ                  ! RRRRR7      ]PJ                  ! RRRRR7      ]PJ                  ! RRRRR7      R 4       4       4       4       4       4       4       t&R t'R  t(]!PG                  4       ]P@                  ]]PJ                  ! R!R"R]! ]4      R#R$7      ]PJ                  ! R%R&R]! ]4      R'R$7      ]PJ                  ! RR(R)RR*R7      ]PJ                  ! R+R,RR-R7      ]PJ                  ! R.RRR/R7      ]PJ                  ! R0RR1R7      ]PJ                  ! R2RR3R7      ]PJ                  ! R4R5])RR6R7R87      ]PJ                  ! R9R5])RR6R:R87      R; 4       4       4       4       4       4       4       4       4       4       4       4       t*]!PG                  4       ]P@                  ]]PJ                  ! R!R"R]! ]4      R#R$7      ]PJ                  ! R%R&R]! ]4      R'R$7      ]PJ                  ! R+R,RR-R7      ]PJ                  ! R<R=RR>R7      ]PJ                  ! RR(R)RR*R7      ]PJ                  ! R.RRR/R7      ]PJ                  ! R?R@RRAR7      RB 4       4       4       4       4       4       4       4       4       4       t+RC t,RD t-RE t.RF t/RG t0]!PG                  4       ]Pb                  ! RH]0RI7      ]PJ                  ! R0RR1R7      ]PJ                  ! R4R5])^ R6RJR87      ]PJ                  ! R9R5])^ R6RKR87      ]]P@                  RL 4       4       4       4       4       4       4       t2R# )N    N)	TRANSPORTYUBIKEY)FidoConnection)OtpConnection)SmartCardConnection)
CAPABILITYDEVICE_FLAGUSB_INTERFACEDeviceConfigManagementSessionMode)CliFail
EnumChoiceclick_force_optionclick_groupclick_postpone_executionclick_promptc                  s    \        R RR7      # )zEnter your lock codeT
hide_input)r        6/usr/lib/python3.14/site-packages/ykman/_cli/config.pyprompt_lock_coder   >   s    .4@@r   )Zconnectionsc                s   V P                   R,          p\        \        \        3 Fb  pVP	                  V4      '       g   K   VP                  V4      pV P                  VP                  4       \        V4      V P                   R&    R# 	  \        R4      h  \         d    \        P                  RT 2RR7        K  i ; i)a  
Configure the YubiKey, enable or disable applications.

The applications may be enabled and disabled independently
over different transports (USB and NFC). The configuration may
also be protected by a lock code.

Examples:


  Disable PIV over NFC:
  $ ykman config nfc --disable PIV


  Enable all applications over USB:
  $ ykman config usb --enable-all


  Generate and set a random application lock code:
  $ ykman config set-lock-code --generate
devicesessionNz&Failed connecting to the YubiKey over T)Zexc_infoz Couldn't connect to the YubiKey.)objr   r   r   supports_connectionZopen_connectionZcall_on_closeZcloser
   	ExceptionloggerZwarningr   )ctxdevZ	conn_typeZconns   &   r   configr    B   s    2 ''(
C)=.I	""9--**95!!$**-%6t%<	" J 4
55	  <YKHSW  s   AB%B?>B?c                 s|    V P                   R ,          pRVP                  u;8  d   R8  d   M R# \        R4      hR# )infoznConfiguring applications is not supported on this YubiKey. Use the `mode` command to configure USB interfaces.N)   r    r    )   r    r    )r   versionr   )r   r!      & r   _require_configr&   j   s;    776?D4<<+)++B
 	
 ,r   c                sz   V P                   R,          pVP                  \        4      '       g   \        R4      hV P                   R,          pVP                  '       go   V P                   R,          P
                  p\        P                  VP                  P                  V4      9   pVP                  '       d	   V'       g   \        R4      hV'       g   \        P                  ! RRRR7       \        P                  ! R4       V P                   R	,          P                  4        \        P                  ! R
4       R# )z
Reset all YubiKey data.

This command is used with the YubiKey Bio Multi-protocol Edition.

This action will wipe all data and restore factory settings for
all applications on the YubiKey.
r   z<Full device reset requires the CCID interface to be enabled.r!   znFull device reset is not supported on this YubiKey, refer to reset commands for specific applications instead.zPWARNING! This will delete all stored data and restore factory settings. Proceed?TZabortZerrzResetting YubiKey data...r   z;Reset complete. All data has been cleared from the YubiKey.N)r   r   r   r   reset_blocked	transportr   ZPIVsupported_capabilitiesgetZ_is_bioclickconfirmechoZdevice_reset)r   forcer   r!   r)   Zhas_pivs   &&    r   resetr0   s   s     ''(
C""#677TUU776?DGGH%//	..D$?$?$C$CI$NNM 
 !		
 
JJ*+GGI##%	JJLMr   zset-lock-codez-lz--lock-codeZHEXzcurrent lock code)metavarhelpz-nz--new-lock-codez-new lock code (can't be used with --generate)z-cz--clearTzclear the lock code)Zis_flagr2   z-gz
--generatez@generate a random lock code (can't be used with --new-lock-code)c                s2   \        V 4       V P                  R,          pV P                  R,          p\        R W$V3 4       4      ^8  d   \        R4      hV'       d   \        pMV'       d`   \
        P                  ! ^4      p\        P                  ! RVP                  4        24       V'       g   \        P                  ! RRRR7       M!V'       g   \        R	RRR
7      p\        V4      pVP                  '       d"   V'       g   \        RRR7      p\        V4      p	MV'       d   \        R4      hRp	 VP                  RRV	V4       \        P                  ! R4       R#   \         d*    TP                  '       d   \        R4      h\        R4      hi ; i)z
Set or change the configuration lock code.

A lock code may be used to protect the application configuration.
The lock code must be a 32 characters (16 bytes) hex value.
r!   r   c              3   s8   "   T F  q'       g   K  ^x  K  	  R# 5i)r"   Nr   )Z.0Zargr%   r   Z	<genexpr>Z set_lock_code.<locals>.<genexpr>   s     
@8C118s   	
zRInvalid options: Only one of --new-lock-code, --generate, and --clear may be used.z&Using a randomly generated lock code: z'Lock configuration with this lock code?Tr'   zEnter your new lock code)r   Zconfirmation_promptzEnter your current lock coder   z>No lock code is currently set. Use --new-lock-code to set one.NFzLock code updated.z3Failed to change the lock code. Wrong current code?zFailed to set the lock code.)r&   r   sumr   CLEAR_LOCK_CODEosZurandomr,   r.   Zhexr-   r   _parse_lock_code	is_lockedwrite_device_configr   )
r   	lock_codeZnew_lock_codeZclearZgenerater/   r!   appZset_codeZuse_codes
   &&&&&&    r   set_lock_coder;      s^   2 C776?D
'')
C

@%8
@@1D'
 	
 "	::b>

;HLLN;KLMMM94 (*tQUM $M2 ~~~$%CPTUI#I.P  6		
 	

'( 6>>>OPP4556s   6*E" "F?Fc                 s    V'       d   V '       d   V'       g   \        R 4      hV'       d   V '       g   \        R4      hV '       d   V'       g   \        4       pV'       d   \        V4      pV# )z8Configuration is locked - supply the --lock-code option.<Configuration is not locked - remove the --lock-code option.)r   r   r6   )r7   r9   r/      &&&r   _get_lock_coder>      sF    9PQQTUU$&	$Y/	r   c                 s   V P                   R ,          pVP                  '       d   \        R4      hVP                  P	                  V4      p	VP
                  P                  P	                  V4      p
V	'       g   \        V R24      hWE,          '       d   \        R4      hV	( WE,          ,          pV'       d   \        VP                   RV R24      hW,          \        V4      ( ,          pV\        P                  8X  dE   \        \        4      V,          ^ 8X  d   \        RV R24      hV
P                  VP                  8g  pMRpV'       d   VP                  R	4       V'       d   VP                  '       g   \        R
4      h\         P"                  ! V R24       V F  p\         P"                  ! RV 24       K  	  V'       g   \         P$                  ! RRRR7       W</Vn        \'        VP                  Wg4      pV P                   R,          p VP)                  VVV4       \         P"                  ! V R24       R#   \*         d    \        RT R24      hi ; i)r!   zOThis YubiKey must be in a newly reset state before applications can be toggled. not supported on this YubiKey.Invalid options.z not supported over z on this YubiKey.z&Can not disable all applications over Z.FzThe YubiKey will rebootr<   z configuration changes:z  zProceed?Tr'   r   z# application configuration updated.zFailed to configure z applications.N)r   r(   r   r*   r+   r    enabled_capabilitiesdisplay_nameintr   USBr3   r   usb_interfacesappendr7   r,   r.   r-   r>   r8   r   )r   r    changesr)   enabledisabler9   r/   r!   Z	supportedenabledZunsupportedZnew_enabledZrebootZchanger:   s   &&&&&&&&        r   _configure_applicationsrK      s    776?D 
 	

 ++//	:Ikk..229=G#BCDD())* 01K''((<YK H 
 	
 #G}4KIMM!z?[(A-B9+QOPP'';+E+EE01TUU	JJ)345

Rx=! j$7#,":Ft~~y@I
'')
CH	

 	

i[ CDE H,YK~FGGHs   ,I Iz-ez--enablezenable applications)Zmultipletyper2   z-dz	--disablezdisable applicationsz--listlist_enabledzlist enabled applicationsz-az--enable-allzenable all applicationsz-Lz+current application configuration lock codez--touch-ejectz`when set, the button toggles the state of the smartcard between ejected and inserted (CCID only)z--no-touch-ejectzdisable touch eject (CCID only)z--autoeject-timeoutFZSECONDSz]when set, the smartcard will automatically eject after the given time (implies --touch-eject))ZrequiredrL   Zdefaultr1   r2   z--chalresp-timeoutzUsets the timeout when waiting for touch for challenge-response in the OTP applicationc           
     sd   \        V 4       \        VVVVVVVV.4      '       g   \        R4      hV'       d   V'       d   \        R4      hV'       d   \        V \        P
                  4       \        / Wx4      p. pV P                  R,          pV'       d<   VP                  P                  \        P
                  4      pVP                  R4       M:\        \        V4      4      pV'       d   VP                  RVP                   24       \        \        V4      4      pV'       d   VP                  RVP                   24       V'       dB   VP                  P                  \         P"                  ,          Vn        VP                  R4       V'       dC   VP                  P                  \         P"                  ( ,          Vn        VP                  R4       V'       d   VP                  R	V 24       V'       d   VP                  R
V 24       \%        V VV\        P
                  VVV	V
4       R# )z*
Enable or disable applications over USB.
 No configuration options chosen.r@   r!   Enable all applicationsEnable Disable zEnable touch-ejectzDisable touch-ejectzSet auto-eject timeout to z"Set challenge-response timeout to N)r&   anyr   
_list_appsr   rD   r	   r   r*   r+   rF   r   r3   rB   r    Zdevice_flagsr   ZEJECTrK   )r   rH   rI   rM   
enable_alltouch_ejectZno_touch_ejectautoeject_timeoutchalresp_timeoutr9   r/   r    rG   r!   s   &&&&&&&&&&&   r   usbrX   E  s   H C		
  899~())3	&"/BFG776?D,,00?01CK(NNWV%8%8$9:;W&G'"6"6!789"kk669J9JJ+,"kk66+:K:K9KK,-34E3FGH;<L;MNO	r   z-Dz--disable-allzdisable all applicationsz-Rz
--restrictz2Disable NFC for transport, re-enabled by USB powerc	           
     s8   V P                   R,          p	\        P                  V	P                  9  d   \	        R4      h\        V 4       \        WSWW'.4      '       g   \	        R4      hV'       d   \        V \        P                  4       \        / RRR4      p
V'       d   V	P                  R8  d   \	        R4      hRV
n
        \        V	P                  Wh4      pV P                   R,          P                  V
RV4       \        P                  ! R	4       V P!                  4        . pV	P                  P#                  \        P                  4      pV'       d   TpVP%                  R
4       M:\'        \)        V4      4      pV'       d   VP%                  RVP*                   24       V'       d   TpVP%                  R4       M:\'        \)        V4      4      pV'       d   VP%                  RVP*                   24       \-        V V
V\        P                  VVVV4       R# )z*
Enable or disable applications over NFC.
r!   z"This YubiKey does not support NFC.rN   Nz.NFC restriction requires YubiKey 5.7 or later.Tr   FzeYubiKey NFC disabled. It will be re-enabled automatically the next time it is connected to USB power.rO   rP   zDisable all applicationsrQ   )r#   i   )r   r   ZNFCr*   r   r&   rR   rS   r	   r$   Znfc_restrictedr>   r7   r8   r,   r.   exitr+   rF   r   r3   rB   rK   )r   rH   rI   rT   Zdisable_allrM   r9   Zrestrictr/   r!   r    rG   Znfc_supporteds   &&&&&&&&&    r   nfcrZ     s   ` 776?D}}D777:;;C&wQRR8993	&"dD$/F<<& JKK $"4>>9D		..vuiH

,	
 	
G//33IMMBM01CK(NNWV%8%8$9:;12S\*NNXg&:&:%;<=	r   c                 s0   V P                   R ,          P                  P                  P                  V4      pVf   \	        V R24      h\
         F3  pW2,          '       g   K  \        P                  ! VP                  4       K5  	  V P                  4        R# )r!   Nr?   )
r   r    rA   r+   r   r   r,   r.   rB   rY   )r   r)   rJ   r:   s   &&  r   rS   rS   /  sl    ggfo$$99==iHG#BCDD==JJs''(  HHJr   c                 s8    W,          '       d   \        R 4      hR# )r@   N)r   )r   rH   rI   r=   r   _ensure_not_invalid_optionsr[   :  s    ()) r   c                 s     \         P                  V 4      p V '       d   \        V 4      ^8w  d   \        R4      hV #   \         d    \        R4      hi ; i)i   z@Lock code must be exactly 16 bytes (32 hexadecimal digits) long.zLock code has the wrong format.)ZbytesZfromhexZlenr   r   )r9   s   &r   r6   r6   ?  sV    9MM),	Y2-R   97889s   < < Ac                 s    \          F2  pVP                  ;'       g    R P                  V 4      '       g   K0  Vu # 	  \        4       h)Z )r   Zname
startswith
ValueError)	interfaceZifacer%   r   _parse_interface_stringr_   N  s8    JJ"((33L  ,r   c                 s    \        V4      p \        P                  ! V4      #   \         d    \	        R T 24      hi ; i  \
         d     Mi ; i T^ ,          R9   d   T P                  R,          pTP                  P                  \        P                  ,          pTP                  p\        P                  ! RTP                  4       4       F>  p\        TR,          4      pTP!                  R4      '       d   Yh,          pK6  Yh,          pK@  	  Mq\#        ^ 4      p\        P$                  ! RTP                  4       4       F  p	T	'       g   K  T\        T	4      ,          pK!  	  M  \
         d    \	        RT 24      hi ; i\        T4      # )zInvalid mode: +r!   z
[+-][A-Z]+:r"   NNz[+]+zInvalid mode string: )r`   Z-)rC   r   Z	from_codeZ
IndexErrorr   r]   r   r    rA   r   rD   rE   reZfindallZupperr_   r\   r   Zsplit)
r   ZparammodeZmode_intr!   usb_enabled
interfacesZmodr^   Zts
   &&&       r   _parse_mode_stringre   U  sL   t9	7>>(++ 	7N8*566	7 67j 776?D++::9==IK$33Jzz->3CG<	>>#&&+J+J ? 'q)JXXgtzz|41"9!"<<J 5  6-dV4556 
s7   A $ >A AAB?E' 8E' E' 'Frb   )Zcallbackzhwhen set, the smartcard will automatically eject after the given time (implies --touch-eject, CCID only)z>sets the timeout when waiting for touch for challenge responsec                sl   V P                   R,          pV P                   R,          pVP                  P                  \        P                  ,          p\        VP                  4      p	VP                  \        P                  ,          p
V
P                  pV P                   R,          pV'       d   VP                  pMRpV'       d   RpV'       d   TMRpVP                  \        P                  8w  d   V'       d   \        R4      hV'       g   W8X  d   \        RV R2^ 4      hV\        P                  \        P                  39   d   \        R	4      hVP                  V9  d   \        R
V R2R,           4      hVP                   '       d+   \        P"                  VP                  9  d   \        R4      hV'       g   \$        P&                  ! RV R2RRR7        VP)                  WV4       \*        P-                  R4       \$        P.                  ! R4       R#   \0         d    \        R4      hi ; i)a  
Manage connection modes (USB Interfaces).

This command is generally used with YubiKeys prior to the 5 series.
Use "ykman config usb" for more granular control on YubiKey 5 and later.

Get the current connection mode of the YubiKey, or set it to MODE.

MODE can be a string, such as "OTP+FIDO+CCID", or a shortened form: "o+f+c".
It can also be a mode number.

Examples:


  Set the OTP and FIDO mode:
  $ ykman config mode OTP+FIDO


  Set the CCID only mode and use touch to eject the smart card:
  $ ykman config mode CCID --touch-eject
r!   r   pidNTz:--touch-eject can only be used when setting CCID-only modezMode is already z, nothing to do...zYMode switching is not supported on this YubiKey!
Use --force to attempt to set it anyway.zMode z# is not supported on this YubiKey!
z(Use --force to attempt to set it anyway.z)Security Key requires FIDO to be enabled.zSet mode of YubiKey to Z?r'   zUSB mode updatedzTMode set! You must remove and re-insert your YubiKey for this change to take effect.z^Failed to switch mode on the YubiKey. Make sure your YubiKey does not have an access code set.)r   r    rA   r   rD   r   rE   r*   Zyubikey_typerd   r   ZCCIDr   r   ZYKSZYKPZis_skyZFIDOr,   r-   Zset_moder   r!   r.   r   )r   rb   rU   rV   rW   r/   r!   Zmgmtrc   Zmy_modeZusb_supportedZinterfaces_supportedrf   Zkey_typeZ	autoejects   &&&&&&         r   rb   rb   u  s   d 776?D779D++229==AK;--.G//	>M(77
''%.C
##%0!dI-,,,VWW?,TF2DEqII'++w{{33;  __$88vAB<=  [[[]//tFEFFMM3D6;4TR
di8&'

.	
  
8
 	

s   =H H3s                   )3Zloggingr5   ra   r,   Zyubikit.corer   r   Zyubikit.core.fidor   Zyubikit.core.otpr   Zyubikit.core.smartcardr   Zyubikit.managementr   r   r   r	   r
   r   Zutilr   r   r   r   r   r   Z	getLoggerZ__name__r   r4   r   Zpass_contextr    r&   Zcommandr0   Zoptionr;   r>   rK   rC   rX   rZ   rS   r[   r6   r_   re   Zargumentrb   r   r   r   <module>rg      s  8  	 	  + , * 6   
		8	$ A -}nMN"6   O"6J
 $N   $NN  dM57JK	8	 dIt2GH	K	;6 I L   !";6|GHT 	J		 	J		 (ND7R dND7PQ	6	 
A  $5VW	
4 	
I X R   hIX 	J		 	J		 dND7PQdOT8RS(ND7R 	6	 	=	E T R   DEP*
	9@ !34
 	
) 		I G
   5 8G
r   