Class MnemonicCode


  • public class MnemonicCode
    extends java.lang.Object
    A MnemonicCode object may be used to convert between binary seed values and lists of words per the BIP 39 specification
    • Constructor Summary

      Constructors 
      Constructor Description
      MnemonicCode()
      Initialise from the included word list.
      MnemonicCode​(java.io.InputStream wordstream, java.lang.String wordListDigest)
      Creates an MnemonicCode object, initializing with words read from the supplied input stream.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void check​(java.util.List<java.lang.String> words)
      Check to see if a mnemonic word list is valid.
      java.util.List<java.lang.String> getWordList()
      Gets the word list this code uses.
      byte[] toEntropy​(java.util.List<java.lang.String> words)
      Convert mnemonic word list to original entropy value.
      java.util.List<java.lang.String> toMnemonic​(byte[] entropy)
      Convert entropy data to mnemonic word list.
      static byte[] toSeed​(java.util.List<java.lang.String> words, java.lang.String passphrase)
      Convert mnemonic word list to seed.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • BIP39_STANDARDISATION_TIME

        public static final java.time.Instant BIP39_STANDARDISATION_TIME
        UNIX time for when the BIP39 standard was finalised. This can be used as a default seed birthday.
      • BIP39_STANDARDISATION_TIME_SECS

        @Deprecated
        public static final int BIP39_STANDARDISATION_TIME_SECS
    • Constructor Detail

      • MnemonicCode

        public MnemonicCode()
                     throws java.io.IOException
        Initialise from the included word list. Won't work on Android.
        Throws:
        java.io.IOException
      • MnemonicCode

        public MnemonicCode​(java.io.InputStream wordstream,
                            java.lang.String wordListDigest)
                     throws java.io.IOException,
                            java.lang.IllegalArgumentException
        Creates an MnemonicCode object, initializing with words read from the supplied input stream. If a wordListDigest is supplied the digest of the words will be checked.
        Parameters:
        wordstream - input stream of 2048 line-seperated words
        wordListDigest - hex-encoded Sha256 digest to check against
        Throws:
        java.io.IOException - if there was a problem reading the steam
        java.lang.IllegalArgumentException - if list size is not 2048 or digest mismatch