SignatureChecker
Author: M^0 Labs
Functions
isValidSignature
Returns whether a signature is valid (ECDSA/secp256k1 or ERC1271) for a signer and digest.
Signatures must not be used as unique identifiers since the ecrecover
EVM opcode allows for malleable (non-unique) signatures. See https://github.com/OpenZeppelin/openzeppelin-contracts/security/advisories/GHSA-4h98-2769-gh6h
Parameters
signer
address
The address of the account purported to have signed.
digest
bytes32
The hash of the data that was signed.
signature
bytes
A byte array signature.
Returns
<none>
bool
Whether the signature is valid or not.
isValidERC1271Signature
Returns whether an ERC1271 signature is valid for a signer and digest.
Parameters
signer
address
The address of the account purported to have signed.
digest
bytes32
The hash of the data that was signed.
signature
bytes
A byte array ERC1271 signature.
Returns
<none>
bool
Whether the signature is valid or not.
decodeECDSASignature
Decodes an ECDSA/secp256k1 signature from a byte array to standard v, r, and s parameters.
Parameters
signature
bytes
A byte array ECDSA/secp256k1 signature.
Returns
v
uint8
An ECDSA/secp256k1 signature parameter.
r
bytes32
An ECDSA/secp256k1 signature parameter.
s
bytes32
An ECDSA/secp256k1 signature parameter.
decodeShortECDSASignature
Decodes an ECDSA/secp256k1 short signature as defined by EIP2098 from a byte array to standard v, r, and s parameters.
Parameters
signature
bytes
A byte array ECDSA/secp256k1 short signature.
Returns
r
bytes32
An ECDSA/secp256k1 signature parameter.
vs
bytes32
An ECDSA/secp256k1 short signature parameter.
isValidECDSASignature
Returns whether an ECDSA/secp256k1 signature is valid for a signer and digest.
Parameters
signer
address
The address of the account purported to have signed.
digest
bytes32
The hash of the data that was signed.
signature
bytes
A byte array ECDSA/secp256k1 signature (encoded r, s, v).
Returns
<none>
bool
Whether the signature is valid or not.
isValidECDSASignature
Returns whether an ECDSA/secp256k1 short signature is valid for a signer and digest.
Parameters
signer
address
The address of the account purported to have signed.
digest
bytes32
The hash of the data that was signed.
r
bytes32
An ECDSA/secp256k1 signature parameter.
vs
bytes32
An ECDSA/secp256k1 short signature parameter.
Returns
<none>
bool
Whether the signature is valid or not.
recoverECDSASigner
Returns the signer of an ECDSA/secp256k1 signature for some digest.
Parameters
digest
bytes32
The hash of the data that was signed.
signature
bytes
A byte array ECDSA/secp256k1 signature.
Returns
<none>
Error
An error, if any, that occurred during the signer recovery.
<none>
address
The address of the account recovered form the signature (0 if error).
recoverECDSASigner
Returns the signer of an ECDSA/secp256k1 short signature for some digest.
See https://eips.ethereum.org/EIPS/eip-2098
Parameters
digest
bytes32
The hash of the data that was signed.
r
bytes32
An ECDSA/secp256k1 signature parameter.
vs
bytes32
An ECDSA/secp256k1 short signature parameter.
Returns
<none>
Error
An error, if any, that occurred during the signer recovery.
<none>
address
The address of the account recovered form the signature (0 if error).
recoverECDSASigner
Returns the signer of an ECDSA/secp256k1 signature for some digest.
Parameters
digest
bytes32
The hash of the data that was signed.
v
uint8
An ECDSA/secp256k1 signature parameter.
r
bytes32
An ECDSA/secp256k1 signature parameter.
s
bytes32
An ECDSA/secp256k1 signature parameter.
Returns
<none>
Error
An error, if any, that occurred during the signer recovery.
signer
address
The address of the account recovered form the signature (0 if error).
validateECDSASignature
Returns an error, if any, in validating an ECDSA/secp256k1 signature for a signer and digest.
Parameters
signer
address
The address of the account purported to have signed.
digest
bytes32
The hash of the data that was signed.
signature
bytes
A byte array ERC1271 signature.
Returns
<none>
Error
An error, if any, that occurred during the signer recovery.
validateECDSASignature
Returns an error, if any, in validating an ECDSA/secp256k1 short signature for a signer and digest.
Parameters
signer
address
The address of the account purported to have signed.
digest
bytes32
The hash of the data that was signed.
r
bytes32
An ECDSA/secp256k1 signature parameter.
vs
bytes32
An ECDSA/secp256k1 short signature parameter.
Returns
<none>
Error
An error, if any, that occurred during the signer recovery.
validateECDSASignature
Returns an error, if any, in validating an ECDSA/secp256k1 signature for a signer and digest.
Parameters
signer
address
The address of the account purported to have signed.
digest
bytes32
The hash of the data that was signed.
v
uint8
An ECDSA/secp256k1 signature parameter.
r
bytes32
An ECDSA/secp256k1 signature parameter.
s
bytes32
An ECDSA/secp256k1 signature parameter.
Returns
<none>
Error
An error, if any, that occurred during the signer recovery.
validateRecoveredSigner
Returns an error if signer
is not recoveredSigner
.
Parameters
signer
address
The address of the some signer.
recoveredSigner
address
The address of the some recoveredSigner.
Returns
<none>
Error
An error if signer
is not recoveredSigner
.
Enums
Error
An enum representing the possible errors that can be emitted during signature validation.