@tari-project/ootle-wasm 0.31.0 → 0.33.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/ootle_wasm.d.ts CHANGED
@@ -168,6 +168,41 @@ export function borEncodeTransaction(transaction_json: string): string;
168
168
  */
169
169
  export function buildStealthInputsStatement(input_commitments: Uint8Array, revealed_amount_microtari: bigint): string;
170
170
 
171
+ /**
172
+ * Build a single stealth output witness entirely client-side (sender side), mirroring the wallet
173
+ * daemon's `create_output_witness`.
174
+ *
175
+ * A fresh commitment mask and ephemeral nonce are generated internally; the recipient recovers the
176
+ * value and mask by decrypting `encrypted_data`. Returns one witness as a JSON string with the shape:
177
+ * ```text
178
+ * {
179
+ * "witness": {
180
+ * "amount": <u64>,
181
+ * "mask": <hex 32 bytes>,
182
+ * "sender_public_nonce": <hex 32 bytes>,
183
+ * "minimum_value_promise": <u64>,
184
+ * "encrypted_data": <hex variable-length>,
185
+ * "resource_view_key": <hex 32 bytes | null>
186
+ * },
187
+ * "spend_condition": <SpendCondition>,
188
+ * "tag": <u32>
189
+ * }
190
+ * ```
191
+ * Collect one witness per output (including change) into a JSON array and pass it to
192
+ * `generateStealthOutputsStatement`.
193
+ *
194
+ * - `network` is the network byte (0x00 = MainNet, 0x10 = LocalNet, 0x26 = Esmeralda, ...).
195
+ * - `destination_account_public_key` / `destination_view_public_key` are the recipient's 32-byte keys.
196
+ * - `resource_address` is the `resource_<hex>` string of the resource being sent.
197
+ * - `resource_view_key` is the resource view-key holder's 32-byte public key, or `null` for resources without a
198
+ * viewable balance (when set, the output receives an ElGamal proof at statement time).
199
+ * - `memo_json` is an optional JSON-encoded `Memo` to embed in the encrypted payload.
200
+ * - `pay_to_json` is an optional JSON-encoded `PayTo`: `"StealthPublicKey"` (the default when `null`, producing a
201
+ * one-time stealth spend key) or `{"AccessRule": <AccessRule>}`.
202
+ * - `minimum_value_promise` is the range-proof lower bound and must be `<= amount` (use `0` normally).
203
+ */
204
+ export function createStealthOutputWitness(network: number, destination_account_public_key: Uint8Array, destination_view_public_key: Uint8Array, amount: bigint, resource_address: string, resource_view_key: Uint8Array | null | undefined, memo_json: string | null | undefined, pay_to_json: string | null | undefined, minimum_value_promise: bigint): string;
205
+
171
206
  /**
172
207
  * Brute-force decrypt an ElGamal viewable-balance proof to recover the bound value.
173
208
  *
package/ootle_wasm.js CHANGED
@@ -5,5 +5,5 @@ import { __wbg_set_wasm } from "./ootle_wasm_bg.js";
5
5
  __wbg_set_wasm(wasm);
6
6
  wasm.__wbindgen_start();
7
7
  export {
8
- DecryptedOutputResult, KeypairResult, OotlePublicKey, OotleSecretKey, ParsedOotleAddress, SchnorrSignatureResult, StealthOutputsResult, addTransactionSigner, aggregateInputMasks, borEncodeTransaction, buildStealthInputsStatement, decryptElgamalViewableBalance, encryptedDataDhKdfAead, generateElgamalViewableBalanceProof, generateExtendedBulletProof, generateKeypair, generateOotleAddress, generateOotleSecretKey, generateStealthBalanceProofSignature, generateStealthOutputsStatement, hashUnsignedTransaction, on_start, ootlePublicKeyFromSecretKey, parseOotleAddress, publicKeyFromSecretKey, schnorrSign, sealTransaction, stealthDhSecret, unblindOutput, validateBalanceProofSignature, validateStealthTransfer
8
+ DecryptedOutputResult, KeypairResult, OotlePublicKey, OotleSecretKey, ParsedOotleAddress, SchnorrSignatureResult, StealthOutputsResult, addTransactionSigner, aggregateInputMasks, borEncodeTransaction, buildStealthInputsStatement, createStealthOutputWitness, decryptElgamalViewableBalance, encryptedDataDhKdfAead, generateElgamalViewableBalanceProof, generateExtendedBulletProof, generateKeypair, generateOotleAddress, generateOotleSecretKey, generateStealthBalanceProofSignature, generateStealthOutputsStatement, hashUnsignedTransaction, on_start, ootlePublicKeyFromSecretKey, parseOotleAddress, publicKeyFromSecretKey, schnorrSign, sealTransaction, stealthDhSecret, unblindOutput, validateBalanceProofSignature, validateStealthTransfer
9
9
  } from "./ootle_wasm_bg.js";
package/ootle_wasm_bg.js CHANGED
@@ -608,6 +608,80 @@ export function buildStealthInputsStatement(input_commitments, revealed_amount_m
608
608
  }
609
609
  }
610
610
 
611
+ /**
612
+ * Build a single stealth output witness entirely client-side (sender side), mirroring the wallet
613
+ * daemon's `create_output_witness`.
614
+ *
615
+ * A fresh commitment mask and ephemeral nonce are generated internally; the recipient recovers the
616
+ * value and mask by decrypting `encrypted_data`. Returns one witness as a JSON string with the shape:
617
+ * ```text
618
+ * {
619
+ * "witness": {
620
+ * "amount": <u64>,
621
+ * "mask": <hex 32 bytes>,
622
+ * "sender_public_nonce": <hex 32 bytes>,
623
+ * "minimum_value_promise": <u64>,
624
+ * "encrypted_data": <hex variable-length>,
625
+ * "resource_view_key": <hex 32 bytes | null>
626
+ * },
627
+ * "spend_condition": <SpendCondition>,
628
+ * "tag": <u32>
629
+ * }
630
+ * ```
631
+ * Collect one witness per output (including change) into a JSON array and pass it to
632
+ * `generateStealthOutputsStatement`.
633
+ *
634
+ * - `network` is the network byte (0x00 = MainNet, 0x10 = LocalNet, 0x26 = Esmeralda, ...).
635
+ * - `destination_account_public_key` / `destination_view_public_key` are the recipient's 32-byte keys.
636
+ * - `resource_address` is the `resource_<hex>` string of the resource being sent.
637
+ * - `resource_view_key` is the resource view-key holder's 32-byte public key, or `null` for resources without a
638
+ * viewable balance (when set, the output receives an ElGamal proof at statement time).
639
+ * - `memo_json` is an optional JSON-encoded `Memo` to embed in the encrypted payload.
640
+ * - `pay_to_json` is an optional JSON-encoded `PayTo`: `"StealthPublicKey"` (the default when `null`, producing a
641
+ * one-time stealth spend key) or `{"AccessRule": <AccessRule>}`.
642
+ * - `minimum_value_promise` is the range-proof lower bound and must be `<= amount` (use `0` normally).
643
+ * @param {number} network
644
+ * @param {Uint8Array} destination_account_public_key
645
+ * @param {Uint8Array} destination_view_public_key
646
+ * @param {bigint} amount
647
+ * @param {string} resource_address
648
+ * @param {Uint8Array | null | undefined} resource_view_key
649
+ * @param {string | null | undefined} memo_json
650
+ * @param {string | null | undefined} pay_to_json
651
+ * @param {bigint} minimum_value_promise
652
+ * @returns {string}
653
+ */
654
+ export function createStealthOutputWitness(network, destination_account_public_key, destination_view_public_key, amount, resource_address, resource_view_key, memo_json, pay_to_json, minimum_value_promise) {
655
+ let deferred8_0;
656
+ let deferred8_1;
657
+ try {
658
+ const ptr0 = passArray8ToWasm0(destination_account_public_key, wasm.__wbindgen_malloc);
659
+ const len0 = WASM_VECTOR_LEN;
660
+ const ptr1 = passArray8ToWasm0(destination_view_public_key, wasm.__wbindgen_malloc);
661
+ const len1 = WASM_VECTOR_LEN;
662
+ const ptr2 = passStringToWasm0(resource_address, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
663
+ const len2 = WASM_VECTOR_LEN;
664
+ var ptr3 = isLikeNone(resource_view_key) ? 0 : passArray8ToWasm0(resource_view_key, wasm.__wbindgen_malloc);
665
+ var len3 = WASM_VECTOR_LEN;
666
+ var ptr4 = isLikeNone(memo_json) ? 0 : passStringToWasm0(memo_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
667
+ var len4 = WASM_VECTOR_LEN;
668
+ var ptr5 = isLikeNone(pay_to_json) ? 0 : passStringToWasm0(pay_to_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
669
+ var len5 = WASM_VECTOR_LEN;
670
+ const ret = wasm.createStealthOutputWitness(network, ptr0, len0, ptr1, len1, amount, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, minimum_value_promise);
671
+ var ptr7 = ret[0];
672
+ var len7 = ret[1];
673
+ if (ret[3]) {
674
+ ptr7 = 0; len7 = 0;
675
+ throw takeFromExternrefTable0(ret[2]);
676
+ }
677
+ deferred8_0 = ptr7;
678
+ deferred8_1 = len7;
679
+ return getStringFromWasm0(ptr7, len7);
680
+ } finally {
681
+ wasm.__wbindgen_free(deferred8_0, deferred8_1, 1);
682
+ }
683
+ }
684
+
611
685
  /**
612
686
  * Brute-force decrypt an ElGamal viewable-balance proof to recover the bound value.
613
687
  *
Binary file
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "The Tari Development Community"
6
6
  ],
7
7
  "description": "WASM bindings for Tari Ootle client-side crypto — thin wasm-bindgen shell over ootle-wasm-core",
8
- "version": "0.31.0",
8
+ "version": "0.33.0",
9
9
  "license": "BSD-3-Clause",
10
10
  "repository": {
11
11
  "type": "git",