@needmoretruth/nmts-cli 0.40.0 → 0.42.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.
- package/CHANGELOG.md +23 -0
- package/README.ko.md +27 -1
- package/README.md +29 -1
- package/dist/api-advice.js +6 -0
- package/dist/api.d.ts +10 -1
- package/dist/api.js +14 -3
- package/dist/arg-options.d.ts +21 -0
- package/dist/args.js +12 -1
- package/dist/artifact-about.d.ts +1 -1
- package/dist/commands/create-link.d.ts +9 -0
- package/dist/commands/create-link.js +31 -1
- package/dist/commands/create.d.ts +9 -0
- package/dist/commands/create.js +17 -0
- package/dist/commands/login-passphrase.d.ts +13 -0
- package/dist/commands/login-passphrase.js +64 -0
- package/dist/commands/login.d.ts +3 -0
- package/dist/commands/login.js +15 -55
- package/dist/commands/openers-attach.d.ts +38 -0
- package/dist/commands/openers-attach.js +97 -0
- package/dist/commands/openers.d.ts +23 -0
- package/dist/commands/openers.js +195 -0
- package/dist/crypto-surface.d.ts +28 -0
- package/dist/crypto-surface.js +7 -0
- package/dist/extend-chain.js +2 -1
- package/dist/help.js +15 -0
- package/dist/main.js +11 -12
- package/dist/openers/doors.d.ts +65 -0
- package/dist/openers/doors.js +97 -0
- package/dist/openers/hints.d.ts +22 -0
- package/dist/openers/hints.js +11 -0
- package/dist/openers/sign.d.ts +56 -0
- package/dist/openers/sign.js +202 -0
- package/dist/openers/wallet.d.ts +71 -0
- package/dist/openers/wallet.js +210 -0
- package/dist/openers-key-file.d.ts +14 -0
- package/dist/openers-key-file.js +99 -0
- package/dist/openers.d.ts +7 -0
- package/dist/openers.js +21 -0
- package/dist/portable.d.ts +3 -0
- package/dist/portable.js +8 -0
- package/dist/product.d.ts +1 -1
- package/dist/product.js +1 -1
- package/dist/progress.d.ts +4 -0
- package/dist/progress.js +7 -2
- package/dist/reach.d.ts +40 -0
- package/dist/reach.js +52 -0
- package/dist/risk.d.ts +11 -0
- package/dist/risk.js +15 -0
- package/dist/sui-rpc.js +2 -1
- package/dist/upload-wallet-chain.js +6 -1
- package/dist/walrus-write.js +9 -4
- package/dist/walrus.d.ts +33 -6
- package/dist/walrus.js +48 -8
- package/docs/commands/openers.md +31 -0
- package/package.json +5 -1
- package/vendor/nmts-crypto/nmts_crypto_wasm.d.ts +54 -0
- package/vendor/nmts-crypto/nmts_crypto_wasm.js +108 -0
- package/vendor/nmts-crypto/nmts_crypto_wasm_bg.wasm +0 -0
- package/vendor/nmts-crypto/nmts_crypto_wasm_bg.wasm.d.ts +4 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# nmts openers — the wallets that open this account
|
|
2
|
+
|
|
3
|
+
Commands: openers
|
|
4
|
+
Tiers: openers=none · openers.add=medium · openers.remove=medium
|
|
5
|
+
|
|
6
|
+
An opener is a second way into the account. The account keeps its NMTS key, and that key is still
|
|
7
|
+
the root; an opener is a copy of it on the NMTS server, locked so that only one wallet's signature of
|
|
8
|
+
one fixed message opens it. NMTS cannot open the copy and does not learn which wallet it belongs to.
|
|
9
|
+
|
|
10
|
+
`nmts openers` lists what this account has — a locator, the kind, the day it was added — and how
|
|
11
|
+
many it may have. `nmts openers add --sui-key-file <file>` attaches a wallet, and
|
|
12
|
+
`nmts openers remove <locator>` takes one off. All three need the NMTS key beside the API key.
|
|
13
|
+
|
|
14
|
+
The file holds one `suiprivkey1…` line. The wallet's key is read, used to sign, never printed, and
|
|
15
|
+
never accepted as an option value. `--account <n>` (default 1) picks which of that wallet's accounts
|
|
16
|
+
and `--app <name>` makes a key for one product only; both are inside the signed message, so another
|
|
17
|
+
value is another signature and another account.
|
|
18
|
+
|
|
19
|
+
Attaching asks the wallet to sign the same message twice and refuses unless the two signatures are
|
|
20
|
+
the same bytes: a wallet that signs differently each time would lock a copy it could never open
|
|
21
|
+
again. A multi-signature account, a zkLogin account and a passkey account are refused by name.
|
|
22
|
+
|
|
23
|
+
Whoever holds an attached wallet can open every file in this account, from any machine, until it is
|
|
24
|
+
removed. Removing stops it from then on. It does not undo the past: a wallet that opened the account
|
|
25
|
+
once has held the NMTS key.
|
|
26
|
+
|
|
27
|
+
A locator that begins with `-` needs `--` before it: `nmts openers remove -- -4FEW…`. The line the
|
|
28
|
+
tool prints after an attach already carries it when it is needed.
|
|
29
|
+
|
|
30
|
+
`nmts login --wallet --sui-key-file <file>` signs in with an attached wallet, and
|
|
31
|
+
`nmts create --wallet --sui-key-file <file>` makes an account and attaches the wallet to it.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@needmoretruth/nmts-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.42.0",
|
|
4
4
|
"description": "Command-line and MCP access to NMTS (NeedMoreTruthStorage, https://nmts.me): open-source, end-to-end encrypted storage on the Walrus network. No fee to NMTS; you pay the network from your own wallet. For people and for their agents.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"publishConfig": {
|
|
@@ -85,6 +85,10 @@
|
|
|
85
85
|
"types": "./dist/drive-erase.d.ts",
|
|
86
86
|
"default": "./dist/drive-erase.js"
|
|
87
87
|
},
|
|
88
|
+
"./openers": {
|
|
89
|
+
"types": "./dist/openers.d.ts",
|
|
90
|
+
"default": "./dist/openers.js"
|
|
91
|
+
},
|
|
88
92
|
"./storage-control": {
|
|
89
93
|
"types": "./dist/storage-control.d.ts",
|
|
90
94
|
"default": "./dist/storage-control.js"
|
|
@@ -253,6 +253,56 @@ export function header_plaintext_len(header: Uint8Array): number;
|
|
|
253
253
|
*/
|
|
254
254
|
export function kdf_derive(code_bytes: Uint8Array): Uint8Array;
|
|
255
255
|
|
|
256
|
+
/**
|
|
257
|
+
* The 16-byte LOCATOR a wallet signature yields — the name the server files this opener's slot
|
|
258
|
+
* under, and the name a sign-in asks for it back by (NCF-3 §1.7).
|
|
259
|
+
*
|
|
260
|
+
* Accepts flag `0x00` Ed25519 (97 bytes), `0x01` secp256k1 and `0x02` secp256r1 (98). Refuses
|
|
261
|
+
* `0x03` multisig, `0x05` zkLogin, `0x06` passkey, any other flag, and an accepted flag at the
|
|
262
|
+
* wrong length — each with its own message, because the caller has to tell a person which one it
|
|
263
|
+
* was and what to do instead.
|
|
264
|
+
*
|
|
265
|
+
* ⚠ It does NOT verify the signature. Checking it against the address in the message is the
|
|
266
|
+
* caller's step, with the Sui library.
|
|
267
|
+
*/
|
|
268
|
+
export function opener_locator(serialized_signature: Uint8Array): Uint8Array;
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* The EXACT bytes a Sui wallet is asked to sign to open an NMTS account (NCF-3 §1.7). LF endings,
|
|
272
|
+
* no trailing newline, ASCII.
|
|
273
|
+
*
|
|
274
|
+
* ⛔ Built HERE rather than in JavaScript, and that is why this export exists at all: the browser,
|
|
275
|
+
* the command line and the recovery tool must ask for the same bytes, and one character of drift
|
|
276
|
+
* between them is a slot that no longer opens. One implementation, one message.
|
|
277
|
+
*
|
|
278
|
+
* Throws when `address` is not `0x` + 64 LOWERCASE hex, when `account` is 0, or when `app` is not
|
|
279
|
+
* 1–64 characters of `a-z0-9.-` starting and ending alphanumeric — and never repairs any of them,
|
|
280
|
+
* because all three are inside the bytes a person reads in the wallet popup.
|
|
281
|
+
*/
|
|
282
|
+
export function opener_message(address: string, account: number, app?: string | null): Uint8Array;
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* The 20 NMTS-KEY bytes inside `slot`, opened with this wallet's signature (NCF-3 §1.7).
|
|
286
|
+
*
|
|
287
|
+
* Throws with a named reason for a slot of the wrong length or an unknown version, and with one
|
|
288
|
+
* indistinguishable "this signature does not open this slot" for a different wallet, a different
|
|
289
|
+
* message or altered bytes — telling those three apart would tell somebody holding a fetched slot
|
|
290
|
+
* whether their guess was getting warmer.
|
|
291
|
+
*
|
|
292
|
+
* ⛔ What comes back IS the account. The caller hands it straight to the sign-in path and drops
|
|
293
|
+
* it; it is never sent anywhere and never logged.
|
|
294
|
+
*/
|
|
295
|
+
export function opener_open(serialized_signature: Uint8Array, slot: Uint8Array): Uint8Array;
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* The 62-byte SLOT holding `nmts_key` (the account's 20 key bytes) under this wallet's signature
|
|
299
|
+
* (NCF-3 §1.7): `version(1) || kind(1) || nonce(24) || XChaCha20-Poly1305(20 + 16)`.
|
|
300
|
+
*
|
|
301
|
+
* The nonce is drawn here from the browser's WebCrypto; there is no caller-nonce path in this
|
|
302
|
+
* build. The result is what goes to the server, and the server can do nothing with it.
|
|
303
|
+
*/
|
|
304
|
+
export function opener_seal(serialized_signature: Uint8Array, nmts_key: Uint8Array): Uint8Array;
|
|
305
|
+
|
|
256
306
|
/**
|
|
257
307
|
* The name this account's recovery manifest is stored under inside a quilt (NCF-3 §2.5).
|
|
258
308
|
*
|
|
@@ -457,6 +507,10 @@ export interface InitOutput {
|
|
|
457
507
|
readonly verify_part_set: (a: number, b: number) => [number, number];
|
|
458
508
|
readonly voucher_hash_from_input: (a: number, b: number) => [number, number];
|
|
459
509
|
readonly wallet_seed_for: (a: number, b: number, c: number) => [number, number, number, number];
|
|
510
|
+
readonly opener_locator: (a: number, b: number) => [number, number, number, number];
|
|
511
|
+
readonly opener_message: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
512
|
+
readonly opener_open: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
513
|
+
readonly opener_seal: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
460
514
|
readonly __wbindgen_exn_store: (a: number) => void;
|
|
461
515
|
readonly __externref_table_alloc: () => number;
|
|
462
516
|
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
@@ -599,6 +599,114 @@ export function kdf_derive(code_bytes) {
|
|
|
599
599
|
return v2;
|
|
600
600
|
}
|
|
601
601
|
|
|
602
|
+
/**
|
|
603
|
+
* The 16-byte LOCATOR a wallet signature yields — the name the server files this opener's slot
|
|
604
|
+
* under, and the name a sign-in asks for it back by (NCF-3 §1.7).
|
|
605
|
+
*
|
|
606
|
+
* Accepts flag `0x00` Ed25519 (97 bytes), `0x01` secp256k1 and `0x02` secp256r1 (98). Refuses
|
|
607
|
+
* `0x03` multisig, `0x05` zkLogin, `0x06` passkey, any other flag, and an accepted flag at the
|
|
608
|
+
* wrong length — each with its own message, because the caller has to tell a person which one it
|
|
609
|
+
* was and what to do instead.
|
|
610
|
+
*
|
|
611
|
+
* ⚠ It does NOT verify the signature. Checking it against the address in the message is the
|
|
612
|
+
* caller's step, with the Sui library.
|
|
613
|
+
* @param {Uint8Array} serialized_signature
|
|
614
|
+
* @returns {Uint8Array}
|
|
615
|
+
*/
|
|
616
|
+
export function opener_locator(serialized_signature) {
|
|
617
|
+
const ptr0 = passArray8ToWasm0(serialized_signature, wasm.__wbindgen_malloc);
|
|
618
|
+
const len0 = WASM_VECTOR_LEN;
|
|
619
|
+
const ret = wasm.opener_locator(ptr0, len0);
|
|
620
|
+
if (ret[3]) {
|
|
621
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
622
|
+
}
|
|
623
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
624
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
625
|
+
return v2;
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
/**
|
|
629
|
+
* The EXACT bytes a Sui wallet is asked to sign to open an NMTS account (NCF-3 §1.7). LF endings,
|
|
630
|
+
* no trailing newline, ASCII.
|
|
631
|
+
*
|
|
632
|
+
* ⛔ Built HERE rather than in JavaScript, and that is why this export exists at all: the browser,
|
|
633
|
+
* the command line and the recovery tool must ask for the same bytes, and one character of drift
|
|
634
|
+
* between them is a slot that no longer opens. One implementation, one message.
|
|
635
|
+
*
|
|
636
|
+
* Throws when `address` is not `0x` + 64 LOWERCASE hex, when `account` is 0, or when `app` is not
|
|
637
|
+
* 1–64 characters of `a-z0-9.-` starting and ending alphanumeric — and never repairs any of them,
|
|
638
|
+
* because all three are inside the bytes a person reads in the wallet popup.
|
|
639
|
+
* @param {string} address
|
|
640
|
+
* @param {number} account
|
|
641
|
+
* @param {string | null} [app]
|
|
642
|
+
* @returns {Uint8Array}
|
|
643
|
+
*/
|
|
644
|
+
export function opener_message(address, account, app) {
|
|
645
|
+
const ptr0 = passStringToWasm0(address, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
646
|
+
const len0 = WASM_VECTOR_LEN;
|
|
647
|
+
var ptr1 = isLikeNone(app) ? 0 : passStringToWasm0(app, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
648
|
+
var len1 = WASM_VECTOR_LEN;
|
|
649
|
+
const ret = wasm.opener_message(ptr0, len0, account, ptr1, len1);
|
|
650
|
+
if (ret[3]) {
|
|
651
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
652
|
+
}
|
|
653
|
+
var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
654
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
655
|
+
return v3;
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
/**
|
|
659
|
+
* The 20 NMTS-KEY bytes inside `slot`, opened with this wallet's signature (NCF-3 §1.7).
|
|
660
|
+
*
|
|
661
|
+
* Throws with a named reason for a slot of the wrong length or an unknown version, and with one
|
|
662
|
+
* indistinguishable "this signature does not open this slot" for a different wallet, a different
|
|
663
|
+
* message or altered bytes — telling those three apart would tell somebody holding a fetched slot
|
|
664
|
+
* whether their guess was getting warmer.
|
|
665
|
+
*
|
|
666
|
+
* ⛔ What comes back IS the account. The caller hands it straight to the sign-in path and drops
|
|
667
|
+
* it; it is never sent anywhere and never logged.
|
|
668
|
+
* @param {Uint8Array} serialized_signature
|
|
669
|
+
* @param {Uint8Array} slot
|
|
670
|
+
* @returns {Uint8Array}
|
|
671
|
+
*/
|
|
672
|
+
export function opener_open(serialized_signature, slot) {
|
|
673
|
+
const ptr0 = passArray8ToWasm0(serialized_signature, wasm.__wbindgen_malloc);
|
|
674
|
+
const len0 = WASM_VECTOR_LEN;
|
|
675
|
+
const ptr1 = passArray8ToWasm0(slot, wasm.__wbindgen_malloc);
|
|
676
|
+
const len1 = WASM_VECTOR_LEN;
|
|
677
|
+
const ret = wasm.opener_open(ptr0, len0, ptr1, len1);
|
|
678
|
+
if (ret[3]) {
|
|
679
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
680
|
+
}
|
|
681
|
+
var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
682
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
683
|
+
return v3;
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
/**
|
|
687
|
+
* The 62-byte SLOT holding `nmts_key` (the account's 20 key bytes) under this wallet's signature
|
|
688
|
+
* (NCF-3 §1.7): `version(1) || kind(1) || nonce(24) || XChaCha20-Poly1305(20 + 16)`.
|
|
689
|
+
*
|
|
690
|
+
* The nonce is drawn here from the browser's WebCrypto; there is no caller-nonce path in this
|
|
691
|
+
* build. The result is what goes to the server, and the server can do nothing with it.
|
|
692
|
+
* @param {Uint8Array} serialized_signature
|
|
693
|
+
* @param {Uint8Array} nmts_key
|
|
694
|
+
* @returns {Uint8Array}
|
|
695
|
+
*/
|
|
696
|
+
export function opener_seal(serialized_signature, nmts_key) {
|
|
697
|
+
const ptr0 = passArray8ToWasm0(serialized_signature, wasm.__wbindgen_malloc);
|
|
698
|
+
const len0 = WASM_VECTOR_LEN;
|
|
699
|
+
const ptr1 = passArray8ToWasm0(nmts_key, wasm.__wbindgen_malloc);
|
|
700
|
+
const len1 = WASM_VECTOR_LEN;
|
|
701
|
+
const ret = wasm.opener_seal(ptr0, len0, ptr1, len1);
|
|
702
|
+
if (ret[3]) {
|
|
703
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
704
|
+
}
|
|
705
|
+
var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
706
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
707
|
+
return v3;
|
|
708
|
+
}
|
|
709
|
+
|
|
602
710
|
/**
|
|
603
711
|
* The name this account's recovery manifest is stored under inside a quilt (NCF-3 §2.5).
|
|
604
712
|
*
|
|
Binary file
|
|
@@ -46,6 +46,10 @@ export const streamencryptor_resumeFromHeader: (a: number, b: number, c: number,
|
|
|
46
46
|
export const verify_part_set: (a: number, b: number) => [number, number];
|
|
47
47
|
export const voucher_hash_from_input: (a: number, b: number) => [number, number];
|
|
48
48
|
export const wallet_seed_for: (a: number, b: number, c: number) => [number, number, number, number];
|
|
49
|
+
export const opener_locator: (a: number, b: number) => [number, number, number, number];
|
|
50
|
+
export const opener_message: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
51
|
+
export const opener_open: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
52
|
+
export const opener_seal: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
49
53
|
export const __wbindgen_exn_store: (a: number) => void;
|
|
50
54
|
export const __externref_table_alloc: () => number;
|
|
51
55
|
export const __wbindgen_externrefs: WebAssembly.Table;
|