Add nostr_bip39_get_wordlist() public accessor for BIP-39 wordlist
This commit is contained in:
@@ -1331,6 +1331,11 @@ static int find_word_index(const char* word) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
const char * const *nostr_bip39_get_wordlist(int *count) {
|
||||
if (count) *count = 2048;
|
||||
return BIP39_WORDLIST;
|
||||
}
|
||||
|
||||
int nostr_bip39_mnemonic_from_bytes(const unsigned char* entropy, size_t entropy_len,
|
||||
char* mnemonic) {
|
||||
if (!entropy || !mnemonic || entropy_len < 16 || entropy_len > 32) return -1;
|
||||
|
||||
@@ -24,6 +24,11 @@ void nostr_bytes_to_hex(const unsigned char *bytes, size_t len, char *hex);
|
||||
// Convert hexadecimal string to bytes
|
||||
int nostr_hex_to_bytes(const char *hex, unsigned char *bytes, size_t len);
|
||||
|
||||
// Get the BIP-39 English wordlist (2048 words). Returns a pointer to a
|
||||
// static array; count is set to 2048 if non-NULL. The pointer is valid
|
||||
// for the lifetime of the process.
|
||||
const char * const *nostr_bip39_get_wordlist(int *count);
|
||||
|
||||
// Base64 encoding function
|
||||
size_t base64_encode(const unsigned char *data, size_t len, char *output,
|
||||
size_t output_size);
|
||||
|
||||
Reference in New Issue
Block a user