예제 #1
0
 def __init__(self,
              location=None,
              identifier=None,
              key=None,
              caveats=None,
              signature=None):
     self.caveats = caveats or []
     self.location = location or ''
     self.identifier = identifier or ''
     self.signature = signature or ''
     self.first_party_caveat_delegate = FirstPartyCaveatDelegate()
     self.third_party_caveat_delegate = ThirdPartyCaveatDelegate()
     if key:
         self.signature = create_initial_signature(
             convert_to_bytes(key), convert_to_bytes(identifier))
예제 #2
0
 def __init__(self,
              location=None,
              identifier=None,
              key=None,
              caveats=None,
              signature=None,
              version=MACAROON_V1):
     if version > MACAROON_V2:
         version = MACAROON_V2
     self._version = version
     self.caveats = caveats or []
     self.location = location or ''
     self.identifier = identifier or ''
     self.signature = signature or ''
     self.first_party_caveat_delegate = FirstPartyCaveatDelegate()
     self.third_party_caveat_delegate = ThirdPartyCaveatDelegate()
     if key:
         self.signature = create_initial_signature(convert_to_bytes(key),
                                                   self.identifier_bytes)