ECRecover

Git Source

SPDX-License-Identifier: MIT Copyright (c) 2016-2019 zOS Global Limited Copyright (c) 2020 CENTRE SECZ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

A library that provides a safe ECDSA recovery function

Functions

recover

Recover signer's address from a signed message

Adapted from: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/65e4ffde586ec89af3b7e9140bdc9235d1254853/contracts/cryptography/ECDSA.sol Modifications: Accept v, r, and s as separate arguments

function recover(bytes32 digest, uint8 v, bytes32 r, bytes32 s) internal pure returns (address);

Parameters

NameTypeDescription
digestbytes32Keccak-256 hash digest of the signed message
vuint8v of the signature
rbytes32r of the signature
sbytes32s of the signature

Returns

NameTypeDescription
<none>addressSigner address