Exemple #1
0
def test_signature_from_owner(each_identity_contract, owner_key):

    data_to_sign = (1234).to_bytes(10, byteorder="big")
    hash = solidity_keccak(["bytes"], [data_to_sign])
    signature = sign_msg_hash(hash, owner_key)

    assert each_identity_contract.functions.validateSignature(
        hash, signature).call()
Exemple #2
0
def test_signature_not_owner(each_identity_contract, account_keys):
    key = account_keys[1]

    data = (1234).to_bytes(10, byteorder="big")
    hash = solidity_keccak(["bytes"], [data])
    signature = sign_msg_hash(hash, key)

    assert not each_identity_contract.functions.validateSignature(
        hash, signature).call()
 def signed(self, key: PrivateKey) -> "MetaTransaction":
     return attr.evolve(self, signature=sign_msg_hash(self.hash, key=key))