@tari-project/ootle-wasm 0.3.1 → 0.4.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
@@ -86,6 +86,14 @@ export class SchnorrSignatureResult {
86
86
  signature: Uint8Array;
87
87
  }
88
88
 
89
+ /**
90
+ * Add a signer to a transaction (unsigned or unsealed JSON).
91
+ *
92
+ * Accepts either an `UnsignedTransactionV1` or `UnsealedTransactionV1` JSON string.
93
+ * Returns the `UnsealedTransactionV1` (with the new signature appended) as a JSON string.
94
+ */
95
+ export function addTransactionSigner(tx_json: string, signer_secret_key: Uint8Array, seal_signer_public_key: Uint8Array): string;
96
+
89
97
  /**
90
98
  * BOR-encode a Transaction (JSON string) → base64 string (TransactionEnvelope format).
91
99
  */
@@ -146,3 +154,11 @@ export function publicKeyFromSecretKey(secret_key: Uint8Array): Uint8Array;
146
154
  * Returns { public_nonce: Uint8Array, signature: Uint8Array }.
147
155
  */
148
156
  export function schnorrSign(secret_key: Uint8Array, message: Uint8Array): SchnorrSignatureResult;
157
+
158
+ /**
159
+ * Seal a transaction (unsigned or unsealed JSON) with the seal signer's secret key.
160
+ *
161
+ * Accepts either an `UnsignedTransactionV1` or `UnsealedTransactionV1` JSON string.
162
+ * Returns the sealed `Transaction` as a JSON string.
163
+ */
164
+ export function sealTransaction(tx_json: string, seal_signer_secret_key: Uint8Array): string;
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
- KeypairResult, OotlePublicKey, OotleSecretKey, ParsedOotleAddress, SchnorrSignatureResult, borEncodeTransaction, generateKeypair, generateOotleAddress, generateOotleSecretKey, hashUnsignedTransaction, on_start, ootlePublicKeyFromSecretKey, parseOotleAddress, publicKeyFromSecretKey, schnorrSign
8
+ KeypairResult, OotlePublicKey, OotleSecretKey, ParsedOotleAddress, SchnorrSignatureResult, addTransactionSigner, borEncodeTransaction, generateKeypair, generateOotleAddress, generateOotleSecretKey, hashUnsignedTransaction, on_start, ootlePublicKeyFromSecretKey, parseOotleAddress, publicKeyFromSecretKey, schnorrSign, sealTransaction
9
9
  } from "./ootle_wasm_bg.js";
package/ootle_wasm_bg.js CHANGED
@@ -337,6 +337,41 @@ export class SchnorrSignatureResult {
337
337
  }
338
338
  if (Symbol.dispose) SchnorrSignatureResult.prototype[Symbol.dispose] = SchnorrSignatureResult.prototype.free;
339
339
 
340
+ /**
341
+ * Add a signer to a transaction (unsigned or unsealed JSON).
342
+ *
343
+ * Accepts either an `UnsignedTransactionV1` or `UnsealedTransactionV1` JSON string.
344
+ * Returns the `UnsealedTransactionV1` (with the new signature appended) as a JSON string.
345
+ * @param {string} tx_json
346
+ * @param {Uint8Array} signer_secret_key
347
+ * @param {Uint8Array} seal_signer_public_key
348
+ * @returns {string}
349
+ */
350
+ export function addTransactionSigner(tx_json, signer_secret_key, seal_signer_public_key) {
351
+ let deferred5_0;
352
+ let deferred5_1;
353
+ try {
354
+ const ptr0 = passStringToWasm0(tx_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
355
+ const len0 = WASM_VECTOR_LEN;
356
+ const ptr1 = passArray8ToWasm0(signer_secret_key, wasm.__wbindgen_malloc);
357
+ const len1 = WASM_VECTOR_LEN;
358
+ const ptr2 = passArray8ToWasm0(seal_signer_public_key, wasm.__wbindgen_malloc);
359
+ const len2 = WASM_VECTOR_LEN;
360
+ const ret = wasm.addTransactionSigner(ptr0, len0, ptr1, len1, ptr2, len2);
361
+ var ptr4 = ret[0];
362
+ var len4 = ret[1];
363
+ if (ret[3]) {
364
+ ptr4 = 0; len4 = 0;
365
+ throw takeFromExternrefTable0(ret[2]);
366
+ }
367
+ deferred5_0 = ptr4;
368
+ deferred5_1 = len4;
369
+ return getStringFromWasm0(ptr4, len4);
370
+ } finally {
371
+ wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
372
+ }
373
+ }
374
+
340
375
  /**
341
376
  * BOR-encode a Transaction (JSON string) → base64 string (TransactionEnvelope format).
342
377
  * @param {string} transaction_json
@@ -519,6 +554,38 @@ export function schnorrSign(secret_key, message) {
519
554
  }
520
555
  return SchnorrSignatureResult.__wrap(ret[0]);
521
556
  }
557
+
558
+ /**
559
+ * Seal a transaction (unsigned or unsealed JSON) with the seal signer's secret key.
560
+ *
561
+ * Accepts either an `UnsignedTransactionV1` or `UnsealedTransactionV1` JSON string.
562
+ * Returns the sealed `Transaction` as a JSON string.
563
+ * @param {string} tx_json
564
+ * @param {Uint8Array} seal_signer_secret_key
565
+ * @returns {string}
566
+ */
567
+ export function sealTransaction(tx_json, seal_signer_secret_key) {
568
+ let deferred4_0;
569
+ let deferred4_1;
570
+ try {
571
+ const ptr0 = passStringToWasm0(tx_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
572
+ const len0 = WASM_VECTOR_LEN;
573
+ const ptr1 = passArray8ToWasm0(seal_signer_secret_key, wasm.__wbindgen_malloc);
574
+ const len1 = WASM_VECTOR_LEN;
575
+ const ret = wasm.sealTransaction(ptr0, len0, ptr1, len1);
576
+ var ptr3 = ret[0];
577
+ var len3 = ret[1];
578
+ if (ret[3]) {
579
+ ptr3 = 0; len3 = 0;
580
+ throw takeFromExternrefTable0(ret[2]);
581
+ }
582
+ deferred4_0 = ptr3;
583
+ deferred4_1 = len3;
584
+ return getStringFromWasm0(ptr3, len3);
585
+ } finally {
586
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
587
+ }
588
+ }
522
589
  export function __wbg_Error_8c4e43fe74559d73(arg0, arg1) {
523
590
  const ret = Error(getStringFromWasm0(arg0, arg1));
524
591
  return ret;
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.3.1",
8
+ "version": "0.4.0",
9
9
  "license": "BSD-3-Clause",
10
10
  "repository": {
11
11
  "type": "git",