@did-btcr2/cli 0.14.0 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/README.md +106 -17
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/cjs/index.js +1160 -131
  4. package/dist/esm/src/cli.js +29 -5
  5. package/dist/esm/src/cli.js.map +1 -1
  6. package/dist/esm/src/commands/config.js +130 -18
  7. package/dist/esm/src/commands/config.js.map +1 -1
  8. package/dist/esm/src/commands/create.js +13 -1
  9. package/dist/esm/src/commands/create.js.map +1 -1
  10. package/dist/esm/src/commands/deactivate.js +16 -2
  11. package/dist/esm/src/commands/deactivate.js.map +1 -1
  12. package/dist/esm/src/commands/index.js +2 -0
  13. package/dist/esm/src/commands/index.js.map +1 -1
  14. package/dist/esm/src/commands/init.js +63 -0
  15. package/dist/esm/src/commands/init.js.map +1 -0
  16. package/dist/esm/src/commands/keystore.js +81 -0
  17. package/dist/esm/src/commands/keystore.js.map +1 -0
  18. package/dist/esm/src/commands/profile.js +6 -4
  19. package/dist/esm/src/commands/profile.js.map +1 -1
  20. package/dist/esm/src/commands/update.js +16 -2
  21. package/dist/esm/src/commands/update.js.map +1 -1
  22. package/dist/esm/src/config-schema.js +149 -0
  23. package/dist/esm/src/config-schema.js.map +1 -0
  24. package/dist/esm/src/config.js +579 -55
  25. package/dist/esm/src/config.js.map +1 -1
  26. package/dist/esm/src/keystore/file-key-store.js +340 -32
  27. package/dist/esm/src/keystore/file-key-store.js.map +1 -1
  28. package/dist/esm/src/keystore/passphrase.js +40 -10
  29. package/dist/esm/src/keystore/passphrase.js.map +1 -1
  30. package/dist/esm/src/keystore/paths.js +6 -17
  31. package/dist/esm/src/keystore/paths.js.map +1 -1
  32. package/dist/esm/src/output.js +49 -0
  33. package/dist/esm/src/output.js.map +1 -1
  34. package/dist/esm/src/paths.js +59 -0
  35. package/dist/esm/src/paths.js.map +1 -0
  36. package/dist/esm/src/types.js +11 -0
  37. package/dist/esm/src/types.js.map +1 -1
  38. package/dist/types/src/cli.d.ts.map +1 -1
  39. package/dist/types/src/commands/config.d.ts.map +1 -1
  40. package/dist/types/src/commands/create.d.ts.map +1 -1
  41. package/dist/types/src/commands/deactivate.d.ts.map +1 -1
  42. package/dist/types/src/commands/index.d.ts +2 -0
  43. package/dist/types/src/commands/index.d.ts.map +1 -1
  44. package/dist/types/src/commands/init.d.ts +13 -0
  45. package/dist/types/src/commands/init.d.ts.map +1 -0
  46. package/dist/types/src/commands/keystore.d.ts +10 -0
  47. package/dist/types/src/commands/keystore.d.ts.map +1 -0
  48. package/dist/types/src/commands/profile.d.ts.map +1 -1
  49. package/dist/types/src/commands/update.d.ts.map +1 -1
  50. package/dist/types/src/config-schema.d.ts +24 -0
  51. package/dist/types/src/config-schema.d.ts.map +1 -0
  52. package/dist/types/src/config.d.ts +252 -14
  53. package/dist/types/src/config.d.ts.map +1 -1
  54. package/dist/types/src/keystore/file-key-store.d.ts +86 -10
  55. package/dist/types/src/keystore/file-key-store.d.ts.map +1 -1
  56. package/dist/types/src/keystore/passphrase.d.ts +16 -1
  57. package/dist/types/src/keystore/passphrase.d.ts.map +1 -1
  58. package/dist/types/src/keystore/paths.d.ts +6 -10
  59. package/dist/types/src/keystore/paths.d.ts.map +1 -1
  60. package/dist/types/src/output.d.ts +22 -0
  61. package/dist/types/src/output.d.ts.map +1 -1
  62. package/dist/types/src/paths.d.ts +54 -0
  63. package/dist/types/src/paths.d.ts.map +1 -0
  64. package/dist/types/src/types.d.ts +70 -0
  65. package/dist/types/src/types.d.ts.map +1 -1
  66. package/package.json +5 -5
  67. package/src/cli.ts +32 -4
  68. package/src/commands/config.ts +143 -18
  69. package/src/commands/create.ts +16 -1
  70. package/src/commands/deactivate.ts +24 -2
  71. package/src/commands/index.ts +2 -0
  72. package/src/commands/init.ts +74 -0
  73. package/src/commands/keystore.ts +98 -0
  74. package/src/commands/profile.ts +6 -4
  75. package/src/commands/update.ts +24 -2
  76. package/src/config-schema.ts +178 -0
  77. package/src/config.ts +752 -58
  78. package/src/keystore/file-key-store.ts +455 -43
  79. package/src/keystore/passphrase.ts +48 -8
  80. package/src/keystore/paths.ts +6 -18
  81. package/src/output.ts +53 -0
  82. package/src/paths.ts +79 -0
  83. package/src/types.ts +34 -0
@@ -7,16 +7,19 @@ export const ENV_KEYSTORE_PASSPHRASE = 'BTCR2_KEYSTORE_PASSPHRASE';
7
7
  * (which would leak into process listings and shell history). Resolution order:
8
8
  * the {@link ENV_KEYSTORE_PASSPHRASE} environment variable, a passphrase file,
9
9
  * then a non-echoing terminal prompt. Throws if none is available and standard
10
- * input is not a terminal.
10
+ * input is not a terminal. When `forcePrompt` is set, the env var and file are
11
+ * skipped and a terminal entry is required.
11
12
  */
12
13
  export function acquirePassphrase(options = {}) {
13
14
  // All sources are normalized identically (at most one trailing newline
14
15
  // removed) so the KDF input is source-independent.
15
- const fromEnv = process.env[ENV_KEYSTORE_PASSPHRASE];
16
- if (fromEnv)
17
- return assertNonEmpty(fromEnv.replace(/\r?\n$/, ''));
18
- if (options.passphraseFile) {
19
- return assertNonEmpty(readFileSync(options.passphraseFile, 'utf-8').replace(/\r?\n$/, ''));
16
+ if (!options.forcePrompt) {
17
+ const fromEnv = process.env[ENV_KEYSTORE_PASSPHRASE];
18
+ if (fromEnv)
19
+ return assertNonEmpty(fromEnv.replace(/\r?\n$/, ''));
20
+ if (options.passphraseFile) {
21
+ return assertNonEmpty(readFileSync(options.passphraseFile, 'utf-8').replace(/\r?\n$/, ''));
22
+ }
20
23
  }
21
24
  if (!process.stdin.isTTY) {
22
25
  throw new KeyStoreError(`No passphrase available. Set ${ENV_KEYSTORE_PASSPHRASE}, pass --passphrase-file, or run in a terminal.`, 'PASSPHRASE_REQUIRED_ERROR');
@@ -37,9 +40,32 @@ function assertNonEmpty(passphrase) {
37
40
  }
38
41
  return passphrase;
39
42
  }
43
+ /**
44
+ * A 4-byte shared buffer used only as an {@link Atomics.wait} target. It lets
45
+ * {@link promptHidden} block briefly on an empty non-blocking TTY instead of
46
+ * busy-spinning. It is never written to, so the wait always times out.
47
+ */
48
+ const IDLE_WAIT = new Int32Array(new SharedArrayBuffer(4));
49
+ /**
50
+ * Milliseconds to block on each empty read. Imperceptible to a typist yet long
51
+ * enough that an open prompt sits idle rather than pegging a CPU core.
52
+ */
53
+ const IDLE_POLL_MS = 20;
54
+ /**
55
+ * Removes the last whole UTF-8 character from an accumulating byte array in
56
+ * place: pops any trailing continuation bytes (0b10xxxxxx) then the leading
57
+ * byte. Exported for testing; a backspace mid-entry must not strand a fragment
58
+ * that later decodes to U+FFFD.
59
+ */
60
+ export function dropLastUtf8Char(bytes) {
61
+ while (bytes.length > 0 && (bytes[bytes.length - 1] & 0xc0) === 0x80)
62
+ bytes.pop();
63
+ bytes.pop();
64
+ }
40
65
  /**
41
66
  * Reads a line from the terminal synchronously without echoing keystrokes.
42
- * Bytes are accumulated and decoded as UTF-8 so multibyte passphrases survive.
67
+ * Bytes are accumulated and decoded as UTF-8 so multibyte passphrases survive,
68
+ * including a backspace that spans a whole multibyte character.
43
69
  * This path runs only when standard input is a terminal.
44
70
  */
45
71
  function promptHidden(label) {
@@ -57,8 +83,12 @@ function promptHidden(label) {
57
83
  }
58
84
  catch (error) {
59
85
  const code = error.code;
60
- if (code === 'EAGAIN')
61
- continue; // no byte ready yet on a non-blocking TTY
86
+ if (code === 'EAGAIN') {
87
+ // No byte ready yet on a non-blocking TTY. Block briefly instead of
88
+ // spinning so an open prompt does not peg a CPU core while it waits.
89
+ Atomics.wait(IDLE_WAIT, 0, 0, IDLE_POLL_MS);
90
+ continue;
91
+ }
62
92
  if (code === 'EOF')
63
93
  break;
64
94
  throw error;
@@ -72,7 +102,7 @@ function promptHidden(label) {
72
102
  throw new KeyStoreError('Passphrase entry aborted.', 'PASSPHRASE_REQUIRED_ERROR');
73
103
  }
74
104
  if (ch === 0x7f || ch === 0x08) { // DEL or backspace
75
- bytes.pop();
105
+ dropLastUtf8Char(bytes);
76
106
  continue;
77
107
  }
78
108
  bytes.push(ch);
@@ -1 +1 @@
1
- {"version":3,"file":"passphrase.js","sourceRoot":"","sources":["../../../../src/keystore/passphrase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,qFAAqF;AACrF,MAAM,CAAC,MAAM,uBAAuB,GAAG,2BAA2B,CAAC;AAYnE;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,UAA6B,EAAE;IAC/D,uEAAuE;IACvE,mDAAmD;IACnD,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;IACrD,IAAI,OAAO;QAAE,OAAO,cAAc,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC;IAElE,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;QAC3B,OAAO,cAAc,CAAC,YAAY,CAAC,OAAO,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC;IAC7F,CAAC;IAED,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACzB,MAAM,IAAI,aAAa,CACrB,gCAAgC,uBAAuB,iDAAiD,EACxG,2BAA2B,CAC5B,CAAC;IACJ,CAAC;IAED,MAAM,UAAU,GAAG,YAAY,CAAC,OAAO,CAAC,MAAM,IAAI,uBAAuB,CAAC,CAAC;IAC3E,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,KAAK,GAAG,YAAY,CAAC,sBAAsB,CAAC,CAAC;QACnD,IAAI,UAAU,KAAK,KAAK,EAAE,CAAC;YACzB,MAAM,IAAI,aAAa,CAAC,4BAA4B,EAAE,2BAA2B,CAAC,CAAC;QACrF,CAAC;IACH,CAAC;IACD,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,CAAC,2BAA2B,EAAE,2BAA2B,CAAC,CAAC;YACpF,CAAC;YACD,IAAI,EAAE,KAAK,IAAI,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,mBAAmB;gBACnD,gBAAgB,CAAC,KAAK,CAAC,CAAC;gBACxB,SAAS;YACX,CAAC;YACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACjB,CAAC;IACH,CAAC;YAAS,CAAC;QACT,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QACzB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AAC9C,CAAC"}
@@ -1,20 +1,9 @@
1
- import { homedir } from 'node:os';
2
- import { join } from 'node:path';
3
1
  /**
4
- * Default keystore file path, following the XDG Base Directory Specification's
5
- * data directory. Secret key material is data a user accumulates, so it lives
6
- * under the data directory, kept separate from the configuration directory used
7
- * for portable settings.
8
- *
9
- * Resolution order:
10
- * 1. `$XDG_DATA_HOME/btcr2/keystore.json`
11
- * 2. `%LOCALAPPDATA%/btcr2/keystore.json` (Windows)
12
- * 3. `~/.local/share/btcr2/keystore.json` (fallback)
2
+ * The default keystore path now lives alongside the config file under a single
3
+ * CLI home root (`<home>/keystore.json`, ADR 079). The implementation lives in
4
+ * `../paths.ts` (the single source of truth for on-disk state locations); it is
5
+ * re-exported here so existing `./paths.js` importers in the keystore layer keep
6
+ * their import surface.
13
7
  */
14
- export function defaultKeystorePath() {
15
- const base = process.env.XDG_DATA_HOME
16
- ?? process.env.LOCALAPPDATA
17
- ?? join(homedir(), '.local', 'share');
18
- return join(base, 'btcr2', 'keystore.json');
19
- }
8
+ export { defaultKeystorePath } from '../paths.js';
20
9
  //# sourceMappingURL=paths.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"paths.js","sourceRoot":"","sources":["../../../../src/keystore/paths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC;;;;;;;;;;GAUG;AACH,MAAM,UAAU,mBAAmB;IACjC,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa;WACjC,OAAO,CAAC,GAAG,CAAC,YAAY;WACxB,IAAI,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IACxC,OAAO,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,eAAe,CAAC,CAAC;AAC9C,CAAC"}
1
+ {"version":3,"file":"paths.js","sourceRoot":"","sources":["../../../../src/keystore/paths.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC"}
@@ -1,3 +1,52 @@
1
+ /** Placeholder printed in place of a redacted secret value. */
2
+ export const REDACTED = '********';
3
+ /**
4
+ * Key names whose (scalar) values are treated as secrets and redacted in printed
5
+ * output. Covers RPC passwords plus header credentials (`Authorization`, API
6
+ * keys, bearer tokens) that a profile can now carry in `btc.headers`/`rpcHeaders`.
7
+ */
8
+ const SECRET_KEY = /(pass|secret|token|auth|api[-_]?key|credential|bearer)/i;
9
+ /** Whether a config key name looks like a secret (so its scalar value should be redacted). */
10
+ export function isSecretKey(key) {
11
+ return SECRET_KEY.test(key);
12
+ }
13
+ /**
14
+ * Masks the password in a `scheme://user:pass@host` URL, leaving the rest of the
15
+ * value verbatim. A credential embedded in an endpoint URL (e.g. `rpcUrl`) is not
16
+ * caught by key-name matching, so it is scrubbed here regardless of the key.
17
+ */
18
+ export function scrubUrlUserinfo(value) {
19
+ if (value === undefined)
20
+ return undefined;
21
+ return value.replace(/^([a-z][a-z0-9+.-]*:\/\/[^/@:]+):[^/@]*@/i, `$1:${REDACTED}@`);
22
+ }
23
+ /**
24
+ * Returns a deep copy of `value` with secret scalar values replaced by
25
+ * {@link REDACTED}, so routine introspection (`config get`/`list`/`effective`)
26
+ * does not print RPC passwords or other secrets into terminal scrollback and CI
27
+ * logs. A secret-named key redacts only a scalar value (an object under such a
28
+ * key, e.g. a profile named `access-token`, is still traversed, not wholesale
29
+ * masked). Passwords embedded in URL values are scrubbed regardless of key name.
30
+ * When `keyName` is a secret name, a directly-passed scalar value is redacted
31
+ * (used when a single leaf value is printed). Display-only: the stored config and
32
+ * the value used to connect are untouched.
33
+ */
34
+ export function redactSecrets(value, keyName) {
35
+ if (Array.isArray(value)) {
36
+ return value.map(item => redactSecrets(item));
37
+ }
38
+ if (value !== null && typeof value === 'object') {
39
+ const out = {};
40
+ for (const [key, val] of Object.entries(value)) {
41
+ out[key] = redactSecrets(val, key);
42
+ }
43
+ return out;
44
+ }
45
+ if (keyName !== undefined && isSecretKey(keyName)) {
46
+ return value === undefined ? undefined : REDACTED;
47
+ }
48
+ return typeof value === 'string' ? scrubUrlUserinfo(value) : value;
49
+ }
1
50
  /**
2
51
  * Formats a CommandResult for console output.
3
52
  * In 'json' mode, the full result is serialized.
@@ -1 +1 @@
1
- {"version":3,"file":"output.js","sourceRoot":"","sources":["../../../src/output.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAAC,MAAqB,EAAE,OAAsB;IACxE,IAAI,OAAO,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;QAC9B,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACzC,CAAC;IACD,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;IACxB,OAAO,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACzE,CAAC"}
1
+ {"version":3,"file":"output.js","sourceRoot":"","sources":["../../../src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KAAK,QAAQ,CAAC,CAAC,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AACrE,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAAC,MAAqB,EAAE,OAAsB;IACxE,IAAI,OAAO,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;QAC9B,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACzC,CAAC;IACD,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;IACxB,OAAO,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACzE,CAAC"}
@@ -0,0 +1,59 @@
1
+ import { homedir } from 'node:os';
2
+ import { join } from 'node:path';
3
+ import { blankToUndef } from './types.js';
4
+ /** Environment variable naming the CLI home directory (all state colocated). */
5
+ export const ENV_HOME = 'BTCR2_HOME';
6
+ /** The config and keystore file names, kept side by side under the home root. */
7
+ export const CONFIG_FILENAME = 'config.json';
8
+ export const KEYSTORE_FILENAME = 'keystore.json';
9
+ /**
10
+ * Resolves the CLI home directory: the single root that holds `config.json` and
11
+ * `keystore.json` side by side (ADR 079). Resolution order, highest wins:
12
+ *
13
+ * 1. `--home <dir>` (the {@link PathOverrides.home} flag)
14
+ * 2. `$BTCR2_HOME`
15
+ * 3. the platform default (see {@link platformDefaultHome})
16
+ *
17
+ * A blank value at any layer defers to the next, mirroring the `blankToUndef`
18
+ * treatment every other precedence layer uses, so an exported-but-empty
19
+ * `BTCR2_HOME` does not resolve the home to a bare relative path.
20
+ */
21
+ export function resolveHome(overrides) {
22
+ return blankToUndef(overrides?.home)
23
+ ?? blankToUndef(process.env[ENV_HOME])
24
+ ?? platformDefaultHome();
25
+ }
26
+ /**
27
+ * The default home when no `--home` / `$BTCR2_HOME` override is present, chosen
28
+ * per OS so the location is idiomatic while staying a single colocated dir:
29
+ *
30
+ * - Windows: `%LOCALAPPDATA%\btcr2` (fallback `%APPDATA%\btcr2`, then the user
31
+ * profile), the native place for per-user application state.
32
+ * - Linux / macOS: `~/.btcr2`, the short, teachable dot-directory in the same
33
+ * family as `~/.ssh`, `~/.aws`, and `~/.gnupg`.
34
+ */
35
+ export function platformDefaultHome() {
36
+ if (process.platform === 'win32') {
37
+ const base = blankToUndef(process.env.LOCALAPPDATA)
38
+ ?? blankToUndef(process.env.APPDATA)
39
+ ?? homedir();
40
+ return join(base, 'btcr2');
41
+ }
42
+ return join(homedir(), '.btcr2');
43
+ }
44
+ /**
45
+ * Default config-file path: `<home>/config.json`. The `--config` flag, when
46
+ * present, overrides it wholesale (it names a specific file, not a home).
47
+ */
48
+ export function defaultConfigPath(overrides) {
49
+ return join(resolveHome(overrides), CONFIG_FILENAME);
50
+ }
51
+ /**
52
+ * Default keystore path: `<home>/keystore.json`. The `--keystore` flag and a
53
+ * profile's `identity.keystore` (resolved in `config.ts`) override it; this
54
+ * function is the final fallback in that chain.
55
+ */
56
+ export function defaultKeystorePath(overrides) {
57
+ return join(resolveHome(overrides), KEYSTORE_FILENAME);
58
+ }
59
+ //# sourceMappingURL=paths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.js","sourceRoot":"","sources":["../../../src/paths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAiB1C,gFAAgF;AAChF,MAAM,CAAC,MAAM,QAAQ,GAAG,YAAY,CAAC;AAErC,iFAAiF;AACjF,MAAM,CAAC,MAAM,eAAe,GAAG,aAAa,CAAC;AAC7C,MAAM,CAAC,MAAM,iBAAiB,GAAG,eAAe,CAAC;AAEjD;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,WAAW,CAAC,SAAyB;IACnD,OAAO,YAAY,CAAC,SAAS,EAAE,IAAI,CAAC;WAC/B,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;WACnC,mBAAmB,EAAE,CAAC;AAC7B,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB;IACjC,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;QACjC,MAAM,IAAI,GAAG,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC;eAC9C,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC;eACjC,OAAO,EAAE,CAAC;QACf,OAAO,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC7B,CAAC;IACD,OAAO,IAAI,CAAC,OAAO,EAAE,EAAE,QAAQ,CAAC,CAAC;AACnC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,SAAyB;IACzD,OAAO,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,EAAE,eAAe,CAAC,CAAC;AACvD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,SAAyB;IAC3D,OAAO,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,EAAE,iBAAiB,CAAC,CAAC;AACzD,CAAC"}
@@ -1,4 +1,15 @@
1
1
  export const SUPPORTED_NETWORKS = [
2
2
  'bitcoin', 'testnet3', 'testnet4', 'signet', 'mutinynet', 'regtest'
3
3
  ];
4
+ /**
5
+ * Normalizes a blank value (empty or whitespace-only) to `undefined`, so a
6
+ * blank at any precedence layer defers to the next layer instead of masking it.
7
+ * A non-blank value is returned unchanged. This mirrors the `|| undefined`
8
+ * treatment the environment layer already applies in `readEnvOverrides`.
9
+ */
10
+ export function blankToUndef(value) {
11
+ if (value === undefined)
12
+ return undefined;
13
+ return value.trim() === '' ? undefined : value;
14
+ }
4
15
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,MAAM,kBAAkB,GAAoB;IACjD,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS;CACpE,CAAC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAiBA,MAAM,CAAC,MAAM,kBAAkB,GAAoB;IACjD,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS;CACpE,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,KAAyB;IACpD,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC1C,OAAO,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC;AACjD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../../src/cli.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAkB,MAAM,WAAW,CAAC;AAWpD,OAAO,EAAyC,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAIrF;;GAEG;AACH,qBAAa,WAAW;IACtB,SAAgB,OAAO,EAAE,OAAO,CAAC;IAEjC;;;;;;;;;;;;;OAaG;gBAED,OAAO,GAAE,UAA8B,EACvC,eAAe,GAAE,UAA+B;IAgClD;;;;OAIG;IACU,GAAG,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CASjD"}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../../src/cli.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAkB,MAAM,WAAW,CAAC;AAapD,OAAO,EAA8D,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAI1G;;GAEG;AACH,qBAAa,WAAW;IACtB,SAAgB,OAAO,EAAE,OAAO,CAAC;IAEjC;;;;;;;;;;;;;OAaG;gBAED,OAAO,GAAE,UAA8B,EACvC,eAAe,GAAE,UAA+B;IAkDlD;;;;OAIG;IACU,GAAG,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CASjD"}
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../src/commands/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAezC,OAAO,KAAK,EAAiB,aAAa,EAAE,MAAM,aAAa,CAAC;AAGhE,sFAAsF;AACtF,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,GAAG,IAAI,CAuD1F"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../src/commands/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAqBzC,OAAO,KAAK,EAAiB,aAAa,EAAiB,MAAM,aAAa,CAAC;AAG/E,sFAAsF;AACtF,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,GAAG,IAAI,CA0H1F"}
@@ -1 +1 @@
1
- {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../../src/commands/create.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,UAAU,EAAuB,MAAM,cAAc,CAAC;AAKpE,OAAO,KAAK,EAAiB,aAAa,EAAiB,MAAM,aAAa,CAAC;AAS/E;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAW,OAAO,EACzB,OAAO,EAAW,UAAU,EAC5B,eAAe,EAAG,UAAU,EAC5B,OAAO,EAAW,MAAM,aAAa,GACpC,IAAI,CA2FN"}
1
+ {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../../src/commands/create.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,UAAU,EAAuB,MAAM,cAAc,CAAC;AAKpE,OAAO,KAAK,EAAiB,aAAa,EAAiB,MAAM,aAAa,CAAC;AAS/E;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAW,OAAO,EACzB,OAAO,EAAW,UAAU,EAC5B,eAAe,EAAG,UAAU,EAC5B,OAAO,EAAW,MAAM,aAAa,GACpC,IAAI,CAyGN"}
@@ -1 +1 @@
1
- {"version":3,"file":"deactivate.d.ts","sourceRoot":"","sources":["../../../../src/commands/deactivate.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAiB,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAI9D,OAAO,KAAK,EAAE,aAAa,EAAwB,MAAM,aAAa,CAAC;AAKvE,wBAAgB,yBAAyB,CACvC,OAAO,EAAG,OAAO,EACjB,OAAO,EAAG,UAAU,EACpB,OAAO,EAAG,MAAM,aAAa,GAC5B,IAAI,CAkFN"}
1
+ {"version":3,"file":"deactivate.d.ts","sourceRoot":"","sources":["../../../../src/commands/deactivate.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAiG,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAI9I,OAAO,KAAK,EAAE,aAAa,EAAwB,MAAM,aAAa,CAAC;AAKvE,wBAAgB,yBAAyB,CACvC,OAAO,EAAG,OAAO,EACjB,OAAO,EAAG,UAAU,EACpB,OAAO,EAAG,MAAM,aAAa,GAC5B,IAAI,CAwGN"}
@@ -1,8 +1,10 @@
1
+ export { registerInitCommand } from './init.js';
1
2
  export { registerCreateCommand } from './create.js';
2
3
  export { registerResolveCommand } from './resolve.js';
3
4
  export { registerUpdateCommand } from './update.js';
4
5
  export { registerDeactivateCommand } from './deactivate.js';
5
6
  export { registerKeyCommand } from './key.js';
7
+ export { registerKeystoreCommand } from './keystore.js';
6
8
  export { registerConfigCommand } from './config.js';
7
9
  export { registerProfileCommand } from './profile.js';
8
10
  export { registerCompletionCommand } from './completion.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { Command } from 'commander';
2
+ import type { GlobalOptions } from '../types.js';
3
+ /**
4
+ * Registers the top-level `btcr2 init`: the one-command entry point that creates
5
+ * the btcr2 home (ADR 079), writes a default config if none exists, and
6
+ * establishes the keystore if none exists (encrypted with a confirmed passphrase
7
+ * by default, or `--dev` for an unencrypted testnet keystore). Idempotent:
8
+ * existing files are left untouched unless `--force` is given. Establishing the
9
+ * passphrase here, up front and confirmed, is what keeps the first `key generate`
10
+ * off the accidental-first-seal path (ADR 080).
11
+ */
12
+ export declare function registerInitCommand(program: Command, globals: () => GlobalOptions): void;
13
+ //# sourceMappingURL=init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQzC,OAAO,KAAK,EAAiB,aAAa,EAAE,MAAM,aAAa,CAAC;AAEhE;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,GAAG,IAAI,CAsDxF"}
@@ -0,0 +1,10 @@
1
+ import type { Command } from 'commander';
2
+ import type { GlobalOptions } from '../types.js';
3
+ /**
4
+ * Registers the `keystore` command group: establish, inspect, and re-key the
5
+ * encrypted keystore (ADR 080). These operate on the keystore file directly (no
6
+ * Bitcoin connection or KeyManager) and never decrypt a key except when
7
+ * re-sealing during `change-passphrase`.
8
+ */
9
+ export declare function registerKeystoreCommand(program: Command, globals: () => GlobalOptions): void;
10
+ //# sourceMappingURL=keystore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keystore.d.ts","sourceRoot":"","sources":["../../../../src/commands/keystore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOzC,OAAO,KAAK,EAAiB,aAAa,EAAE,MAAM,aAAa,CAAC;AAEhE;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,GAAG,IAAI,CAkF5F"}
@@ -1 +1 @@
1
- {"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../../../src/commands/profile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIzC,OAAO,KAAK,EAAiB,aAAa,EAAE,MAAM,aAAa,CAAC;AAEhE,iFAAiF;AACjF,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,GAAG,IAAI,CAyD3F"}
1
+ {"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../../../src/commands/profile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIzC,OAAO,KAAK,EAAiB,aAAa,EAAE,MAAM,aAAa,CAAC;AAEhE,iFAAiF;AACjF,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,GAAG,IAAI,CA2D3F"}
@@ -1 +1 @@
1
- {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../../src/commands/update.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAiB,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAI9D,OAAO,KAAK,EAAE,aAAa,EAAwB,MAAM,aAAa,CAAC;AAEvE,wBAAgB,qBAAqB,CACnC,OAAO,EAAG,OAAO,EACjB,OAAO,EAAG,UAAU,EACpB,OAAO,EAAG,MAAM,aAAa,GAC5B,IAAI,CAqFN"}
1
+ {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../../src/commands/update.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAiG,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAI9I,OAAO,KAAK,EAAE,aAAa,EAAwB,MAAM,aAAa,CAAC;AAEvE,wBAAgB,qBAAqB,CACnC,OAAO,EAAG,OAAO,EACjB,OAAO,EAAG,UAAU,EACpB,OAAO,EAAG,MAAM,aAAa,GAC5B,IAAI,CA2GN"}
@@ -0,0 +1,24 @@
1
+ /** One problem found in a config file: the dotted path and a human-readable reason. */
2
+ export interface ConfigIssue {
3
+ path: string;
4
+ issue: string;
5
+ }
6
+ /** Whether a dotted path is part of the known config schema (leaf or intermediate). */
7
+ export declare function isKnownConfigPath(dotted: string): boolean;
8
+ /**
9
+ * Write-time validation for `config set`. An enum, number, or object leaf whose
10
+ * value has the wrong kind is a hard rejection (throws). An unknown path is
11
+ * permitted but reported, so `config set` can warn and still write (keeping
12
+ * forward-compatible and third-party keys usable). Returns `{ unknownPath }`.
13
+ */
14
+ export declare function validateConfigSet(dotted: string, value: unknown): {
15
+ unknownPath: boolean;
16
+ };
17
+ /**
18
+ * Strict validation for `config validate`: walks a parsed config and collects
19
+ * every unknown key and out-of-enum value, plus a `schemaVersion` that is newer
20
+ * than this CLI supports. Never throws; returns the full list so the caller can
21
+ * report all problems at once.
22
+ */
23
+ export declare function findConfigIssues(config: Record<string, unknown>, supportedSchemaVersion: number): ConfigIssue[];
24
+ //# sourceMappingURL=config-schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-schema.d.ts","sourceRoot":"","sources":["../../../src/config-schema.ts"],"names":[],"mappings":"AAgDA,uFAAuF;AACvF,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAI,MAAM,CAAC;IACf,KAAK,EAAG,MAAM,CAAC;CAChB;AAwBD,uFAAuF;AACvF,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEzD;AAwCD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG;IAAE,WAAW,EAAE,OAAO,CAAA;CAAE,CAO1F;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,sBAAsB,EAAE,MAAM,GAAG,WAAW,EAAE,CAa/G"}