Format: application/x-python-code
1 o
2
3 .'h�% � @ s� d dl mZ d dlmZ d dlZd dlZd dlZddl m
4 Z
5 ddl mZ ddl mZ ddl m
6 Z
7 ddlmZ G d d
8 � d
9 �ZG dd� de�Zdddd�ZG dd� de�Zddd�ZG dd� d�ZdS ) � )�annotationsN� )�_base64_alphabet)�
10 base64_decode)�
11 base64_encode��
12 want_bytes)�BadSignaturec @ s$ e Zd ZdZd
13 dd�Zdd
14 d�ZdS )�SigningAlgorithmzgSubclasses must implement :meth:`get_signature` to provide
15 signature generation functionality.
16 �key�bytes�value�returnc C s t � �)z2Returns the signature for the given key and value.)�NotImplementedError��selfr r
17 � r �IC:\Users\shubh\Videos\agent\nova\Lib\site-packages\itsdangerous/signer.py�
18 get_signature s zSigningAlgorithm.get_signature�sig�boolc C s t �|| �||��S )zMVerifies the given signature matches the expected
19 signature.
20 )�hmac�compare_digestr )r r r
21 r r r r �verify_signature s z!SigningAlgorithm.verify_signatureN�r r r
22 r r r )r r r
23 r r r r r )�__name__�
24 __module__�__qualname__�__doc__r r r r r r r
25 s
26 r
27 c @ s e Zd ZdZd dd�ZdS )
28 �
29 NoneAlgorithmz`Provides an algorithm that does not perform any signing and
30 returns an empty signature.
31 r r r
32 r c C s dS )N� r r r r r r $ s zNoneAlgorithm.get_signatureNr )r r r r r r r r r r s r r �stringr r �t.Anyc C s
33 t �| �S )z�Don't access ``hashlib.sha1`` until runtime. FIPS builds may not include
34 SHA-1, in which case the import and use as a default would fail before the
35 developer can configure something else.
36 )�hashlib�sha1)r! r r r �
37 _lazy_sha1( �
38 r% c @ s8 e Zd ZU dZee�Zded<