HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //proc/thread-self/root/lib/python3/dist-packages/pymacaroons/__pycache__/verifier.cpython-38.pyc
U

BQ�YQ�@s�ddlZzddlmZWn ek
r8ddlmZYnXddlmZddl	m
Z
ddlmZm
Z
ddlmZmZmZmZGdd	�d	e�ZdS)
�N)�compare_digest)�equals)�HashSignaturesBinder)�!MacaroonInvalidSignatureException)� FirstPartyCaveatVerifierDelegate� ThirdPartyCaveatVerifierDelegate)�convert_to_bytes�convert_to_string�generate_derived_key�hmac_digestc@s`eZdZdd�Zdd�Zdd�Zdd�Zdd
d�Zddd
�Zdd�Z	dd�Z
dd�Zdd�Zd	S)�VerifiercCs*g|_|jg|_d|_t�|_t�|_dS�N)�
predicates�verify_exact�	callbacks�calculated_signaturer�$first_party_caveat_verifier_delegater�$third_party_caveat_verifier_delegate)�self�r�6/usr/lib/python3/dist-packages/pymacaroons/verifier.py�__init__s
��zVerifier.__init__cCs$|dkrtd��|j�t|��dS)NzPredicate cannot be none.)�	TypeErrorr�appendr	�rZ	predicaterrr�
satisfy_exact$szVerifier.satisfy_exactcCs"t|d�std��|j�|�dS)N�__call__z*General caveat verifiers must be callable.)�hasattrrrr)r�funcrrr�satisfy_general)s
zVerifier.satisfy_generalcCs
||jkSr
)rrrrrr.szVerifier.verify_exactNcCstt|��}|�||||�Sr
)r
r�verify_discharge)r�macaroon�key�discharge_macaroonsrrr�verify1s�zVerifier.verifycCs^t||j�}|�||||�}||kr>t�t|��t�|���}|�|j	t�|��sZt
d��dS)NzSignatures do not matchT)rZidentifier_bytes�_verify_caveats�binasciiZ	unhexlifyrZbind_signatureZhexlify�_signatures_matchZsignature_bytesr)r�rootZ	discharger"r#rrrrr :s,�����zVerifier.verify_dischargecCs.|jD]"}|�|||||�r|�||�}q|Sr
)Zcaveats�_caveat_met�_update_signature)rr(r!r#�	signature�caveatrrrr%Qs
�zVerifier._verify_caveatscCs2|��r|j�|||�S|j�||||||�SdSr
)�first_partyrZverify_first_party_caveatrZverify_third_party_caveat)rr(r,r!r#r+rrrr)[s ����zVerifier._caveat_metcCs(|��r|j�||�S|j�||�SdSr
)r-rZupdate_signaturer)rr,r+rrrr*ms����zVerifier._update_signaturecCstt|�t|��Sr
)�constant_time_comparer)rZmacaroon_signatureZcomputed_signaturerrrr'{s�zVerifier._signatures_match)N)N)
�__name__�
__module__�__qualname__rrrrr$r r%r)r*r'rrrrrs
	

r)r&Zhmacrr.�ImportErrorZpymacaroons.utilsrZpymacaroons.bindersrZpymacaroons.exceptionsrZpymacaroons.caveat_delegatesrrrr	r
r�objectrrrrr�<module>s