▸ ecrecover(msgHash
: Buffer, v
: number, r
: Buffer, s
: Buffer, chainId?
: undefined | number): Buffer
Defined in signature.ts:37
ECDSA public key recovery from signature.
Parameters:
Name | Type |
---|---|
msgHash |
Buffer |
v |
number |
r |
Buffer |
s |
Buffer |
chainId? |
undefined | number |
Returns: Buffer
Recovered public key
▸ ecsign(msgHash
: Buffer, privateKey
: Buffer, chainId?
: undefined | number): ECDSASignature
Defined in signature.ts:16
Returns the ECDSA signature of a message hash.
Parameters:
Name | Type |
---|---|
msgHash |
Buffer |
privateKey |
Buffer |
chainId? |
undefined | number |
Returns: ECDSASignature
▸ fromRpcSig(sig
: string): ECDSASignature
Defined in signature.ts:71
Convert signature format of the eth_sign
RPC method to signature parameters
NOTE: all because of a bug in geth: ethereum/go-ethereum#2053
Parameters:
Name | Type |
---|---|
sig |
string |
Returns: ECDSASignature
▸ hashPersonalMessage(message
: Buffer): Buffer
Defined in signature.ts:137
Returns the keccak-256 hash of message
, prefixed with the header used by the eth_sign
RPC call.
The output of this function can be fed into ecsign
to produce the same signature as the eth_sign
call for a given message
, or fed to ecrecover
along with a signature to recover the public key
used to produce the signature.
Parameters:
Name | Type |
---|---|
message |
Buffer |
Returns: Buffer
▸ isValidSignature(v
: number, r
: Buffer, s
: Buffer, homesteadOrLater
: boolean, chainId?
: undefined | number): boolean
Defined in signature.ts:96
Validate a ECDSA signature.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
v |
number | - | - |
r |
Buffer | - | - |
s |
Buffer | - | - |
homesteadOrLater |
boolean | true | Indicates whether this is being used on either the homestead hardfork or a later one |
chainId? |
undefined | number | - | - |
Returns: boolean
▸ toRpcSig(v
: number, r
: Buffer, s
: Buffer, chainId?
: undefined | number): string
Defined in signature.ts:57
Convert signature parameters into the format of eth_sign
RPC method.
Parameters:
Name | Type |
---|---|
v |
number |
r |
Buffer |
s |
Buffer |
chainId? |
undefined | number |
Returns: string
Signature