Options
All
  • Public
  • Public/Protected
  • All
Menu

Class KeyPairSecp256k1

This class provides key pair functionality for Secp256k1 curve: generating key pairs, encoding key pairs, signing and verifying.

Hierarchy

Constructors

constructor

  • Construct an instance of key pair given a secret key. It's generally assumed that these are encoded in base58check.

    Parameters

    • secretKey: string

    Returns KeyPairSecp256k1

Properties

Readonly _keyType

_keyType: KeyType

Protected _publicKey

_publicKey: PublicKey

Readonly _secretKey

_secretKey: Buffer

Accessors

address

  • Returns Address

publicKey

  • Returns PublicKey

type

  • Returns KeyType

Methods

sign

  • Sign message and return ECDSASignature

    Parameters

    • message: Buffer

      Buffer Sha256 hash of message

    Returns Signature

toString

  • toString(): string
  • Returns string

verify

  • verify(message: Buffer, signature: Buffer[]): boolean
  • Check if message signed by current key pair

    Parameters

    • message: Buffer

      Sha256 hash of message

    • signature: Buffer[]

      Buffer [v,r,s] from Ethereum ECDSASignature

    Returns boolean

Static fromRandom

  • Generate a new random secp256k1 keypair.

    example
    
    

    Returns KeyPair

Static fromString

  • fromString(secretKey: string): KeyPair
  • Construct an instance of key pair given a secret key. It's generally assumed that these are encoded in base58check.

    Parameters

    • secretKey: string

    Returns KeyPair

Generated using TypeDoc