Skip to content
This repository has been archived by the owner on Jun 17, 2021. It is now read-only.

Latest commit

 

History

History
147 lines (91 loc) · 3.81 KB

_signature_.md

File metadata and controls

147 lines (91 loc) · 3.81 KB

ethereumjs-util"signature"

Module: "signature"

Index

Interfaces

Functions

Functions

Const ecrecover

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


Const ecsign

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


Const fromRpcSig

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


Const hashPersonalMessage

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


Const isValidSignature

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


Const toRpcSig

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