RAILGUN Reloaded
    Preparing search index...

    The Mnemonic class provides utility methods for working with BIP-39 mnemonic phrases. It includes functionality for generating, validating, and converting mnemonic phrases to entropy, seeds, and private keys. This class leverages the BIP-39 standard for secure and deterministic key generation.

    Methods:

    • generate(strength: 128 | 192 | 256 = 128): string: Generates a mnemonic phrase based on the specified entropy strength. Acceptable values are 128, 192, or 256 bits. Defaults to 128 if not specified.

    • validate(mnemonic: string): boolean: Validates a given mnemonic phrase against the BIP-39 wordlist. Returns true if the mnemonic is valid, otherwise false.

    • toSeed(mnemonic: string, password: string = ""): Uint8Array: Converts a BIP-39 mnemonic phrase into a seed. An optional password can be provided to secure the seed. Defaults to an empty string if not specified.

    • toEntropy(mnemonic: string): Uint8Array: Converts a BIP-39 mnemonic phrase into its corresponding entropy.

    • fromEntropy(entropy: Uint8Array): string: Generates a mnemonic phrase from the provided entropy.

    • to0xPrivateKey(mnemonic: string, derivationIndex?: number): Uint8Array: Converts a mnemonic phrase into a private key in the form of a Uint8Array. Optionally accepts a derivation index for hierarchical deterministic (HD) path derivation.

    Index
    • Generates a mnemonic phrase based on the specified strength.

      Parameters

      • strength: 128 | 192 | 256 = 128

        The entropy strength for the mnemonic generation. Acceptable values are 128, 192, or 256 bits. Defaults to 128 if not specified.

      Returns string

      A mnemonic phrase as a string.

    • Validates a given mnemonic phrase against the BIP39 wordlist.

      Parameters

      • mnemonic: string

        The mnemonic phrase to validate.

      Returns boolean

      true if the mnemonic is valid, otherwise false.

    • Converts a BIP-39 mnemonic phrase into a seed.

      Parameters

      • mnemonic: string

        The BIP-39 mnemonic phrase to be converted into a seed.

      • password: string = ''

        An optional password used to secure the seed. Defaults to an empty string if not provided.

      Returns Uint8Array

      A Uint8Array representing the generated seed.

    • Converts a BIP-39 mnemonic phrase into its corresponding entropy.

      Parameters

      • mnemonic: string

        The BIP-39 mnemonic phrase to be converted.

      Returns Uint8Array

      A Uint8Array representing the entropy derived from the mnemonic.

    • Generates a mnemonic phrase from the provided entropy.

      Parameters

      • entropy: Uint8Array

        A Uint8Array representing the entropy used to generate the mnemonic.

      Returns string

      A string containing the mnemonic phrase derived from the entropy.

    • Converts a mnemonic phrase into a private key in the form of a Uint8Array.

      Parameters

      • mnemonic: string

        The BIP-39 mnemonic phrase used to generate the seed.

      • OptionalderivationIndex: number

        (Optional) The index used for deriving the key from the hierarchical deterministic (HD) path. If not provided, a default derivation path will be used.

      Returns Uint8Array

      The derived private key as a Uint8Array.