The Mnemonic class provides functionality related to mnemonic phrases, including encoding to bytes, generating, validating, and deriving keys from mnemonic words based on the BIP39 standard. It implements the VeChainDataModel interface.

VeChainDataModel

Implements

Constructors

Accessors

  • get bi(): bigint
  • Throws an exception because the mnemonic cannot be represented as a big integer.

    Returns bigint

    The BigInt representation of the mnemonic.

    The mnemonic cannot be represented as a bigint. VeChainDataModel#bi

    The conversion to BigInt is not supported for a mnemonic.

  • get bytes(): Uint8Array
  • Generates a mnemonic as encoded bytes.

    Returns Uint8Array

    The bytes representation of the words with spaces.

  • get n(): number
  • Throws an exception because the mnemonic cannot be represented as a number.

    Returns number

    The number representation of the mnemonic.

    The mnemonic cannot be represented as a number. VeChainDataModel#n

    The conversion to number is not supported for a mnemonic.

Methods

  • Check if the given mnemonic words are valid.

    Parameters

    • words: string | string[]

      The mnemonic words to check.

    Returns boolean

    true if the words are valid, false otherwise.

    Security auditable method, depends on

  • Derives a private key from a given list of BIP39 Mnemonic Words and a derivation path as in the examples.

    Parameters

    • words: string[]

      The set of words used for mnemonic generation.

    • Optionalpath: string = HDKey.VET_DERIVATION_PATH

      The derivation path from the current node.

    Returns Uint8Array

    • The derived private key as a Uint8Array.
    `m/0` (default)
    
    `m/0/2`
    
    `m/0/2/4/6`
    

    Security auditable method, depends on