Class Key

Creates a key object from a base58 encoded key.

Param

Param

A public or secret key in base58 encoding, or a 15 word bip39 english mnemonic string. Not providing a key will import a ledger public key.

Param

The passphrase used if the key provided is an encrypted private key or a fundraiser key

Param

Email used if a fundraiser key is passed

Param

Ledger derivation path

Param

Ledger curve

Param

Ledger transport

Example

import TransportNodeHid from "@ledgerhq/hw-transport-node-hid";
const key = new Key({ ledgerPath: "44'/1729'/0'/1'", ledgerTransport: TransportNodeHid });

const key = new Key({ key: 'edskRv6ZnkLQMVustbYHFPNsABu1Js6pEEWyMUFJQTqEZjVCU2WHh8ckcc7YA4uBzPiJjZCsv3pC1NDdV99AnyLzPjSip4uC3y' });

Hierarchy

  • Key

Constructors

  • Parameters

    • __namedParameters: { email?: string; key?: string; ledgerCurve?: string; ledgerPath?: string; ledgerTransport?: any; passphrase?: string } = {}
      • Optional email?: string
      • Optional key?: string
      • Optional ledgerCurve?: string
      • Optional ledgerPath?: string
      • Optional ledgerTransport?: any
      • Optional passphrase?: string

    Returns Key

Properties

_curve: string
_isLedger: boolean
_isSecret: boolean
_ledgerCurve: string
_ledgerPath: string
_ledgerTransport: any
_publicKey: Uint8Array
_salt: Uint8Array
_secretKey?: Uint8Array
ready: Promise<boolean>

Accessors

  • get curve(): string
  • Returns string

  • get isLedger(): boolean
  • Returns boolean

  • set isLedger(value: boolean): void
  • Parameters

    • value: boolean

    Returns void

  • get ledgerCurve(): string
  • Returns string

  • set ledgerCurve(value: string): void
  • Parameters

    • value: string

    Returns void

  • get ledgerPath(): string
  • Returns string

  • set ledgerPath(value: string): void
  • Parameters

    • value: string

    Returns void

Methods

  • Parameters

    • __namedParameters: { email?: string; key?: string; passphrase?: string }
      • Optional email?: string
      • Optional key?: string
      • Optional passphrase?: string
    • setInit: ((value: boolean) => void)
        • (value: boolean): void
        • Parameters

          • value: boolean

          Returns void

    Returns Promise<void>

  • Memberof

    Key

    Description

    Returns the public key

    Returns

    The public key associated with the private key

    Returns Promise<string>

  • Memberof

    Key

    Description

    Returns public key hash for this key

    Returns

    The public key hash for this key

    Returns Promise<string>

  • Memberof

    Key

    Description

    Returns the secret key

    Returns

    The secret key associated with this key, if available

    Parameters

    • Optional passphrase: string

      The password used to encrypt the secret key, if applicable

    Returns Promise<string>

  • Memberof

    Key

    Description

    Sign a raw sequence of bytes

    Returns

    The signature object

    Parameters

    • bytes: string

      Sequence of bytes, raw format or hexadecimal notation

    • Optional magicBytes: Uint8Array

      The magic bytes for the operation

    Returns Promise<{ bytes: string; magicBytes: string; prefixSig: string; sbytes: string; sig: string }>

  • Memberof

    Key

    Description

    Verify signature

    Returns

    Whether the signature is valid

    Parameters

    • bytes: string

      Sequance of bytes, raw format or hexadecimal notation

    • signature: string

      A signature in base58 encoding

    • publicKey: string

      A public key

    Returns Promise<boolean>

Generated using TypeDoc