�
M�g� � � � d dl mZ d dlmZ d dlZd dlZd dlmZ d dlm Z ddl
mZ ddl
mZ ddl
m
Z
dd l
mZ dd
l
mZ ddlmZ ddlmZ dd
lmZ ddlmZ ddlmZ ddlmZ G d� de� � Z G d� dee � � ZdS )� )�annotationsN)�datetime)�timezone� )�
base64_decode)�
base64_encode)�bytes_to_int)�int_to_bytes)�
want_bytes)�BadSignature)�BadTimeSignature)�SignatureExpired)�_TSerialized)�
Serializer)�Signerc � � � e Zd ZdZdd�Zdd�Zdd�Zej dd d�� � Z ej d!d"d�� � Z dd#� fd�
Z d$d%d�Z
� xZS )&�TimestampSignerz�Works like the regular :class:`.Signer` but also records the time
of the signing and can be used to expire signatures. The
:meth:`unsign` method can raise :exc:`.SignatureExpired` if the
unsigning failed because the signature is expired.
�return�intc �B � t t j � � � � S )zTReturns the current timestamp. The function must return an
integer.
)r �time)�selfs �b/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/itsdangerous/timed.py�
get_timestampzTimestampSigner.get_timestamp s � � �4�9�;�;���� �tsr c �B � t j |t j �� � S )a Convert the timestamp from :meth:`get_timestamp` into an
aware :class`datetime.datetime` in UTC.
.. versionchanged:: 2.0
The timestamp is returned as a timezone-aware ``datetime``
in UTC rather than a naive ``datetime`` assumed to be UTC.
)�tz)r �
fromtimestampr �utc)r r s r �timestamp_to_datetimez%TimestampSigner.timestamp_to_datetime# s � � �%�b�X�\�:�:�:�:r �value�str | bytes�bytesc �� � t |� � }t t | � � � � � � � }t | j � � }||z |z }||z | � |� � z S )z:Signs the given string and also attaches time information.)r r r
r �sep�
get_signature)r r"