Skip to content

Commit 85fc8c6

Browse files
committed
Fix up hsmtool to support the new hsm_secret API
1 parent 94d8e7b commit 85fc8c6

3 files changed

Lines changed: 265 additions & 291 deletions

File tree

common/hsm_secret.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,10 @@ const char *hsm_secret_error_str(enum hsm_secret_error err)
160160
return "Could not derive seed from mnemonic";
161161
case HSM_SECRET_ERR_INVALID_FORMAT:
162162
return "Invalid hsm_secret format";
163+
case HSM_SECRET_ERR_TERMINAL:
164+
return "Terminal error";
165+
case HSM_SECRET_ERR_MEMORY:
166+
return "Memory error";
163167
}
164168
return "Unknown error";
165169
}

common/hsm_secret.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,12 @@ int is_legacy_hsm_secret_encrypted(const char *path);
100100
/**
101101
* Reads a passphrase from stdin, disabling terminal echo.
102102
* Returns a newly allocated string on success, NULL on error.
103-
* @reason - on failure, this will be set to the reason.
104-
* @exit_code - on failure, this will be set to the recommended exit code.
103+
* @ctx - tal context for allocation
104+
* @err - on failure, this will be set to the error code
105+
*
106+
* Returns allocated passphrase or NULL on error.
105107
*/
106-
char *read_stdin_pass_with_exit_code(const char **reason, int *exit_code);
108+
const char *read_stdin_pass(const tal_t *ctx, enum hsm_secret_error *err);
107109

108110
/**
109111
* Derive encryption key from passphrase using Argon2id.

0 commit comments

Comments
 (0)