Class Mnemonic

  • All Implemented Interfaces:

    
    public final class Mnemonic
    
                        

    Provides utility methods to generate random mnemonics and also generate seeds from mnemonics.

    • Method Detail

      • generate

        @JvmOverloads() final String generate(Integer strength)

        Generates a random mnemonic.

        Parameters:
        strength - The strength of the mnemonic, defaults to 128 bits.
        Returns:

        The generated mnemonic.

      • toEntropy

         final ByteArray toEntropy(List<String> words)

        Converts the mnemonic words to entropy.

        Parameters:
        words - The mnemonic words.
        Returns:

        The entropy.

      • toMnemonic

         final String toMnemonic(ByteArray entropy)

        Converts the entropy to mnemonic words.

        Parameters:
        entropy - The entropy.
        Returns:

        The mnemonic words.

      • check

         final Boolean check(String mnemonic)

        Checks if the mnemonic is valid.

        Parameters:
        mnemonic - The mnemonic words.
        Returns:

        True if the mnemonic is valid, false otherwise.

      • expandWord

         final String expandWord(String prefix)

        Expands the given word prefix to a complete word from the wordlist.

        Parameters:
        prefix - The word prefix.
        Returns:

        The expanded word if a unique match is found, otherwise the original prefix.

      • expand

         final String expand(String mnemonic)

        Expands the given mnemonic by expanding each word prefix to a complete word from the wordlist.

        Parameters:
        mnemonic - The mnemonic words.
        Returns:

        The expanded mnemonic.

      • detectLanguage

         final static Language detectLanguage(String mnemonic)

        Detects the language of the mnemonic words.

        Parameters:
        mnemonic - The mnemonic words.
        Returns:

        The language code of the mnemonic words.

      • toSeed

        @JvmOverloads() final static ByteArray toSeed(String mnemonic, String passphrase)

        Converts the mnemonic words to a seed.

        Parameters:
        mnemonic - The mnemonic words.
        passphrase - The passphrase to use for the seed, defaults to an empty string.
        Returns:

        The seed.

      • toSeed

        @JvmOverloads() final static ByteArray toSeed(String mnemonic)

        Converts the mnemonic words to a seed.

        Parameters:
        mnemonic - The mnemonic words.
        Returns:

        The seed.

      • toHdMasterKey

        @JvmOverloads() final static String toHdMasterKey(ByteArray seed, Boolean testnet)

        Converts the seed to a BIP32 HD master key.

        Parameters:
        seed - The seed.
        testnet - Whether to generate a testnet key, defaults to false.
        Returns:

        The HD master key.