+
    :iT  c                   s   ^ RI t ^ RIt^ RIt^ RIHt ^ RIHt ^ RIHt ^ RIH	t	 ^ RI
Ht ^RIHt ] P                  ! ]4      tR R	 lt. ROt]P&                  ]3R
 R lltR R ltRR R lltRR R lltRR R lltR# )i    N)datetime)Iterable)modhex_encode)parse_b32_key)YubiOtpSession)KEYBOARD_LAYOUTc                0    V ^8  d   QhR\         R\        /# )   sessionreturn)r   ZboolZformat   "./usr/lib/python3.14/site-packages/ykman/otp.py__annotate__r   +   s     C C^ C C    c                sB    V P                   P                  ^R^4      R8H  # )zoCheck if the OTP application of a FIPS YubiKey is in FIPS approved mode.

:param session: The YubiOTP session.
r   s   )ZbackendZsend_and_receive)r      &r   is_in_fips_moder   +   s"    
 ??++D#q9UBBr   c                s^    V ^8  d   QhR\         R\        R\        \        ,          R\        /# )r   lengthkeyboard_layout	blocklistr	   )intr   r   strr
   r   r   r   r   6   s4     > >>$> }> 		>r   c                s   VP                   P                  4        Uu. uF  q3V9  g   K  VNK  	  pp\        P                  ! 4       pRP	                  \        V 4       Uu. uF  qeP                  V4      NK  	  up4      # u upi u upi )zGenerate a random password.

:param length: The length of the password.
:param keyboard_layout: The keyboard layout.
:param blocklist: The list of characters to block.
 )ZvalueZkeysrandomZSystemRandomjoinZrangeZchoice)r   r   r   ZkZcharsZsrZ_s   &&&    r   generate_static_pwr   6   sp     (--224K418JQQ4EK				B77eFm<mIIe$m<== L<s   A?A?Bc                r   )r   valr	   )r   bytesr
   r   r   r   r   F   s     " " " "r   c                sf     \         P                  V 4      #   \         d    \        T 4      u # i ; i)zQParse a secret key encoded as either Hex or Base32.

:param val: The secret key.
)r   ZfromhexZ
ValueErrorr   )r   r   r   parse_oath_keyr   F   s0    
"}}S!! "S!!"s    00c                s<    V ^8  d   QhR\         R\        R\        /# )r   responsedigitsr	   )r   r   r   r
   r   r   r   r   Q   s!     5 5u 5c 5# 5r   c                s    V R,          ^,          p\         P                  ! RWR 4      ^ ,          R,          pRV,          V^
V,          ,          ,          # )zFormat an OATH code from a hash response.

:param response: The response.
:param digits: The number of digits in the OATH code.
z>INiz%%0%ddi)structZunpack_from)r   r   ZoffsZcodes   &&  r   format_oath_coder    Q   sK     B<#DdHUO4Q7*DDv$V"344r   c                s<    V ^8  d   QhR\         R\         R\        /# )r   	timestampperiodr	   )r   r   r
   r   r   r   r   \   s!     7 7c 73 7 7r   c                sN    \         P                  ! R\        W,          4      4      # )zFormat a HMAC-SHA1 challenge based on an OATH timestamp and period.

:param timestamp: The timestamp.
:param period: The period.
z>q)r   Zpackr   )r!   r"   s   &&r   time_challenger#   \   s     ;;tS!4566r   c                s    V ^8  d   QhR\         R\        R\        R\        R\        R,          R\        R,          R\        /# )	r   serial	public_id
private_idkeyaccess_codeNr!   r	   )r   r   r    r   r
   r   r   r   r   e   sV        
	
  $ 	r   c                s   T;'       g    \         P                  ! 4       pRP                  \        V 4      \	        V4      VP                  4       VP                  4       V'       d   VP                  4       MRVP                  RR7      R.4      # )zProduce a CSV line in the "Yubico" format.

:param serial: The serial number.
:param public_id: The public ID.
:param private_id: The private ID.
:param key: The secret key.
:param access_code: The access code.
Z,r   Zseconds)Ztimespec)r    Znowr   r   r   ZhexZ	isoformat)r$   r%   r&   r'   r(   r!   Ztss   &&&&&& r   
format_csvr)   e   sn      
	$	$hllnB88K)$NNGGI!,KOO"LL)L,	

 
r   )Z	Z
Z )i   )i   )NN)Zloggingr   r   r    Ztypingr   Zyubikit.core.otpr   Zyubikit.oathr   Zyubikit.yubiotpr   Z	scancodesr   Z	getLoggerZ__name__Zloggerr   ZDEFAULT_PW_CHAR_BLOCKLISTZMODHEXr   r   r    r#   r)   ) r   r   <module>r*      sl   8      * & * &			8	$C . 
 (7'='=8> "57 r   