hsmtool: tighten checks for validity on getcodexsecret

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2023-08-01 10:59:54 +09:30
parent e981a4f14a
commit 4dcd712d6e
5 changed files with 80 additions and 30 deletions

View File

@@ -42,18 +42,19 @@ struct codex32 *codex32_decode(const tal_t *ctx,
/** Encode a seed into codex32 secret format.
*
* Out: char *: String containing the codex32 (BIP93) format secret.
* fail: Asserting error if invalid threshold is used.
* In: input: id: Valid 4 char string identifying the secret
* threshold: Threshold according to the bip93
* seed: The secret in u8*
* seedlen: Length of the seed provided.
* Returns a string which contains the seed provided in bip93 format.
*
* Returns an error string, or returns NULL and sets @bip93.
*/
char *codex32_secret_encode(const tal_t *ctx,
const char *id,
const u32 threshold,
const u8 *seed,
size_t seedlen);
const char *codex32_secret_encode(const tal_t *ctx,
const char *id,
const u32 threshold,
const u8 *seed,
size_t seedlen,
char **bip93);
#endif /* LIGHTNING_COMMON_CODEX32_H */