Bip39 Functions¶
-
int
bip39_get_languages
(char **output)¶ Get the list of default supported languages.
..note:: The string returned should be freed using
wally_free_string
. :return: See Error Codes
-
int
bip39_get_wordlist
(const char *lang, struct words **output)¶ Get the default word list for a language.
Parameters: - lang – Language to use. Pass NULL to use the default English list.
- output – Destination for the resulting word list.
Note
The returned structure should not be freed or modified.
Returns: See Error Codes
-
int
bip39_get_word
(const struct words *w, size_t index, char **output)¶ Get the ‘index’th word from a word list.
Parameters: - w – Word list to use. Pass NULL to use the default English list.
- index – The 0-based index of the word in
w
. - output – Destination for the resulting word.
The string returned should be freed using
wally_free_string
. :return: See Error Codes
-
int
bip39_mnemonic_from_bytes
(const struct words *w, const unsigned char *bytes, size_t bytes_len, char **output)¶ Generate a mnemonic sentence from the entropy in
bytes
.Parameters: - w – Word list to use. Pass NULL to use the default English list.
- bytes – Entropy to convert.
- bytes_len – The length of
bytes
in bytes. - output – Destination for the resulting mnemonic sentence.
Note
The string returned should be freed using
wally_free_string
.Returns: See Error Codes
-
int
bip39_mnemonic_to_bytes
(const struct words *w, const char *mnemonic, unsigned char *bytes_out, size_t len, size_t *written)¶ Convert a mnemonic sentence into entropy at
bytes_out
.Parameters: - w – Word list to use. Pass NULL to use the default English list.
- mnemonic – Mnemonic to convert.
- bytes_out – Where to store the resulting entropy.
- len – The length of
bytes_out
in bytes. - written – Destination for the number of bytes written to
bytes_out
.
Returns:
-
int
bip39_mnemonic_validate
(const struct words *w, const char *mnemonic)¶ Validate the checksum embedded in a mnemonic sentence.
Parameters: - w – Word list to use. Pass NULL to use the default English list.
- mnemonic – Mnemonic to validate.
Returns: See Error Codes
-
int
bip39_mnemonic_to_seed
(const char *mnemonic, const char *passphrase, unsigned char *bytes_out, size_t len, size_t *written)¶ Convert a mnemonic into a binary seed.
Parameters: - mnemonic – Mnemonic to convert.
- passphrase – Mnemonic passphrase or NULL if no passphrase is needed.
- bytes_out – The destination for the binary seed.
- len – The length of
bytes_out
in bytes. Currently This must beBIP39_SEED_LEN_512
. - written – Destination for the number of bytes written to
bytes_out
.
Returns: