public final class MnemonicValidator
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static MnemonicValidator |
ofWordList(WordList wordList)
Get a Mnemonic validator for the given word list.
|
void |
validate(java.lang.CharSequence mnemonic)
Check that the supplied mnemonic fits the BIP0039 spec.
|
void |
validate(java.util.Collection<? extends java.lang.CharSequence> mnemonic)
Check that the supplied mnemonic fits the BIP0039 spec.
|
public static MnemonicValidator ofWordList(WordList wordList)
wordList - A WordList implementationpublic void validate(java.lang.CharSequence mnemonic)
throws InvalidChecksumException,
InvalidWordCountException,
WordNotFoundException,
UnexpectedWhiteSpaceException
mnemonic - The memorable list of wordsInvalidChecksumException - If the last bytes don't match the expected last bytesInvalidWordCountException - If the number of words is not a multiple of 3, 24 or fewerWordNotFoundException - If a word in the mnemonic is not present in the word listUnexpectedWhiteSpaceException - Occurs if one of the supplied words is empty, e.g. a double spacepublic void validate(java.util.Collection<? extends java.lang.CharSequence> mnemonic)
throws InvalidChecksumException,
InvalidWordCountException,
WordNotFoundException,
UnexpectedWhiteSpaceException
The purpose of this method overload is to avoid constructing a mnemonic String if you have gathered a list of words from the user.
mnemonic - The memorable list of wordsInvalidChecksumException - If the last bytes don't match the expected last bytesInvalidWordCountException - If the number of words is not a multiple of 3, 24 or fewerWordNotFoundException - If a word in the mnemonic is not present in the word listUnexpectedWhiteSpaceException - Occurs if one of the supplied words is empty