Class CryptoJDK.Mnemonic

java.lang.Object
com.barbantfintech.tools.common.cryptojdk.CryptoJDK.Mnemonic
Enclosing class:
CryptoJDK

public static class CryptoJDK.Mnemonic extends Object
Provides utility methods to generate and validate mnemonic phrases used for seed generation in blockchain technologies. Mnemonic phrases are sequences of words that are used to generate deterministic keys for securing and accessing blockchain assets.
  • Constructor Details

    • Mnemonic

      public Mnemonic()
  • Method Details

    • generate

      public static String generate(@NonNull @NonNull Integer length) throws CryptoJDKException
      Generates a random mnemonic phrase. A mnemonic phrase is a sequence of words that can be used to derive deterministic keys.
      Parameters:
      length - the number of words in the generated mnemonic phrase. It must be a value between 12 and 24, inclusive, and divisible by 3.
      Returns:
      a mnemonic phrase composed of English words.
      Throws:
      CryptoJDKException - if the provided length is invalid or if the internal validation of the generated mnemonic phrase fails.
    • validate

      public static boolean validate(@NonNull @NonNull String mnemonic)
      Validates a given mnemonic phrase. Confirms if the provided mnemonic phrase adheres to the standards and can correctly derive keys.
      Parameters:
      mnemonic - the mnemonic phrase to be validated.
      Returns:
      true if the mnemonic phrase is valid, otherwise false.