MCPcopy Create free account
hub / github.com/ElementsProject/lightning / validate_mnemonic

Function validate_mnemonic

common/hsm_secret.c:32–51  ·  view source on GitHub ↗

Helper function to validate a mnemonic string */

Source from the content-addressed store, hash-verified

30
31/* Helper function to validate a mnemonic string */
32enum hsm_secret_error validate_mnemonic(const char *mnemonic)
33{
34 struct words *words;
35 bool ok;
36
37 tal_wally_start();
38 if (bip39_get_wordlist("en", &words) != WALLY_OK) {
39 abort();
40 }
41
42 ok = (bip39_mnemonic_validate(words, mnemonic) == WALLY_OK);
43
44 /* Wordlists can persist, so provide a common context! */
45 tal_wally_end(notleak_with_children(tal(NULL, char)));
46
47 if (!ok)
48 return HSM_SECRET_ERR_INVALID_MNEMONIC;
49
50 return HSM_SECRET_OK;
51}
52
53struct secret *get_encryption_key(const tal_t *ctx, const char *passphrase)
54{

Callers 3

hsm_secret_argFunction · 0.85
extract_mnemonic_secretFunction · 0.85
read_stdin_mnemonicFunction · 0.85

Calls 3

tal_wally_startFunction · 0.85
abortFunction · 0.85
tal_wally_endFunction · 0.85

Tested by

no test coverage detected