@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.
- package/AGENTS.md +8 -8
- package/CHANGELOG.md +78 -0
- package/README.ko.md +6 -3
- package/README.md +31 -11
- 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 +19 -1
- package/dist/args.js +14 -2
- package/dist/artifact-about.d.ts +1 -1
- package/dist/autonomy.js +3 -3
- 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 +15 -0
- package/dist/commands/handover.js +376 -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/link.d.ts +12 -0
- package/dist/commands/link.js +121 -0
- package/dist/commands/ls.d.ts +5 -0
- package/dist/commands/ls.js +9 -1
- package/dist/commands/public-code-manage.d.ts +24 -0
- package/dist/commands/public-code-manage.js +217 -0
- package/dist/commands/public-code.d.ts +12 -1
- package/dist/commands/public-code.js +140 -45
- 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 +14 -8
- package/dist/commands/s3.js +44 -10
- package/dist/commands/share-dispatch.js +14 -1
- package/dist/commands/share.d.ts +2 -0
- package/dist/commands/share.js +45 -35
- package/dist/commands/shares-sent.js +8 -3
- package/dist/crypto-surface.d.ts +35 -0
- package/dist/crypto-surface.js +13 -0
- package/dist/crypto.d.ts +8 -0
- package/dist/crypto.js +8 -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-codes.d.ts +25 -0
- package/dist/handover-codes.js +106 -0
- package/dist/handover.d.ts +62 -0
- package/dist/handover.js +217 -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 +13 -4
- package/dist/help.js +24 -3
- package/dist/links.d.ts +58 -0
- package/dist/links.js +206 -0
- package/dist/list-tier.d.ts +7 -0
- package/dist/list-tier.js +47 -0
- package/dist/main.js +13 -10
- package/dist/manifest-write.d.ts +4 -3
- package/dist/mcp-tools/reads.js +20 -6
- package/dist/mcp-tools/share.js +47 -1
- package/dist/mcp-tools/tiers.js +16 -1
- package/dist/platform-sign.d.ts +4 -4
- package/dist/platform-sign.js +3 -3
- package/dist/portable.d.ts +23 -0
- package/dist/portable.js +19 -0
- package/dist/product.d.ts +1 -1
- package/dist/product.js +1 -1
- package/dist/public-code-activity.d.ts +35 -0
- package/dist/public-code-activity.js +88 -0
- package/dist/public-code-refusals.d.ts +25 -0
- package/dist/public-code-refusals.js +87 -0
- package/dist/public-codes.d.ts +76 -0
- package/dist/public-codes.js +182 -0
- 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 +55 -1
- package/dist/risk.js +55 -3
- 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-codes.d.ts +40 -0
- package/dist/share-codes.js +151 -0
- package/dist/share.d.ts +39 -0
- package/dist/share.js +54 -13
- 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/public-link.d.ts +41 -0
- package/dist/shared/lib/share/public-link.js +107 -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 +54 -0
- package/docs/commands/heavy.md +35 -0
- package/docs/commands/link.md +27 -0
- package/docs/commands/mcp.md +2 -1
- package/docs/commands/public-code.md +25 -6
- package/docs/commands/push.md +4 -1
- package/docs/commands/put.md +15 -1
- package/docs/commands/share.md +8 -3
- package/package.json +5 -2
- package/server.json +2 -2
- package/vendor/nmts-crypto/nmts_crypto_wasm.d.ts +106 -4
- package/vendor/nmts-crypto/nmts_crypto_wasm.js +286 -3
- package/vendor/nmts-crypto/nmts_crypto_wasm_bg.wasm +0 -0
- 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` =
|
|
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
|
|
609
|
-
* under
|
|
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
|
|
Binary file
|
|
@@ -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
|
|
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;
|