+
     hH%  c                  s    ^ RI H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 ^RIHtHt ^R	IHtHt ]P2                  ! ]4      t ! R
 R4      tR# )i    )annotationsN)IntEnumunique)AnyMappingSequence)cbor)	CtapError)PublicKeyCredentialDescriptorPublicKeyCredentialUserEntity_as_cbor)Ctap2Info)PinProtocol_PinUvc                  s>   ] tR t^0tRt] ! R R]4      4       t] ! R R]4      4       t] ! R R]4      4       t	]
R R	 l4       t]
R
 R l4       t]
R R l4       tR R ltR%R ltR R ltR R ltR R ltR R ltR R ltR R ltR R ltR  R! ltR" R# ltR$tR# )&CredentialManagementaM  Implementation of a draft specification of the Credential Management API.
WARNING: This specification is not final and this class is likely to change.

:param ctap: An instance of a CTAP2 object.
:param pin_uv_protocol: An instance of a PinUvAuthProtocol.
:param pin_uv_token: A valid PIN/UV Auth Token for the current CTAP session.
c                  s2    ] tR t^9t^t^t^t^t^t^t	^t
RtR# )CredentialManagement.CMD N)__name__
__module____qualname____firstlineno__GET_CREDS_METADATAENUMERATE_RPS_BEGINENUMERATE_RPS_NEXTENUMERATE_CREDS_BEGINENUMERATE_CREDS_NEXTDELETE_CREDENTIALUPDATE_USER_INFO__static_attributes__r       8/usr/lib/python3.14/site-packages/fido2/ctap2/credman.pyCMDr   9   s,    !"! $# r   r    c                  s"    ] tR t^Ct^t^t^tRtR# )CredentialManagement.PARAMr   N)r   r   r   r   
RP_ID_HASHCREDENTIAL_IDUSERr   r   r   r   PARAMr!   C   s    
r   r%   c                  sB    ] tR t^It^t^t^t^t^t^t	^t
^t^	t^
t^tRtR# )CredentialManagement.RESULTr   N)r   r   r   r   ZEXISTING_CRED_COUNTZMAX_REMAINING_COUNTZRPr"   	TOTAL_RPSr$   r#   Z
PUBLIC_KEYTOTAL_CREDENTIALSZCRED_PROTECTZLARGE_BLOB_KEYr   r   r   r   RESULTr&   I   s<    ""
	
 r   r)   c                    V ^8  d   QhRRRR/#    infor   returnboolr   Zformat   "r   __annotate__!CredentialManagement.__annotate__X   s      4 D r   c                	s    V P                   P                  R 4      '       d   R# RV P                  9   d   RV P                   9   d   R# R# )credMgmtTZFIDO_2_1_PREZcredentialMgmtPreviewF)optionsgetZversionsr-      &r   is_supportedZ!CredentialManagement.is_supportedW   s8    <<J''T]]*/F$,,/Vr   c               r*   r+   r   r0   r1   r   r2   r3   a   s     2 2$ 24 2r   c                	J    \        V P                  P                  R 4      4      # )r4   r/   r5   r6   r7   r8   r   is_update_supportedZ(CredentialManagement.is_update_supported`   s     DLL$$Z011r   c               r*   r+   r   r0   r1   r   r2   r3   f   s     7 7D 7T 7r   c                	r:   )ZperCredMgmtROr;   r7   r8   r   is_readonly_supportedZ*CredentialManagement.is_readonly_supportede   s    DLL$$_566r   c               $    V ^8  d   QhRRRRRR/# )r,   ctapr   pin_uv_protocolr   pin_uv_tokenbytesr   r0   r1   r   r2   r3   i   s(     
< 
<
< %
< 	
<r   c                	s    V P                  VP                  4      '       g   \        R 4      hWn        \	        W#4      V n        R# )z4Authenticator does not support Credential ManagementN)r9   r-   
ValueErrorr?   r   pin_uv)selfr?   r@   rA   s   &&&&r   __init__ZCredentialManagement.__init__i   s6       ++STT	_;r   Nc                	s   R VRV/pV'       d   \         P                  ! RV4      pVe   V\        P                  ! V4      ,          pV P                  P
                  P                  VR&   V P                  P
                  P                  V P                  P                  V4      VR&   V P                  P                  ! R/ VB # )sub_cmdZsub_cmd_paramsz>Br@   Zpin_uv_paramr   )structZpackr   ZencoderD   ZprotocolZVERSIONZauthenticateZtokenr?   Zcredential_mgmt)rE   rG   ZparamsauthkwargsZmsgs   &&&&  r   _callZCredentialManagement._callu   s    W&6?++dG,C!t{{6**(,(<(<(D(DF$%%)[[%9%9%F%F!!3&F>" yy((2622r   c                   V ^8  d   QhRR/# r,   r.   Mapping[int, Any]r   r0   r1   r   r2   r3      s     	G 	G/ 	Gr   c                T    V P                  \        P                  P                  4      # )a+  Get credentials metadata.

This returns the existing resident credentials count, and the max
possible number of remaining resident credentials (the actual number of
remaining credentials may depend on algorithm choice, etc).

:return: A dict containing EXISTING_CRED_COUNT, and MAX_REMAINING_COUNT.
)rK   r   r    r   rE   r8   r   get_metadataZ!CredentialManagement.get_metadata   s      zz.22EEFFr   c               rL   rM   r   r0   r1   r   r2   r3      s     H H%6 Hr   c                rO   )a   Start enumeration of RP entities of resident credentials.

This will begin enumeration of stored RP entities, returning the first
entity, as well as a count of the total number of entities stored.

:return: A dict containing RP, RP_ID_HASH, and TOTAL_RPS.
)rK   r   r    r   rP   r8   r   enumerate_rps_beginZ(CredentialManagement.enumerate_rps_begin   s      zz.22FFGGr   c               rL   rM   r   r0   r1   r   r2   r3      s     S S$5 Sr   c                X    V P                  \        P                  P                  RR7      # )zGet the next RP entity stored.

This continues enumeration of stored RP entities, returning the next
entity.

:return: A dict containing RP, and RP_ID_HASH.
FrI   )rK   r   r    r   rP   r8   r   enumerate_rps_nextZ'CredentialManagement.enumerate_rps_next   s$     zz.22EEEzRRr   c               rL   r,   r.   zSequence[Mapping[int, Any]]r   r0   r1   r   r2   r3      s      : r   c                sn    V P                  4       pT\
        P                  P                  ,          pT^ 8X  d   . # \        ^T4       Uu. uF  q@P                  4       NK  	  ppT.T,           #   \         d7   pTP                  \        P                  P                  8X  d   . u Rp?# h Rp?ii ; iu upi )zfConvenience method to enumerate all RPs.

See enumerate_rps_begin and enumerate_rps_next for details.
N)
rR   r   codeERRNO_CREDENTIALSr   r)   r'   rangerU   )rE   firsteZn_rps_rests   &     r   enumerate_rpsZ"CredentialManagement.enumerate_rps   s    
	,,.E
 *11;;<A:I38E?C?a'')?Cw~  	vv555		 Ds)   A. 
B2.B/9*B*#B/)B**B/c               r*   )r,   
rp_id_hashrB   r.   rN   r   r0   r1   r   r2   r3      s     
 
 
:K 
r   c                s    V P                  \        P                  P                  \        P                  P
                  V/4      # )am  Start enumeration of resident credentials.

This will begin enumeration of resident credentials for a given RP,
returning the first credential, as well as a count of the total number
of resident credentials stored for the given RP.

:param rp_id_hash: SHA256 hash of the RP ID.
:return: A dict containing USER, CREDENTIAL_ID, PUBLIC_KEY, and
    TOTAL_CREDENTIALS.
)rK   r   r    r   r%   r"   )rE   r`      &&r   enumerate_creds_beginZ*CredentialManagement.enumerate_creds_begin   s8     zz $$::!''22J?
 	
r   c               rL   rM   r   r0   r1   r   r2   r3      s     U U&7 Ur   c                rS   )zGet the next resident credential stored.

This continues enumeration of resident credentials, returning the next
credential.

:return: A dict containing USER, CREDENTIAL_ID, and PUBLIC_KEY.
FrT   )rK   r   r    r   rP   r8   r   enumerate_creds_nextZ)CredentialManagement.enumerate_creds_next   s$     zz.22GGezTTr   c               rL   rV   r   r0   r1   r   r2   r3      s      2M r   c                sp    V P                   ! V/ VB p\        ^TP                  \        P                  P                  ^4      4       Uu. uF  pT P                  4       NK  	  ppT.T,           #   \         d7   pTP                  \        P                  P                  8X  d   . u Rp?# h Rp?ii ; iu upi )zConvenience method to enumerate all resident credentials for an RP.

See enumerate_creds_begin and enumerate_creds_next for details.
N)rb   r   rW   rX   rY   rZ   r6   r   r)   r(   rc   )rE   ZargsrJ   r[   r\   r]   r^   s   &*,    r   enumerate_credsZ$CredentialManagement.enumerate_creds   s    
	..??E 599188JJAN
 %%' 	 
 w~  	vv555		
s)   A/ 
B3/B0:*B+$B0*B++B0c               r*   )r,   cred_idr   r.   Noner   r0   r1   r   r2   r3      s     * *#@ *T *r   c                s&   \         P                  ! V4      p\        P                  RV 24       V P	                  \
        P                  P                  \
        P                  P                  \        V4      /4       \        P                  R4       R# )znDelete a resident credential.

:param cred_id: The PublicKeyCredentialDescriptor of the credential to delete.
zDeleting credential with ID: zCredential deletedN)r   	from_dictloggerdebugrK   r   r    r   r%   r#   r
   r-   )rE   re   ra   r   delete_credZ CredentialManagement.delete_cred   sk    
 099'B4WI>?

 $$66!''55x7HI	
 	()r   c               r>   )r,   re   r   	user_infor	   r.   rf   r   r0   r1   r   r2   r3      s(     4 4.4 14 
	4r   c           	     s   \         P                  V P                  P                  4      '       g   \	        R4      h\
        P                  ! V4      p\        P                  ! V4      p\        P                  RV RV 24       V P                  \         P                  P                  \         P                  P                  \        V4      \         P                  P                   \        V4      /4       \        P                  R4       R# )zUpdate the user entity of a resident key.

:param cred_id: The PublicKeyCredentialDescriptor of the credential to update.
:param user_info: The user info update.
z/Authenticator does not support update_user_infozUpdating credential: z with user info: zCredential user info updatedN)r   r<   r?   r-   rC   r   rg   r	   rh   ri   rK   r    r   r%   r#   r
   r$   )rE   re   rk   s   &&&r   update_user_infoZ%CredentialManagement.update_user_info   s     $77		GGNOO/99'B1;;IF	,WI5FykRS

 $$55$**88(7:K$**//)1D	
 	23r   )r?   rD   )NT)r   r   r   r   Z__doc__r   r   r    r%   r)   Zstaticmethodr9   r<   r=   rF   rK   rQ   rR   rU   r_   rb   rc   rd   rj   rl   r   r   r   r   r   r   0   s      g       
      2 2 7 7
<
3	GHS"
 U&*4 4r   r   )Z
__future__r    ZloggingrH   Zenumr   r   Ztypingr   r   r   Z r   r?   r   Zwebauthnr   r	   r
   Zbaser   r   Zpinr   r   Z	getLoggerr   rh   r   r   r   r   <module>rm      sM   8 #     ) )   
  $			8	$R4 R4r   