ape icon indicating copy to clipboard operation
ape copied to clipboard

Add `recover_signer`

Open fubuloubu opened this issue 2 years ago • 0 comments

Overview

It'd be nice to have a utility function to return the signer address of a message for verification purposes. Thankfully, eth-account exposes an easy method for signature verification that we can make even easier.

Specification

Add the following to src/ape/types/signatures.py:

def recover_signer(msg: SignableMessage, sig: MessageSignature) -> AddressType:
    return eth_account.Account.recover_message(msg.signable_message, signature=sig.encode_vrs())

Dependencies

n/a

fubuloubu avatar Sep 15 '22 16:09 fubuloubu