2024-01-02 15:25:11 -05:00
|
|
|
#pragma once
|
|
|
|
|
2024-02-20 21:41:37 -05:00
|
|
|
/**
|
|
|
|
** \defgroup bip39 BIP39
|
|
|
|
** Convert between raw bytes and \ref bip39_words.
|
|
|
|
** See: https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki.
|
|
|
|
** @{
|
|
|
|
*/
|
|
|
|
|
2024-01-02 15:25:11 -05:00
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
|
2024-03-04 12:23:00 -05:00
|
|
|
/**
|
|
|
|
** Convert a key from bytes to words.
|
|
|
|
** @param bytes A raw binary representation of a key.
|
|
|
|
** @param bytes_size The size of bytes.
|
|
|
|
** @param[out] out_words A human-readable English word representation of a key.
|
|
|
|
** @param words_size The size of the out_words buffer.
|
|
|
|
** @return True if the key was successfully converted.
|
|
|
|
*/
|
2024-01-02 15:25:11 -05:00
|
|
|
bool tf_bip39_bytes_to_words(const uint8_t* bytes, size_t bytes_size, char* out_words, size_t words_size);
|
2024-03-04 12:23:00 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
** Convert a key from words to bytes.
|
|
|
|
** @param words A space-separated list of English words forming a key.
|
|
|
|
** @param[out] out_bytes A buffer to receive the raw binary form of the key.
|
|
|
|
** @param bytes_size The size of the out_bytes buffer.
|
|
|
|
** @return True if the key was successfully converted.
|
|
|
|
*/
|
2024-01-02 15:25:11 -05:00
|
|
|
bool tf_bip39_words_to_bytes(const char* words, uint8_t* out_bytes, size_t bytes_size);
|
2024-02-20 21:41:37 -05:00
|
|
|
|
|
|
|
/** @} */
|