ó
    ûÞ jQ  ã                  ó¤   • S SK Jr  S SKrS SKJr  SSKJr  SSKJr  SSK	J
r
Jr  SSKJr  SS	KJr  SS
KJr  SS/r " S S\
5      r " S S\5      rg)é    )ÚannotationsN)Úcasté   )ÚHeadersLike)Úconstruct_type)ÚSyncAPIResourceÚAsyncAPIResource)ÚInvalidWebhookSignatureError)Úwebhook_signature_matches)ÚUnwrapWebhookEventÚWebhooksÚAsyncWebhooksc                  óZ   • \ rS rSrSS.       S	S jjrSSS.         S
S jjrSrg)r   é   N©Úsecretc          	     ó´   • Uc  U R                   R                  nU R                  XUS9  [        [        [        [        [        R                  " U5      S95      $ )úKValidates that the given payload was sent by OpenAI and parses the payload.©ÚpayloadÚheadersr   ©Útype_Úvalue)Ú_clientÚwebhook_secretÚverify_signaturer   r   r   ÚjsonÚloads)Úselfr   r   r   s       Ú\/var/www/html/gaurav/venv/lib/python3.13/site-packages/openai/resources/webhooks/webhooks.pyÚunwrapÚWebhooks.unwrap   sR   € ð ‰>Ø—\‘\×0Ñ0ˆFà×Ñ gÀvÐÑNäÜÜÜ(Ü—j’j Ó)ñó
ð 	
ó    é,  ©r   Ú	tolerancec               óˆ   • Uc  U R                   R                  nUc  [        S5      e[        XX4S9(       d  [	        S5      Seg©a,  Validates whether or not the webhook payload was sent by OpenAI.

Args:
    payload: The webhook payload
    headers: The webhook headers
    secret: The webhook secret (optional, will use client secret if not provided)
    tolerance: Maximum age of the webhook in seconds (default: 300 = 5 minutes)
Nz�The webhook secret must either be set using the env var, OPENAI_WEBHOOK_SECRET, on the client class, OpenAI(webhook_secret='123'), or passed to this functionr&   zAThe given webhook signature does not match the expected signature©r   r   Ú
ValueErrorÚ_webhook_signature_matchesr
   ©r    r   r   r   r'   s        r!   r   ÚWebhooks.verify_signature(   sU   € ð  ‰>Ø—\‘\×0Ñ0ˆFà‰>Üð`óð ô
 *¨'À6×_Ü.ØSóàðð `r$   © ©r   ústr | bytesr   r   r   ú
str | NoneÚreturnr   ©
r   r1   r   r   r   r2   r'   Úintr3   ÚNone©Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__r"   r   Ú__static_attributes__r/   r$   r!   r   r      st   † ð "ñ
àð
ð ð
ð
 ð
ð 
õ
ð4 "Øñàðð ðð
 ðð ðð 
÷ð r$   c                  óZ   • \ rS rSrSS.       S	S jjrSSS.         S
S jjrSrg)r   éG   Nr   c          	     ó  • Uc  U R                   R                  nU R                  XUS9  [        U[        5      (       a  UR                  S5      OUn[        [        [        [        [        R                  " U5      S95      $ )r   r   zutf-8r   )r   r   r   Ú
isinstanceÚbytesÚdecoder   r   r   r   r   )r    r   r   r   Úbodys        r!   r"   ÚAsyncWebhooks.unwrapH   sn   € ð ‰>Ø—\‘\×0Ñ0ˆFà×Ñ gÀvÐÑNä*4°W¼e×*DÑ*Dˆw�~‰~˜gÔ&È'ˆÜÜÜÜ(Ü—j’j Ó&ñó
ð 	
r$   r%   r&   c               óˆ   • Uc  U R                   R                  nUc  [        S5      Se[        XX4S9(       d  [	        S5      egr)   r*   r-   s        r!   r   ÚAsyncWebhooks.verify_signature^   sS   € ð  ‰>Ø—\‘\×0Ñ0ˆFà‰>Üð`óð ðô
 *¨'À6×_Ü.Ð/rÓsÐsð `r$   r/   r0   r4   r7   r/   r$   r!   r   r   G   s{   † ð "ñ
àð
ð ð
ð
 ð
ð 
õ
ð6 "Øñtàðtð ðtð
 ðtð ðtð 
÷tð tr$   )Ú
__future__r   r   Útypingr   Ú_typesr   Ú_modelsr   Ú	_resourcer   r	   Ú_exceptionsr
   Úlib._webhooksr   r,   Ú#types.webhooks.unwrap_webhook_eventr   Ú__all__r   r   r/   r$   r!   Ú<module>rP      sH   ðõ #ã Ý å !Ý %ß :Ý 7Ý TÝ Eà�Ð
'€ô2ˆô 2ôj1tÐ$õ 1tr$   