Skip to content

Commit 89c1b06

Browse files
committed
global: use lightning-hsmtool not hsmtool.
When installed, the name is `lightning-hsmtool`. We actually copy `tools/hsmtool` to `tools/lightning-hsmtool` but that's a silly step which we should get rid of. So: 1. Make sure our documentation always refers to it as lightning-hsmtool. 2. Make sure our tests invoke it as `lightning-hsmtool`. 3. Rename the C file. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
1 parent 6421931 commit 89c1b06

File tree

18 files changed

+33
-38
lines changed

18 files changed

+33
-38
lines changed

Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -934,8 +934,7 @@ TESTBINS = \
934934
$(CLN_PLUGIN_EXAMPLES) \
935935
tests/plugins/test_libplugin \
936936
tests/plugins/channeld_fakenet \
937-
tests/plugins/test_selfdisable_after_getmanifest \
938-
tools/hsmtool
937+
tests/plugins/test_selfdisable_after_getmanifest
939938

940939
# The testpack is used in CI to transfer built artefacts between the
941940
# build and the test phase. This is necessary because the fixtures in

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ If the two blockheights drift apart it might be necessary to intervene.
198198

199199
### HD wallet encryption
200200

201-
You can encrypt the `hsm_secret` content (which is used to derive the HD wallet's master key) by passing the `--encrypted-hsm` startup argument, or by using the `hsmtool` (which you can find in the `tool/` directory at the root of this repo) with the `encrypt` method. You can unencrypt an encrypted `hsm_secret` using the `hsmtool` with the `decrypt` method.
201+
You can encrypt the `hsm_secret` content (which is used to derive the HD wallet's master key) by passing the `--encrypted-hsm` startup argument, or by using the `lightning-hsmtool` (which you can find in the `tool/` directory at the root of this repo) with the `encrypt` method. You can unencrypt an encrypted `hsm_secret` using the `lightning-hsmtool` with the `decrypt` method.
202202

203203
If you encrypt your `hsm_secret`, you will have to pass the `--encrypted-hsm` startup option to `lightningd`. Once your `hsm_secret` is encrypted, you __will not__ be able to access your funds without your password, so please beware with your password management. Also, beware of not feeling too safe with an encrypted `hsm_secret`: unlike for `bitcoind` where the wallet encryption can restrict the usage of some RPC command, `lightningd` always needs to access keys from the wallet which is thus __not locked__ (yet), even with an encrypted BIP32 master seed.
204204

contrib/msggen/msggen/schema.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7472,7 +7472,7 @@
74727472
"Value to be decoded:",
74737473
" * a *bolt11* or *bolt12* string (optionally prefixed by `lightning:` or `LIGHTNING:`) as specified by the BOLT 11 and BOLT 12 specifications.",
74747474
" * a *rune* as created by lightning-commando-rune(7).",
7475-
" * an *emergency_recover* string generated by hsmtool like `lightning-hsmtool getemergencyrecover <path/to/emergency.recover>`. It holds `emergency.recover` contents and starts with `clnemerg1`."
7475+
" * an *emergency_recover* string generated by lightning-hsmtool like `lightning-hsmtool getemergencyrecover <path/to/emergency.recover>`. It holds `emergency.recover` contents and starts with `clnemerg1`."
74767476
]
74777477
}
74787478
}
@@ -30510,7 +30510,7 @@
3051030510
"description": [
3051130511
"The **recover** RPC command wipes your node and restarts it with the `--recover` option. This is only permitted if the node is unused: no channels, no bitcoin addresses issued (you can use `check` to see if recovery is possible).",
3051230512
"",
30513-
"*hsmsecret* is either a codex32 secret starting with \"cl1\" as returned by `hsmtool getcodexsecret`, or a raw 64 character hex string.",
30513+
"*hsmsecret* is either a codex32 secret starting with \"cl1\" as returned by `lightning-hsmtool getcodexsecret`, or a raw 64 character hex string.",
3051430514
"",
3051530515
"NOTE: this command only currently works with the `sqlite3` database backend."
3051630516
],
@@ -30523,7 +30523,7 @@
3052330523
"hsmsecret": {
3052430524
"type": "string",
3052530525
"description": [
30526-
"Either a codex32 secret starting with `cl1` as returned by `hsmtool getcodexsecret`, or a raw 64 character hex string."
30526+
"Either a codex32 secret starting with `cl1` as returned by `lightning-hsmtool getcodexsecret`, or a raw 64 character hex string."
3052730527
]
3052830528
}
3052930529
}

doc/beginners-guide/backup-and-recovery/hsm-secret.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ privacy:
1010

1111
## Generate HSM Secret
1212

13-
If you are deploying a new node that has no funds and channels yet, you can generate BIP39 words using any process, and create the `hsm_secret` using the `hsmtool generatehsm` command. If you did `make install` then `hsmtool` is installed as [`lightning-hsmtool`](ref:lightning-hsmtool), else you can find it in the `tools/` directory of the build directory.
13+
If you are deploying a new node that has no funds and channels yet, you can generate BIP39 words using any process, and create the `hsm_secret` using the `lightning-hsmtool generatehsm` command. If you did `make install` then `hsmtool` is installed as [`lightning-hsmtool`](ref:lightning-hsmtool), else you can find it in the `tools/` directory of the build directory.
1414

1515
```shell
1616
lightning-hsmtool generatehsm hsm_secret
@@ -25,14 +25,14 @@ You can regenerate the same `hsm_secret` file using the same BIP39 words, which
2525

2626
You can encrypt the `hsm_secret` content (which is used to derive the HD wallet's master key):
2727
- either by passing the `--encrypted-hsm` startup argument
28-
- or by using the `encrypt` method from `/tools/hsmtool`.
28+
- or by using the `encrypt` method from `/tools/lightning-hsmtool`.
2929

3030
If you encrypt your `hsm_secret`, you will have to pass the `--encrypted-hsm` startup option to `lightningd`. Once your `hsm_secret` is encrypted, you **will not** be able to access your funds without your password, so please beware with your password management. Also, beware of not feeling too safe with an encrypted `hsm_secret`: unlike for `bitcoind` where the wallet encryption can restrict the usage of some RPC command, `lightningd` always needs to access keys from the wallet which is thus **not locked** (yet), even with an encrypted BIP32 master seed.
3131

3232

3333
## Decrypt HSM Secret
3434

35-
You can unencrypt an encrypted `hsm_secret` using the `hsmtool` with the `decrypt` method.
35+
You can unencrypt an encrypted `hsm_secret` using the `lightning-hsmtool` with the `decrypt` method.
3636

3737
```shell
3838
lightning-hsmtool decrypt ${LIGHTNINGDIR}/hsm_secret

doc/beginners-guide/backup.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ chmod 0400 hsm_secret
6565

6666
#### Codex32 Format
6767

68-
Run `tools/hsmtool getcodexsecret <hsm/secret/path> <id>` to get the `hsm_secret` in codex32 format.
68+
Run `tools/lightning-hsmtool getcodexsecret <hsm/secret/path> <id>` to get the `hsm_secret` in codex32 format.
6969

70-
Example `tools/hsmtool getcodexsecret ~/.lightning/bitcoin/hsm_secret adt0`.
70+
Example `tools/lightning-hsmtool getcodexsecret ~/.lightning/bitcoin/hsm_secret adt0`.
7171

7272
`hsm/secret/path` in the above command is `$LIGHTNINGDIR/hsm_secret`, and
7373
`id` is any 4 character string used to identify this secret. It **cannot** contain `i`, `o`, or `b`, but **can** contain all digits except `1`.

doc/lightningd-config.5.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ connections. Default is 9736.
338338

339339
* **recover**=*hsmsecret*
340340

341-
Restore the node from a 32-byte secret encoded as either a codex32 secret string or a 64-character hex string: this will fail if the `hsm_secret` file exists. Your node will start the node in offline mode, for manual recovery. The secret can be extracted from the `hsm_secret` using hsmtool(8).
341+
Restore the node from a 32-byte secret encoded as either a codex32 secret string or a 64-character hex string: this will fail if the `hsm_secret` file exists. Your node will start the node in offline mode, for manual recovery. The secret can be extracted from the `hsm_secret` using lightning-hsmtool(8).
342342

343343
* **alias**=*NAME*
344344

doc/node-operators-guide/faq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ There are 3 types of 'rescans' you can make:
159159
160160
### Database corruption / channel state lost
161161
162-
If you lose data (likely corrupted `lightningd.sqlite3`) about a channel **with `option_static_remotekey` enabled**, you can wait for your peer to unilateraly close the channel, then use `tools/hsmtool` with the `guesstoremote` command to attempt to recover your funds from the peer's published unilateral close transaction.
162+
If you lose data (likely corrupted `lightningd.sqlite3`) about a channel **with `option_static_remotekey` enabled**, you can wait for your peer to unilateraly close the channel, then use `tools/lightning-hsmtool` with the `guesstoremote` command to attempt to recover your funds from the peer's published unilateral close transaction.
163163
164164
If `option_static_remotekey` was not enabled, you're probably out of luck. The keys for your funds in your peer's unilateral close transaction are derived from information you lost. Fortunately, since version `0.7.3` channels are created with `option_static_remotekey` by default if your peer supports it. Which is to say that channels created after block [598000](https://blockstream.info/block/0000000000000000000dd93b8fb5c622b9c903bf6f921ef48e266f0ead7faedb)
165165
(short channel id starting with > 598000) have a high chance of supporting `option_static_remotekey`. You can verify it using the `features` field from the [`listpeers` command](ref:listpeers)'s result.

doc/schemas/decode.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"Value to be decoded:",
2020
" * a *bolt11* or *bolt12* string (optionally prefixed by `lightning:` or `LIGHTNING:`) as specified by the BOLT 11 and BOLT 12 specifications.",
2121
" * a *rune* as created by lightning-commando-rune(7).",
22-
" * an *emergency_recover* string generated by hsmtool like `lightning-hsmtool getemergencyrecover <path/to/emergency.recover>`. It holds `emergency.recover` contents and starts with `clnemerg1`."
22+
" * an *emergency_recover* string generated by lightning-hsmtool like `lightning-hsmtool getemergencyrecover <path/to/emergency.recover>`. It holds `emergency.recover` contents and starts with `clnemerg1`."
2323
]
2424
}
2525
}

doc/schemas/recover.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"description": [
77
"The **recover** RPC command wipes your node and restarts it with the `--recover` option. This is only permitted if the node is unused: no channels, no bitcoin addresses issued (you can use `check` to see if recovery is possible).",
88
"",
9-
"*hsmsecret* is either a codex32 secret starting with \"cl1\" as returned by `hsmtool getcodexsecret`, or a raw 64 character hex string.",
9+
"*hsmsecret* is either a codex32 secret starting with \"cl1\" as returned by `lightning-hsmtool getcodexsecret`, or a raw 64 character hex string.",
1010
"",
1111
"NOTE: this command only currently works with the `sqlite3` database backend."
1212
],
@@ -19,7 +19,7 @@
1919
"hsmsecret": {
2020
"type": "string",
2121
"description": [
22-
"Either a codex32 secret starting with `cl1` as returned by `hsmtool getcodexsecret`, or a raw 64 character hex string."
22+
"Either a codex32 secret starting with `cl1` as returned by `lightning-hsmtool getcodexsecret`, or a raw 64 character hex string."
2323
]
2424
}
2525
}

tests/autogenerate-rpc-examples.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1827,7 +1827,7 @@ def get_hsm_secret(n):
18271827
"""Returns codex32 and hex"""
18281828
try:
18291829
hsmfile = os.path.join(n.daemon.lightning_dir, TEST_NETWORK, "hsm_secret")
1830-
codex32 = subprocess.check_output(["tools/hsmtool", "getcodexsecret", hsmfile, "leet"]).decode('utf-8').strip()
1830+
codex32 = subprocess.check_output(["tools/lightning-hsmtool", "getcodexsecret", hsmfile, "leet"]).decode('utf-8').strip()
18311831
with open(hsmfile, "rb") as f:
18321832
hexhsm = f.read().hex()
18331833
return codex32, hexhsm

0 commit comments

Comments
 (0)