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

@@ -251,9 +251,15 @@ static int make_codexsecret(const char *hsm_secret_path,
const u32 threshold)
{
struct secret hsm_secret;
char *bip93;
const char *err;
get_hsm_secret(&hsm_secret, hsm_secret_path);
printf("Codex32 Secret of your hsm_secret is: %s\n",
codex32_secret_encode(tmpctx, id, threshold, hsm_secret.data, 32));
err = codex32_secret_encode(tmpctx, id, threshold, hsm_secret.data, 32, &bip93);
if (err)
errx(ERROR_USAGE, "%s", err);
printf("%s\n", bip93);
return 0;
}