validate Mnemonic
suspend fun validateMnemonic(mnemonic: String, language: MnemonicLanguage = MnemonicLanguage.ENGLISH): Boolean
Validates a BIP-39 mnemonic phrase.
Checks that all words are in the word list and the checksum is valid. This is a convenience function that returns a boolean instead of throwing exceptions.
This function is suspend because JavaScript requires async initialization of the cryptographic library for checksum validation. On JVM and Native platforms, the suspend keyword has zero overhead.
Return
true if the mnemonic is valid, false otherwise
Example:
val isValid = MnemonicUtils.validateMnemonic(
"illness spike retreat truth genius clock brain pass fit cave bargain toe"
)
// isValid is true
val isInvalid = MnemonicUtils.validateMnemonic("invalid mnemonic words")
// isInvalid is falseContent copied to clipboard
Parameters
mnemonic
Space-separated mnemonic phrase
language
Word list language (default: English)