HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/projects/env/lib64/python3.10/site-packages/stripe/__pycache__/webhook.cpython-310.pyc
o

&we^
�@slddlZddlZddlZddlmZddlmZddlZddlmZm	Z	Gdd�de
�ZGdd�de
�ZdS)	�N)�OrderedDict)�sha256)�error�utilc@s"eZdZdZeedfdd��ZdS)�Webhooki,NcCsJt|d�r
|�d�}t�||||�tj|td�}tj�	||p!tj
�}|S)N�decode�utf-8)�object_pairs_hook)�hasattrr�WebhookSignature�
verify_header�json�loadsr�stripe�Event�construct_from�api_key)�payload�
sig_header�secret�	tolerancer�data�event�r�G/home/arjun/projects/env/lib/python3.10/site-packages/stripe/webhook.py�construct_events

zWebhook.construct_event)�__name__�
__module__�__qualname__�DEFAULT_TOLERANCE�staticmethodrrrrrrs
�rc@s6eZdZdZedd��Zedd��Zed	dd��ZdS)
r�v1cCs$tj|�d�|�d�td�}|��S)Nr)�msg�	digestmod)�hmac�new�encoder�	hexdigest)rr�macrrr�_compute_signature s�z#WebhookSignature._compute_signaturecsDdd�|�d�D�}tdd�|D�d�}�fdd�|D�}||fS)NcSsg|]}|�dd��qS)�=�)�split��.0�irrr�
<listcomp>+szBWebhookSignature._get_timestamp_and_signatures.<locals>.<listcomp>�,cSs g|]}|ddkr|d�qS)r�t�rr-rrrr0,� rcs g|]}|d�kr|d�qS)rr3rr-��schemerrr0-r4)r,�int)�headerr6�
list_items�	timestamp�
signaturesrr5r�_get_timestamp_and_signatures)sz.WebhookSignature._get_timestamp_and_signaturesNcs�z|�||j�\}}Wntyt�d||��w|s&t�d|j||��d||f}|�||��t�fdd�|D��sDt�d||��|rW|t��|krWt�d|||��dS)	Nz6Unable to extract timestamp and signatures from headerz+No signatures found with expected scheme %sz%d.%sc3s�|]	}t��|�VqdS�N)r�secure_compare)r.�s��expected_sigrr�	<genexpr>Gs�z1WebhookSignature.verify_header.<locals>.<genexpr>z?No signatures found matching the expected signature for payloadz)Timestamp outside the tolerance zone (%d)T)r<�EXPECTED_SCHEME�	Exceptionr�SignatureVerificationErrorr)�any�time)�clsrr8rrr:r;�signed_payloadrr@rr0sD�������zWebhookSignature.verify_headerr=)	rrrrCr r)r<�classmethodrrrrrrs

r)
r$r
rG�collectionsr�hashlibrrrr�objectrrrrrr�<module>s