Skip to content

Commit 6d48966

Browse files
committed
schema: remove BIP86 addresstype option
Since BIP86 derivation is now always used (based on hsm_secret), there's no need for a separate 'bip86' addresstype option in the schema. This reverts the schema changes that added the bip86 option, example, and related descriptions. The p2tr addresstype now always uses BIP86 derivation when the hsm_secret is mnemonic-based.
1 parent 7c532f6 commit 6d48966

File tree

21 files changed

+1216
-1233
lines changed

21 files changed

+1216
-1233
lines changed

.msggen.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1546,7 +1546,8 @@
15461546
},
15471547
"ExposesecretResponse": {
15481548
"ExposeSecret.codex32": 2,
1549-
"ExposeSecret.identifier": 1
1549+
"ExposeSecret.identifier": 1,
1550+
"ExposeSecret.mnemonic": 3
15501551
},
15511552
"FeeratesOnchainFeeEstimates": {
15521553
"Feerates.onchain_fee_estimates.htlc_success_satoshis": 5,
@@ -6758,6 +6759,10 @@
67586759
"added": "v24.11",
67596760
"deprecated": null
67606761
},
6762+
"ExposeSecret.mnemonic": {
6763+
"added": "v25.12",
6764+
"deprecated": null
6765+
},
67616766
"ExposeSecret.passphrase": {
67626767
"added": "v24.11",
67636768
"deprecated": null

cln-grpc/proto/node.proto

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cln-grpc/src/convert.rs

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cln-rpc/src/model.rs

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

common/hsm_secret.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
#include "config.h"
22
#include <assert.h>
3-
#include <ccan/crypto/sha256/sha256.h>
43
#include <ccan/mem/mem.h>
54
#include <ccan/tal/grab_file/grab_file.h>
65
#include <ccan/tal/str/str.h>
7-
#include <ccan/tal/tal.h>
86
#include <common/errcode.h>
97
#include <common/hsm_secret.h>
108
#include <common/utils.h>
119
#include <errno.h>
12-
#include <sodium.h>
1310
#include <sys/stat.h>
1411
#include <termios.h>
1512
#include <unistd.h>

common/hsm_secret.h

Lines changed: 68 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ enum hsm_secret_error {
3737
};
3838

3939
/**
40-
* Represents the content of the hsm_secret file, either a raw seed or a mnemonic.
40+
*Represents the content of the hsm_secret file, either a raw seed or a mnemonic.
4141
*/
4242
struct hsm_secret {
4343
enum hsm_secret_type type;
@@ -47,139 +47,139 @@ struct hsm_secret {
4747

4848

4949
/**
50-
* Check if this HSM secret is mnemonic-based (64-byte seed).
51-
* Returns true for mnemonic-derived secrets, false for legacy 32-byte secrets.
50+
*Check if this HSM secret is mnemonic-based (64-byte seed).
51+
*Returns true for mnemonic-derived secrets, false for legacy 32-byte secrets.
5252
*/
5353
bool is_mnemonic_secret(size_t secret_len);
5454

5555
/**
56-
* Check if we should use BIP86 derivation for this HSM secret.
57-
* BIP86 was introduced alongside mnemonic support, so they're available together.
58-
* Returns true if mnemonic-based secret is available, false otherwise.
56+
*Check if we should use BIP86 derivation for this HSM secret.
57+
*BIP86 was introduced alongside mnemonic support, so they're available together.
58+
*Returns true if mnemonic-based secret is available, false otherwise.
5959
*/
6060
bool use_bip86_derivation(size_t secret_len);
6161

6262
/**
63-
* Checks whether the hsm_secret data requires a passphrase to decrypt.
64-
* Handles legacy, encrypted, and mnemonic-based formats.
63+
*Checks whether the hsm_secret data requires a passphrase to decrypt.
64+
*Handles legacy, encrypted, and mnemonic-based formats.
6565
*/
6666
bool hsm_secret_needs_passphrase(const u8 *hsm_secret, size_t len);
6767

6868
/**
69-
* Parse and decrypt an hsm_secret file.
69+
*Parse and decrypt an hsm_secret file.
7070
*
71-
* @ctx - a tal context
72-
* @hsm_secret - raw file contents
73-
* @len - length of file
74-
* @passphrase - passphrase, or NULL if not needed
75-
* @err - optional pointer to set error code on failure
76-
*
77-
* Returns parsed `struct hsm_secret` or NULL on error.
71+
*@ctx - a tal context
72+
*@hsm_secret - raw file contents
73+
*@len - length of file
74+
*@passphrase - passphrase, or NULL if not needed
75+
*@err - optional pointer to set error code on failure
76+
*
77+
*Returns parsed `struct hsm_secret` or NULL on error.
7878
*/
7979
struct hsm_secret *extract_hsm_secret(const tal_t *ctx,
8080
const u8 *hsm_secret, size_t len,
8181
const char *passphrase,
8282
enum hsm_secret_error *err);
8383

8484
/**
85-
* Encrypt a given hsm_secret using a provided encryption key.
86-
* @encryption_key - derived from passphrase (via Argon2)
87-
* @hsm_secret - plaintext secret to encrypt
88-
* @output - output buffer for encrypted data (must be ENCRYPTED_HSM_SECRET_LEN bytes)
85+
*Encrypt a given hsm_secret using a provided encryption key.
86+
*@encryption_key - derived from passphrase (via Argon2)
87+
*@hsm_secret - plaintext secret to encrypt
88+
*@output - output buffer for encrypted data (must be ENCRYPTED_HSM_SECRET_LEN bytes)
8989
*
90-
* Returns true on success.
90+
*Returns true on success.
9191
*/
9292
bool encrypt_legacy_hsm_secret(const struct secret *encryption_key,
9393
const struct secret *hsm_secret,
9494
u8 *output);
9595

9696
/**
97-
* Reads a passphrase from stdin, disabling terminal echo.
98-
* Returns a newly allocated string on success, NULL on error.
99-
* @ctx - tal context for allocation
100-
* @err - on failure, this will be set to the error code
101-
*
102-
* Returns allocated passphrase or NULL on error.
97+
*Reads a passphrase from stdin, disabling terminal echo.
98+
*Returns a newly allocated string on success, NULL on error.
99+
*@ctx - tal context for allocation
100+
*@err - on failure, this will be set to the error code
101+
*
102+
*Returns allocated passphrase or NULL on error.
103103
*/
104104
const char *read_stdin_pass(const tal_t *ctx, enum hsm_secret_error *err);
105105

106106
/**
107-
* Convert error code to human-readable string.
108-
* @err - the error code to convert
109-
*
110-
* Returns a string describing the error.
107+
*Convert error code to human-readable string.
108+
*@err - the error code to convert
109+
*
110+
*Returns a string describing the error.
111111
*/
112112
const char *hsm_secret_error_str(enum hsm_secret_error err);
113113

114114
/**
115-
* Detect the type of hsm_secret based on its content and length.
116-
* @hsm_secret - raw file contents
117-
* @len - length of file
118-
*
119-
* Returns the detected type.
115+
*Detect the type of hsm_secret based on its content and length.
116+
*@hsm_secret - raw file contents
117+
*@len - length of file
118+
*
119+
*Returns the detected type.
120120
*/
121121
enum hsm_secret_type detect_hsm_secret_type(const u8 *hsm_secret, size_t len);
122122

123123
/**
124-
* Reads a BIP39 mnemonic from stdin with validation.
125-
* Returns a newly allocated string on success, NULL on error.
126-
* @ctx - tal context for allocation
127-
* @err - optional pointer to set error code on failure
128-
*
129-
* Returns tal-allocated mnemonic string or NULL on error.
124+
*Reads a BIP39 mnemonic from stdin with validation.
125+
*Returns a newly allocated string on success, NULL on error.
126+
*@ctx - tal context for allocation
127+
*@err - optional pointer to set error code on failure
128+
*
129+
*Returns tal-allocated mnemonic string or NULL on error.
130130
*/
131131
const char *read_stdin_mnemonic(const tal_t *ctx, enum hsm_secret_error *err);
132132

133133
/**
134-
* Derive seed hash from mnemonic + passphrase.
135-
* @mnemonic - the BIP39 mnemonic
136-
* @passphrase - the passphrase (can be NULL)
137-
* @seed_hash - output parameter for the derived seed hash
138-
*
139-
* Returns true on success, false on failure.
134+
*Derive seed hash from mnemonic + passphrase.
135+
*@mnemonic - the BIP39 mnemonic
136+
*@passphrase - the passphrase (can be NULL)
137+
*@seed_hash - output parameter for the derived seed hash
138+
*
139+
*Returns true on success, false on failure.
140140
*/
141141
bool derive_seed_hash(const char *mnemonic, const char *passphrase, struct sha256 *seed_hash);
142142

143143
/**
144-
* Check if hsm_secret file is encrypted (legacy format only).
145-
* @path - path to the hsm_secret file
146-
*
147-
* Returns 1 if encrypted, 0 if not encrypted, -1 on error.
144+
*Check if hsm_secret file is encrypted (legacy format only).
145+
*@path - path to the hsm_secret file
146+
*
147+
*Returns 1 if encrypted, 0 if not encrypted, -1 on error.
148148
*/
149149
int is_legacy_hsm_secret_encrypted(const char *path);
150150

151151
/**
152-
* Zero and unlock a secret's memory.
153-
* @secret - the secret to destroy
152+
*Zero and unlock a secret's memory.
153+
*@secret - the secret to destroy
154154
*/
155155
void destroy_secret(struct secret *secret);
156156

157157
/**
158-
* Convert hsm_secret_type enum to human-readable string.
159-
* @type - the hsm_secret_type to convert
158+
*Convert hsm_secret_type enum to human-readable string.
159+
*@type - the hsm_secret_type to convert
160160
*
161-
* Returns a string describing the type.
161+
*Returns a string describing the type.
162162
*/
163163
const char *format_type_name(enum hsm_secret_type type);
164164

165165
/**
166-
* Wrapper around grab_file that removes the NUL terminator.
167-
* @ctx - tal context for allocation
168-
* @filename - path to the file to read
169-
* @len - output parameter for the file length (excluding NUL terminator)
166+
*Wrapper around grab_file that removes the NUL terminator.
167+
*@ctx - tal context for allocation
168+
*@filename - path to the file to read
169+
*@len - output parameter for the file length (excluding NUL terminator)
170170
*
171-
* Returns file contents with NUL terminator removed, or NULL on error.
172-
* Unlike grab_file, the returned data does not include the NUL terminator.
171+
*Returns file contents with NUL terminator removed, or NULL on error.
172+
*Unlike grab_file, the returned data does not include the NUL terminator.
173173
*/
174174
u8 *grab_file_contents(const tal_t *ctx, const char *filename, size_t *len);
175175

176176
/**
177-
* Derive encryption key from passphrase using Argon2.
178-
* @ctx - tal context for allocation
179-
* @passphrase - the passphrase to derive from
177+
*Derive encryption key from passphrase using Argon2.
178+
*@ctx - tal context for allocation
179+
*@passphrase - the passphrase to derive from
180180
*
181-
* Returns derived encryption key, or NULL on error.
182-
* The returned key is memory-locked and has a destructor to clear it.
181+
*Returns derived encryption key, or NULL on error.
182+
*The returned key is memory-locked and has a destructor to clear it.
183183
*/
184184
struct secret *get_encryption_key(const tal_t *ctx, const char *passphrase);
185185

contrib/msggen/msggen/schema.json

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11725,6 +11725,7 @@
1172511725
},
1172611726
"mnemonic": {
1172711727
"type": "string",
11728+
"added": "v25.12",
1172811729
"description": [
1172911730
"The BIP39 mnemonic phrase for the HSM secret (only present for mnemonic-based secrets)."
1173011731
]
@@ -26482,13 +26483,12 @@
2648226483
"addresstype": {
2648326484
"type": "string",
2648426485
"description": [
26485-
"It specifies the type of address wanted; currently *bech32* (e.g. `tb1qu9j4lg5f9rgjyfhvfd905vw46eg39czmktxqgg` on bitcoin testnet or `bc1qwqdg6squsna38e46795at95yu9atm8azzmyvckulcc7kytlcckxswvvzej` on bitcoin mainnet), *p2tr* taproot addresses, or *bip86* for BIP86-derived taproot addresses. The special value *all* generates all known address types for the same underlying key."
26486+
"It specifies the type of address wanted; currently *bech32* (e.g. `tb1qu9j4lg5f9rgjyfhvfd905vw46eg39czmktxqgg` on bitcoin testnet or `bc1qwqdg6squsna38e46795at95yu9atm8azzmyvckulcc7kytlcckxswvvzej` on bitcoin mainnet), or *p2tr* taproot addresses. The special value *all* generates all known address types for the same underlying key."
2648626487
],
2648726488
"default": "*bech32* address",
2648826489
"enum": [
2648926490
"bech32",
2649026491
"p2tr",
26491-
"bip86",
2649226492
"all"
2649326493
]
2649426494
}
@@ -26502,7 +26502,7 @@
2650226502
"added": "v23.08",
2650326503
"type": "string",
2650426504
"description": [
26505-
"The taproot address (returned for both 'p2tr' and 'bip86' addresstype)."
26505+
"The taproot address."
2650626506
]
2650726507
},
2650826508
"bech32": {
@@ -26550,18 +26550,6 @@
2655026550
"response": {
2655126551
"p2tr": "bcrt1p2gppccw6ywewmg74qqxxmqfdpjds3rpr0mf22y9tm9xcc0muggwsea9nkf"
2655226552
}
26553-
},
26554-
{
26555-
"request": {
26556-
"id": "example:newaddr#3",
26557-
"method": "newaddr",
26558-
"params": {
26559-
"addresstype": "bip86"
26560-
}
26561-
},
26562-
"response": {
26563-
"p2tr": "bcrt1p2gppccw6ywewmg74qqxxmqfdpjds3rpr0mf22y9tm9xcc0muggwsea9nkf"
26564-
}
2656526553
}
2656626554
]
2656726555
},

contrib/pyln-grpc-proto/pyln/grpc/node_pb2.py

Lines changed: 970 additions & 970 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contrib/pyln-testing/pyln/testing/grpc2py.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,7 @@ def exposesecret2py(m):
451451
return remove_default({
452452
"codex32": m.codex32, # PrimitiveField in generate_composite
453453
"identifier": m.identifier, # PrimitiveField in generate_composite
454+
"mnemonic": m.mnemonic, # PrimitiveField in generate_composite
454455
})
455456

456457

doc/schemas/exposesecret.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
},
4747
"mnemonic": {
4848
"type": "string",
49+
"added": "v25.12",
4950
"description": [
5051
"The BIP39 mnemonic phrase for the HSM secret (only present for mnemonic-based secrets)."
5152
]

0 commit comments

Comments
 (0)