def test_anybody_can_verify(): """ In the last example, we used the lower-level Crypto API to verify the signature. Here, we show that anybody can do it without needing to directly access Crypto. """ # Alice can sign by default, by dint of her _default_crypto_powerups. alice = Alice(federated_only=True, always_be_learning=False) # So, our story is fairly simple: an everyman meets Alice. somebody = Character(always_be_learning=False, federated_only=True) # Alice signs a message. message = b"A message for all my friends who can only verify and not sign." signature = alice.stamp(message) # Our everyman can verify it. cleartext = somebody.verify_from(alice, message, signature, decrypt=False) assert cleartext is constants.NO_DECRYPTION_PERFORMED
def test_anybody_can_verify(nucypher_test_config, mock_policy_agent): """ In the last example, we used the lower-level Crypto API to verify the signature. Here, we show that anybody can do it without needing to directly access Crypto. """ # Alice can sign by default, by dint of her _default_crypto_powerups. alice = Alice(config=nucypher_test_config, policy_agent=mock_policy_agent) # So, our story is fairly simple: an everyman meets Alice. somebody = Character(config=nucypher_test_config) # Alice signs a message. message = b"A message for all my friends who can only verify and not sign." signature = alice.stamp(message) # Our everyman can verify it. verification, cleartext = somebody.verify_from(alice, message, signature, decrypt=False) assert verification is True assert cleartext is constants.NO_DECRYPTION_PERFORMED