@needmoretruth/nmts-cli 0.45.0 → 0.47.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 (252) hide show
  1. package/AGENTS.md +8 -8
  2. package/CHANGELOG.md +78 -0
  3. package/README.ko.md +6 -3
  4. package/README.md +31 -11
  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 +19 -1
  9. package/dist/args.js +14 -2
  10. package/dist/artifact-about.d.ts +1 -1
  11. package/dist/autonomy.js +3 -3
  12. package/dist/collision.d.ts +20 -3
  13. package/dist/collision.js +21 -3
  14. package/dist/commands/erase.js +1 -0
  15. package/dist/commands/handover.d.ts +15 -0
  16. package/dist/commands/handover.js +376 -0
  17. package/dist/commands/heavy-run.d.ts +59 -0
  18. package/dist/commands/heavy-run.js +247 -0
  19. package/dist/commands/heavy.d.ts +7 -0
  20. package/dist/commands/heavy.js +123 -0
  21. package/dist/commands/link.d.ts +12 -0
  22. package/dist/commands/link.js +121 -0
  23. package/dist/commands/ls.d.ts +5 -0
  24. package/dist/commands/ls.js +9 -1
  25. package/dist/commands/public-code-manage.d.ts +24 -0
  26. package/dist/commands/public-code-manage.js +217 -0
  27. package/dist/commands/public-code.d.ts +12 -1
  28. package/dist/commands/public-code.js +140 -45
  29. package/dist/commands/push-heavy.d.ts +6 -0
  30. package/dist/commands/push-heavy.js +128 -0
  31. package/dist/commands/push-tree.d.ts +24 -0
  32. package/dist/commands/push-tree.js +91 -0
  33. package/dist/commands/push.d.ts +4 -13
  34. package/dist/commands/push.js +7 -77
  35. package/dist/commands/put-heavy.d.ts +9 -0
  36. package/dist/commands/put-heavy.js +120 -0
  37. package/dist/commands/put-payer.d.ts +21 -0
  38. package/dist/commands/put-payer.js +24 -0
  39. package/dist/commands/put.d.ts +2 -2
  40. package/dist/commands/put.js +8 -7
  41. package/dist/commands/receive.js +14 -8
  42. package/dist/commands/s3.js +44 -10
  43. package/dist/commands/share-dispatch.js +14 -1
  44. package/dist/commands/share.d.ts +2 -0
  45. package/dist/commands/share.js +45 -35
  46. package/dist/commands/shares-sent.js +8 -3
  47. package/dist/crypto-surface.d.ts +35 -0
  48. package/dist/crypto-surface.js +13 -0
  49. package/dist/crypto.d.ts +8 -0
  50. package/dist/crypto.js +8 -0
  51. package/dist/download-part.d.ts +32 -1
  52. package/dist/download-part.js +95 -6
  53. package/dist/download-range.d.ts +19 -0
  54. package/dist/download-range.js +108 -0
  55. package/dist/download-sink.d.ts +15 -0
  56. package/dist/download.d.ts +14 -0
  57. package/dist/download.js +19 -4
  58. package/dist/handover-codes.d.ts +25 -0
  59. package/dist/handover-codes.js +106 -0
  60. package/dist/handover.d.ts +62 -0
  61. package/dist/handover.js +217 -0
  62. package/dist/heavy-api.d.ts +36 -0
  63. package/dist/heavy-api.js +107 -0
  64. package/dist/heavy-copy.d.ts +72 -0
  65. package/dist/heavy-copy.js +108 -0
  66. package/dist/heavy-evm.d.ts +20 -0
  67. package/dist/heavy-evm.js +106 -0
  68. package/dist/heavy-self-pay.d.ts +92 -0
  69. package/dist/heavy-self-pay.js +167 -0
  70. package/dist/heavy-upload.d.ts +87 -0
  71. package/dist/heavy-upload.js +154 -0
  72. package/dist/heavy-wallet-pay.d.ts +39 -0
  73. package/dist/heavy-wallet-pay.js +73 -0
  74. package/dist/help-options.js +13 -4
  75. package/dist/help.js +24 -3
  76. package/dist/links.d.ts +58 -0
  77. package/dist/links.js +206 -0
  78. package/dist/list-tier.d.ts +7 -0
  79. package/dist/list-tier.js +47 -0
  80. package/dist/main.js +13 -10
  81. package/dist/manifest-write.d.ts +4 -3
  82. package/dist/mcp-tools/reads.js +20 -6
  83. package/dist/mcp-tools/share.js +47 -1
  84. package/dist/mcp-tools/tiers.js +16 -1
  85. package/dist/platform-sign.d.ts +4 -4
  86. package/dist/platform-sign.js +3 -3
  87. package/dist/portable.d.ts +23 -0
  88. package/dist/portable.js +19 -0
  89. package/dist/product.d.ts +1 -1
  90. package/dist/product.js +1 -1
  91. package/dist/public-code-activity.d.ts +35 -0
  92. package/dist/public-code-activity.js +88 -0
  93. package/dist/public-code-refusals.d.ts +25 -0
  94. package/dist/public-code-refusals.js +87 -0
  95. package/dist/public-codes.d.ts +76 -0
  96. package/dist/public-codes.js +182 -0
  97. package/dist/recovery-build.js +16 -0
  98. package/dist/recovery-map-part.d.ts +82 -0
  99. package/dist/recovery-map-part.js +83 -0
  100. package/dist/recovery-map.d.ts +5 -40
  101. package/dist/recovery-map.js +18 -1
  102. package/dist/recovery-source.d.ts +3 -0
  103. package/dist/recovery-source.js +9 -0
  104. package/dist/risk.d.ts +55 -1
  105. package/dist/risk.js +55 -3
  106. package/dist/run-log.d.ts +1 -1
  107. package/dist/run-log.js +7 -1
  108. package/dist/s3/address.d.ts +20 -0
  109. package/dist/s3/address.js +97 -0
  110. package/dist/s3/answer.d.ts +48 -0
  111. package/dist/s3/answer.js +330 -0
  112. package/dist/s3/body-deframe.d.ts +49 -0
  113. package/dist/s3/body-deframe.js +264 -0
  114. package/dist/s3/body-measure.d.ts +13 -0
  115. package/dist/s3/body-measure.js +48 -0
  116. package/dist/s3/body-plan.d.ts +31 -0
  117. package/dist/s3/body-plan.js +159 -0
  118. package/dist/s3/body.d.ts +46 -0
  119. package/dist/s3/body.js +117 -0
  120. package/dist/s3/call.d.ts +36 -0
  121. package/dist/s3/call.js +42 -0
  122. package/dist/s3/checksum.d.ts +26 -0
  123. package/dist/s3/checksum.js +176 -0
  124. package/dist/s3/content-type.d.ts +3 -0
  125. package/dist/s3/content-type.js +49 -0
  126. package/dist/s3/contract.d.ts +91 -14
  127. package/dist/s3/drive-conditions.d.ts +47 -0
  128. package/dist/s3/drive-conditions.js +134 -0
  129. package/dist/s3/drive-key.d.ts +11 -0
  130. package/dist/s3/drive-key.js +58 -0
  131. package/dist/s3/drive-limits.d.ts +33 -0
  132. package/dist/s3/drive-limits.js +53 -0
  133. package/dist/s3/drive-lock.d.ts +11 -0
  134. package/dist/s3/drive-lock.js +47 -0
  135. package/dist/s3/drive-trashed-name.d.ts +13 -0
  136. package/dist/s3/drive-trashed-name.js +59 -0
  137. package/dist/s3/drive-write.d.ts +38 -0
  138. package/dist/s3/drive-write.js +258 -0
  139. package/dist/s3/drive.d.ts +59 -25
  140. package/dist/s3/drive.js +46 -77
  141. package/dist/s3/listing.d.ts +27 -1
  142. package/dist/s3/listing.js +62 -20
  143. package/dist/s3/long-answer.d.ts +12 -0
  144. package/dist/s3/long-answer.js +104 -0
  145. package/dist/s3/multipart-assemble.d.ts +17 -0
  146. package/dist/s3/multipart-assemble.js +68 -0
  147. package/dist/s3/multipart-sweep.d.ts +15 -0
  148. package/dist/s3/multipart-sweep.js +87 -0
  149. package/dist/s3/multipart-view.d.ts +45 -0
  150. package/dist/s3/multipart-view.js +232 -0
  151. package/dist/s3/multipart.d.ts +26 -19
  152. package/dist/s3/multipart.js +193 -78
  153. package/dist/s3/object-read.d.ts +17 -0
  154. package/dist/s3/object-read.js +127 -0
  155. package/dist/s3/object-write.d.ts +35 -0
  156. package/dist/s3/object-write.js +198 -0
  157. package/dist/s3/range.d.ts +14 -0
  158. package/dist/s3/range.js +80 -0
  159. package/dist/s3/response-sink.d.ts +12 -2
  160. package/dist/s3/response-sink.js +71 -7
  161. package/dist/s3/routes.d.ts +0 -1
  162. package/dist/s3/routes.js +242 -217
  163. package/dist/s3/same-file.d.ts +4 -1
  164. package/dist/s3/same-file.js +12 -3
  165. package/dist/s3/server.d.ts +54 -4
  166. package/dist/s3/server.js +174 -14
  167. package/dist/s3/sigv4-canonical.d.ts +91 -0
  168. package/dist/s3/sigv4-canonical.js +148 -0
  169. package/dist/s3/sigv4-presigned.d.ts +13 -0
  170. package/dist/s3/sigv4-presigned.js +82 -0
  171. package/dist/s3/sigv4.d.ts +26 -27
  172. package/dist/s3/sigv4.js +137 -102
  173. package/dist/s3/spool.d.ts +37 -0
  174. package/dist/s3/spool.js +104 -0
  175. package/dist/s3/staging.d.ts +90 -7
  176. package/dist/s3/staging.js +97 -66
  177. package/dist/s3/xml-multipart.d.ts +38 -0
  178. package/dist/s3/xml-multipart.js +47 -0
  179. package/dist/s3/xml-read.d.ts +28 -0
  180. package/dist/s3/xml-read.js +235 -0
  181. package/dist/s3/xml.d.ts +45 -2
  182. package/dist/s3/xml.js +72 -13
  183. package/dist/s3-gateway.d.ts +11 -5
  184. package/dist/s3-gateway.js +5 -2
  185. package/dist/seal.d.ts +1 -1
  186. package/dist/share-codes.d.ts +40 -0
  187. package/dist/share-codes.js +151 -0
  188. package/dist/share.d.ts +39 -0
  189. package/dist/share.js +54 -13
  190. package/dist/shared/lib/api/types-heavy.d.ts +167 -0
  191. package/dist/shared/lib/api/types-heavy.js +60 -0
  192. package/dist/shared/lib/drive/rebuild-verify.js +1 -0
  193. package/dist/shared/lib/filecoin/providers.d.ts +25 -0
  194. package/dist/shared/lib/filecoin/providers.js +58 -0
  195. package/dist/shared/lib/heavy/download.d.ts +48 -0
  196. package/dist/shared/lib/heavy/download.js +116 -0
  197. package/dist/shared/lib/heavy/order-plan.d.ts +77 -0
  198. package/dist/shared/lib/heavy/order-plan.js +83 -0
  199. package/dist/shared/lib/heavy/order-runner.d.ts +9 -0
  200. package/dist/shared/lib/heavy/order-runner.js +300 -0
  201. package/dist/shared/lib/heavy/order-types.d.ts +90 -0
  202. package/dist/shared/lib/heavy/order-types.js +6 -0
  203. package/dist/shared/lib/heavy/order-wire.d.ts +55 -0
  204. package/dist/shared/lib/heavy/order-wire.js +113 -0
  205. package/dist/shared/lib/heavy/piece-cid.d.ts +24 -0
  206. package/dist/shared/lib/heavy/piece-cid.js +55 -0
  207. package/dist/shared/lib/heavy/sp-upload.d.ts +37 -0
  208. package/dist/shared/lib/heavy/sp-upload.js +112 -0
  209. package/dist/shared/lib/heavy/synapse-piece.d.ts +1 -0
  210. package/dist/shared/lib/heavy/synapse-piece.js +8 -0
  211. package/dist/shared/lib/share/handover-format.d.ts +129 -0
  212. package/dist/shared/lib/share/handover-format.js +323 -0
  213. package/dist/shared/lib/share/public-link.d.ts +41 -0
  214. package/dist/shared/lib/share/public-link.js +107 -0
  215. package/dist/shared/lib/share/shared-file-info.js +1 -0
  216. package/dist/shared/lib/storage-network.d.ts +4 -4
  217. package/dist/shared/lib/storage-network.js +7 -7
  218. package/dist/shared/lib/storage-tier.d.ts +28 -0
  219. package/dist/shared/lib/storage-tier.js +63 -0
  220. package/dist/shared/lib/wallet/send-rules.js +1 -0
  221. package/dist/upload-file.d.ts +8 -0
  222. package/dist/upload-file.js +57 -25
  223. package/dist/upload-price-node.d.ts +3 -0
  224. package/dist/upload-price-node.js +3 -6
  225. package/dist/upload-price.d.ts +10 -0
  226. package/dist/upload-price.js +13 -1
  227. package/dist/upload-run.d.ts +80 -0
  228. package/dist/upload-run.js +173 -0
  229. package/dist/upload-steps.js +15 -4
  230. package/dist/upload-store.d.ts +15 -6
  231. package/dist/upload-store.js +6 -0
  232. package/dist/upload-wallet-put.d.ts +9 -4
  233. package/dist/upload-wallet-put.js +16 -6
  234. package/dist/upload-wallet.js +4 -0
  235. package/dist/upload-wire.d.ts +25 -0
  236. package/dist/upload-wire.js +20 -1
  237. package/dist/upload.js +28 -13
  238. package/dist/wallet-sign.js +2 -2
  239. package/docs/commands/handover.md +54 -0
  240. package/docs/commands/heavy.md +35 -0
  241. package/docs/commands/link.md +27 -0
  242. package/docs/commands/mcp.md +2 -1
  243. package/docs/commands/public-code.md +25 -6
  244. package/docs/commands/push.md +4 -1
  245. package/docs/commands/put.md +15 -1
  246. package/docs/commands/share.md +8 -3
  247. package/package.json +5 -2
  248. package/server.json +2 -2
  249. package/vendor/nmts-crypto/nmts_crypto_wasm.d.ts +106 -4
  250. package/vendor/nmts-crypto/nmts_crypto_wasm.js +286 -3
  251. package/vendor/nmts-crypto/nmts_crypto_wasm_bg.wasm +0 -0
  252. package/vendor/nmts-crypto/nmts_crypto_wasm_bg.wasm.d.ts +12 -1
@@ -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,370) 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}
@@ -589,7 +617,7 @@ export function header_plaintext_len(header) {
589
617
  /**
590
618
  * Derives the account keys from the 20 raw account-code bytes (NCF-3 §1).
591
619
  *
592
- * Returns one concatenated buffer (`KDF_DERIVE_LEN` = 288 bytes) the caller slices:
620
+ * Returns one concatenated buffer (`KDF_DERIVE_LEN` = 320 bytes) the caller slices:
593
621
  * ```text
594
622
  * 0.. 16 account_id public — the server's lookup key
595
623
  * 16.. 48 auth_secret secret — sent to the server over TLS at login
@@ -601,12 +629,13 @@ export function header_plaintext_len(header) {
601
629
  * 208..224 share_address public — the address a user hands out to be shared with
602
630
  * 224..256 share_sig_seed secret — ML-DSA-44 seed; its key IS the identity root (§5.2a)
603
631
  * 256..288 ai_account_root secret — parent of every AI-account code (§1.5, the product rule of 2026-09-06)
632
+ * 288..320 share_id_root secret — parent of share identities 1 and up (§5.9, 2026-09-23)
604
633
  * ```
605
634
  * Every secret region above must be retained inside the crypto worker and never cross the
606
635
  * postMessage boundary.
607
636
  *
608
- * ⚠ **This layout only ever grows at the TAIL**, and `ai_account_root` was appended on 2026-09-06
609
- * under the same rule. `share_sig_seed` was appended in 2026-08-02
637
+ * ⚠ **This layout only ever grows at the TAIL**: `ai_account_root` was appended on 2026-09-06 and
638
+ * `share_id_root` on 2026-09-23 under that rule. `share_sig_seed` was appended in 2026-08-02
610
639
  * rather than filed beside the other two share secrets, where it would read better, because
611
640
  * inserting it there would shift `wallet_root` and `share_address` and every constant on the
612
641
  * JS side would be silently wrong about which 32 bytes it was holding. Readability loses to
@@ -630,6 +659,99 @@ export function kdf_derive(code_bytes) {
630
659
  return v2;
631
660
  }
632
661
 
662
+ /**
663
+ * A fresh 32-byte link secret `S`, drawn inside Rust from WebCrypto. One per link.
664
+ * @returns {Uint8Array}
665
+ */
666
+ export function link_generate_secret() {
667
+ const ret = wasm.link_generate_secret();
668
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
669
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
670
+ return v1;
671
+ }
672
+
673
+ /**
674
+ * Opens a link secret sealed by `link_seal_secret`, returning the 32-byte `S`.
675
+ * @param {Uint8Array} data_key
676
+ * @param {Uint8Array} sealed
677
+ * @returns {Uint8Array}
678
+ */
679
+ export function link_open_secret(data_key, sealed) {
680
+ const ptr0 = passArray8ToWasm0(data_key, wasm.__wbindgen_malloc);
681
+ const len0 = WASM_VECTOR_LEN;
682
+ const ptr1 = passArray8ToWasm0(sealed, wasm.__wbindgen_malloc);
683
+ const len1 = WASM_VECTOR_LEN;
684
+ const ret = wasm.link_open_secret(ptr0, len0, ptr1, len1);
685
+ if (ret[3]) {
686
+ throw takeFromExternrefTable0(ret[2]);
687
+ }
688
+ var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
689
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
690
+ return v3;
691
+ }
692
+
693
+ /**
694
+ * Seals a link secret under the uploader's dataKey: `E(dataKey, "nmts/v3/link-secret", S)`,
695
+ * 104 bytes. Stored beside the link so the uploader can copy the same link again later.
696
+ * @param {Uint8Array} data_key
697
+ * @param {Uint8Array} link_secret
698
+ * @returns {Uint8Array}
699
+ */
700
+ export function link_seal_secret(data_key, link_secret) {
701
+ const ptr0 = passArray8ToWasm0(data_key, wasm.__wbindgen_malloc);
702
+ const len0 = WASM_VECTOR_LEN;
703
+ const ptr1 = passArray8ToWasm0(link_secret, wasm.__wbindgen_malloc);
704
+ const len1 = WASM_VECTOR_LEN;
705
+ const ret = wasm.link_seal_secret(ptr0, len0, ptr1, len1);
706
+ if (ret[3]) {
707
+ throw takeFromExternrefTable0(ret[2]);
708
+ }
709
+ var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
710
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
711
+ return v3;
712
+ }
713
+
714
+ /**
715
+ * Opens a link's wrapped DEK with the secret from the fragment, returning the 32-byte DEK.
716
+ * @param {Uint8Array} link_secret
717
+ * @param {Uint8Array} wrapped
718
+ * @returns {Uint8Array}
719
+ */
720
+ export function link_unwrap_dek(link_secret, wrapped) {
721
+ const ptr0 = passArray8ToWasm0(link_secret, wasm.__wbindgen_malloc);
722
+ const len0 = WASM_VECTOR_LEN;
723
+ const ptr1 = passArray8ToWasm0(wrapped, wasm.__wbindgen_malloc);
724
+ const len1 = WASM_VECTOR_LEN;
725
+ const ret = wasm.link_unwrap_dek(ptr0, len0, ptr1, len1);
726
+ if (ret[3]) {
727
+ throw takeFromExternrefTable0(ret[2]);
728
+ }
729
+ var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
730
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
731
+ return v3;
732
+ }
733
+
734
+ /**
735
+ * Wraps a file DEK under a link secret: `E(S, "nmts/v3/link-wrap", DEK)`, 104 bytes. The server
736
+ * stores the result beside the link's token.
737
+ * @param {Uint8Array} link_secret
738
+ * @param {Uint8Array} dek
739
+ * @returns {Uint8Array}
740
+ */
741
+ export function link_wrap_dek(link_secret, dek) {
742
+ const ptr0 = passArray8ToWasm0(link_secret, wasm.__wbindgen_malloc);
743
+ const len0 = WASM_VECTOR_LEN;
744
+ const ptr1 = passArray8ToWasm0(dek, wasm.__wbindgen_malloc);
745
+ const len1 = WASM_VECTOR_LEN;
746
+ const ret = wasm.link_wrap_dek(ptr0, len0, ptr1, len1);
747
+ if (ret[3]) {
748
+ throw takeFromExternrefTable0(ret[2]);
749
+ }
750
+ var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
751
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
752
+ return v3;
753
+ }
754
+
633
755
  /**
634
756
  * The 16-byte LOCATOR a wallet signature yields — the name the server files this opener's slot
635
757
  * under, and the name a sign-in asks for it back by (NCF-3 §1.7).
@@ -858,6 +980,25 @@ export function sha256(data) {
858
980
  return v2;
859
981
  }
860
982
 
983
+ /**
984
+ * The 16-byte share ADDRESS of identity number `index`, from its signing seed alone — no
985
+ * signature is made to answer it. At index 0 it is `kdf_derive`'s `share_address` (208..224).
986
+ * @param {Uint8Array} share_sig_seed
987
+ * @param {number} index
988
+ * @returns {Uint8Array}
989
+ */
990
+ export function share_address_at(share_sig_seed, index) {
991
+ const ptr0 = passArray8ToWasm0(share_sig_seed, wasm.__wbindgen_malloc);
992
+ const len0 = WASM_VECTOR_LEN;
993
+ const ret = wasm.share_address_at(ptr0, len0, index);
994
+ if (ret[3]) {
995
+ throw takeFromExternrefTable0(ret[2]);
996
+ }
997
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
998
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
999
+ return v2;
1000
+ }
1001
+
861
1002
  /**
862
1003
  * The display form of a share address (`kdf_derive` bytes 208..224):
863
1004
  * `XXXXXXXXX-XXXXXXXXX-XXXXXXXXC` — Crockford Base32 with a trailing check symbol.
@@ -950,6 +1091,32 @@ export function share_claimed_sender(envelope) {
950
1091
  return v2;
951
1092
  }
952
1093
 
1094
+ /**
1095
+ * The three secret seeds of share identity number `index` (1-based) from the 32-byte
1096
+ * `share_id_root` at `kdf_derive` bytes 288..320: `kem(32) || auth(32) || sig(32)`, 96 bytes.
1097
+ *
1098
+ * ⛔ It takes the ROOT rather than the account code for the reason `wallet_seed_for` does: the
1099
+ * browser derives once at sign-in and keeps only the roots, and a person makes a new public code
1100
+ * whenever they like. Holding the root grants identities 1 and up and nothing else.
1101
+ *
1102
+ * Rejects `index` 0. All 96 bytes are secret and stay inside the crypto worker, like the
1103
+ * `kdf_derive` regions they sit beside.
1104
+ * @param {Uint8Array} share_id_root
1105
+ * @param {number} index
1106
+ * @returns {Uint8Array}
1107
+ */
1108
+ export function share_id_seeds(share_id_root, index) {
1109
+ const ptr0 = passArray8ToWasm0(share_id_root, wasm.__wbindgen_malloc);
1110
+ const len0 = WASM_VECTOR_LEN;
1111
+ const ret = wasm.share_id_seeds(ptr0, len0, index);
1112
+ if (ret[3]) {
1113
+ throw takeFromExternrefTable0(ret[2]);
1114
+ }
1115
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1116
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1117
+ return v2;
1118
+ }
1119
+
953
1120
  /**
954
1121
  * The 4989-byte PUBLIC share identity, built from the three secrets at `kdf_derive` bytes
955
1122
  * 112..176 and 224..256 (KEM seed, auth secret, signing seed).
@@ -983,6 +1150,34 @@ export function share_public_key(share_kem_seed, share_auth_secret, share_sig_se
983
1150
  return v4;
984
1151
  }
985
1152
 
1153
+ /**
1154
+ * The 4989-byte PUBLIC share identity number `index`: the bundle `share_public_key` builds, with
1155
+ * `derivation_index = index`. At index 0 it is `share_public_key`, byte for byte.
1156
+ *
1157
+ * The number is inside the root, so each number has its own address; the self-signature covers
1158
+ * it, so a numbered bundle is verified by exactly the steps any bundle is.
1159
+ * @param {Uint8Array} share_kem_seed
1160
+ * @param {Uint8Array} share_auth_secret
1161
+ * @param {Uint8Array} share_sig_seed
1162
+ * @param {number} index
1163
+ * @returns {Uint8Array}
1164
+ */
1165
+ export function share_public_key_at(share_kem_seed, share_auth_secret, share_sig_seed, index) {
1166
+ const ptr0 = passArray8ToWasm0(share_kem_seed, wasm.__wbindgen_malloc);
1167
+ const len0 = WASM_VECTOR_LEN;
1168
+ const ptr1 = passArray8ToWasm0(share_auth_secret, wasm.__wbindgen_malloc);
1169
+ const len1 = WASM_VECTOR_LEN;
1170
+ const ptr2 = passArray8ToWasm0(share_sig_seed, wasm.__wbindgen_malloc);
1171
+ const len2 = WASM_VECTOR_LEN;
1172
+ const ret = wasm.share_public_key_at(ptr0, len0, ptr1, len1, ptr2, len2, index);
1173
+ if (ret[3]) {
1174
+ throw takeFromExternrefTable0(ret[2]);
1175
+ }
1176
+ var v4 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1177
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1178
+ return v4;
1179
+ }
1180
+
986
1181
  /**
987
1182
  * Unwraps a share envelope addressed to us, returning the 32-byte file DEK.
988
1183
  *
@@ -1026,6 +1221,49 @@ export function share_unwrap_dek(share_kem_seed, share_auth_secret, share_sig_se
1026
1221
  return v9;
1027
1222
  }
1028
1223
 
1224
+ /**
1225
+ * `share_unwrap_dek` as identity number `index`, returning the 32-byte file DEK.
1226
+ *
1227
+ * An envelope does not name its recipient, so the caller picks the number — the inbox knows
1228
+ * which address a share was stored against. Opened as the wrong number it fails with the same
1229
+ * message as an envelope meant for somebody else, a forged sender or a rewritten row.
1230
+ * @param {Uint8Array} share_kem_seed
1231
+ * @param {Uint8Array} share_auth_secret
1232
+ * @param {Uint8Array} share_sig_seed
1233
+ * @param {number} index
1234
+ * @param {Uint8Array} sender_public
1235
+ * @param {Uint8Array} envelope
1236
+ * @param {string} item_id
1237
+ * @param {Uint8Array} name_share_ct
1238
+ * @param {Uint8Array} content_hash_share_ct
1239
+ * @returns {Uint8Array}
1240
+ */
1241
+ export function share_unwrap_dek_as(share_kem_seed, share_auth_secret, share_sig_seed, index, sender_public, envelope, item_id, name_share_ct, content_hash_share_ct) {
1242
+ const ptr0 = passArray8ToWasm0(share_kem_seed, wasm.__wbindgen_malloc);
1243
+ const len0 = WASM_VECTOR_LEN;
1244
+ const ptr1 = passArray8ToWasm0(share_auth_secret, wasm.__wbindgen_malloc);
1245
+ const len1 = WASM_VECTOR_LEN;
1246
+ const ptr2 = passArray8ToWasm0(share_sig_seed, wasm.__wbindgen_malloc);
1247
+ const len2 = WASM_VECTOR_LEN;
1248
+ const ptr3 = passArray8ToWasm0(sender_public, wasm.__wbindgen_malloc);
1249
+ const len3 = WASM_VECTOR_LEN;
1250
+ const ptr4 = passArray8ToWasm0(envelope, wasm.__wbindgen_malloc);
1251
+ const len4 = WASM_VECTOR_LEN;
1252
+ const ptr5 = passStringToWasm0(item_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1253
+ const len5 = WASM_VECTOR_LEN;
1254
+ const ptr6 = passArray8ToWasm0(name_share_ct, wasm.__wbindgen_malloc);
1255
+ const len6 = WASM_VECTOR_LEN;
1256
+ const ptr7 = passArray8ToWasm0(content_hash_share_ct, wasm.__wbindgen_malloc);
1257
+ const len7 = WASM_VECTOR_LEN;
1258
+ const ret = wasm.share_unwrap_dek_as(ptr0, len0, ptr1, len1, ptr2, len2, index, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6, ptr7, len7);
1259
+ if (ret[3]) {
1260
+ throw takeFromExternrefTable0(ret[2]);
1261
+ }
1262
+ var v9 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1263
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1264
+ return v9;
1265
+ }
1266
+
1029
1267
  /**
1030
1268
  * Wraps a file DEK for ONE recipient, given the public key the server returned AND the address
1031
1269
  * the sender was actually given.
@@ -1081,6 +1319,51 @@ export function share_wrap_dek(sender_auth_secret, sender_sig_seed, recipient_pu
1081
1319
  return v9;
1082
1320
  }
1083
1321
 
1322
+ /**
1323
+ * `share_wrap_dek` sending AS identity number `sender_index`: the two sender secrets are that
1324
+ * identity's, and the envelope's sender address is that identity's address.
1325
+ *
1326
+ * Every other argument and every check is `share_wrap_dek`'s — the recipient key is checked
1327
+ * against `recipient_address` before anything is encrypted to it, the last three arguments are
1328
+ * the row the envelope is bound to, and fresh randomness is drawn per call. Returns the 1240-byte
1329
+ * share envelope.
1330
+ * @param {Uint8Array} sender_auth_secret
1331
+ * @param {Uint8Array} sender_sig_seed
1332
+ * @param {number} sender_index
1333
+ * @param {Uint8Array} recipient_public
1334
+ * @param {Uint8Array} recipient_address
1335
+ * @param {Uint8Array} dek
1336
+ * @param {string} item_id
1337
+ * @param {Uint8Array} name_share_ct
1338
+ * @param {Uint8Array} content_hash_share_ct
1339
+ * @returns {Uint8Array}
1340
+ */
1341
+ export function share_wrap_dek_as(sender_auth_secret, sender_sig_seed, sender_index, recipient_public, recipient_address, dek, item_id, name_share_ct, content_hash_share_ct) {
1342
+ const ptr0 = passArray8ToWasm0(sender_auth_secret, wasm.__wbindgen_malloc);
1343
+ const len0 = WASM_VECTOR_LEN;
1344
+ const ptr1 = passArray8ToWasm0(sender_sig_seed, wasm.__wbindgen_malloc);
1345
+ const len1 = WASM_VECTOR_LEN;
1346
+ const ptr2 = passArray8ToWasm0(recipient_public, wasm.__wbindgen_malloc);
1347
+ const len2 = WASM_VECTOR_LEN;
1348
+ const ptr3 = passArray8ToWasm0(recipient_address, wasm.__wbindgen_malloc);
1349
+ const len3 = WASM_VECTOR_LEN;
1350
+ const ptr4 = passArray8ToWasm0(dek, wasm.__wbindgen_malloc);
1351
+ const len4 = WASM_VECTOR_LEN;
1352
+ const ptr5 = passStringToWasm0(item_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1353
+ const len5 = WASM_VECTOR_LEN;
1354
+ const ptr6 = passArray8ToWasm0(name_share_ct, wasm.__wbindgen_malloc);
1355
+ const len6 = WASM_VECTOR_LEN;
1356
+ const ptr7 = passArray8ToWasm0(content_hash_share_ct, wasm.__wbindgen_malloc);
1357
+ const len7 = WASM_VECTOR_LEN;
1358
+ const ret = wasm.share_wrap_dek_as(ptr0, len0, ptr1, len1, sender_index, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6, ptr7, len7);
1359
+ if (ret[3]) {
1360
+ throw takeFromExternrefTable0(ret[2]);
1361
+ }
1362
+ var v9 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1363
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1364
+ return v9;
1365
+ }
1366
+
1084
1367
  /**
1085
1368
  * Decrypts a whole NCF-3 stream under the file DEK, verifying framing/anti-tamper.
1086
1369
  * @param {Uint8Array} dek
@@ -41,7 +41,11 @@ 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];
44
+ export const share_address_at: (a: number, b: number, c: number) => [number, number, number, number];
45
+ export const share_id_seeds: (a: number, b: number, c: number) => [number, number, number, number];
46
+ export const share_public_key_at: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number, number];
47
+ export const share_unwrap_dek_as: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number) => [number, number, number, number];
48
+ export const share_wrap_dek_as: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number) => [number, number, number, number];
45
49
  export const opener_locator: (a: number, b: number) => [number, number, number, number];
46
50
  export const opener_message: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
47
51
  export const opener_open: (a: number, b: number, c: number, d: number) => [number, number, number, number];
@@ -50,11 +54,18 @@ export const passkey_locator: (a: number, b: number) => [number, number, number,
50
54
  export const passkey_open: (a: number, b: number, c: number, d: number) => [number, number, number, number];
51
55
  export const passkey_prf_salt: () => [number, number];
52
56
  export const passkey_seal: (a: number, b: number, c: number, d: number) => [number, number, number, number];
57
+ export const link_generate_secret: () => [number, number];
58
+ export const link_open_secret: (a: number, b: number, c: number, d: number) => [number, number, number, number];
59
+ export const link_seal_secret: (a: number, b: number, c: number, d: number) => [number, number, number, number];
60
+ export const link_unwrap_dek: (a: number, b: number, c: number, d: number) => [number, number, number, number];
61
+ export const link_wrap_dek: (a: number, b: number, c: number, d: number) => [number, number, number, number];
53
62
  export const account_code_display: (a: number, b: number) => [number, number, number, number];
54
63
  export const account_code_generate: () => [number, number];
55
64
  export const account_code_parse: (a: number, b: number) => [number, number, number, number];
56
65
  export const account_code_phrase: (a: number, b: number, c: number, d: number) => [number, number, number, number];
57
66
  export const voucher_hash_from_input: (a: number, b: number) => [number, number];
67
+ export const evm_key_for: (a: number, b: number, c: number) => [number, number, number, number];
68
+ export const wallet_seed_for: (a: number, b: number, c: number) => [number, number, number, number];
58
69
  export const __wbindgen_exn_store: (a: number) => void;
59
70
  export const __externref_table_alloc: () => number;
60
71
  export const __wbindgen_externrefs: WebAssembly.Table;