@hashgraph/sdk
    Preparing search index...

    Class Mnemonic

    Multi-word mnemonic phrase (BIP-39).

    Compatible with the official Hiero mobile wallets (24-words or 22-words) and BRD (12-words).

    Index

    Properties

    _mnemonic: Mnemonic

    Methods

    • Converts a derivation path from string to an array of integers. Note that this expects precisely 5 components in the derivation path, as per BIP-44: m / purpose' / coin_type' / account' / change / address_index Takes into account ' for hardening as per BIP-32, and does not prescribe which components should be hardened.

      Parameters

      • derivationPath: string

        the derivation path in BIP-44 format, e.g. "m/44'/60'/0'/0/0"

      Returns number[]

      to be used with PrivateKey#derive

    • Parameters

      • Optionalpassphrase: string = ""
      • Optionalpath: number[]

      Returns Promise<PrivateKey>

      • Use toStandardEd25519PrivateKey() or toStandardECDSAsecp256k1PrivateKey() instead Recover an ECDSA private key from this mnemonic phrase, with an optional passphrase.
    • Parameters

      • Optionalpassphrase: string = ""
      • Optionalpath: number[]

      Returns Promise<PrivateKey>

      • Use toStandardEd25519PrivateKey() or toStandardECDSAsecp256k1PrivateKey() instead Recover an Ed25519 private key from this mnemonic phrase, with an optional passphrase.
    • Parameters

      • Optionalpassphrase: string = ""

      Returns Promise<PrivateKey>

      • Use toStandardEd25519PrivateKey() or toStandardECDSAsecp256k1PrivateKey() instead Recover a private key from this mnemonic phrase, with an optional passphrase.
    • Parameters

      • passphrase: string

      Returns Promise<Uint8Array<ArrayBufferLike>>

    • Recover an ECDSA private key from this mnemonic phrase, with an optional passphrase.

      Parameters

      • Optionalpassphrase: string = ""
      • Optionalindex: number

      Returns Promise<PrivateKey>

    • Recover an ECDSAsecp256k1 private key from this mnemonic phrase and derivation path, with an optional passphrase

      Parameters

      • passphrase: string = ""

        the passphrase used to protect the mnemonic, use "" for none

      • derivationPath: string

        the derivation path in BIP-44 format, e.g. "m/44'/60'/0'/0/0"

      Returns Promise<PrivateKey>

      the private key

    • Common implementation for both toStandardECDSAsecp256k1PrivateKey functions.

      Parameters

      • passphrase: string

        the passphrase used to protect the mnemonic, use "" for none

      • derivationPathValues: number[]

        derivation path as an integer array, see: calculateDerivationPathValues

      Returns Promise<PrivateKey>

      a private key

    • Recover an Ed25519 private key from this mnemonic phrase, with an optional passphrase.

      Parameters

      • Optionalpassphrase: string = ""
      • Optionalindex: number

      Returns Promise<PrivateKey>

    • Recover a mnemonic phrase from a string, splitting on spaces. Handles 12, 22 (legacy), and 24 words.

      Parameters

      • mnemonic: string

      Returns Promise<Mnemonic>

    • Construct a mnemonic from a list of words. Handles 12, 22 (legacy), and 24 words.

      An exception of BadMnemonicError will be thrown if the mnemonic contains unknown words or fails the checksum. An invalid mnemonic can still be used to create private keys, the exception will contain the failing mnemonic in case you wish to ignore the validation error and continue.

      Parameters

      • words: string[]

      Returns Promise<Mnemonic>