@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.
Files changed (224) hide show
  1. package/AGENTS.md +2 -2
  2. package/CHANGELOG.md +61 -0
  3. package/README.ko.md +6 -3
  4. package/README.md +15 -3
  5. package/dist/api-advice.js +17 -2
  6. package/dist/api.d.ts +22 -0
  7. package/dist/api.js +49 -1
  8. package/dist/arg-options.d.ts +8 -0
  9. package/dist/args.js +7 -1
  10. package/dist/artifact-about.d.ts +1 -1
  11. package/dist/collision.d.ts +20 -3
  12. package/dist/collision.js +21 -3
  13. package/dist/commands/erase.js +1 -0
  14. package/dist/commands/handover.d.ts +13 -0
  15. package/dist/commands/handover.js +328 -0
  16. package/dist/commands/heavy-run.d.ts +59 -0
  17. package/dist/commands/heavy-run.js +247 -0
  18. package/dist/commands/heavy.d.ts +7 -0
  19. package/dist/commands/heavy.js +123 -0
  20. package/dist/commands/ls.d.ts +5 -0
  21. package/dist/commands/ls.js +9 -1
  22. package/dist/commands/public-code.d.ts +6 -0
  23. package/dist/commands/public-code.js +46 -0
  24. package/dist/commands/push-heavy.d.ts +6 -0
  25. package/dist/commands/push-heavy.js +128 -0
  26. package/dist/commands/push-tree.d.ts +24 -0
  27. package/dist/commands/push-tree.js +91 -0
  28. package/dist/commands/push.d.ts +4 -13
  29. package/dist/commands/push.js +7 -77
  30. package/dist/commands/put-heavy.d.ts +9 -0
  31. package/dist/commands/put-heavy.js +120 -0
  32. package/dist/commands/put-payer.d.ts +21 -0
  33. package/dist/commands/put-payer.js +24 -0
  34. package/dist/commands/put.d.ts +2 -2
  35. package/dist/commands/put.js +8 -7
  36. package/dist/commands/receive.js +3 -3
  37. package/dist/commands/s3.js +44 -10
  38. package/dist/crypto-surface.d.ts +8 -0
  39. package/dist/crypto-surface.js +3 -0
  40. package/dist/crypto.d.ts +3 -0
  41. package/dist/crypto.js +3 -0
  42. package/dist/download-part.d.ts +32 -1
  43. package/dist/download-part.js +95 -6
  44. package/dist/download-range.d.ts +19 -0
  45. package/dist/download-range.js +108 -0
  46. package/dist/download-sink.d.ts +15 -0
  47. package/dist/download.d.ts +14 -0
  48. package/dist/download.js +19 -4
  49. package/dist/handover.d.ts +44 -0
  50. package/dist/handover.js +199 -0
  51. package/dist/heavy-api.d.ts +36 -0
  52. package/dist/heavy-api.js +107 -0
  53. package/dist/heavy-copy.d.ts +72 -0
  54. package/dist/heavy-copy.js +108 -0
  55. package/dist/heavy-evm.d.ts +20 -0
  56. package/dist/heavy-evm.js +106 -0
  57. package/dist/heavy-self-pay.d.ts +92 -0
  58. package/dist/heavy-self-pay.js +167 -0
  59. package/dist/heavy-upload.d.ts +87 -0
  60. package/dist/heavy-upload.js +154 -0
  61. package/dist/heavy-wallet-pay.d.ts +39 -0
  62. package/dist/heavy-wallet-pay.js +73 -0
  63. package/dist/help-options.js +4 -2
  64. package/dist/help.js +16 -3
  65. package/dist/list-tier.d.ts +7 -0
  66. package/dist/list-tier.js +47 -0
  67. package/dist/main.js +12 -10
  68. package/dist/manifest-write.d.ts +4 -3
  69. package/dist/platform-sign.d.ts +4 -4
  70. package/dist/platform-sign.js +3 -3
  71. package/dist/portable.d.ts +15 -0
  72. package/dist/portable.js +11 -0
  73. package/dist/product.d.ts +1 -1
  74. package/dist/product.js +1 -1
  75. package/dist/recovery-build.js +16 -0
  76. package/dist/recovery-map-part.d.ts +82 -0
  77. package/dist/recovery-map-part.js +83 -0
  78. package/dist/recovery-map.d.ts +5 -40
  79. package/dist/recovery-map.js +18 -1
  80. package/dist/recovery-source.d.ts +3 -0
  81. package/dist/recovery-source.js +9 -0
  82. package/dist/risk.d.ts +30 -0
  83. package/dist/risk.js +23 -2
  84. package/dist/run-log.d.ts +1 -1
  85. package/dist/run-log.js +7 -1
  86. package/dist/s3/address.d.ts +20 -0
  87. package/dist/s3/address.js +97 -0
  88. package/dist/s3/answer.d.ts +48 -0
  89. package/dist/s3/answer.js +330 -0
  90. package/dist/s3/body-deframe.d.ts +49 -0
  91. package/dist/s3/body-deframe.js +264 -0
  92. package/dist/s3/body-measure.d.ts +13 -0
  93. package/dist/s3/body-measure.js +48 -0
  94. package/dist/s3/body-plan.d.ts +31 -0
  95. package/dist/s3/body-plan.js +159 -0
  96. package/dist/s3/body.d.ts +46 -0
  97. package/dist/s3/body.js +117 -0
  98. package/dist/s3/call.d.ts +36 -0
  99. package/dist/s3/call.js +42 -0
  100. package/dist/s3/checksum.d.ts +26 -0
  101. package/dist/s3/checksum.js +176 -0
  102. package/dist/s3/content-type.d.ts +3 -0
  103. package/dist/s3/content-type.js +49 -0
  104. package/dist/s3/contract.d.ts +91 -14
  105. package/dist/s3/drive-conditions.d.ts +47 -0
  106. package/dist/s3/drive-conditions.js +134 -0
  107. package/dist/s3/drive-key.d.ts +11 -0
  108. package/dist/s3/drive-key.js +58 -0
  109. package/dist/s3/drive-limits.d.ts +33 -0
  110. package/dist/s3/drive-limits.js +53 -0
  111. package/dist/s3/drive-lock.d.ts +11 -0
  112. package/dist/s3/drive-lock.js +47 -0
  113. package/dist/s3/drive-trashed-name.d.ts +13 -0
  114. package/dist/s3/drive-trashed-name.js +59 -0
  115. package/dist/s3/drive-write.d.ts +38 -0
  116. package/dist/s3/drive-write.js +258 -0
  117. package/dist/s3/drive.d.ts +59 -25
  118. package/dist/s3/drive.js +46 -77
  119. package/dist/s3/listing.d.ts +27 -1
  120. package/dist/s3/listing.js +62 -20
  121. package/dist/s3/long-answer.d.ts +12 -0
  122. package/dist/s3/long-answer.js +104 -0
  123. package/dist/s3/multipart-assemble.d.ts +17 -0
  124. package/dist/s3/multipart-assemble.js +68 -0
  125. package/dist/s3/multipart-sweep.d.ts +15 -0
  126. package/dist/s3/multipart-sweep.js +87 -0
  127. package/dist/s3/multipart-view.d.ts +45 -0
  128. package/dist/s3/multipart-view.js +232 -0
  129. package/dist/s3/multipart.d.ts +26 -19
  130. package/dist/s3/multipart.js +193 -78
  131. package/dist/s3/object-read.d.ts +17 -0
  132. package/dist/s3/object-read.js +127 -0
  133. package/dist/s3/object-write.d.ts +35 -0
  134. package/dist/s3/object-write.js +198 -0
  135. package/dist/s3/range.d.ts +14 -0
  136. package/dist/s3/range.js +80 -0
  137. package/dist/s3/response-sink.d.ts +12 -2
  138. package/dist/s3/response-sink.js +71 -7
  139. package/dist/s3/routes.d.ts +0 -1
  140. package/dist/s3/routes.js +242 -217
  141. package/dist/s3/same-file.d.ts +4 -1
  142. package/dist/s3/same-file.js +12 -3
  143. package/dist/s3/server.d.ts +54 -4
  144. package/dist/s3/server.js +174 -14
  145. package/dist/s3/sigv4-canonical.d.ts +91 -0
  146. package/dist/s3/sigv4-canonical.js +148 -0
  147. package/dist/s3/sigv4-presigned.d.ts +13 -0
  148. package/dist/s3/sigv4-presigned.js +82 -0
  149. package/dist/s3/sigv4.d.ts +26 -27
  150. package/dist/s3/sigv4.js +137 -102
  151. package/dist/s3/spool.d.ts +37 -0
  152. package/dist/s3/spool.js +104 -0
  153. package/dist/s3/staging.d.ts +90 -7
  154. package/dist/s3/staging.js +97 -66
  155. package/dist/s3/xml-multipart.d.ts +38 -0
  156. package/dist/s3/xml-multipart.js +47 -0
  157. package/dist/s3/xml-read.d.ts +28 -0
  158. package/dist/s3/xml-read.js +235 -0
  159. package/dist/s3/xml.d.ts +45 -2
  160. package/dist/s3/xml.js +72 -13
  161. package/dist/s3-gateway.d.ts +11 -5
  162. package/dist/s3-gateway.js +5 -2
  163. package/dist/seal.d.ts +1 -1
  164. package/dist/share.d.ts +5 -0
  165. package/dist/share.js +1 -1
  166. package/dist/shared/lib/api/types-heavy.d.ts +167 -0
  167. package/dist/shared/lib/api/types-heavy.js +60 -0
  168. package/dist/shared/lib/drive/rebuild-verify.js +1 -0
  169. package/dist/shared/lib/filecoin/providers.d.ts +25 -0
  170. package/dist/shared/lib/filecoin/providers.js +58 -0
  171. package/dist/shared/lib/heavy/download.d.ts +48 -0
  172. package/dist/shared/lib/heavy/download.js +116 -0
  173. package/dist/shared/lib/heavy/order-plan.d.ts +77 -0
  174. package/dist/shared/lib/heavy/order-plan.js +83 -0
  175. package/dist/shared/lib/heavy/order-runner.d.ts +9 -0
  176. package/dist/shared/lib/heavy/order-runner.js +300 -0
  177. package/dist/shared/lib/heavy/order-types.d.ts +90 -0
  178. package/dist/shared/lib/heavy/order-types.js +6 -0
  179. package/dist/shared/lib/heavy/order-wire.d.ts +55 -0
  180. package/dist/shared/lib/heavy/order-wire.js +113 -0
  181. package/dist/shared/lib/heavy/piece-cid.d.ts +24 -0
  182. package/dist/shared/lib/heavy/piece-cid.js +55 -0
  183. package/dist/shared/lib/heavy/sp-upload.d.ts +37 -0
  184. package/dist/shared/lib/heavy/sp-upload.js +112 -0
  185. package/dist/shared/lib/heavy/synapse-piece.d.ts +1 -0
  186. package/dist/shared/lib/heavy/synapse-piece.js +8 -0
  187. package/dist/shared/lib/share/handover-format.d.ts +129 -0
  188. package/dist/shared/lib/share/handover-format.js +323 -0
  189. package/dist/shared/lib/share/shared-file-info.js +1 -0
  190. package/dist/shared/lib/storage-network.d.ts +4 -4
  191. package/dist/shared/lib/storage-network.js +7 -7
  192. package/dist/shared/lib/storage-tier.d.ts +28 -0
  193. package/dist/shared/lib/storage-tier.js +63 -0
  194. package/dist/shared/lib/wallet/send-rules.js +1 -0
  195. package/dist/upload-file.d.ts +8 -0
  196. package/dist/upload-file.js +57 -25
  197. package/dist/upload-price-node.d.ts +3 -0
  198. package/dist/upload-price-node.js +3 -6
  199. package/dist/upload-price.d.ts +10 -0
  200. package/dist/upload-price.js +13 -1
  201. package/dist/upload-run.d.ts +80 -0
  202. package/dist/upload-run.js +173 -0
  203. package/dist/upload-steps.js +15 -4
  204. package/dist/upload-store.d.ts +15 -6
  205. package/dist/upload-store.js +6 -0
  206. package/dist/upload-wallet-put.d.ts +9 -4
  207. package/dist/upload-wallet-put.js +16 -6
  208. package/dist/upload-wallet.js +4 -0
  209. package/dist/upload-wire.d.ts +25 -0
  210. package/dist/upload-wire.js +20 -1
  211. package/dist/upload.js +28 -13
  212. package/dist/wallet-sign.js +2 -2
  213. package/docs/commands/handover.md +38 -0
  214. package/docs/commands/heavy.md +35 -0
  215. package/docs/commands/public-code.md +7 -0
  216. package/docs/commands/push.md +4 -1
  217. package/docs/commands/put.md +15 -1
  218. package/docs/commands/share.md +3 -1
  219. package/package.json +5 -2
  220. package/server.json +2 -2
  221. package/vendor/nmts-crypto/nmts_crypto_wasm.d.ts +17 -1
  222. package/vendor/nmts-crypto/nmts_crypto_wasm.js +28 -0
  223. package/vendor/nmts-crypto/nmts_crypto_wasm_bg.wasm +0 -0
  224. 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. Deleting it looks tidier and is the
110
- // trap: the idempotency key is derived from a key that is a pure function of the account,
111
- // the bytes and the destination, and the server replays a reservation row under its key
112
- // whatever state it is in — `failed` included. A cleared record means the next run
113
- // rebuilds the same key, is handed the same dead row, and is told to start over into it.
114
- // Forever. Counting up is what starting over actually means.
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.attempt),
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 file.
283
+ * The idempotency key for one attempt at one part of one upload.
275
284
  *
276
- * ⛔ THE ATTEMPT NUMBER IS IN IT. Without it the key is a pure function of the account, the bytes
277
- * and the destination — and the server replays whatever row it has under a key, including a
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, attempt) {
281
- return `nmts-cli-${key}-${attempt}`;
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) {
@@ -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` and `upload-wallet.ts` (the wallet rail `commands/put-wallet.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`.
@@ -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`).
@@ -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);
@@ -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`). `unshare
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.45.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.45.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.45.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}
@@ -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;