+
    :iZ}  c                   s2   ^ RI t ^ RIt^ RIHt ^ RIHt ^ RIt^ RIHt ^ RI	H
t
 ^ RIHt ^ RIHt ^ RIHtHt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  ^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-H.t.H/t/H0t0H1t1 ] Pd                  ! ]34      t4](! ].R7      ]Pj                  ]*R 4       4       4       t]Pm                  4       ]Pj                  R 4       4       t7]Pm                  4       ]Pj                  ]'R 4       4       4       t8]Pr                  ! RRRR7      t:]Pr                  ! RRRRR7      t;R t<R}R lt=R t>]P                  4       R 4       t@]@Pm                  4       ]Pj                  ]:]Pr                  ! RR RR!R7      ]Pr                  ! R"R#R$R7      ];R% 4       4       4       4       4       4       tA]@Pm                  4       ]Pj                  ]:R& 4       4       4       tBR' tC]@Pm                  4       ]Pj                  ]Pr                  ! R(R)RRR*]CR+R,7      R- 4       4       4       tD]Pr                  ! R.R/RR0R7      tE]Pr                  ! R1R2RR3R7      tFR4 tGR5 tHR6 tIR7 tJR8 tKR9tL]P                  4       R: 4       tM]MPm                  4       ]P                  ! R;4      ]P                  ! R<])R*R=7      ]Pr                  ! R>R?]%! ]4      ]P                  P                  R@RRA7      ]Pr                  ! RBRC]P                  ! . R~O4      RDRERRA7      ]Pr                  ! R(RF]%! ]4      ]P                  P                  RRGRH7      ]Pr                  ! RRI]P                  ^ RJRK7      ]Pr                  ! RLRMRNR7      ]Pr                  ! RORPRQ^RRR7      ]Pr                  ! RSRTRRUR7      ]Pr                  ! RVRW]P                  ! RX4      RYRZ7      ]Pr                  ! R[R\R7      ]Pr                  ! R]R^R7      ]E]']:];]Pj                  R_ 4       4       4       4       4       4       4       4       4       4       4       4       4       4       4       4       4       4       tU]&! 4       R` 4       tV]MPm                  4       ]P                  ! Ra]VR*RbRc7      ]E]']:];]Pj                  Rd 4       4       4       4       4       4       4       tW]MPm                  Re4      ]P                  ! Rf]P                  ! Rg4      RhRi7      ]E]']:];]Pj                  Rj 4       4       4       4       4       4       4       tXRk tY]MPm                  Rl4      ]F]Pj                  ]Pr                  ! R>R?RRmR7      ]Pr                  ! RORPRRnR7      ]:];Ro 4       4       4       4       4       4       4       tZ]MPm                  4       ]F]Pj                  ]P                  ! RpR*RqRr7      ]Pr                  ! RsRtRRuR7      ]:];Rv 4       4       4       4       4       4       4       t[]MPm                  4       ]Pj                  ]P                  ! Rp4      ]P                  ! R;4      ]Pr                  ! RwRxRRyR7      ]:];Rz 4       4       4       4       4       4       4       t\]MPm                  4       ]Pj                  ]P                  ! Rp4      ]Pr                  ! RwRxRR{R7      ]:];R| 4       4       4       4       4       4       t]R# )    N)	b32encode)Any)NameOID)PSKC)parse_rfc4514_string)	TRANSPORT)SW	ApduErrorSmartCardConnection)
CAPABILITY)HASH_ALGORITHM	OATH_TYPECredentialDataOathSession_format_cred_idparse_b32_key)calculate_steamdelete_broken_credential	is_hiddenis_steam)AppData)CliFail
EnumChoiceclick_callbackclick_force_optionclick_groupclick_parse_b32_keyclick_postpone_executionclick_promptget_scp_paramsis_yk4_fipslog_or_echopretty_printprompt_for_touchprompt_timeout)Zconnectionsc                sp   V P                   R,          pVP                  \        4      pV P                  VP                  4       \        V \        P                  V4      p\        W#4      V P                   R&   \        R4      V P                   R&   V P                   R,          p\        P                  VP                  9   pT;'       d    \        P                  VP                  9  V P                   R&   T;'       d-    VP                  \        P                  8H  ;'       d    V'       * V P                   R&   R# )ac  
Manage the OATH application.

Examples:


  Generate codes for accounts starting with 'yubi':
  $ ykman oath accounts code yubi


  Add an account with the secret key f5up4ub3dw and the name yubico,
  which requires touch:
  $ ykman oath accounts add yubico f5up4ub3dw --touch


  Set a password for the OATH application:
  $ ykman oath access change
Zdevicesession	oath_keysinfofips_unreadyno_scpN)objZopen_connectionr	   Zcall_on_closeZcloser   r
   OATHr   r   fips_capablefips_approvedZ	transportr   ZNFC)ctxZdevZconnZ
scp_paramsr&   Zis_fips   &     4/usr/lib/python3.14/site-packages/ykman/_cli/oath.pyoathr0   H   s    . ''(
C23Ddjj!Z__d;J$T6CGGI";/CGGK776?Doo!2!22G%SS*//ASAS*SCGGNUUCMMY]]$BUU:~CGGH    c                s^   V P                   R,          pV P                   R,          pRRVP                  ,          /pV.p\        P                  VP                  9   d"   \        P                  VP
                  9   VR&   M \        V4      '       d   VP                  VR&   VP                  '       d   RMRVR&   V P                   R	,          pVP                  '       d#   VP                  V9   d   VP                  R
4       \        P                  ! RP                  \        V4      4      4       R# )z1
Display general status of the OATH application.
r$   r&   zOATH versionz%d.%d.%dzFIPS approvedZenabledZdisabledzPassword protectionr%   z5The password for this YubiKey is remembered by ykman.Z
N)r)   versionr
   r*   r+   r,   r   locked	device_idappendclickechoZjoinr!   )r-   r$   r&   dataZlineskeysr.   r/   r&   r&   m   s     ggi G776?D*J,HIDvE$+++ *43E3E E_	T		 '_/6~~~):D	77;D~~~'++t3LM	JJtyye,-.r1   c                s~   V'       g   \         P                  ! RRRR7       V P                  R,          p\         P                  ! R4       VP                  pVP                  4        V P                  R,          pW49   d(   WC VP                  4        \        P                  R4       \         P                  ! R4       R	# )
z
Reset all OATH data.

This action will delete all accounts and restore factory settings for
the OATH application on the YubiKey.
zYWARNING! This will delete all stored OATH accounts and restore factory settings. Proceed?TZaborterrr$   zResetting OATH data...r%   Deleted remembered access keyzEReset complete. All OATH accounts have been deleted from the YubiKey.N)	r6   confirmr)   r7   r4   resetwriteloggerr&   )r-   forcer$   Zold_idr9   s   &&   r/   r>   r>      s     !		
 ggi G	JJ'(FMMO77;D~L

34	JJVWr1   z-pz
--passwordz"the password to unlock the YubiKey)helpz-rz
--rememberTz%remember the password on this machine)is_flagrB   c                 sR   V P                   R ,          pV P                   R,          pVP                  V4       V'       dh   VP                  VP                  VP	                  4       4       VP                  4        \        P                  R4       \        P                  ! R4       R# R# )r$   r%   zAccess key rememberedPassword remembered.N)
r)   Zvalidate
put_secretr4   hexr?   r@   r&   r6   r7   )r-   keyrememberr$   r9   s   &&&  r/   	_validaterI      sq    ggi G77;DS))37795

+,

)*	 r1   c                 sf   V P                   R ,          pV P                   R,          pVP                  pVP                  '       d    V'       d5   \        P	                  R4       VP                  V4      p\        WV4       R# We9   dI   \        P	                  R4        \        P                  VP                  V4      4      p\        WR4       R# \#        VR	R
7      pVP                  V4      p\        WV4       R# V'       d   \%        R4      hR#   \         dQ   pTP                  \        P                  8X  d(   \        P	                  R4       YV TP                  4         Rp?LRp?i\         d"   p\        P!                  RTR7        Rp?LRp?ii ; i  \         d    \%        R4      hi ; i)r$   r%   z,Access key required, using provided passwordNz)Access key required, using remembered keyFz&Remembered key incorrect, deleting keyzError authenticating)Zexc_infoT
hide_input5Authentication to the YubiKey failed. Wrong password?z*Password provided, but no password is set.)r)   r4   r3   r@   debug
derive_keyrI   bytesfromhexZ
get_secretr   swr   ZINCORRECT_PARAMETERSr?   	Exceptionwarningr   r   )	r-   passwordrH   promptr$   r9   r4   rG   es	   &&&&     r/   _init_sessionrW      s_   ggi G77;D!!I~~~	SKL((2#H-  HIG--	(BCCc. $Ft<H$$X.Cc) 
BCC 
# ! %ttr666%MN O

  GNN#9ANFFG  	SQRR	Ss[   F 2F F 0D *F FAE'"F 'F4F5FF FF F0c                 s    V P                   R ,          '       d+   VP                  \        P                  8X  d   \	        R4      hVh)r(   z+Unable to manage OATH over NFC without SCP.)r)   rQ   r   ZCONDITIONS_NOT_SATISFIEDr   )r-   rV   s   &&r/   	_fail_scprX      s3    
wwxQTTR%@%@@CDD
Gr1   c                     R# )z$Manage password protection for OATH.N rZ   r1   r/   accessr[          r1   z-cz--clearzremove the current passwordz-nz--new-passwordz%provide a new password as an argumentc                s   V'       dQ   V'       d   \        R4      hV P                  R,          p\        P                  VP                  9   d   \        R4      h\        WRRR7       V P                  R,          pV P                  R,          pVP                  pV'       dV   VP                  4        W9   d(   Wx VP                  4        \        P                  R	4       \        P                  ! R
4       R# V'       d    VP                  4        V'       g   \        RRRR7      pVP!                  V4      p	V'       dG   VP#                  WP%                  4       4       VP                  4        \        P                  ! R4       MW9   d   Wx VP                  4         VP'                  V	4       \        P                  ! R4       R#   \         d    \        R4      hi ; i  \(         d   p
\+        Y
4        Rp
?
R# Rp
?
ii ; i)z
Change the password used to protect OATH accounts.

Allows you to set or change a password that will be required to access the OATH
accounts stored on the YubiKey.
z/--clear cannot be combined with --new-password.r&   z5Removing the password is not allowed on YubiKey FIPS.FzEnter the current password)rU   r$   r%   r<   zPassword cleared from YubiKey.BFailed to remember password, the keyring is locked or unavailable.zEnter the new passwordTrK   Zconfirmation_promptrD   zPassword updated.N)r   r)   r
   r*   r+   rW   r4   Z	unset_keyr?   r@   r&   r6   r7   ensure_unlocked
ValueErrorr   rN   rE   rF   Zset_keyr   rX   )r-   rT   clearZnew_passwordrH   r&   r$   r9   r4   rG   rV   s   &&&&&      r/   changerb      s   $ KLLwwv??d///QRR#/KLggi G77;D!!IJJLKK78

34$$&
 '(TtL   .OOIwwy1JJLJJ-.JJL	OOC JJ*+%  X &  	c	s$   ?G 'G  G H+G<<Hc                sH   V P                   R,          pVP                  pV P                   R,          pVP                  '       gP   W49   d2   WBP                   VP                  4        \        P                  R4       \        P                  ! R4       R#  VP                  4        T'       g   \        RRR7      pTP                  T4      p \        YR4       \        P                  ! R	4       R#   \         d    \        R4      hi ; i  \         d    \        R
4      hi ; i)zW
Store the YubiKeys password on this computer to avoid having to enter it
on each use.
r$   r%   r<   z'This YubiKey is not password protected.r]   Enter the passwordTrJ   rD   rL   N)r)   r4   r3   r?   r@   r&   r6   r7   r_   r`   r   r   rN   rI   rR   )r-   rT   r$   r4   r9   rG   s   &&    r/   rH   rH   7  s     ggi G!!I77;D>>>&&'JJLKK78

<=	  "
 #$8TJH  *	Sc%JJ-.  	T 	  	SQRR	Ss   C0 "D
 0D
D!c                 s    V'       d   V P                   '       d   R # \        R4      pV'       d!   VP                  4        VP                  4        \        P
                  ! R4       V P                  4        R # )Nr%   z"All passwords have been forgotten.)Zresilient_parsingr   ra   r?   r6   r7   exit)r-   paramvaluer9   s   &&& r/   _clear_all_passwordsrg   Z  sH    C)));D



	JJ34HHJr1   z-az--allFzremove all stored passwords)rC   Zis_eagerZexpose_valuecallbackrB   c                s4   V P                   R,          pVP                  pV P                   R,          pW#9   dJ   W1P                   VP                  4        \        P	                  R4       \
        P                  ! R4       R# \
        P                  ! R4       R# )z.
Remove a stored password from this computer.
r$   r%   r<   zPassword forgotten.z$No password stored for this YubiKey.N)r)   r4   r?   r@   r&   r6   r7   )r-   r$   r4   r9   s   &   r/   forgetri   f  sm     ggi G!!I77;D""#

34

()

9:r1   z-tz--touchz)require touch on YubiKey to generate codez-Hz--show-hiddenzinclude hidden accountsc                 s8    V P                   P                  R 4      # )zutf-8)iddecode)Z
credential   &r/   
_string_idrm     s    ==((r1   c                 s    \         P                  ! R RR7       \         P                  ! RRR7       V F$  p\         P                  ! \        V4      RR7       K&  	  V P                  ^4       R# )z6Error: Multiple matches, make the query more specific.T)r;    N)r6   r7   rm   rd   )r-   hitscreds   && r/   _error_multiple_hitsrq     sG    	JJGTR	JJrt

:d#. HHQKr1   c                 s    . pV  Fj  p\        V4      pV'       g   \        V4      '       d   K)  WQ8X  d   V.u # VP                  4       VP                  4       9   g   KY  VP                  V4       Kl  	  V# N)rm   r   lowerr5   )credsqueryshow_hiddenro   ccred_ids   &&&   r/   _searchry     s[    DQ-y||3J;;=GMMO+KKN  Kr1   c                 sT    \        V 4      P                  4       P                  R R4      # )Z=rn   )r   rk   ZreplacerG   rl   r/   _b32_encoder{     s"    S>  "**333r1   c                 s    \        V R V 4      # )name)Zgetattr)Zfobjrl   r/   _fnamer}     s    4&&r1   z$urn:ietf:params:xml:ns:keyprov:pskc:c                 rY   )zManage and use OATH accounts.NrZ   rZ   r1   r/   accountsr~     r\   r1   r|   secret)rh   requiredz-oz--oath-typez1time-based (TOTP) or counter-based (HOTP) account)typedefaultrB   show_defaultz-dz--digits6z"number of digits in generated codez--algorithmz$algorithm to use for code generation)r   r   r   rB   z	--counterz'initial counter value for HOTP accounts)r   r   rB   z-iz--issuerz issuer of the account (optional)z-Pz--periodz&number of seconds a TOTP code is valid)rB   r   r   z-gz
--generatez=generate a random credential key (cannot be used with SECRET)z-Oz--outputZwbzKwrite the credential to a PSKC file in addition to adding it to the YubiKey)r   rB   z
--pskc-keyz1encrypt the PSKC file with a pre-shared key (hex)z--pskc-passphrasez'encrypt the PSKC file with a passphrasec                s   V P                   R,          '       d   \        R4      h\        V4      pV P                   R,          P                  pV'       d   Vf   \        R4      hV'       d*   V'       d   \        R4      h\        P
                  ! ^4      pV'       d   V'       d   \        R4      hV'       g	   V'       d   V'       g   \        R4      hV'       d2   VR	8X  d   \        R
RRR7      p\        V4      ^8  d   \        R4      hMNV'       dG   VR	8X  d   \        RRRR7      p \        P                  V4      p\        V4      ^8w  d   \        R4      hV'       g    \        R4      p \        V4      p \        WV4       \!        W'WWW4      p\#        V VV	V4       \%        R\&        V4       V'       Ed   \)        4       pV'       d2   VP*                  P-                  V4       \&        P/                  R4       M9V'       d2   VP*                  P1                  VR7       \&        P/                  R4       VP2                  pVP4                  '       d   VP4                  R,           V,           p\7        VP8                  \:         VP<                  P2                  P?                  4        2VVRVP4                  RVP2                   2V\A        VPB                  4      RVPD                  P2                  R7      pVP<                  \F        PH                  8X  d   \A        VPJ                  4      VR&   M\A        VPL                  4      VR&   VPN                  ! R/ VB  VPQ                  V4       \%        R\S        V4       2\&        V4       R# V'       d%   \        P                  ! R\U        V4       24       R# R#   \         d    Rp ELi ; i  \         d#   p\        P                  ! T4        Rp?EK  Rp?ii ; i) z
Add a new account.

This will add a new OATH account to the YubiKey.


NAME    human readable name of the account, such as a username or e-mail address
SECRET  base32-encoded secret/key value provided by the server
r'   zDYubiKey FIPS must be in FIPS approved mode prior to adding accounts.r&   Nz>YubiKey has readable serial number, cannot write to PSKC file.z6Cannot use --generate together with a provided SECRET.z1Cannot use both --pskc-key and --pskc-passphrase.zAMust specify --output when using --pskc-key or --pskc-passphrase.Z-z%Enter passphrase to encrypt PSKC fileTr^   z)Passphrase must be at least 8 characters.z/Enter pre-shared key (hex) to encrypt PSKC filer1   z4Pre-shared key must be 16 bytes (32 hex characters).zEnter a secret key (base32)zOATH account addedz+PSKC file will be encrypted with passphraserz   z/PSKC file will be encrypted with pre-shared key:ZYubicozCN=ZDECIMAL)r   	algorithmrj   serialZmanufacturerissuer
key_useridfriendly_nameresponse_lengthZresponse_encodingalgorithm_suitetime_intervalcounterz!Credential written to PSKC file: z&Generated credential secret (base32): rZ   )+r)   r   Zintr   osZurandomr   lenrO   rP   r`   r   rR   r6   r7   rW   r   	_add_credr    r@   r   
encryptionZsetup_pbkdf2rM   Zsetup_preshared_keyr|   r   Zdictr   _PSKC_ALG_PREFIX	oath_typers   strdigitshash_algorithmr   TOTPperiodr   Zadd_keyr?   r}   r{   )r-   r   r|   r   r   ZgenerateZoutputr   r   touchr   r   rA   rT   rH   Zpskc_keyZpskc_passphraser   rV   rp   pskcr   Zfieldss   &&&&&&&&&&&&&&&&&      r/   addr     s=   @ ww~R
 	
 [FWWV_##F&.VWWRSSBOIJJOVO
 	
 c!*7$(O
 !#EFF $	s?#A$(H
	}}X.H x=BPQQ!"?@F&v. #*FGD 	 $ff5vvOO((9LLFGOO//H/=LLJK		;;; KK#-=M;;)*4>>+>+>+D+D+F*GH!;;TYYK(',' //44
 >>Y^^+&)$++&6F?# #DLL 1F9v

6/v/?@&&	
 


;K<O;PQR 
}  	H	  

1s*   *N9 /O 9O
	O
O:O55O:c                 s     \         P                  ! V4      #   \        \        3 d    \        P
                  ! R 4      hi ; i)z#URI seems to have the wrong format.)r   	parse_urir`   ZKeyErrorr6   ZBadParameter)r-   re   Zvals   &&&r/   click_parse_urir   ~  sA    H'',,! H  !FGGHs	    (A r8   ZURI)rh   r   metavarc                s   V P                   R,          '       d   \        R4      hV'       g%    \        R4      p \        P                  ! V4      p VP                  ^8X  d   \        V4      '       d   ^Vn        \        WV4       \        WW#4       \        P                  ! R4       R#   \
         d"   p\        P                  ! T4        Rp?K  Rp?ii ; i)z[
Add a new account from an otpauth:// URI.

Use a URI to add a new account to the YubiKey.
r'   zCYubiKey FIPS must be in FIPS approved mode prior to adding accountszEnter an OATH URI (otpauth://)NzOATH account added.)r)   r   r   r   r   rR   r6   r7   r   r   rW   r   )r-   r8   r   rA   rT   rH   urirV   s   &&&&&&  r/   r   r     s     ww~Q
 	
 ?@C%//4 {{aHTNN#*c&	JJ$%  

1s   B* *C5CCZimportimport_fileZrbZFILE)r   r   c                s   \        V4      pVP                  P                  '       d   VP                  P                  P                  '       d*   \        RRR7      pVP                  P                  V4       M2\        RRR7      p \        P                  V4      VP                  n	        \        WV4       ^ p	Rp
VP                   EF  pVP                  '       d\   VP                  P                  \        4      '       d7   \         VP                  \#        \        4      R P%                  4       ,          pM$\&        P)                  RVP                   24       K   VP*                  pTe   TP.                  f   \&        P)                  R
4       K  TP0                  '       d&   \2        TP0                  P%                  4       ,          M\2        P4                  pRTP.                  ppTP6                  '       d1   RTP6                  9   d    TP6                  P9                  R^4      w  ppTP:                  '       d   TP:                  pTP<                  '       d`    \?        TP<                  4      pTPA                  \B        PD                  4      ^ ,          PF                  p\I        T\J        4      '       g   Q h \O        TTTTTTPP                  ;'       g    ^TPR                  ;'       g    ^TPT                  ;'       g    ^ R7      pT'       d
   TR,           MR T 2pT'       g#   \V        PX                  ! RT R2RR7      '       d0   \[        T TY#4       \V        P\                  ! RT 24       T	^,          p	Rp
EK  	  V
'       d   \V        P\                  ! V	 R24       R# \        R4      h  \         d    \        R4      hi ; i  \,         d   p\        R	4      ThRp?ii ; i  \        \L        3 d    TP<                  p ELMi ; i)af  
Add new account(s) from a PSKC file.

Reads credentials from a PSKC file, adding them to the YubiKey.
The file can contain multiple credentials, and you will be prompted
to confirm each one before it is added, unless --force is used, in
which case all valid credentials will be added without prompting, overwriting
any existing accounts with the same name.
z%Enter passphrase to decrypt PSKC fileTrJ   z7Enter pre-shared key (32 char hex) to decrypt PSKC filez2Invalid pre-shared key: must be valid hexadecimal.FNz%Skipping key with unknown algorithm: z@Failed to decrypt PSKC file. Wrong passphrase or pre-shared key?z$Skipping key with no secret or no idr   )r   r   r|   r   r   r   r   r   rn   zImport account:  ?)r   zAdded account: z OATH account(s) added.z)No valid OATH accounts found in the file.)/r   r   Zis_encryptedZ
derivationr   r   rN   rO   rP   rG   r`   r   rW   r9   
startswithr   r   r   Zupperr@   rM   r   rR   rj   r   r   SHA1r   splitr   r   r   Zget_attributes_for_oidr   ZCOMMON_NAMErf   Z
isinstancer   Z
IndexErrorr   r   r   r   r6   r=   r   r7   )r-   r   r   rA   rT   rH   r   Z
passphraserG   Zn_keysZvalidr   r   rV   r   r   r|   Zdnrp   Zaccount_name   &&&&&&              r/   import_pskcr     sF   " D###??%%///%7J OO&&z2ICT&+mmC&8# #*FEyy===S]]556FGG!#--4D0E0G"H"N"N"PQILL@PQ	ZZF
 >SVV^LL?@ """ 3..4467$$ 	 SVV(9(9!9,,223:LFD:::ZZF>>>&)#..9001D1DEaHNN!$,,,, )&&++!$$**KK$$1	
 +1&3,b9$@U]]%5l^2#FPTUUc4.JJ78aKFo r 

fX456ABBG  TRSST"  	R	6 
+ &~~&s7   $N* OAO#*OO OO #PPc                 sH  a
 V P                   R ,          pVP                  p^ \        VP                  4      u;8  d   ^@8:  g   M \	        R4      h\        VP
                  4      ^8  d   \	        R4      hV'       d   VR8  g   \	        R4      hVP                  '       d+   VP                  \        P                  8w  d   \	        R4      hVP                  \        P                  8X  d5   VR8  d#   \        V P                   R,          4      '       d   \	        R4      hVP                  4       pVP                  4       o
V'       gh   \         ;QJ d    V
3R lV 4       F  '       g   K   RM	  R	M! V
3R lV 4       4      '       d(   \"        P$                  ! R
VP                   R2RRR7       RTu;8  ;'       d    R8  Mu p\         ;QJ d    V
3R lV 4       F  '       g   K   RM	  R	M! V
3R lV 4       4      pV'       d   V'       d   \	        R4      h VP'                  W4       R#   \(         dk   p	T	P*                  \,        P.                  8X  d   \	        R4      hT	P*                  \,        P0                  8X  d   \	        R4      h\3        Y	4        Rp	?	R# Rp	?	ii ; i)r$   z$Name must be between 1 and 64 bytes.z Secret must be at least 2 bytes.z/Require touch is not supported on this YubiKey.z)Counter only supported for HOTP accounts.r&   z/Algorithm SHA512 not supported on this YubiKey.c              3   @   <"   T F  qP                   S8H  x  K  	  R # 5irr   rj   .0rp   rx      & r/   	<genexpr>_add_cred.<locals>.<genexpr>)  s     >G+   TFzAn account called z= already exists on this YubiKey. Do you want to overwrite it?r:   c              3   s   <"   T F6  qP                   P                  S4      ;'       d    VP                   S8g  x  K8  	  R # 5irr   )rj   r   r   r   r/   r   r   2  s5      IN		G	$	;	;G);	;s
   %AAz:Choose a name that is not a subset of an existing account.z/No space left on the YubiKey for OATH accounts.z9The command failed. Is there enough space on the YubiKey?N)   i   i   )r      i   )r   r    r    )r   r   i   )r)   r2   r   r|   r   r   r   r   r   HOTPr   r   ZSHA512r   list_credentialsZget_idanyr6   r=   Zput_credentialr   rQ   r   ZNO_SPACEZCOMMAND_ABORTEDrX   )r-   r8   r   rA   r$   r2   rt   Zfirmware_overwrite_issueZcred_is_subsetrV   rx   s   &&&&      @r/   r   r     s   ggi GooGDII$"$<==
4;;!899W	)GHH|||)..8ABBn333y K$@$@GHH$$&EkkmGSS>>SSS>>>>  ,, ,		
  )7>>Y>S INSSS IN N
  NRSSt+ 442;;KLLTTR'''UVV#s   H, ,J!7AJJ!Zlistzdisplay the OATH typezdisplay the periodc                s(   \        WV4       V P                  R,          pVP                  4        Uu. uF   pV'       g   \        V4      '       d   K  VNK"  	  ppVP	                  4        V F  p\
        P                  ! \        V4      RR7       V'       d0   \
        P                  ! RVP                  P                   2RR7       V'       d&   \
        P                  ! RVP                   2RR7       \
        P                  ! 4        K  	  R# u upi )z>
List all accounts.

List all accounts stored on the YubiKey.
r$   F)Znlz, N)rW   r)   r   r   Zsortr6   r7   rm   r   r|   r   )	r-   rv   r   r   rT   rH   r$   rp   rt   s	   &&&&&&   r/   
list_credsr   E  s     #*ggi G ,,..Dio 	. 
 
 
JJL

:d#.JJDNN//01e<JJDKK=)e4

 s   DDDru   rn   )r   r   z-sz--singlez4ensure only a single match, and output only the codec                s"   \        WV4       V P                  R,          p VP                  4       p\        TP                  4       Y!4      p	\        T	4      ^8X  Ed   T	^ ,          p
T
P                  '       d   \        4         \!        T
4      '       d   \#        Yj4      pMYz,          '       d   Yz,          P$                  pMrT
P&                  \(        P*                  8X  d8   \-        4       ;_uu_ 4        TP/                  T
4      P$                  pRRR4       MTP/                  T
4      P$                  p T'       d   \4        P6                  ! X4       R# \4        P6                  ! \9        T
4       RX 24       R# T'       d!   T	'       d   \;        Y	4       R# \3        R4      h. p\=        T	4       F  p
Yz,          pT'       d+   \!        T
4      '       d   \#        Yj4      pMFTP$                  pM9T
P                  '       d   RpM$T
P&                  \(        P*                  8X  d   R	pMR
pTP?                  \9        T
4      T34       K  	  T'       d   \A        R T 4       4      M^ pT'       d   \A        R T 4       4      M^ pRTT3,          pT F,  w  pp\4        P6                  ! TPC                  TT4      4       K.  	  R#   \         dx   pTP                  \
        P                  8X  dS   \        P                  R4       \        T4      '       d   TP                  4       p Rp?EL\        P                  R4       h h Rp?ii ; i  + '       g   i     EL; i  \         d1   pTP                  \
        P0                  8X  d   \3        R4      hh Rp?ii ; i)z
Generate codes.

Generate codes from OATH accounts stored on the YubiKey.
Provide a query string to match one or more specific accounts.
Accounts of type HOTP, or those that require touch, require a single match to be
triggered.
r$   z2Corrupted data in OATH accounts, attempting to fixzUnable to fix memory failureNzTouch account timed out!z  zNo matching account found.z[Requires Touch]z[HOTP Account]rn   c              3   s<   "   T F  w  r\        V4      x  K  	  R # 5irr   r   r   Znrw      &  r/   r   code.<locals>.<genexpr>       8fq3q66   c              3   s<   "   T F  w  r\        V4      x  K  	  R # 5irr   r   r   r   r/   r   r     r   r   z{:<%d}  {:>%d})"rW   r)   Zcalculate_allr   rQ   r   ZMEMORY_FAILUREr@   rS   r   Zerrorry   r9   r   Ztouch_requiredr"   r   r   rf   r   r   r   r#   Zcalculate_codeZ SECURITY_CONDITION_NOT_SATISFIEDr   r6   r7   rm   rq   Zsortedr5   ZmaxZformat)r-   rv   ru   ZsinglerT   rH   r$   ZentriesrV   rt   rp   rf   ZoutputscodeZcodestrZlongest_nameZlongest_codeZ
format_strr|   Zresultr   r/   r   r   c  s   , #*ggi G'') GLLNE7E
5zQQx	~~'6++>>Y^^3')) !( 6 6t < B B *)
 $2248>>E
 JJuJJ*T*+2eW56	 ,6775MD=DD>>-g<G"jjG$$$,9>>1*NNJt,g67 " =Ds888<Cs888%|(DD
#LD&JJz((v67 $C  	442$$$NNOP'00!//1;<	2 *))  	ttr:::899	sf   J: M  M  1M 1L?M M :L<AL7 L77L<?M	
M M N+N		Nz-fz--forcez confirm rename without promptingc                s  a \        WV4       V P                  R,          pVP                  4       p\        WqR4      p\	        V4      ^ 8X  d   \
        P                  ! R4       R# \	        V4      ^8X  EdD   V^ ,          p	RV9   d   VP                  R^4      w  rMRp
\        WV	P                  V	P                  4      o\        ;QJ d    V3R lV 4       F  '       g   K   RM	  RM! V3R lV 4       4      '       d   \        RSP                  4        R	24      hV'       g-   \
        P                  ! R
\        V	4       R2RRR7      '       dS   VP!                  V	P"                  W*4       \
        P                  ! R\        V	4       RSP                  4        R24       R# \
        P                  ! R4       R# \%        W4       R# )z
Rename an account (requires YubiKey 5.3 or later).


QUERY  a query to match a single account (as shown in "list")
NAME   the name of the account (use "<issuer>:<name>" to specify issuer)
r$   TNo matches, nothing to be done.r   Nc              3   r   rr   r   )r   rp   new_idr   r/   r   Zrename.<locals>.<genexpr>  s     3UTww& Ur   FzAnother account with ID z  already exists on this YubiKey.zRename account: r   r   r;   zRenamed z to .zRename aborted by user.)rW   r)   r   ry   r   r6   r7   r   r   r   r   r   r   rk   r=   rm   Zrename_credentialrj   rq   )r-   ru   r|   rA   rT   rH   r$   rt   ro   rp   r   r   s   &&&&&&     @r/   renamer     sb     #*ggi G$$&E5&D
4yA~

45	TaAw$;::c1-LFDF t~~t{{K33U33333U333*6==?*; <2 2  MM":d#3"4B7  %%dggt<JJ*T"2!347HJKJJ01 	S'r1   z"confirm deletion without promptingc                s,   \        WV4       V P                  R,          pVP                  4       p\        WaR4      p\	        V4      ^ 8X  d   \
        P                  ! R4       R# \	        V4      ^8X  d   V^ ,          pV'       g-   \
        P                  ! R\        V4       R2RRR7      '       dA   VP                  VP                  4       \
        P                  ! R\        V4       R	24       R# \
        P                  ! R
4       R# \        W4       R# )zz
Delete an account.

Delete an account from the YubiKey.


QUERY  a query to match a single account (as shown in "list")
r$   Tr   zDelete account: r   Fr   zDeleted r   zDeletion aborted by user.N)rW   r)   r   ry   r   r6   r7   r=   rm   Zdelete_credentialrj   rq   )	r-   ru   rA   rT   rH   r$   rt   ro   rp   s	   &&&&&    r/   deleter     s      #*ggi G$$&E5&D
4yA~

45	TaAwMM":d#3"4B7  %%dgg.JJ*T"2!3156JJ23 	S'r1   )rc   )r   Z7Z8)^Zloggingr   Zbase64r   Ztypingr   r6   Zcryptography.x509r   r   r   Z	ykman.pivr   Zyubikit.corer   Zyubikit.core.smartcardr   r   r	   Zyubikit.managementr
   Zyubikit.oathr   r   r   r   r   r   r0   r   r   r   r   Zsettingsr   Zutilr   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   Z	getLoggerZ__name__r@   Zpass_contextZcommandr&   r>   ZoptionZclick_password_optionZclick_remember_optionrI   rW   rX   Zgroupr[   rb   rH   rg   ri   Zclick_touch_optionZclick_show_hidden_optionrm   rq   ry   r{   r}   r   r~   Zargumentr   r|   ZChoicer   ZINTZFiler   r   r   r   r   r   r   r   r   rZ   r1   r/   <module>r      sk  8  	    %  * " E E )  R Q    " 
		8	$ -./V   0VD /  /. X   X< ,A 
 	0	 +'DT / / 	&	 d$+RS5  T   5p S   S@	 !	&;  ;" \\)T(S  !<</4.G 
)
4' :  ( ( 
#6G	I	NN	< 	o	&	- 	N	#$$	/ 		2 dJ%GH	1 	H	 	D		V	 	< 	2 DS     		 I H  FDSN H H 
5%P&      Q &> 
(EJJt$4fE\C      F \C~0f 
&dM46MNdJ3GH   I O   . 
%4	?	 Q8   5   Q8h 
dIt2TU)(   V    )(X 
dIt2VW(   X   (r1   