Add nostr_bip39_get_wordlist() public accessor for BIP-39 wordlist

This commit is contained in:
Laan Tungir
2026-07-28 06:31:43 -04:00
parent 932c770f6f
commit a3337e5207
2 changed files with 10 additions and 0 deletions
+5
View File
@@ -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;
+5
View File
@@ -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);