Package convex.core.crypto
Class BIP39
java.lang.Object
convex.core.crypto.BIP39
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Minimum number of words accepted in a mnemonicstatic final int
static final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
Return true if the string is a valid mnemonic phrasestatic String
static String
createSecureMnemonic
(int numWords) createWords
(SecureRandom r, int n) Create a list of random mnemonic words given a random number generatorstatic Blob
Gets a BIP39 seed given a mnemonic and passphrasestatic Blob
Gets a BIP39 seed given a mnemonic and passphraseGets the individual words from a mnemonic String.static String
Create a mnemonic String from a list of words, separated by spacesstatic String
static Blob
seedToEd25519Seed
(Blob seed) Converts a BIP39 seed to an Ed25519 seed.static AKeyPair
seedToKeyPair
(Blob seed)
-
Field Details
-
NUM_WORDS
public static final int NUM_WORDS -
SEED_LENGTH
public static final int SEED_LENGTH- See Also:
-
MIN_WORDS
public static final int MIN_WORDSMinimum number of words accepted in a mnemonic- See Also:
-
-
Constructor Details
-
BIP39
public BIP39()
-
-
Method Details
-
getSeed
public static Blob getSeed(List<String> words, String passphrase) throws NoSuchAlgorithmException, InvalidKeySpecException Gets a BIP39 seed given a mnemonic and passphrase- Parameters:
words
- Mnemonic wordspassphrase
- Optional BIP39 passphrase- Returns:
- Blob containing BIP39 seed (64 bytes)
- Throws:
NoSuchAlgorithmException
InvalidKeySpecException
-
seedToKeyPair
-
seedToEd25519Seed
-
checkMnemonic
-
getSeed
-
createSecureMnemonic
-
createSecureMnemonic
-
createWords
Create a list of random mnemonic words given a random number generator- Parameters:
r
- Random number generator instancen
- Number of words to generate- Returns:
- List of words
-
getWords
-
normalise
-
mnemonic
-