+
    :i  c                   s    ^ RI t ^ RIt^ RIHt ^ RIHtHt ^ RIHtHtH	t	H
t
 ] P                  ! ]4      tRtR R ltR R	 ltRR
 R lltR R ltR R ltR# )i    N)time)SW	ApduError)	OATH_TYPE
CredentialCredentialDataOathSessionZ23456789BCDFGHJKMNPQRTVWXYc                0    V ^8  d   QhR\         R\        /#    
credentialreturn)r   boolZformat   "//usr/lib/python3.14/site-packages/ykman/oath.py__annotate__r   )   s     * ** * *    c                s     V P                   R8H  # )z#Check if OATH credential is hidden.Z_hidden)issuerr
      &r   	is_hiddenr   )   s    	))r   c                sF    V ^8  d   QhR\         \        ,          R\        /# r   )r   r   r   r   r   r   r   r   .   s#     S Sn4 S Sr   c                sj    V P                   \        P                  8H  ;'       d    V P                  R8H  # )z"Check if OATH credential is steam.ZSteam)	oath_typer   TOTPr   r   r   r   is_steamr   .   s*    9>>1RRj6G6G76RRr   c                sV    V ^8  d   QhR\         R\        R\        R,          R\        /# )r	   appr
   	timestampNr   )r   r   intZstrr   r   r   r   r   3   s0      	",9<tr   c                s   \        T;'       g    \        4       4      pV P                  VP                  \        P
                  ! RV^,          4      4      pVR,          ^,          p\        P                  ! RW4V^,            4      ^ ,          R,          p. p\        ^4       FI  pVP                  \        V\        \        4      ,          ,          4       V\        \        4      ,          pKK  	  RP                  V4      # )zCalculate steam codes.z>qz>IiZ i)r   r    Z	calculateidstructZpackZunpackrangeappendSTEAM_CHAR_TABLElenZjoin)r   r
   r   ZrespZoffsetZcodeZcharsis   &&&     r   calculate_steamr#   3   s     I''(I==D)r/(JKD"X_F==tVaZ89!<zIDE1X%dS1A-B&BCD%&&  775>r   c                r   r	   r   r   r   r   r   r   r   r   r   B   s        r   c                s    V P                   # )z*Check if OATH application is in FIPS mode.)Zlocked)r   r   r   is_in_fips_moder&   B   s    ::r   c                r   r$   r%   r   r   r   r   r   G   s      + $ r   c                sd   \         P                  R4       V P                  4       p. pV F  pVP                  \        P
                  8X  g   K$  VP                  '       d   K8  \        ^4       F9  p V P                  V4       \         P                  RVP                  : 24        K~  	  VP                  VP                  4       \         P                  RVP                  : 24       K  	  \!        V4      ^8X  d0   \         P#                  R4       V P%                  V^ ,          4       R# \         P                  R\!        V4       24       R	#   \         dW   pTP                  \        P                  8X  d2   T^ 8X  d$   \         P                  RTP                  : 24        Rp?EK<  h Rp?ii ; i)
z7Checks for credential in a broken state and deletes it.zProbing for broken credentialszCredential appears OK: zMemory failure in: Nz!Credential appears to be broken: zDeleting broken credentialTz+Requires a single broken credential, found F)loggerZdebugZlist_credentialsr   r   r   Ztouch_requiredr   Zcalculate_coder   r   Zswr   ZMEMORY_FAILUREr   Zwarningr!   ZinfoZdelete_credential)r   ZcredsZbrokenZcr"   Zes   &     r   delete_broken_credentialr(   G   sA   
LL12  "EF;;)..(1A1A1A1X	&&q)LL#:144(!CD	  add#!B144(KL " 6{a01fQi(
NN@VNO! ! ttr0006"LL+>qtth)GH s   14EF/A	F*)F**F/)N)Zloggingr   r    Zyubikit.core.smartcardr   r   Zyubikit.oathr   r   r   r   Z	getLoggerZ__name__r'   r    r   r   r#   r&   r(   ) r   r   <module>r)      sK   8    0 K K			8	$ 0 *
S

r   