@needmoretruth/nmts-cli 0.45.0 → 0.46.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/AGENTS.md +2 -2
- package/CHANGELOG.md +61 -0
- package/README.ko.md +6 -3
- package/README.md +15 -3
- package/dist/api-advice.js +17 -2
- package/dist/api.d.ts +22 -0
- package/dist/api.js +49 -1
- package/dist/arg-options.d.ts +8 -0
- package/dist/args.js +7 -1
- package/dist/artifact-about.d.ts +1 -1
- package/dist/collision.d.ts +20 -3
- package/dist/collision.js +21 -3
- package/dist/commands/erase.js +1 -0
- package/dist/commands/handover.d.ts +13 -0
- package/dist/commands/handover.js +328 -0
- package/dist/commands/heavy-run.d.ts +59 -0
- package/dist/commands/heavy-run.js +247 -0
- package/dist/commands/heavy.d.ts +7 -0
- package/dist/commands/heavy.js +123 -0
- package/dist/commands/ls.d.ts +5 -0
- package/dist/commands/ls.js +9 -1
- package/dist/commands/public-code.d.ts +6 -0
- package/dist/commands/public-code.js +46 -0
- package/dist/commands/push-heavy.d.ts +6 -0
- package/dist/commands/push-heavy.js +128 -0
- package/dist/commands/push-tree.d.ts +24 -0
- package/dist/commands/push-tree.js +91 -0
- package/dist/commands/push.d.ts +4 -13
- package/dist/commands/push.js +7 -77
- package/dist/commands/put-heavy.d.ts +9 -0
- package/dist/commands/put-heavy.js +120 -0
- package/dist/commands/put-payer.d.ts +21 -0
- package/dist/commands/put-payer.js +24 -0
- package/dist/commands/put.d.ts +2 -2
- package/dist/commands/put.js +8 -7
- package/dist/commands/receive.js +3 -3
- package/dist/commands/s3.js +44 -10
- package/dist/crypto-surface.d.ts +8 -0
- package/dist/crypto-surface.js +3 -0
- package/dist/crypto.d.ts +3 -0
- package/dist/crypto.js +3 -0
- package/dist/download-part.d.ts +32 -1
- package/dist/download-part.js +95 -6
- package/dist/download-range.d.ts +19 -0
- package/dist/download-range.js +108 -0
- package/dist/download-sink.d.ts +15 -0
- package/dist/download.d.ts +14 -0
- package/dist/download.js +19 -4
- package/dist/handover.d.ts +44 -0
- package/dist/handover.js +199 -0
- package/dist/heavy-api.d.ts +36 -0
- package/dist/heavy-api.js +107 -0
- package/dist/heavy-copy.d.ts +72 -0
- package/dist/heavy-copy.js +108 -0
- package/dist/heavy-evm.d.ts +20 -0
- package/dist/heavy-evm.js +106 -0
- package/dist/heavy-self-pay.d.ts +92 -0
- package/dist/heavy-self-pay.js +167 -0
- package/dist/heavy-upload.d.ts +87 -0
- package/dist/heavy-upload.js +154 -0
- package/dist/heavy-wallet-pay.d.ts +39 -0
- package/dist/heavy-wallet-pay.js +73 -0
- package/dist/help-options.js +4 -2
- package/dist/help.js +16 -3
- package/dist/list-tier.d.ts +7 -0
- package/dist/list-tier.js +47 -0
- package/dist/main.js +12 -10
- package/dist/manifest-write.d.ts +4 -3
- package/dist/platform-sign.d.ts +4 -4
- package/dist/platform-sign.js +3 -3
- package/dist/portable.d.ts +15 -0
- package/dist/portable.js +11 -0
- package/dist/product.d.ts +1 -1
- package/dist/product.js +1 -1
- package/dist/recovery-build.js +16 -0
- package/dist/recovery-map-part.d.ts +82 -0
- package/dist/recovery-map-part.js +83 -0
- package/dist/recovery-map.d.ts +5 -40
- package/dist/recovery-map.js +18 -1
- package/dist/recovery-source.d.ts +3 -0
- package/dist/recovery-source.js +9 -0
- package/dist/risk.d.ts +30 -0
- package/dist/risk.js +23 -2
- package/dist/run-log.d.ts +1 -1
- package/dist/run-log.js +7 -1
- package/dist/s3/address.d.ts +20 -0
- package/dist/s3/address.js +97 -0
- package/dist/s3/answer.d.ts +48 -0
- package/dist/s3/answer.js +330 -0
- package/dist/s3/body-deframe.d.ts +49 -0
- package/dist/s3/body-deframe.js +264 -0
- package/dist/s3/body-measure.d.ts +13 -0
- package/dist/s3/body-measure.js +48 -0
- package/dist/s3/body-plan.d.ts +31 -0
- package/dist/s3/body-plan.js +159 -0
- package/dist/s3/body.d.ts +46 -0
- package/dist/s3/body.js +117 -0
- package/dist/s3/call.d.ts +36 -0
- package/dist/s3/call.js +42 -0
- package/dist/s3/checksum.d.ts +26 -0
- package/dist/s3/checksum.js +176 -0
- package/dist/s3/content-type.d.ts +3 -0
- package/dist/s3/content-type.js +49 -0
- package/dist/s3/contract.d.ts +91 -14
- package/dist/s3/drive-conditions.d.ts +47 -0
- package/dist/s3/drive-conditions.js +134 -0
- package/dist/s3/drive-key.d.ts +11 -0
- package/dist/s3/drive-key.js +58 -0
- package/dist/s3/drive-limits.d.ts +33 -0
- package/dist/s3/drive-limits.js +53 -0
- package/dist/s3/drive-lock.d.ts +11 -0
- package/dist/s3/drive-lock.js +47 -0
- package/dist/s3/drive-trashed-name.d.ts +13 -0
- package/dist/s3/drive-trashed-name.js +59 -0
- package/dist/s3/drive-write.d.ts +38 -0
- package/dist/s3/drive-write.js +258 -0
- package/dist/s3/drive.d.ts +59 -25
- package/dist/s3/drive.js +46 -77
- package/dist/s3/listing.d.ts +27 -1
- package/dist/s3/listing.js +62 -20
- package/dist/s3/long-answer.d.ts +12 -0
- package/dist/s3/long-answer.js +104 -0
- package/dist/s3/multipart-assemble.d.ts +17 -0
- package/dist/s3/multipart-assemble.js +68 -0
- package/dist/s3/multipart-sweep.d.ts +15 -0
- package/dist/s3/multipart-sweep.js +87 -0
- package/dist/s3/multipart-view.d.ts +45 -0
- package/dist/s3/multipart-view.js +232 -0
- package/dist/s3/multipart.d.ts +26 -19
- package/dist/s3/multipart.js +193 -78
- package/dist/s3/object-read.d.ts +17 -0
- package/dist/s3/object-read.js +127 -0
- package/dist/s3/object-write.d.ts +35 -0
- package/dist/s3/object-write.js +198 -0
- package/dist/s3/range.d.ts +14 -0
- package/dist/s3/range.js +80 -0
- package/dist/s3/response-sink.d.ts +12 -2
- package/dist/s3/response-sink.js +71 -7
- package/dist/s3/routes.d.ts +0 -1
- package/dist/s3/routes.js +242 -217
- package/dist/s3/same-file.d.ts +4 -1
- package/dist/s3/same-file.js +12 -3
- package/dist/s3/server.d.ts +54 -4
- package/dist/s3/server.js +174 -14
- package/dist/s3/sigv4-canonical.d.ts +91 -0
- package/dist/s3/sigv4-canonical.js +148 -0
- package/dist/s3/sigv4-presigned.d.ts +13 -0
- package/dist/s3/sigv4-presigned.js +82 -0
- package/dist/s3/sigv4.d.ts +26 -27
- package/dist/s3/sigv4.js +137 -102
- package/dist/s3/spool.d.ts +37 -0
- package/dist/s3/spool.js +104 -0
- package/dist/s3/staging.d.ts +90 -7
- package/dist/s3/staging.js +97 -66
- package/dist/s3/xml-multipart.d.ts +38 -0
- package/dist/s3/xml-multipart.js +47 -0
- package/dist/s3/xml-read.d.ts +28 -0
- package/dist/s3/xml-read.js +235 -0
- package/dist/s3/xml.d.ts +45 -2
- package/dist/s3/xml.js +72 -13
- package/dist/s3-gateway.d.ts +11 -5
- package/dist/s3-gateway.js +5 -2
- package/dist/seal.d.ts +1 -1
- package/dist/share.d.ts +5 -0
- package/dist/share.js +1 -1
- package/dist/shared/lib/api/types-heavy.d.ts +167 -0
- package/dist/shared/lib/api/types-heavy.js +60 -0
- package/dist/shared/lib/drive/rebuild-verify.js +1 -0
- package/dist/shared/lib/filecoin/providers.d.ts +25 -0
- package/dist/shared/lib/filecoin/providers.js +58 -0
- package/dist/shared/lib/heavy/download.d.ts +48 -0
- package/dist/shared/lib/heavy/download.js +116 -0
- package/dist/shared/lib/heavy/order-plan.d.ts +77 -0
- package/dist/shared/lib/heavy/order-plan.js +83 -0
- package/dist/shared/lib/heavy/order-runner.d.ts +9 -0
- package/dist/shared/lib/heavy/order-runner.js +300 -0
- package/dist/shared/lib/heavy/order-types.d.ts +90 -0
- package/dist/shared/lib/heavy/order-types.js +6 -0
- package/dist/shared/lib/heavy/order-wire.d.ts +55 -0
- package/dist/shared/lib/heavy/order-wire.js +113 -0
- package/dist/shared/lib/heavy/piece-cid.d.ts +24 -0
- package/dist/shared/lib/heavy/piece-cid.js +55 -0
- package/dist/shared/lib/heavy/sp-upload.d.ts +37 -0
- package/dist/shared/lib/heavy/sp-upload.js +112 -0
- package/dist/shared/lib/heavy/synapse-piece.d.ts +1 -0
- package/dist/shared/lib/heavy/synapse-piece.js +8 -0
- package/dist/shared/lib/share/handover-format.d.ts +129 -0
- package/dist/shared/lib/share/handover-format.js +323 -0
- package/dist/shared/lib/share/shared-file-info.js +1 -0
- package/dist/shared/lib/storage-network.d.ts +4 -4
- package/dist/shared/lib/storage-network.js +7 -7
- package/dist/shared/lib/storage-tier.d.ts +28 -0
- package/dist/shared/lib/storage-tier.js +63 -0
- package/dist/shared/lib/wallet/send-rules.js +1 -0
- package/dist/upload-file.d.ts +8 -0
- package/dist/upload-file.js +57 -25
- package/dist/upload-price-node.d.ts +3 -0
- package/dist/upload-price-node.js +3 -6
- package/dist/upload-price.d.ts +10 -0
- package/dist/upload-price.js +13 -1
- package/dist/upload-run.d.ts +80 -0
- package/dist/upload-run.js +173 -0
- package/dist/upload-steps.js +15 -4
- package/dist/upload-store.d.ts +15 -6
- package/dist/upload-store.js +6 -0
- package/dist/upload-wallet-put.d.ts +9 -4
- package/dist/upload-wallet-put.js +16 -6
- package/dist/upload-wallet.js +4 -0
- package/dist/upload-wire.d.ts +25 -0
- package/dist/upload-wire.js +20 -1
- package/dist/upload.js +28 -13
- package/dist/wallet-sign.js +2 -2
- package/docs/commands/handover.md +38 -0
- package/docs/commands/heavy.md +35 -0
- package/docs/commands/public-code.md +7 -0
- package/docs/commands/push.md +4 -1
- package/docs/commands/put.md +15 -1
- package/docs/commands/share.md +3 -1
- package/package.json +5 -2
- package/server.json +2 -2
- package/vendor/nmts-crypto/nmts_crypto_wasm.d.ts +17 -1
- package/vendor/nmts-crypto/nmts_crypto_wasm.js +28 -0
- package/vendor/nmts-crypto/nmts_crypto_wasm_bg.wasm +0 -0
- package/vendor/nmts-crypto/nmts_crypto_wasm_bg.wasm.d.ts +2 -1
package/dist/upload.js
CHANGED
|
@@ -30,6 +30,7 @@ import { fromBase64Url, toBase64Url } from "./bytes.js";
|
|
|
30
30
|
import { NmtsError } from "./errors.js";
|
|
31
31
|
import { ServerError } from "./api.js";
|
|
32
32
|
import { readReservationBytes, readReservationRecord, writeReservation, } from "./upload-store.js";
|
|
33
|
+
import { refuseOtherSealing, runIdField } from "./upload-run.js";
|
|
33
34
|
import { pushPart } from "./upload-steps.js";
|
|
34
35
|
import { UploadError, } from "./upload-wire.js";
|
|
35
36
|
export * from "./upload-wire.js";
|
|
@@ -82,6 +83,9 @@ export async function buyAndPushPart(input) {
|
|
|
82
83
|
});
|
|
83
84
|
}
|
|
84
85
|
}
|
|
86
|
+
// ⛔ JUDGED ON THE SAME READ THAT WOULD RESUME IT. A record another sealing of this file wrote is
|
|
87
|
+
// refused here, not picked up (`upload-run.ts`).
|
|
88
|
+
refuseOtherSealing(existing, input);
|
|
85
89
|
// ── the credits already moved: ask where the reservation stands before doing anything ──
|
|
86
90
|
if (existing?.ledgerId !== undefined) {
|
|
87
91
|
const record = existing;
|
|
@@ -97,6 +101,7 @@ export async function buyAndPushPart(input) {
|
|
|
97
101
|
phase: "reserve",
|
|
98
102
|
message: `Could not ask about the paid reservation ${ledgerId}: ${why(error)}`,
|
|
99
103
|
paid: true,
|
|
104
|
+
from: error,
|
|
100
105
|
nextStep: "Nothing more was spent. The storage this account paid for is still bought — run the " +
|
|
101
106
|
"same command again when the server answers.",
|
|
102
107
|
});
|
|
@@ -106,12 +111,12 @@ export async function buyAndPushPart(input) {
|
|
|
106
111
|
return paidPart(record, ledgerId, true);
|
|
107
112
|
}
|
|
108
113
|
if (!isLive(status.state)) {
|
|
109
|
-
// ⛔ THE RECORD IS KEPT AND ITS ATTEMPT NUMBER GOES UP.
|
|
110
|
-
//
|
|
111
|
-
//
|
|
112
|
-
//
|
|
113
|
-
//
|
|
114
|
-
//
|
|
114
|
+
// ⛔ THE RECORD IS KEPT AND ITS ATTEMPT NUMBER GOES UP. The server replays a reservation row
|
|
115
|
+
// under its key whatever state it is in — `failed` included — so the next run, which reads
|
|
116
|
+
// its key off this record, would be handed the same dead row and told to start over into
|
|
117
|
+
// it. Forever. Counting up is what starting over actually means. (A record written before
|
|
118
|
+
// run ids existed has a key that is a pure function of the account, the bytes and the
|
|
119
|
+
// destination, so for it even deleting the record would not have helped.)
|
|
115
120
|
await writeReservation(key, { ...stripReservation(record), attempt: record.attempt + 1 }, await readReservationBytes(key));
|
|
116
121
|
throw new UploadError({
|
|
117
122
|
phase: "reserve",
|
|
@@ -166,6 +171,7 @@ export async function buyAndPushPart(input) {
|
|
|
166
171
|
// ⛔ The attempt number is CARRIED FORWARD, not reset. A record that survives a dead
|
|
167
172
|
// reservation is exactly the case that needs a different idempotency key.
|
|
168
173
|
attempt: existing?.attempt ?? 0,
|
|
174
|
+
...runIdField(existing, input.runId),
|
|
169
175
|
blobId: meta.blobId,
|
|
170
176
|
nonceB64,
|
|
171
177
|
rootHashB64: toBase64Url(meta.rootHash),
|
|
@@ -187,7 +193,7 @@ export async function buyAndPushPart(input) {
|
|
|
187
193
|
let reply;
|
|
188
194
|
try {
|
|
189
195
|
reply = await api.reserve({
|
|
190
|
-
idempotency_key: idempotencyKey(key, record
|
|
196
|
+
idempotency_key: idempotencyKey(key, record),
|
|
191
197
|
blob_id: meta.blobId,
|
|
192
198
|
root_hash_b64: record.rootHashB64,
|
|
193
199
|
// One number, measured: what the treasury is asked to buy and what the credits are charged
|
|
@@ -209,6 +215,9 @@ export async function buyAndPushPart(input) {
|
|
|
209
215
|
// ⛔ A refusal did not spend. A request that never got an answer MIGHT have — and the record
|
|
210
216
|
// is on disk either way, so the next run asks the server instead of guessing here.
|
|
211
217
|
paid: false,
|
|
218
|
+
// ⛔ THE SERVER'S CODE GOES WITH IT. Credits that ran out and a ceiling that was hit are two
|
|
219
|
+
// different things for a program to do, and the words alone do not say which.
|
|
220
|
+
from: error,
|
|
212
221
|
nextStep: error instanceof ServerError
|
|
213
222
|
? "Nothing was uploaded. No credits were spent on a refused reservation."
|
|
214
223
|
: "If the request reached the server, credits may have been spent — running the same " +
|
|
@@ -271,14 +280,20 @@ function paidPart(record, ledgerId, resumed) {
|
|
|
271
280
|
};
|
|
272
281
|
}
|
|
273
282
|
/**
|
|
274
|
-
* The idempotency key for one attempt at one
|
|
283
|
+
* The idempotency key for one attempt at one part of one upload.
|
|
275
284
|
*
|
|
276
|
-
* ⛔ THE ATTEMPT NUMBER
|
|
277
|
-
* and the destination — and the server replays whatever row it has under
|
|
278
|
-
* settled one that can never become storage
|
|
285
|
+
* ⛔ THE RUN ID AND THE ATTEMPT NUMBER ARE BOTH IN IT. Without them the key is a pure function of
|
|
286
|
+
* the account, the bytes and the destination — and the server replays whatever row it has under
|
|
287
|
+
* a key: a settled one that can never become storage, or the one an EARLIER upload of the same
|
|
288
|
+
* file bought for bytes that are not these (`newRunId` in `upload-store.ts`).
|
|
289
|
+
*
|
|
290
|
+
* ⚠ A record an earlier version wrote has no run id and keeps the key that version asked under,
|
|
291
|
+
* because that is where its reservation is.
|
|
279
292
|
*/
|
|
280
|
-
function idempotencyKey(key,
|
|
281
|
-
return
|
|
293
|
+
function idempotencyKey(key, record) {
|
|
294
|
+
return record.runId === undefined
|
|
295
|
+
? `nmts-cli-${key}-${record.attempt}`
|
|
296
|
+
: `nmts-cli-${key}-${record.runId}-${record.attempt}`;
|
|
282
297
|
}
|
|
283
298
|
/** What the file list must record about this upload. Always from the record, never from a run. */
|
|
284
299
|
export function entryOf(record) {
|
package/dist/wallet-sign.js
CHANGED
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
// exists so somebody can prove an address is theirs — all the hall of fame asks for.
|
|
14
14
|
//
|
|
15
15
|
// ⛔ IT IS REACHED FROM `commands/extend.ts`, `commands/wallet-send.ts`, `commands/wallet-donate.ts`,
|
|
16
|
-
// `commands/wallet-swap.ts
|
|
17
|
-
// drives), each after the price, the fee and the balances have been read and printed, and (a
|
|
16
|
+
// `commands/wallet-swap.ts`, `upload-wallet.ts` (the wallet rail `commands/put-wallet.ts`
|
|
17
|
+
// drives) and `commands/heavy-run.ts` (an NMTS Heavy order's one WAL payment), each after the price, the fee and the balances have been read and printed, and (a
|
|
18
18
|
// gift excepted) after `requireWalletGrant(…)`. Nothing else imports it, and it is loaded lazily
|
|
19
19
|
// so that a run which does not spend never even brings the code into memory.
|
|
20
20
|
//
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# nmts handover — hand one file to one account outside NMTS
|
|
2
|
+
|
|
3
|
+
Commands: handover
|
|
4
|
+
Tiers: handover=none · handover.make=high(share)
|
|
5
|
+
|
|
6
|
+
`handover make <path> --to <public code | public code file>` writes a handover file: one file of
|
|
7
|
+
your drive, sealed so that only the recipient's NMTS key decrypts the file inside it. You pass the
|
|
8
|
+
handover file on yourself — mail, chat, a USB stick. No share is registered, and the recipient's
|
|
9
|
+
side asks the NMTS server nothing. `--out <file>` names the handover file (default
|
|
10
|
+
`nmts-handover-<YYYY-MM-DD>.nmtshandover` in the current directory, the date in UTC; it never
|
|
11
|
+
carries the file's own name); `--force` replaces a file that is already there. Both are checked
|
|
12
|
+
before anything else is done. The handover file is written readable by you only (mode 0600).
|
|
13
|
+
|
|
14
|
+
The recipient is either a public code, which is looked up on the server the way `share` looks it
|
|
15
|
+
up — so the server sees whom this account looked up — or the path of their public code file
|
|
16
|
+
(`nmts public-code --save` on their side), which is not looked up at all. A public code file is
|
|
17
|
+
believed only when the identity inside fingerprints to the code it names; that proves the file is
|
|
18
|
+
consistent, not that it came from the recipient, so compare the code it shows with the one they
|
|
19
|
+
gave you.
|
|
20
|
+
|
|
21
|
+
It gives another account this file, so it sits behind the same unlock as `share` and asks on every
|
|
22
|
+
run: it prints the file, the recipient and the output path and stops until the same command is run
|
|
23
|
+
with `--yes`, in every mode but skip-permissions. The command it prints keeps every option you gave.
|
|
24
|
+
|
|
25
|
+
A handover cannot be taken back. The recipient can download the file until its storage ends or its
|
|
26
|
+
stored bytes are destroyed. Removing the file from your drive (`rm`, `erase`) does not stop it.
|
|
27
|
+
|
|
28
|
+
`handover open <file>` opens a handover file with this account's NMTS key and saves the file it
|
|
29
|
+
carries. Without `--out` it is saved in the current directory under the name the sender gave it,
|
|
30
|
+
reduced to its last segment; `--out <file>` saves it at that path instead, as `receive --out` does.
|
|
31
|
+
It needs the NMTS key and no API key, fetches the pieces straight from Walrus aggregators, checks
|
|
32
|
+
each piece's position against its own header and the whole file against the hash the sender
|
|
33
|
+
sealed; a file that does not match is not written. It refuses a handover file over 1 MiB, a file
|
|
34
|
+
made for another NMTS key, a file whose fields do not hold together, a file from a newer version,
|
|
35
|
+
and a file made on the other network (`--network`).
|
|
36
|
+
|
|
37
|
+
Whoever holds a handover file sees the sender's public code in it. The aggregator the recipient
|
|
38
|
+
fetches from sees the recipient's network address, as for any download.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# nmts heavy — the EVM wallet that pays Filecoin yourself
|
|
2
|
+
|
|
3
|
+
Commands: heavy
|
|
4
|
+
Tiers: heavy=none · heavy.fund=high(wallet)
|
|
5
|
+
|
|
6
|
+
NMTS Heavy keeps a file whole in two separate places on Filecoin instead of spreading it across
|
|
7
|
+
Walrus. Most uploads never need this command: `put --tier heavy` and `push --tier heavy` pay with
|
|
8
|
+
credits, or with WAL from the wallet under `--pay wallet`, and NMTS's own Filecoin treasury pays the
|
|
9
|
+
storage. This command is the developer's handle for paying Filecoin directly, as you could with the
|
|
10
|
+
Synapse SDK on your own.
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
nmts heavy wallet # the EVM address this NMTS key derives, its FIL and USDFC, the deposit
|
|
14
|
+
nmts heavy wallet --index 1 # another of this key's EVM wallets
|
|
15
|
+
nmts heavy fund 5 --yes # deposit 5 USDFC into Filecoin Pay for --pay evm uploads
|
|
16
|
+
nmts put report.pdf --tier heavy --pay evm # 2 copies, providers chosen for you
|
|
17
|
+
nmts put report.pdf --tier heavy --pay evm --copies 3 --providers 4,9
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
The EVM wallet is derived from the NMTS key (format NCF-3 §1.9), so the recovery tool finds the same
|
|
21
|
+
address (`nmts-recovery --derive`) and can print its private key for an Ethereum-style wallet app
|
|
22
|
+
(`--export-evm-key N`). Its Filecoin address is the same 20 bytes.
|
|
23
|
+
|
|
24
|
+
`heavy wallet` reads only. `heavy fund <USDFC>` signs a deposit into Filecoin Pay and the approval
|
|
25
|
+
for the storage service: it is a wallet act (`nmts unlock wallet`), prints what it will do, and signs
|
|
26
|
+
only with `--yes`. When the deposit already covers the amount it signs nothing.
|
|
27
|
+
|
|
28
|
+
`--pay evm` uploads pay the storage providers from that deposit. The file stays as long as the
|
|
29
|
+
deposit lasts (`heavy wallet` shows the epoch it lasts to); add more with `heavy fund` before then.
|
|
30
|
+
`--copies` takes 1 to 12 (default 2), `--providers` names provider ids, and `--evm-wallet N` pays
|
|
31
|
+
from another derived wallet. On a network whose storage providers this version does not list, it
|
|
32
|
+
is refused before anything is spent.
|
|
33
|
+
|
|
34
|
+
You need FIL for gas and USDFC in the EVM wallet before `heavy fund`. On the Calibration test
|
|
35
|
+
network both come from the public faucets; on mainnet, from an exchange or a swap.
|
|
@@ -7,3 +7,10 @@ Prints the account's public code and whether it has been published. It is not th
|
|
|
7
7
|
An unpublished code cannot receive anything. Publishing is permanent, so it is `--publish` and not
|
|
8
8
|
automatic: in the default mode it asks first (or takes `--yes`); in an auto mode it is your
|
|
9
9
|
judgement, and a permanent, public act is one to put to the person.
|
|
10
|
+
|
|
11
|
+
`--save [file]` writes this account's public code file: the public code and the identity behind
|
|
12
|
+
it, nothing secret. Without a file name it writes `nmts-public-code-<public code>.nmtscode` in the
|
|
13
|
+
current directory. It needs the NMTS key and asks the server nothing. Whoever has the file can make
|
|
14
|
+
a handover file for you (`nmts handover make … --to <file>`) without looking your code up, so NMTS
|
|
15
|
+
does not learn who is sending to you. `--force` replaces a file that is already there. It is not
|
|
16
|
+
combined with `--publish`.
|
package/docs/commands/push.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# nmts push — upload a whole directory
|
|
2
2
|
|
|
3
3
|
Commands: push
|
|
4
|
-
Tiers: push=medium · push.wallet=high(wallet)
|
|
4
|
+
Tiers: push=medium · push.wallet=high(wallet) · push.evm=high(wallet)
|
|
5
5
|
|
|
6
6
|
Uploads a directory, rebuilding its shape in the account, and spends credits the way `put` does
|
|
7
7
|
(`nmts help put`). It stops at the first failure, saying what is already uploaded; running it again
|
|
@@ -10,3 +10,6 @@ without `--hidden`, and symbolic links are not followed. `--to` names the destin
|
|
|
10
10
|
`--dry-run` prices the whole run and sends nothing.
|
|
11
11
|
|
|
12
12
|
`--pay wallet` does what it does for `put`, one file at a time, under the same standing unlock.
|
|
13
|
+
|
|
14
|
+
`--tier heavy` stores every file of the run on NMTS Heavy, paid the way `put --tier heavy` is
|
|
15
|
+
(`nmts help put`), and `--tier heavy --pay evm` pays Filecoin yourself (`nmts help heavy`).
|
package/docs/commands/put.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# nmts put — encrypt one file and upload it
|
|
2
2
|
|
|
3
3
|
Commands: put
|
|
4
|
-
Tiers: put=medium · put.wallet=high(wallet)
|
|
4
|
+
Tiers: put=medium · put.wallet=high(wallet) · put.evm=high(wallet)
|
|
5
5
|
|
|
6
6
|
`put` spends credits: one per started mebibyte, and the price is printed before the upload
|
|
7
7
|
starts. In the default mode it asks first (answer at the terminal, or run with `--yes`);
|
|
@@ -35,6 +35,20 @@ cuts it to size and leaves the rest free, `whole` binds all of it with the file.
|
|
|
35
35
|
`--storage` for the person: the leftover is their decision. `--epochs` and `--storage` without
|
|
36
36
|
`--pay wallet` exit 2.
|
|
37
37
|
|
|
38
|
+
**`--tier heavy`** stores the file on NMTS Heavy instead of NMTS Standard: each part is kept whole in
|
|
39
|
+
two separate places on Filecoin rather than spread across Walrus storage nodes. It is paid the same
|
|
40
|
+
two ways. With credits (the default) each part costs half the Standard credits, rounded up and at
|
|
41
|
+
least one, and the file is kept 28 days. With
|
|
42
|
+
`--pay wallet` the WAL price is set when the upload opens, the wallet is checked for it before
|
|
43
|
+
anything is encrypted, and it is paid once, after the file is stored; `--days N` (1–365, default 28)
|
|
44
|
+
is the term. Parts are 512 MiB, and `--part-size`, `--epochs`, `--storage`, `--from`, `--deposit` and
|
|
45
|
+
`--thumbnail` do not apply.
|
|
46
|
+
`get`, `ls` and deletion work the same for both tiers; `nmts ls --long` shows each file's tier. The
|
|
47
|
+
default is `--tier standard`. A Heavy run that stops is not resumed: running it again is a new upload.
|
|
48
|
+
|
|
49
|
+
**`--tier heavy --pay evm`** pays Filecoin yourself from the EVM wallet the NMTS key derives, out of
|
|
50
|
+
its Filecoin Pay deposit, with `--copies` and `--providers` choosing where. See `nmts help heavy`.
|
|
51
|
+
|
|
38
52
|
**`--thumbnail`** on a video also sends one frame of it as `<saved name>.thumb.jpg`: an ordinary
|
|
39
53
|
small file, priced, sealed and paid for like any other, linked to the video so every app shows it
|
|
40
54
|
as the video's tile. The frame is taken by `ffmpeg` (one second in, 512 px on the long side);
|
package/docs/commands/share.md
CHANGED
|
@@ -11,5 +11,7 @@ the file and the code and stops until the same command is run with `--yes`, in e
|
|
|
11
11
|
skip-permissions. Sharing is also on the short list the periodic human check gates.
|
|
12
12
|
|
|
13
13
|
`shares` lists what was shared with this account; `shares --sent <path>` says who one file was
|
|
14
|
-
shared with. `receive <id>` downloads one shared file (`--out`, `--force` as for `get`)
|
|
14
|
+
shared with. `receive <id>` downloads one shared file (`--out`, `--force` as for `get`); without
|
|
15
|
+
`--out` it is saved in the current directory under the name the sender gave it, reduced to its last
|
|
16
|
+
segment, so a name such as `../x` or an absolute path cannot place it anywhere else. `unshare
|
|
15
17
|
<id>` withdraws a share you sent, or removes one you were sent; in the default mode it asks once.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@needmoretruth/nmts-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.46.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": {
|
|
@@ -141,11 +141,14 @@
|
|
|
141
141
|
"typescript": "^5.9.3"
|
|
142
142
|
},
|
|
143
143
|
"dependencies": {
|
|
144
|
+
"@filoz/synapse-core": "0.9.1",
|
|
145
|
+
"@filoz/synapse-sdk": "2.0.0",
|
|
144
146
|
"@mysten/sui": "^2.20.1",
|
|
145
147
|
"@mysten/walrus": "^1.2.3",
|
|
146
148
|
"@noble/curves": "^2.3.0",
|
|
147
149
|
"@noble/hashes": "^2.2.0",
|
|
148
|
-
"uqr": "^0.1.3"
|
|
150
|
+
"uqr": "^0.1.3",
|
|
151
|
+
"viem": "2.56.8"
|
|
149
152
|
},
|
|
150
153
|
"mcpName": "io.github.needmoretruth/nmts"
|
|
151
154
|
}
|
package/server.json
CHANGED
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
"url": "https://github.com/needmoretruth/nmts-cli",
|
|
7
7
|
"source": "github"
|
|
8
8
|
},
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.46.0",
|
|
10
10
|
"packages": [
|
|
11
11
|
{
|
|
12
12
|
"registryType": "npm",
|
|
13
13
|
"registryBaseUrl": "https://registry.npmjs.org",
|
|
14
14
|
"identifier": "@needmoretruth/nmts-cli",
|
|
15
|
-
"version": "0.
|
|
15
|
+
"version": "0.46.0",
|
|
16
16
|
"transport": {
|
|
17
17
|
"type": "stdio"
|
|
18
18
|
},
|
|
@@ -197,6 +197,21 @@ export function envelope_open(key: Uint8Array, aad: Uint8Array, envelope: Uint8A
|
|
|
197
197
|
*/
|
|
198
198
|
export function envelope_seal(key: Uint8Array, aad: Uint8Array, plaintext: Uint8Array): Uint8Array;
|
|
199
199
|
|
|
200
|
+
/**
|
|
201
|
+
* The secp256k1 private key (32 bytes, big-endian) of EVM wallet number `index` from the 32-byte
|
|
202
|
+
* `wallet_root` (NCF-3 §1.9) — the key that pays for NMTS Heavy on Filecoin when a person pays
|
|
203
|
+
* from their own EVM wallet.
|
|
204
|
+
*
|
|
205
|
+
* ⛔ Like `wallet_seed_for`, this hands back key material. It is called in-process by the crypto
|
|
206
|
+
* worker and by the command-line tool; no page-facing RPC returns it.
|
|
207
|
+
*
|
|
208
|
+
* ⚠ The ADDRESS is deliberately not exported. Computing it needs the curve's point arithmetic,
|
|
209
|
+
* which added 63 KB to a package every visitor downloads (measured 2026-09-24: 539,169 → 602,131
|
|
210
|
+
* bytes; the key alone is 545,338) for a value no browser screen shows. The command-line tool and
|
|
211
|
+
* the recovery tool compute the address themselves.
|
|
212
|
+
*/
|
|
213
|
+
export function evm_key_for(wallet_root: Uint8Array, index: number): Uint8Array;
|
|
214
|
+
|
|
200
215
|
/**
|
|
201
216
|
* A fresh random 32-byte file DEK (WebCrypto-backed).
|
|
202
217
|
*/
|
|
@@ -533,7 +548,6 @@ export interface InitOutput {
|
|
|
533
548
|
readonly streamencryptor_push: (a: number, b: number, c: number) => [number, number, number, number];
|
|
534
549
|
readonly streamencryptor_resumeFromHeader: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
535
550
|
readonly verify_part_set: (a: number, b: number) => [number, number];
|
|
536
|
-
readonly wallet_seed_for: (a: number, b: number, c: number) => [number, number, number, number];
|
|
537
551
|
readonly opener_locator: (a: number, b: number) => [number, number, number, number];
|
|
538
552
|
readonly opener_message: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
539
553
|
readonly opener_open: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
@@ -546,7 +560,9 @@ export interface InitOutput {
|
|
|
546
560
|
readonly account_code_generate: () => [number, number];
|
|
547
561
|
readonly account_code_parse: (a: number, b: number) => [number, number, number, number];
|
|
548
562
|
readonly account_code_phrase: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
563
|
+
readonly evm_key_for: (a: number, b: number, c: number) => [number, number, number, number];
|
|
549
564
|
readonly voucher_hash_from_input: (a: number, b: number) => [number, number];
|
|
565
|
+
readonly wallet_seed_for: (a: number, b: number, c: number) => [number, number, number, number];
|
|
550
566
|
readonly __wbindgen_exn_store: (a: number) => void;
|
|
551
567
|
readonly __externref_table_alloc: () => number;
|
|
552
568
|
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
@@ -497,6 +497,34 @@ export function envelope_seal(key, aad, plaintext) {
|
|
|
497
497
|
return v4;
|
|
498
498
|
}
|
|
499
499
|
|
|
500
|
+
/**
|
|
501
|
+
* The secp256k1 private key (32 bytes, big-endian) of EVM wallet number `index` from the 32-byte
|
|
502
|
+
* `wallet_root` (NCF-3 §1.9) — the key that pays for NMTS Heavy on Filecoin when a person pays
|
|
503
|
+
* from their own EVM wallet.
|
|
504
|
+
*
|
|
505
|
+
* ⛔ Like `wallet_seed_for`, this hands back key material. It is called in-process by the crypto
|
|
506
|
+
* worker and by the command-line tool; no page-facing RPC returns it.
|
|
507
|
+
*
|
|
508
|
+
* ⚠ The ADDRESS is deliberately not exported. Computing it needs the curve's point arithmetic,
|
|
509
|
+
* which added 63 KB to a package every visitor downloads (measured 2026-09-24: 539,169 → 602,131
|
|
510
|
+
* bytes; the key alone is 545,338) for a value no browser screen shows. The command-line tool and
|
|
511
|
+
* the recovery tool compute the address themselves.
|
|
512
|
+
* @param {Uint8Array} wallet_root
|
|
513
|
+
* @param {number} index
|
|
514
|
+
* @returns {Uint8Array}
|
|
515
|
+
*/
|
|
516
|
+
export function evm_key_for(wallet_root, index) {
|
|
517
|
+
const ptr0 = passArray8ToWasm0(wallet_root, wasm.__wbindgen_malloc);
|
|
518
|
+
const len0 = WASM_VECTOR_LEN;
|
|
519
|
+
const ret = wasm.evm_key_for(ptr0, len0, index);
|
|
520
|
+
if (ret[3]) {
|
|
521
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
522
|
+
}
|
|
523
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
524
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
525
|
+
return v2;
|
|
526
|
+
}
|
|
527
|
+
|
|
500
528
|
/**
|
|
501
529
|
* A fresh random 32-byte file DEK (WebCrypto-backed).
|
|
502
530
|
* @returns {Uint8Array}
|
|
Binary file
|
|
@@ -41,7 +41,6 @@ export const streamencryptor_new: (a: number, b: number, c: number, d: number, e
|
|
|
41
41
|
export const streamencryptor_push: (a: number, b: number, c: number) => [number, number, number, number];
|
|
42
42
|
export const streamencryptor_resumeFromHeader: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
43
43
|
export const verify_part_set: (a: number, b: number) => [number, number];
|
|
44
|
-
export const wallet_seed_for: (a: number, b: number, c: number) => [number, number, number, number];
|
|
45
44
|
export const opener_locator: (a: number, b: number) => [number, number, number, number];
|
|
46
45
|
export const opener_message: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
47
46
|
export const opener_open: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
@@ -54,7 +53,9 @@ export const account_code_display: (a: number, b: number) => [number, number, nu
|
|
|
54
53
|
export const account_code_generate: () => [number, number];
|
|
55
54
|
export const account_code_parse: (a: number, b: number) => [number, number, number, number];
|
|
56
55
|
export const account_code_phrase: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
56
|
+
export const evm_key_for: (a: number, b: number, c: number) => [number, number, number, number];
|
|
57
57
|
export const voucher_hash_from_input: (a: number, b: number) => [number, number];
|
|
58
|
+
export const wallet_seed_for: (a: number, b: number, c: number) => [number, number, number, number];
|
|
58
59
|
export const __wbindgen_exn_store: (a: number) => void;
|
|
59
60
|
export const __externref_table_alloc: () => number;
|
|
60
61
|
export const __wbindgen_externrefs: WebAssembly.Table;
|