MCPcopy Create free account
hub / github.com/ElementsProject/lightning / opt_set_hsm_password

Function opt_set_hsm_password

lightningd/options.c:605–627  ·  view source on GitHub ↗

Prompt the user to enter a password, from which will be derived the key used * for `hsm_secret` encryption. * The algorithm used to derive the key is Argon2(id), to which libsodium * defaults. However argon2id-specific constants are used in case someone runs it * with a libsodium version which default constants differs (typically <1.0.9). * * DEPRECATED: Use --hsm-passphrase instead. */

Source from the content-addressed store, hash-verified

603 * DEPRECATED: Use --hsm-passphrase instead.
604 */
605static char *opt_set_hsm_password(struct lightningd *ld)
606{
607 int is_encrypted;
608
609 /* Show deprecation warning */
610 if (!opt_deprecated_ok(ld, "encrypted_hsm",
611 "Use --hsm-passphrase instead",
612 "v25.12", "v26.12"))
613 return "--encrypted-hsm was removed, use --hsm-passphrase instead";
614
615 is_encrypted = is_legacy_hsm_secret_encrypted("hsm_secret");
616 /* While lightningd is performing the first initialization
617 * this check is always true because the file does not exist.
618 *
619 * Maybe the is_hsm_secret_encrypted is performing a not useful
620 * check at this stage, but the hsm is a delicate part,
621 * so it is a good information to have inside the log. */
622 if (is_encrypted == -1)
623 log_info(ld->log, "'hsm_secret' does not exist (%s)",
624 strerror(errno));
625
626 return read_hsm_passphrase(ld);
627}
628
629/* Set flag to indicate hsm_secret needs a passphrase.
630 * This replaces the old --encrypted-hsm option which was for legacy encrypted secrets.

Callers

nothing calls this directly

Calls 4

opt_deprecated_okFunction · 0.85
log_infoClass · 0.85
read_hsm_passphraseFunction · 0.85

Tested by

no test coverage detected