File: //usr/lib/python3/dist-packages/pymacaroons/__pycache__/macaroon.cpython-310.pyc
o
�%�Ya � @ s� d dl mZ d dlZd dlmZ d dlmZ d dlmZ d dl m
Z
d dlmZm
Z
mZ d dlmZmZ d Zd
ZG dd� de�ZdS )
� )�unicode_literalsN)�standard_b64encode)�HashSignaturesBinder)�BinarySerializer)�MacaroonInitException)�convert_to_bytes�convert_to_string�create_initial_signature)�FirstPartyCaveatDelegate�ThirdPartyCaveatDelegate� � c @ s� e Zd Zdddddefdd�Zed%dd��Zedd� �Zej dd� �Zed d
� �Z
edd� �Zed
d� �Zej dd� �Zedd� �Z
e
j dd� �Z
edd� �Zdd� Zd%dd�Zdd� Zdd� Zdd� Zdd � Zd!d"� Zd#d$� ZdS )&�MacaroonNc C sh |t krt }|| _|pg | _|pd| _|pd| _|pd| _t� | _t� | _ |r2t
t|�| j�| _d S d S )N� )
�MACAROON_V2�_version�caveats�location�
identifier� signaturer
�first_party_caveat_delegater �third_party_caveat_delegater r �identifier_bytes)�selfr r �keyr r �version� r �6/usr/lib/python3/dist-packages/pymacaroons/macaroon.py�__init__ s
��zMacaroon.__init__c C s |pt � }|r|�|�S td��)Nz Must supply serialized macaroon.)r �deserializer )�cls�
serialized�
serializerr r r r + s
�zMacaroon.deserializec C �
t | j�S �N)r � _location�r r r r r 5 �
zMacaroon.locationc C � t |�| _d S r$ )r r% �r �string_or_bytesr r r r 9 � c C � | j S r$ )r r&