当前位置: 首页>>代码示例>>Python>>正文


Python Macaroon.first_party_caveat_delegate方法代码示例

本文整理汇总了Python中pymacaroons.Macaroon.first_party_caveat_delegate方法的典型用法代码示例。如果您正苦于以下问题:Python Macaroon.first_party_caveat_delegate方法的具体用法?Python Macaroon.first_party_caveat_delegate怎么用?Python Macaroon.first_party_caveat_delegate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pymacaroons.Macaroon的用法示例。


在下文中一共展示了Macaroon.first_party_caveat_delegate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_encrypted_first_party_caveat

# 需要导入模块: from pymacaroons import Macaroon [as 别名]
# 或者: from pymacaroons.Macaroon import first_party_caveat_delegate [as 别名]
 def test_encrypted_first_party_caveat(self):
     m = Macaroon(
         location='http://mybank/',
         identifier='we used our secret key',
         key='this is our super secret key; only we should know it'
     )
     encryptor = SecretBoxEncryptor(nonce=ZERO_NONCE)
     m.first_party_caveat_delegate = EncryptedFirstPartyCaveatDelegate(field_encryptor=encryptor)
     m.add_first_party_caveat('test = caveat', encrypted=True)
     assert_equal(
         m.signature,
         'a443bc61e8f45dca4f0c441d6cfde90b804cebb0b267aab60de1ec2ab8cc8522'
     )
开发者ID:matrix-org,项目名称:pymacaroons,代码行数:15,代码来源:encrypted_field_tests.py

示例2: test_verify_encrypted_first_party_exact_caveats

# 需要导入模块: from pymacaroons import Macaroon [as 别名]
# 或者: from pymacaroons.Macaroon import first_party_caveat_delegate [as 别名]
    def test_verify_encrypted_first_party_exact_caveats(self):
        m = Macaroon(
            location='http://mybank/',
            identifier='we used our secret key',
            key='this is our super secret key; only we should know it'
        )
        m.first_party_caveat_delegate = EncryptedFirstPartyCaveatDelegate()
        m.add_first_party_caveat('test = caveat', encrypted=True)

        v = Verifier()
        v.first_party_caveat_verifier_delegate = EncryptedFirstPartyCaveatVerifierDelegate()
        v.satisfy_exact('test = caveat')
        verified = v.verify(
            m,
            'this is our super secret key; only we should know it'
        )
        assert_true(verified)
开发者ID:matrix-org,项目名称:pymacaroons,代码行数:19,代码来源:encrypted_field_tests.py


注:本文中的pymacaroons.Macaroon.first_party_caveat_delegate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。