cojson-core-wasm 0.17.12 → 0.17.14

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cojson-core-wasm",
3
3
  "type": "module",
4
- "version": "0.17.12",
4
+ "version": "0.17.14",
5
5
  "files": [
6
6
  "public/cojson_core_wasm.js",
7
7
  "public/cojson_core_wasm.d.ts",
@@ -96,47 +96,6 @@ export function verify(signature: Uint8Array, message: Uint8Array, id: Uint8Arra
96
96
  * Returns base58-encoded verifying key with "signer_z" prefix or throws JsError if derivation fails.
97
97
  */
98
98
  export function get_signer_id(secret: Uint8Array): string;
99
- /**
100
- * Generate a 24-byte nonce from input material using BLAKE3.
101
- * - `nonce_material`: Raw bytes to derive the nonce from
102
- * Returns 24 bytes suitable for use as a nonce in cryptographic operations.
103
- * This function is deterministic - the same input will produce the same nonce.
104
- */
105
- export function generate_nonce(nonce_material: Uint8Array): Uint8Array;
106
- /**
107
- * Hash data once using BLAKE3.
108
- * - `data`: Raw bytes to hash
109
- * Returns 32 bytes of hash output.
110
- * This is the simplest way to compute a BLAKE3 hash of a single piece of data.
111
- */
112
- export function blake3_hash_once(data: Uint8Array): Uint8Array;
113
- /**
114
- * Hash data once using BLAKE3 with a context prefix.
115
- * - `data`: Raw bytes to hash
116
- * - `context`: Context bytes to prefix to the data
117
- * Returns 32 bytes of hash output.
118
- * This is useful for domain separation - the same data hashed with different contexts will produce different outputs.
119
- */
120
- export function blake3_hash_once_with_context(data: Uint8Array, context: Uint8Array): Uint8Array;
121
- /**
122
- * Get an empty BLAKE3 state for incremental hashing.
123
- * Returns a new Blake3Hasher instance for incremental hashing.
124
- */
125
- export function blake3_empty_state(): Blake3Hasher;
126
- /**
127
- * Update a BLAKE3 state with new data for incremental hashing.
128
- * - `state`: Current Blake3Hasher instance
129
- * - `data`: New data to incorporate into the hash
130
- * Returns the updated Blake3Hasher.
131
- */
132
- export function blake3_update_state(state: Blake3Hasher, data: Uint8Array): void;
133
- /**
134
- * Get the final hash from a BLAKE3 state.
135
- * - `state`: The Blake3Hasher to finalize
136
- * Returns 32 bytes of hash output.
137
- * This finalizes an incremental hashing operation.
138
- */
139
- export function blake3_digest_for_state(state: Blake3Hasher): Uint8Array;
140
99
  /**
141
100
  * Generate a new X25519 private key using secure random number generation.
142
101
  * Returns 32 bytes of raw key material suitable for use with other X25519 functions.
@@ -182,6 +141,47 @@ export function seal(message: Uint8Array, sender_secret: string, recipient_id: s
182
141
  * Returns unsealed bytes or throws JsError if unsealing fails.
183
142
  */
184
143
  export function unseal(sealed_message: Uint8Array, recipient_secret: string, sender_id: string, nonce_material: Uint8Array): Uint8Array;
144
+ /**
145
+ * Generate a 24-byte nonce from input material using BLAKE3.
146
+ * - `nonce_material`: Raw bytes to derive the nonce from
147
+ * Returns 24 bytes suitable for use as a nonce in cryptographic operations.
148
+ * This function is deterministic - the same input will produce the same nonce.
149
+ */
150
+ export function generate_nonce(nonce_material: Uint8Array): Uint8Array;
151
+ /**
152
+ * Hash data once using BLAKE3.
153
+ * - `data`: Raw bytes to hash
154
+ * Returns 32 bytes of hash output.
155
+ * This is the simplest way to compute a BLAKE3 hash of a single piece of data.
156
+ */
157
+ export function blake3_hash_once(data: Uint8Array): Uint8Array;
158
+ /**
159
+ * Hash data once using BLAKE3 with a context prefix.
160
+ * - `data`: Raw bytes to hash
161
+ * - `context`: Context bytes to prefix to the data
162
+ * Returns 32 bytes of hash output.
163
+ * This is useful for domain separation - the same data hashed with different contexts will produce different outputs.
164
+ */
165
+ export function blake3_hash_once_with_context(data: Uint8Array, context: Uint8Array): Uint8Array;
166
+ /**
167
+ * Get an empty BLAKE3 state for incremental hashing.
168
+ * Returns a new Blake3Hasher instance for incremental hashing.
169
+ */
170
+ export function blake3_empty_state(): Blake3Hasher;
171
+ /**
172
+ * Update a BLAKE3 state with new data for incremental hashing.
173
+ * - `state`: Current Blake3Hasher instance
174
+ * - `data`: New data to incorporate into the hash
175
+ * Returns the updated Blake3Hasher.
176
+ */
177
+ export function blake3_update_state(state: Blake3Hasher, data: Uint8Array): void;
178
+ /**
179
+ * Get the final hash from a BLAKE3 state.
180
+ * - `state`: The Blake3Hasher to finalize
181
+ * Returns 32 bytes of hash output.
182
+ * This finalizes an incremental hashing operation.
183
+ */
184
+ export function blake3_digest_for_state(state: Blake3Hasher): Uint8Array;
185
185
  /**
186
186
  * WASM-exposed function to encrypt bytes with a key secret and nonce material.
187
187
  * - `value`: The raw bytes to encrypt
@@ -210,24 +210,26 @@ export class SessionLog {
210
210
  constructor(co_id: string, session_id: string, signer_id?: string | null);
211
211
  clone(): SessionLog;
212
212
  tryAdd(transactions_json: string[], new_signature_str: string, skip_verify: boolean): void;
213
- addNewPrivateTransaction(changes_json: string, signer_secret: string, encryption_key: string, key_id: string, made_at: number): string;
214
- addNewTrustingTransaction(changes_json: string, signer_secret: string, made_at: number): string;
213
+ addNewPrivateTransaction(changes_json: string, signer_secret: string, encryption_key: string, key_id: string, made_at: number, meta?: string | null): string;
214
+ addNewTrustingTransaction(changes_json: string, signer_secret: string, made_at: number, meta?: string | null): string;
215
215
  decryptNextTransactionChangesJson(tx_index: number, encryption_key: string): string;
216
+ decryptNextTransactionMetaJson(tx_index: number, encryption_key: string): string | undefined;
216
217
  }
217
218
 
218
219
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
219
220
 
220
221
  export interface InitOutput {
221
222
  readonly memory: WebAssembly.Memory;
222
- readonly decrypt_xsalsa20: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
223
- readonly encrypt_xsalsa20: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
224
223
  readonly __wbg_sessionlog_free: (a: number, b: number) => void;
225
224
  readonly sessionlog_new: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
226
225
  readonly sessionlog_clone: (a: number) => number;
227
226
  readonly sessionlog_tryAdd: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
228
- readonly sessionlog_addNewPrivateTransaction: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number, number, number];
229
- readonly sessionlog_addNewTrustingTransaction: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
227
+ readonly sessionlog_addNewPrivateTransaction: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => [number, number, number, number];
228
+ readonly sessionlog_addNewTrustingTransaction: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number, number];
230
229
  readonly sessionlog_decryptNextTransactionChangesJson: (a: number, b: number, c: number, d: number) => [number, number, number, number];
230
+ readonly sessionlog_decryptNextTransactionMetaJson: (a: number, b: number, c: number, d: number) => [number, number, number, number];
231
+ readonly decrypt_xsalsa20: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
232
+ readonly encrypt_xsalsa20: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
231
233
  readonly new_ed25519_signing_key: () => [number, number];
232
234
  readonly ed25519_sign: (a: number, b: number, c: number, d: number) => [number, number, number, number];
233
235
  readonly ed25519_verify: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
@@ -240,6 +242,12 @@ export interface InitOutput {
240
242
  readonly sign: (a: number, b: number, c: number, d: number) => [number, number, number, number];
241
243
  readonly verify: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
242
244
  readonly get_signer_id: (a: number, b: number) => [number, number, number, number];
245
+ readonly new_x25519_private_key: () => [number, number];
246
+ readonly x25519_public_key: (a: number, b: number) => [number, number, number, number];
247
+ readonly x25519_diffie_hellman: (a: number, b: number, c: number, d: number) => [number, number, number, number];
248
+ readonly get_sealer_id: (a: number, b: number) => [number, number, number, number];
249
+ readonly seal: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number, number];
250
+ readonly unseal: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number, number];
243
251
  readonly generate_nonce: (a: number, b: number) => [number, number];
244
252
  readonly blake3_hash_once: (a: number, b: number) => [number, number];
245
253
  readonly blake3_hash_once_with_context: (a: number, b: number, c: number, d: number) => [number, number];
@@ -251,12 +259,6 @@ export interface InitOutput {
251
259
  readonly blake3_digest_for_state: (a: number) => [number, number];
252
260
  readonly blake3hasher_update: (a: number, b: number, c: number) => void;
253
261
  readonly blake3hasher_new: () => number;
254
- readonly new_x25519_private_key: () => [number, number];
255
- readonly x25519_public_key: (a: number, b: number) => [number, number, number, number];
256
- readonly x25519_diffie_hellman: (a: number, b: number, c: number, d: number) => [number, number, number, number];
257
- readonly get_sealer_id: (a: number, b: number) => [number, number, number, number];
258
- readonly seal: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number, number];
259
- readonly unseal: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number, number];
260
262
  readonly encrypt: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
261
263
  readonly decrypt: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
262
264
  readonly __wbindgen_malloc: (a: number, b: number) => number;
@@ -167,10 +167,13 @@ function debugString(val) {
167
167
  return className;
168
168
  }
169
169
 
170
- function passArray8ToWasm0(arg, malloc) {
171
- const ptr = malloc(arg.length * 1, 1) >>> 0;
172
- getUint8ArrayMemory0().set(arg, ptr / 1);
173
- WASM_VECTOR_LEN = arg.length;
170
+ function passArrayJsValueToWasm0(array, malloc) {
171
+ const ptr = malloc(array.length * 4, 4) >>> 0;
172
+ for (let i = 0; i < array.length; i++) {
173
+ const add = addToExternrefTable0(array[i]);
174
+ getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
175
+ }
176
+ WASM_VECTOR_LEN = array.length;
174
177
  return ptr;
175
178
  }
176
179
 
@@ -180,6 +183,13 @@ function takeFromExternrefTable0(idx) {
180
183
  return value;
181
184
  }
182
185
 
186
+ function passArray8ToWasm0(arg, malloc) {
187
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
188
+ getUint8ArrayMemory0().set(arg, ptr / 1);
189
+ WASM_VECTOR_LEN = arg.length;
190
+ return ptr;
191
+ }
192
+
183
193
  function getArrayU8FromWasm0(ptr, len) {
184
194
  ptr = ptr >>> 0;
185
195
  return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
@@ -240,15 +250,6 @@ export function decrypt_xsalsa20(key, nonce_material, ciphertext) {
240
250
  return v4;
241
251
  }
242
252
 
243
- function passArrayJsValueToWasm0(array, malloc) {
244
- const ptr = malloc(array.length * 4, 4) >>> 0;
245
- for (let i = 0; i < array.length; i++) {
246
- const add = addToExternrefTable0(array[i]);
247
- getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
248
- }
249
- WASM_VECTOR_LEN = array.length;
250
- return ptr;
251
- }
252
253
  /**
253
254
  * Generate a new Ed25519 signing key using secure random number generation.
254
255
  * Returns 32 bytes of raw key material suitable for use with other Ed25519 functions.
@@ -512,108 +513,6 @@ export function get_signer_id(secret) {
512
513
  }
513
514
  }
514
515
 
515
- /**
516
- * Generate a 24-byte nonce from input material using BLAKE3.
517
- * - `nonce_material`: Raw bytes to derive the nonce from
518
- * Returns 24 bytes suitable for use as a nonce in cryptographic operations.
519
- * This function is deterministic - the same input will produce the same nonce.
520
- * @param {Uint8Array} nonce_material
521
- * @returns {Uint8Array}
522
- */
523
- export function generate_nonce(nonce_material) {
524
- const ptr0 = passArray8ToWasm0(nonce_material, wasm.__wbindgen_malloc);
525
- const len0 = WASM_VECTOR_LEN;
526
- const ret = wasm.generate_nonce(ptr0, len0);
527
- var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
528
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
529
- return v2;
530
- }
531
-
532
- /**
533
- * Hash data once using BLAKE3.
534
- * - `data`: Raw bytes to hash
535
- * Returns 32 bytes of hash output.
536
- * This is the simplest way to compute a BLAKE3 hash of a single piece of data.
537
- * @param {Uint8Array} data
538
- * @returns {Uint8Array}
539
- */
540
- export function blake3_hash_once(data) {
541
- const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
542
- const len0 = WASM_VECTOR_LEN;
543
- const ret = wasm.blake3_hash_once(ptr0, len0);
544
- var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
545
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
546
- return v2;
547
- }
548
-
549
- /**
550
- * Hash data once using BLAKE3 with a context prefix.
551
- * - `data`: Raw bytes to hash
552
- * - `context`: Context bytes to prefix to the data
553
- * Returns 32 bytes of hash output.
554
- * This is useful for domain separation - the same data hashed with different contexts will produce different outputs.
555
- * @param {Uint8Array} data
556
- * @param {Uint8Array} context
557
- * @returns {Uint8Array}
558
- */
559
- export function blake3_hash_once_with_context(data, context) {
560
- const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
561
- const len0 = WASM_VECTOR_LEN;
562
- const ptr1 = passArray8ToWasm0(context, wasm.__wbindgen_malloc);
563
- const len1 = WASM_VECTOR_LEN;
564
- const ret = wasm.blake3_hash_once_with_context(ptr0, len0, ptr1, len1);
565
- var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
566
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
567
- return v3;
568
- }
569
-
570
- /**
571
- * Get an empty BLAKE3 state for incremental hashing.
572
- * Returns a new Blake3Hasher instance for incremental hashing.
573
- * @returns {Blake3Hasher}
574
- */
575
- export function blake3_empty_state() {
576
- const ret = wasm.blake3_empty_state();
577
- return Blake3Hasher.__wrap(ret);
578
- }
579
-
580
- function _assertClass(instance, klass) {
581
- if (!(instance instanceof klass)) {
582
- throw new Error(`expected instance of ${klass.name}`);
583
- }
584
- }
585
- /**
586
- * Update a BLAKE3 state with new data for incremental hashing.
587
- * - `state`: Current Blake3Hasher instance
588
- * - `data`: New data to incorporate into the hash
589
- * Returns the updated Blake3Hasher.
590
- * @param {Blake3Hasher} state
591
- * @param {Uint8Array} data
592
- */
593
- export function blake3_update_state(state, data) {
594
- _assertClass(state, Blake3Hasher);
595
- const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
596
- const len0 = WASM_VECTOR_LEN;
597
- wasm.blake3_update_state(state.__wbg_ptr, ptr0, len0);
598
- }
599
-
600
- /**
601
- * Get the final hash from a BLAKE3 state.
602
- * - `state`: The Blake3Hasher to finalize
603
- * Returns 32 bytes of hash output.
604
- * This finalizes an incremental hashing operation.
605
- * @param {Blake3Hasher} state
606
- * @returns {Uint8Array}
607
- */
608
- export function blake3_digest_for_state(state) {
609
- _assertClass(state, Blake3Hasher);
610
- var ptr0 = state.__destroy_into_raw();
611
- const ret = wasm.blake3_digest_for_state(ptr0);
612
- var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
613
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
614
- return v2;
615
- }
616
-
617
516
  /**
618
517
  * Generate a new X25519 private key using secure random number generation.
619
518
  * Returns 32 bytes of raw key material suitable for use with other X25519 functions.
@@ -761,6 +660,108 @@ export function unseal(sealed_message, recipient_secret, sender_id, nonce_materi
761
660
  return v5;
762
661
  }
763
662
 
663
+ /**
664
+ * Generate a 24-byte nonce from input material using BLAKE3.
665
+ * - `nonce_material`: Raw bytes to derive the nonce from
666
+ * Returns 24 bytes suitable for use as a nonce in cryptographic operations.
667
+ * This function is deterministic - the same input will produce the same nonce.
668
+ * @param {Uint8Array} nonce_material
669
+ * @returns {Uint8Array}
670
+ */
671
+ export function generate_nonce(nonce_material) {
672
+ const ptr0 = passArray8ToWasm0(nonce_material, wasm.__wbindgen_malloc);
673
+ const len0 = WASM_VECTOR_LEN;
674
+ const ret = wasm.generate_nonce(ptr0, len0);
675
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
676
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
677
+ return v2;
678
+ }
679
+
680
+ /**
681
+ * Hash data once using BLAKE3.
682
+ * - `data`: Raw bytes to hash
683
+ * Returns 32 bytes of hash output.
684
+ * This is the simplest way to compute a BLAKE3 hash of a single piece of data.
685
+ * @param {Uint8Array} data
686
+ * @returns {Uint8Array}
687
+ */
688
+ export function blake3_hash_once(data) {
689
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
690
+ const len0 = WASM_VECTOR_LEN;
691
+ const ret = wasm.blake3_hash_once(ptr0, len0);
692
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
693
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
694
+ return v2;
695
+ }
696
+
697
+ /**
698
+ * Hash data once using BLAKE3 with a context prefix.
699
+ * - `data`: Raw bytes to hash
700
+ * - `context`: Context bytes to prefix to the data
701
+ * Returns 32 bytes of hash output.
702
+ * This is useful for domain separation - the same data hashed with different contexts will produce different outputs.
703
+ * @param {Uint8Array} data
704
+ * @param {Uint8Array} context
705
+ * @returns {Uint8Array}
706
+ */
707
+ export function blake3_hash_once_with_context(data, context) {
708
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
709
+ const len0 = WASM_VECTOR_LEN;
710
+ const ptr1 = passArray8ToWasm0(context, wasm.__wbindgen_malloc);
711
+ const len1 = WASM_VECTOR_LEN;
712
+ const ret = wasm.blake3_hash_once_with_context(ptr0, len0, ptr1, len1);
713
+ var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
714
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
715
+ return v3;
716
+ }
717
+
718
+ /**
719
+ * Get an empty BLAKE3 state for incremental hashing.
720
+ * Returns a new Blake3Hasher instance for incremental hashing.
721
+ * @returns {Blake3Hasher}
722
+ */
723
+ export function blake3_empty_state() {
724
+ const ret = wasm.blake3_empty_state();
725
+ return Blake3Hasher.__wrap(ret);
726
+ }
727
+
728
+ function _assertClass(instance, klass) {
729
+ if (!(instance instanceof klass)) {
730
+ throw new Error(`expected instance of ${klass.name}`);
731
+ }
732
+ }
733
+ /**
734
+ * Update a BLAKE3 state with new data for incremental hashing.
735
+ * - `state`: Current Blake3Hasher instance
736
+ * - `data`: New data to incorporate into the hash
737
+ * Returns the updated Blake3Hasher.
738
+ * @param {Blake3Hasher} state
739
+ * @param {Uint8Array} data
740
+ */
741
+ export function blake3_update_state(state, data) {
742
+ _assertClass(state, Blake3Hasher);
743
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
744
+ const len0 = WASM_VECTOR_LEN;
745
+ wasm.blake3_update_state(state.__wbg_ptr, ptr0, len0);
746
+ }
747
+
748
+ /**
749
+ * Get the final hash from a BLAKE3 state.
750
+ * - `state`: The Blake3Hasher to finalize
751
+ * Returns 32 bytes of hash output.
752
+ * This finalizes an incremental hashing operation.
753
+ * @param {Blake3Hasher} state
754
+ * @returns {Uint8Array}
755
+ */
756
+ export function blake3_digest_for_state(state) {
757
+ _assertClass(state, Blake3Hasher);
758
+ var ptr0 = state.__destroy_into_raw();
759
+ const ret = wasm.blake3_digest_for_state(ptr0);
760
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
761
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
762
+ return v2;
763
+ }
764
+
764
765
  /**
765
766
  * WASM-exposed function to encrypt bytes with a key secret and nonce material.
766
767
  * - `value`: The raw bytes to encrypt
@@ -942,11 +943,12 @@ export class SessionLog {
942
943
  * @param {string} encryption_key
943
944
  * @param {string} key_id
944
945
  * @param {number} made_at
946
+ * @param {string | null} [meta]
945
947
  * @returns {string}
946
948
  */
947
- addNewPrivateTransaction(changes_json, signer_secret, encryption_key, key_id, made_at) {
948
- let deferred6_0;
949
- let deferred6_1;
949
+ addNewPrivateTransaction(changes_json, signer_secret, encryption_key, key_id, made_at, meta) {
950
+ let deferred7_0;
951
+ let deferred7_1;
950
952
  try {
951
953
  const ptr0 = passStringToWasm0(changes_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
952
954
  const len0 = WASM_VECTOR_LEN;
@@ -956,46 +958,51 @@ export class SessionLog {
956
958
  const len2 = WASM_VECTOR_LEN;
957
959
  const ptr3 = passStringToWasm0(key_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
958
960
  const len3 = WASM_VECTOR_LEN;
959
- const ret = wasm.sessionlog_addNewPrivateTransaction(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, made_at);
960
- var ptr5 = ret[0];
961
- var len5 = ret[1];
961
+ var ptr4 = isLikeNone(meta) ? 0 : passStringToWasm0(meta, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
962
+ var len4 = WASM_VECTOR_LEN;
963
+ const ret = wasm.sessionlog_addNewPrivateTransaction(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, made_at, ptr4, len4);
964
+ var ptr6 = ret[0];
965
+ var len6 = ret[1];
962
966
  if (ret[3]) {
963
- ptr5 = 0; len5 = 0;
967
+ ptr6 = 0; len6 = 0;
964
968
  throw takeFromExternrefTable0(ret[2]);
965
969
  }
966
- deferred6_0 = ptr5;
967
- deferred6_1 = len5;
968
- return getStringFromWasm0(ptr5, len5);
970
+ deferred7_0 = ptr6;
971
+ deferred7_1 = len6;
972
+ return getStringFromWasm0(ptr6, len6);
969
973
  } finally {
970
- wasm.__wbindgen_free(deferred6_0, deferred6_1, 1);
974
+ wasm.__wbindgen_free(deferred7_0, deferred7_1, 1);
971
975
  }
972
976
  }
973
977
  /**
974
978
  * @param {string} changes_json
975
979
  * @param {string} signer_secret
976
980
  * @param {number} made_at
981
+ * @param {string | null} [meta]
977
982
  * @returns {string}
978
983
  */
979
- addNewTrustingTransaction(changes_json, signer_secret, made_at) {
980
- let deferred4_0;
981
- let deferred4_1;
984
+ addNewTrustingTransaction(changes_json, signer_secret, made_at, meta) {
985
+ let deferred5_0;
986
+ let deferred5_1;
982
987
  try {
983
988
  const ptr0 = passStringToWasm0(changes_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
984
989
  const len0 = WASM_VECTOR_LEN;
985
990
  const ptr1 = passStringToWasm0(signer_secret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
986
991
  const len1 = WASM_VECTOR_LEN;
987
- const ret = wasm.sessionlog_addNewTrustingTransaction(this.__wbg_ptr, ptr0, len0, ptr1, len1, made_at);
988
- var ptr3 = ret[0];
989
- var len3 = ret[1];
992
+ var ptr2 = isLikeNone(meta) ? 0 : passStringToWasm0(meta, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
993
+ var len2 = WASM_VECTOR_LEN;
994
+ const ret = wasm.sessionlog_addNewTrustingTransaction(this.__wbg_ptr, ptr0, len0, ptr1, len1, made_at, ptr2, len2);
995
+ var ptr4 = ret[0];
996
+ var len4 = ret[1];
990
997
  if (ret[3]) {
991
- ptr3 = 0; len3 = 0;
998
+ ptr4 = 0; len4 = 0;
992
999
  throw takeFromExternrefTable0(ret[2]);
993
1000
  }
994
- deferred4_0 = ptr3;
995
- deferred4_1 = len3;
996
- return getStringFromWasm0(ptr3, len3);
1001
+ deferred5_0 = ptr4;
1002
+ deferred5_1 = len4;
1003
+ return getStringFromWasm0(ptr4, len4);
997
1004
  } finally {
998
- wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
1005
+ wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
999
1006
  }
1000
1007
  }
1001
1008
  /**
@@ -1023,6 +1030,25 @@ export class SessionLog {
1023
1030
  wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
1024
1031
  }
1025
1032
  }
1033
+ /**
1034
+ * @param {number} tx_index
1035
+ * @param {string} encryption_key
1036
+ * @returns {string | undefined}
1037
+ */
1038
+ decryptNextTransactionMetaJson(tx_index, encryption_key) {
1039
+ const ptr0 = passStringToWasm0(encryption_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1040
+ const len0 = WASM_VECTOR_LEN;
1041
+ const ret = wasm.sessionlog_decryptNextTransactionMetaJson(this.__wbg_ptr, tx_index, ptr0, len0);
1042
+ if (ret[3]) {
1043
+ throw takeFromExternrefTable0(ret[2]);
1044
+ }
1045
+ let v2;
1046
+ if (ret[0] !== 0) {
1047
+ v2 = getStringFromWasm0(ret[0], ret[1]).slice();
1048
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1049
+ }
1050
+ return v2;
1051
+ }
1026
1052
  }
1027
1053
 
1028
1054
  async function __wbg_load(module, imports) {