@maatara/core-pqc-wasm 0.4.2 → 0.4.4

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.
@@ -5,43 +5,78 @@
5
5
  * Returns hex-encoded calldata ready for transaction
6
6
  */
7
7
  export function generate_evm_anchor_calldata(root_hex: string, epoch: bigint): string;
8
- export function preimage_governance(policy_json: string): string;
9
8
  /**
10
- * Compute shortest path verification info for provenance chains
11
- * This returns the algorithm parameters for JS-side graph operations
9
+ * ML-DSA-65 verification (FIPS 204 compliant)
10
+ * Security: Input validation prevents DoS; constant-time comparison
12
11
  */
13
- export function provenance_path_config(chain_length: number, branches: number): string;
14
- export function preimage_anchor(user_id: string, root_hex: string, epoch: string, chains_json: string): string;
15
- export function validate_royalty(receiver: string, bps: number): string;
12
+ export function dilithium_verify(message_b64u: string, signature_b64u: string, public_b64u: string): string;
13
+ /**
14
+ * Truncate a SHA3-384 hash (48 bytes) to bytes32 (32 bytes) for EVM
15
+ * Uses first 32 bytes, preserving collision resistance
16
+ */
17
+ export function truncate_to_bytes32(hash_hex: string): string;
18
+ /**
19
+ * Create a nonce cache for replay attack prevention
20
+ * capacity: maximum number of nonces to track
21
+ * ttl_ms: time-to-live in milliseconds before nonces expire
22
+ */
23
+ export function create_nonce_cache(capacity: number, ttl_ms: bigint): string;
16
24
  export function preimage_asset_mint(header_json: string, asset_json: string): string;
25
+ export function jcs_canonicalize(json: string): string;
17
26
  export function verify_attestations(msg_b64u: string, attestations_json: string, allowed_public_keys_json?: string | null): string;
18
- export function kyber_encaps(public_b64u: string): string;
19
- export function aes_gcm_unwrap(key_b64u: string, iv_b64u: string, ct_b64u: string, aad_b64u: string): string;
20
27
  /**
21
28
  * ML-DSA-65 key generation (FIPS 204 compliant)
22
29
  * Security: Keys are generated using platform CSPRNG
23
30
  */
24
31
  export function dilithium_keygen(): string;
32
+ export function hkdf_sha256(secret_b64u: string, info_b64u: string, salt_b64u: string | null | undefined, len: number): string;
33
+ export function start(): void;
34
+ export function aes_gcm_unwrap(key_b64u: string, iv_b64u: string, ct_b64u: string, aad_b64u: string): string;
25
35
  /**
26
- * Create a Merkle accumulator leaf for a chain state
27
- * Returns JSON with the leaf hash and canonical data
36
+ * Get SSSP algorithm configuration for graph verification
37
+ * nodes: expected number of nodes in the graph
28
38
  */
29
- export function create_accumulator_leaf(user_id: string, chain_id: string, block_hash: string, block_index: bigint): string;
39
+ export function sssp_config(nodes: number): string;
40
+ export function preimage_asset_transfer(header_json: string): string;
41
+ /**
42
+ * Get supported anchor chains and their configurations
43
+ */
44
+ export function anchor_chains_info(): string;
45
+ export function kyber_encaps(public_b64u: string): string;
46
+ /**
47
+ * Compute shortest path verification info for provenance chains
48
+ * This returns the algorithm parameters for JS-side graph operations
49
+ */
50
+ export function provenance_path_config(chain_length: number, branches: number): string;
51
+ export function preimage_governance(policy_json: string): string;
52
+ export function aes_gcm_wrap(key_b64u: string, dek_b64u: string, aad_b64u: string): string;
30
53
  /**
31
54
  * Generate Bitcoin OP_RETURN payload for anchoring
32
55
  * Returns hex-encoded payload (45 bytes)
33
56
  */
34
57
  export function generate_bitcoin_anchor_payload(root_hex: string, epoch: bigint): string;
35
- export function jcs_canonicalize(json: string): string;
36
58
  /**
37
- * Decode a Bitcoin OP_RETURN payload
59
+ * Create a Merkle accumulator leaf for a chain state
60
+ * Returns JSON with the leaf hash and canonical data
61
+ * Default hash algorithm is SHA3-384 (PQC)
38
62
  */
39
- export function decode_bitcoin_anchor_payload(payload_hex: string): string;
63
+ export function create_accumulator_leaf(user_id: string, chain_id: string, block_hash: string, block_index: bigint): string;
40
64
  /**
41
- * Get supported anchor chains and their configurations
65
+ * Create a Merkle accumulator leaf with an explicit hash algorithm
66
+ * hash_alg: "sha256" or "sha3-384"
42
67
  */
43
- export function anchor_chains_info(): string;
44
- export function hkdf_sha256(secret_b64u: string, info_b64u: string, salt_b64u: string | null | undefined, len: number): string;
68
+ export function create_accumulator_leaf_with_alg(user_id: string, chain_id: string, block_hash: string, block_index: bigint, hash_alg: string): string;
69
+ /**
70
+ * Compute Merkle root from an array of leaf hashes
71
+ * Input: JSON array of hex hash strings
72
+ * Returns: { root: string, leaf_count: number }
73
+ */
74
+ export function compute_merkle_root(leaves_json: string, hash_alg: string): string;
75
+ export function validate_royalty(receiver: string, bps: number): string;
76
+ /**
77
+ * Get anchor configuration and gas estimates
78
+ */
79
+ export function anchor_config_info(): string;
45
80
  /**
46
81
  * Check if a nonce has been seen (for replay prevention)
47
82
  * Returns info about the nonce cache algorithm
@@ -52,46 +87,17 @@ export function nonce_cache_info(): string;
52
87
  * Security: Input validation prevents DoS; constant-time operations
53
88
  */
54
89
  export function dilithium_sign(message_b64u: string, secret_b64u: string): string;
55
- /**
56
- * Truncate a SHA3-384 hash (48 bytes) to bytes32 (32 bytes) for EVM
57
- * Uses first 32 bytes, preserving collision resistance
58
- */
59
- export function truncate_to_bytes32(hash_hex: string): string;
60
- export function kyber_keygen(): string;
61
90
  /**
62
91
  * Get elastic hash table configuration for key caching
63
92
  */
64
93
  export function elastic_hash_config(capacity: number, load_factor: number): string;
94
+ export function kyber_keygen(): string;
65
95
  /**
66
- * Create a nonce cache for replay attack prevention
67
- * capacity: maximum number of nonces to track
68
- * ttl_ms: time-to-live in milliseconds before nonces expire
96
+ * Decode a Bitcoin OP_RETURN payload
69
97
  */
70
- export function create_nonce_cache(capacity: number, ttl_ms: bigint): string;
98
+ export function decode_bitcoin_anchor_payload(payload_hex: string): string;
99
+ export function preimage_anchor(user_id: string, root_hex: string, epoch: string, chains_json: string): string;
71
100
  export function kyber_decaps(secret_b64u: string, kem_ct_b64u: string): string;
72
- export function aes_gcm_wrap(key_b64u: string, dek_b64u: string, aad_b64u: string): string;
73
- /**
74
- * Get anchor configuration and gas estimates
75
- */
76
- export function anchor_config_info(): string;
77
- /**
78
- * Get SSSP algorithm configuration for graph verification
79
- * nodes: expected number of nodes in the graph
80
- */
81
- export function sssp_config(nodes: number): string;
82
- export function preimage_asset_transfer(header_json: string): string;
83
- /**
84
- * ML-DSA-65 verification (FIPS 204 compliant)
85
- * Security: Input validation prevents DoS; constant-time comparison
86
- */
87
- export function dilithium_verify(message_b64u: string, signature_b64u: string, public_b64u: string): string;
88
- /**
89
- * Compute Merkle root from an array of leaf hashes
90
- * Input: JSON array of hex hash strings
91
- * Returns: { root: string, leaf_count: number }
92
- */
93
- export function compute_merkle_root(leaves_json: string, hash_alg: string): string;
94
- export function start(): void;
95
101
 
96
102
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
97
103
 
@@ -103,6 +109,7 @@ export interface InitOutput {
103
109
  readonly anchor_config_info: () => [number, number];
104
110
  readonly compute_merkle_root: (a: number, b: number, c: number, d: number) => [number, number];
105
111
  readonly create_accumulator_leaf: (a: number, b: number, c: number, d: number, e: number, f: number, g: bigint) => [number, number];
112
+ readonly create_accumulator_leaf_with_alg: (a: number, b: number, c: number, d: number, e: number, f: number, g: bigint, h: number, i: number) => [number, number];
106
113
  readonly create_nonce_cache: (a: number, b: bigint) => [number, number];
107
114
  readonly decode_bitcoin_anchor_payload: (a: number, b: number) => [number, number];
108
115
  readonly dilithium_keygen: () => [number, number];
package/core_pqc_wasm.js CHANGED
@@ -127,16 +127,45 @@ export function generate_evm_anchor_calldata(root_hex, epoch) {
127
127
  }
128
128
 
129
129
  /**
130
- * @param {string} policy_json
130
+ * ML-DSA-65 verification (FIPS 204 compliant)
131
+ * Security: Input validation prevents DoS; constant-time comparison
132
+ * @param {string} message_b64u
133
+ * @param {string} signature_b64u
134
+ * @param {string} public_b64u
131
135
  * @returns {string}
132
136
  */
133
- export function preimage_governance(policy_json) {
137
+ export function dilithium_verify(message_b64u, signature_b64u, public_b64u) {
138
+ let deferred4_0;
139
+ let deferred4_1;
140
+ try {
141
+ const ptr0 = passStringToWasm0(message_b64u, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
142
+ const len0 = WASM_VECTOR_LEN;
143
+ const ptr1 = passStringToWasm0(signature_b64u, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
144
+ const len1 = WASM_VECTOR_LEN;
145
+ const ptr2 = passStringToWasm0(public_b64u, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
146
+ const len2 = WASM_VECTOR_LEN;
147
+ const ret = wasm.dilithium_verify(ptr0, len0, ptr1, len1, ptr2, len2);
148
+ deferred4_0 = ret[0];
149
+ deferred4_1 = ret[1];
150
+ return getStringFromWasm0(ret[0], ret[1]);
151
+ } finally {
152
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
153
+ }
154
+ }
155
+
156
+ /**
157
+ * Truncate a SHA3-384 hash (48 bytes) to bytes32 (32 bytes) for EVM
158
+ * Uses first 32 bytes, preserving collision resistance
159
+ * @param {string} hash_hex
160
+ * @returns {string}
161
+ */
162
+ export function truncate_to_bytes32(hash_hex) {
134
163
  let deferred2_0;
135
164
  let deferred2_1;
136
165
  try {
137
- const ptr0 = passStringToWasm0(policy_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
166
+ const ptr0 = passStringToWasm0(hash_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
138
167
  const len0 = WASM_VECTOR_LEN;
139
- const ret = wasm.preimage_governance(ptr0, len0);
168
+ const ret = wasm.truncate_to_bytes32(ptr0, len0);
140
169
  deferred2_0 = ret[0];
141
170
  deferred2_1 = ret[1];
142
171
  return getStringFromWasm0(ret[0], ret[1]);
@@ -146,17 +175,18 @@ export function preimage_governance(policy_json) {
146
175
  }
147
176
 
148
177
  /**
149
- * Compute shortest path verification info for provenance chains
150
- * This returns the algorithm parameters for JS-side graph operations
151
- * @param {number} chain_length
152
- * @param {number} branches
178
+ * Create a nonce cache for replay attack prevention
179
+ * capacity: maximum number of nonces to track
180
+ * ttl_ms: time-to-live in milliseconds before nonces expire
181
+ * @param {number} capacity
182
+ * @param {bigint} ttl_ms
153
183
  * @returns {string}
154
184
  */
155
- export function provenance_path_config(chain_length, branches) {
185
+ export function create_nonce_cache(capacity, ttl_ms) {
156
186
  let deferred1_0;
157
187
  let deferred1_1;
158
188
  try {
159
- const ret = wasm.provenance_path_config(chain_length, branches);
189
+ const ret = wasm.create_nonce_cache(capacity, ttl_ms);
160
190
  deferred1_0 = ret[0];
161
191
  deferred1_1 = ret[1];
162
192
  return getStringFromWasm0(ret[0], ret[1]);
@@ -166,45 +196,38 @@ export function provenance_path_config(chain_length, branches) {
166
196
  }
167
197
 
168
198
  /**
169
- * @param {string} user_id
170
- * @param {string} root_hex
171
- * @param {string} epoch
172
- * @param {string} chains_json
199
+ * @param {string} header_json
200
+ * @param {string} asset_json
173
201
  * @returns {string}
174
202
  */
175
- export function preimage_anchor(user_id, root_hex, epoch, chains_json) {
176
- let deferred5_0;
177
- let deferred5_1;
203
+ export function preimage_asset_mint(header_json, asset_json) {
204
+ let deferred3_0;
205
+ let deferred3_1;
178
206
  try {
179
- const ptr0 = passStringToWasm0(user_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
207
+ const ptr0 = passStringToWasm0(header_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
180
208
  const len0 = WASM_VECTOR_LEN;
181
- const ptr1 = passStringToWasm0(root_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
209
+ const ptr1 = passStringToWasm0(asset_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
182
210
  const len1 = WASM_VECTOR_LEN;
183
- const ptr2 = passStringToWasm0(epoch, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
184
- const len2 = WASM_VECTOR_LEN;
185
- const ptr3 = passStringToWasm0(chains_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
186
- const len3 = WASM_VECTOR_LEN;
187
- const ret = wasm.preimage_anchor(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
188
- deferred5_0 = ret[0];
189
- deferred5_1 = ret[1];
211
+ const ret = wasm.preimage_asset_mint(ptr0, len0, ptr1, len1);
212
+ deferred3_0 = ret[0];
213
+ deferred3_1 = ret[1];
190
214
  return getStringFromWasm0(ret[0], ret[1]);
191
215
  } finally {
192
- wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
216
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
193
217
  }
194
218
  }
195
219
 
196
220
  /**
197
- * @param {string} receiver
198
- * @param {number} bps
221
+ * @param {string} json
199
222
  * @returns {string}
200
223
  */
201
- export function validate_royalty(receiver, bps) {
224
+ export function jcs_canonicalize(json) {
202
225
  let deferred2_0;
203
226
  let deferred2_1;
204
227
  try {
205
- const ptr0 = passStringToWasm0(receiver, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
228
+ const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
206
229
  const len0 = WASM_VECTOR_LEN;
207
- const ret = wasm.validate_royalty(ptr0, len0, bps);
230
+ const ret = wasm.jcs_canonicalize(ptr0, len0);
208
231
  deferred2_0 = ret[0];
209
232
  deferred2_1 = ret[1];
210
233
  return getStringFromWasm0(ret[0], ret[1]);
@@ -213,28 +236,6 @@ export function validate_royalty(receiver, bps) {
213
236
  }
214
237
  }
215
238
 
216
- /**
217
- * @param {string} header_json
218
- * @param {string} asset_json
219
- * @returns {string}
220
- */
221
- export function preimage_asset_mint(header_json, asset_json) {
222
- let deferred3_0;
223
- let deferred3_1;
224
- try {
225
- const ptr0 = passStringToWasm0(header_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
226
- const len0 = WASM_VECTOR_LEN;
227
- const ptr1 = passStringToWasm0(asset_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
228
- const len1 = WASM_VECTOR_LEN;
229
- const ret = wasm.preimage_asset_mint(ptr0, len0, ptr1, len1);
230
- deferred3_0 = ret[0];
231
- deferred3_1 = ret[1];
232
- return getStringFromWasm0(ret[0], ret[1]);
233
- } finally {
234
- wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
235
- }
236
- }
237
-
238
239
  /**
239
240
  * @param {string} msg_b64u
240
241
  * @param {string} attestations_json
@@ -261,24 +262,53 @@ export function verify_attestations(msg_b64u, attestations_json, allowed_public_
261
262
  }
262
263
 
263
264
  /**
264
- * @param {string} public_b64u
265
+ * ML-DSA-65 key generation (FIPS 204 compliant)
266
+ * Security: Keys are generated using platform CSPRNG
265
267
  * @returns {string}
266
268
  */
267
- export function kyber_encaps(public_b64u) {
268
- let deferred2_0;
269
- let deferred2_1;
269
+ export function dilithium_keygen() {
270
+ let deferred1_0;
271
+ let deferred1_1;
270
272
  try {
271
- const ptr0 = passStringToWasm0(public_b64u, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
273
+ const ret = wasm.dilithium_keygen();
274
+ deferred1_0 = ret[0];
275
+ deferred1_1 = ret[1];
276
+ return getStringFromWasm0(ret[0], ret[1]);
277
+ } finally {
278
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
279
+ }
280
+ }
281
+
282
+ /**
283
+ * @param {string} secret_b64u
284
+ * @param {string} info_b64u
285
+ * @param {string | null | undefined} salt_b64u
286
+ * @param {number} len
287
+ * @returns {string}
288
+ */
289
+ export function hkdf_sha256(secret_b64u, info_b64u, salt_b64u, len) {
290
+ let deferred4_0;
291
+ let deferred4_1;
292
+ try {
293
+ const ptr0 = passStringToWasm0(secret_b64u, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
272
294
  const len0 = WASM_VECTOR_LEN;
273
- const ret = wasm.kyber_encaps(ptr0, len0);
274
- deferred2_0 = ret[0];
275
- deferred2_1 = ret[1];
295
+ const ptr1 = passStringToWasm0(info_b64u, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
296
+ const len1 = WASM_VECTOR_LEN;
297
+ var ptr2 = isLikeNone(salt_b64u) ? 0 : passStringToWasm0(salt_b64u, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
298
+ var len2 = WASM_VECTOR_LEN;
299
+ const ret = wasm.hkdf_sha256(ptr0, len0, ptr1, len1, ptr2, len2, len);
300
+ deferred4_0 = ret[0];
301
+ deferred4_1 = ret[1];
276
302
  return getStringFromWasm0(ret[0], ret[1]);
277
303
  } finally {
278
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
304
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
279
305
  }
280
306
  }
281
307
 
308
+ export function start() {
309
+ wasm.start();
310
+ }
311
+
282
312
  /**
283
313
  * @param {string} key_b64u
284
314
  * @param {string} iv_b64u
@@ -308,15 +338,16 @@ export function aes_gcm_unwrap(key_b64u, iv_b64u, ct_b64u, aad_b64u) {
308
338
  }
309
339
 
310
340
  /**
311
- * ML-DSA-65 key generation (FIPS 204 compliant)
312
- * Security: Keys are generated using platform CSPRNG
341
+ * Get SSSP algorithm configuration for graph verification
342
+ * nodes: expected number of nodes in the graph
343
+ * @param {number} nodes
313
344
  * @returns {string}
314
345
  */
315
- export function dilithium_keygen() {
346
+ export function sssp_config(nodes) {
316
347
  let deferred1_0;
317
348
  let deferred1_1;
318
349
  try {
319
- const ret = wasm.dilithium_keygen();
350
+ const ret = wasm.sssp_config(nodes);
320
351
  deferred1_0 = ret[0];
321
352
  deferred1_1 = ret[1];
322
353
  return getStringFromWasm0(ret[0], ret[1]);
@@ -326,47 +357,52 @@ export function dilithium_keygen() {
326
357
  }
327
358
 
328
359
  /**
329
- * Create a Merkle accumulator leaf for a chain state
330
- * Returns JSON with the leaf hash and canonical data
331
- * @param {string} user_id
332
- * @param {string} chain_id
333
- * @param {string} block_hash
334
- * @param {bigint} block_index
360
+ * @param {string} header_json
335
361
  * @returns {string}
336
362
  */
337
- export function create_accumulator_leaf(user_id, chain_id, block_hash, block_index) {
338
- let deferred4_0;
339
- let deferred4_1;
363
+ export function preimage_asset_transfer(header_json) {
364
+ let deferred2_0;
365
+ let deferred2_1;
340
366
  try {
341
- const ptr0 = passStringToWasm0(user_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
367
+ const ptr0 = passStringToWasm0(header_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
342
368
  const len0 = WASM_VECTOR_LEN;
343
- const ptr1 = passStringToWasm0(chain_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
344
- const len1 = WASM_VECTOR_LEN;
345
- const ptr2 = passStringToWasm0(block_hash, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
346
- const len2 = WASM_VECTOR_LEN;
347
- const ret = wasm.create_accumulator_leaf(ptr0, len0, ptr1, len1, ptr2, len2, block_index);
348
- deferred4_0 = ret[0];
349
- deferred4_1 = ret[1];
369
+ const ret = wasm.preimage_asset_transfer(ptr0, len0);
370
+ deferred2_0 = ret[0];
371
+ deferred2_1 = ret[1];
350
372
  return getStringFromWasm0(ret[0], ret[1]);
351
373
  } finally {
352
- wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
374
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
353
375
  }
354
376
  }
355
377
 
356
378
  /**
357
- * Generate Bitcoin OP_RETURN payload for anchoring
358
- * Returns hex-encoded payload (45 bytes)
359
- * @param {string} root_hex
360
- * @param {bigint} epoch
379
+ * Get supported anchor chains and their configurations
361
380
  * @returns {string}
362
381
  */
363
- export function generate_bitcoin_anchor_payload(root_hex, epoch) {
382
+ export function anchor_chains_info() {
383
+ let deferred1_0;
384
+ let deferred1_1;
385
+ try {
386
+ const ret = wasm.anchor_chains_info();
387
+ deferred1_0 = ret[0];
388
+ deferred1_1 = ret[1];
389
+ return getStringFromWasm0(ret[0], ret[1]);
390
+ } finally {
391
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
392
+ }
393
+ }
394
+
395
+ /**
396
+ * @param {string} public_b64u
397
+ * @returns {string}
398
+ */
399
+ export function kyber_encaps(public_b64u) {
364
400
  let deferred2_0;
365
401
  let deferred2_1;
366
402
  try {
367
- const ptr0 = passStringToWasm0(root_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
403
+ const ptr0 = passStringToWasm0(public_b64u, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
368
404
  const len0 = WASM_VECTOR_LEN;
369
- const ret = wasm.generate_bitcoin_anchor_payload(ptr0, len0, epoch);
405
+ const ret = wasm.kyber_encaps(ptr0, len0);
370
406
  deferred2_0 = ret[0];
371
407
  deferred2_1 = ret[1];
372
408
  return getStringFromWasm0(ret[0], ret[1]);
@@ -376,36 +412,83 @@ export function generate_bitcoin_anchor_payload(root_hex, epoch) {
376
412
  }
377
413
 
378
414
  /**
379
- * @param {string} json
415
+ * Compute shortest path verification info for provenance chains
416
+ * This returns the algorithm parameters for JS-side graph operations
417
+ * @param {number} chain_length
418
+ * @param {number} branches
380
419
  * @returns {string}
381
420
  */
382
- export function jcs_canonicalize(json) {
421
+ export function provenance_path_config(chain_length, branches) {
422
+ let deferred1_0;
423
+ let deferred1_1;
424
+ try {
425
+ const ret = wasm.provenance_path_config(chain_length, branches);
426
+ deferred1_0 = ret[0];
427
+ deferred1_1 = ret[1];
428
+ return getStringFromWasm0(ret[0], ret[1]);
429
+ } finally {
430
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
431
+ }
432
+ }
433
+
434
+ /**
435
+ * @param {string} policy_json
436
+ * @returns {string}
437
+ */
438
+ export function preimage_governance(policy_json) {
383
439
  let deferred2_0;
384
440
  let deferred2_1;
385
441
  try {
386
- const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
442
+ const ptr0 = passStringToWasm0(policy_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
387
443
  const len0 = WASM_VECTOR_LEN;
388
- const ret = wasm.jcs_canonicalize(ptr0, len0);
444
+ const ret = wasm.preimage_governance(ptr0, len0);
389
445
  deferred2_0 = ret[0];
390
446
  deferred2_1 = ret[1];
391
447
  return getStringFromWasm0(ret[0], ret[1]);
392
448
  } finally {
393
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
449
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
450
+ }
451
+ }
452
+
453
+ /**
454
+ * @param {string} key_b64u
455
+ * @param {string} dek_b64u
456
+ * @param {string} aad_b64u
457
+ * @returns {string}
458
+ */
459
+ export function aes_gcm_wrap(key_b64u, dek_b64u, aad_b64u) {
460
+ let deferred4_0;
461
+ let deferred4_1;
462
+ try {
463
+ const ptr0 = passStringToWasm0(key_b64u, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
464
+ const len0 = WASM_VECTOR_LEN;
465
+ const ptr1 = passStringToWasm0(dek_b64u, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
466
+ const len1 = WASM_VECTOR_LEN;
467
+ const ptr2 = passStringToWasm0(aad_b64u, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
468
+ const len2 = WASM_VECTOR_LEN;
469
+ const ret = wasm.aes_gcm_wrap(ptr0, len0, ptr1, len1, ptr2, len2);
470
+ deferred4_0 = ret[0];
471
+ deferred4_1 = ret[1];
472
+ return getStringFromWasm0(ret[0], ret[1]);
473
+ } finally {
474
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
394
475
  }
395
476
  }
396
477
 
397
478
  /**
398
- * Decode a Bitcoin OP_RETURN payload
399
- * @param {string} payload_hex
479
+ * Generate Bitcoin OP_RETURN payload for anchoring
480
+ * Returns hex-encoded payload (45 bytes)
481
+ * @param {string} root_hex
482
+ * @param {bigint} epoch
400
483
  * @returns {string}
401
484
  */
402
- export function decode_bitcoin_anchor_payload(payload_hex) {
485
+ export function generate_bitcoin_anchor_payload(root_hex, epoch) {
403
486
  let deferred2_0;
404
487
  let deferred2_1;
405
488
  try {
406
- const ptr0 = passStringToWasm0(payload_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
489
+ const ptr0 = passStringToWasm0(root_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
407
490
  const len0 = WASM_VECTOR_LEN;
408
- const ret = wasm.decode_bitcoin_anchor_payload(ptr0, len0);
491
+ const ret = wasm.generate_bitcoin_anchor_payload(ptr0, len0, epoch);
409
492
  deferred2_0 = ret[0];
410
493
  deferred2_1 = ret[1];
411
494
  return getStringFromWasm0(ret[0], ret[1]);
@@ -415,40 +498,26 @@ export function decode_bitcoin_anchor_payload(payload_hex) {
415
498
  }
416
499
 
417
500
  /**
418
- * Get supported anchor chains and their configurations
419
- * @returns {string}
420
- */
421
- export function anchor_chains_info() {
422
- let deferred1_0;
423
- let deferred1_1;
424
- try {
425
- const ret = wasm.anchor_chains_info();
426
- deferred1_0 = ret[0];
427
- deferred1_1 = ret[1];
428
- return getStringFromWasm0(ret[0], ret[1]);
429
- } finally {
430
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
431
- }
432
- }
433
-
434
- /**
435
- * @param {string} secret_b64u
436
- * @param {string} info_b64u
437
- * @param {string | null | undefined} salt_b64u
438
- * @param {number} len
501
+ * Create a Merkle accumulator leaf for a chain state
502
+ * Returns JSON with the leaf hash and canonical data
503
+ * Default hash algorithm is SHA3-384 (PQC)
504
+ * @param {string} user_id
505
+ * @param {string} chain_id
506
+ * @param {string} block_hash
507
+ * @param {bigint} block_index
439
508
  * @returns {string}
440
509
  */
441
- export function hkdf_sha256(secret_b64u, info_b64u, salt_b64u, len) {
510
+ export function create_accumulator_leaf(user_id, chain_id, block_hash, block_index) {
442
511
  let deferred4_0;
443
512
  let deferred4_1;
444
513
  try {
445
- const ptr0 = passStringToWasm0(secret_b64u, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
514
+ const ptr0 = passStringToWasm0(user_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
446
515
  const len0 = WASM_VECTOR_LEN;
447
- const ptr1 = passStringToWasm0(info_b64u, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
516
+ const ptr1 = passStringToWasm0(chain_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
448
517
  const len1 = WASM_VECTOR_LEN;
449
- var ptr2 = isLikeNone(salt_b64u) ? 0 : passStringToWasm0(salt_b64u, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
450
- var len2 = WASM_VECTOR_LEN;
451
- const ret = wasm.hkdf_sha256(ptr0, len0, ptr1, len1, ptr2, len2, len);
518
+ const ptr2 = passStringToWasm0(block_hash, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
519
+ const len2 = WASM_VECTOR_LEN;
520
+ const ret = wasm.create_accumulator_leaf(ptr0, len0, ptr1, len1, ptr2, len2, block_index);
452
521
  deferred4_0 = ret[0];
453
522
  deferred4_1 = ret[1];
454
523
  return getStringFromWasm0(ret[0], ret[1]);
@@ -458,39 +527,53 @@ export function hkdf_sha256(secret_b64u, info_b64u, salt_b64u, len) {
458
527
  }
459
528
 
460
529
  /**
461
- * Check if a nonce has been seen (for replay prevention)
462
- * Returns info about the nonce cache algorithm
530
+ * Create a Merkle accumulator leaf with an explicit hash algorithm
531
+ * hash_alg: "sha256" or "sha3-384"
532
+ * @param {string} user_id
533
+ * @param {string} chain_id
534
+ * @param {string} block_hash
535
+ * @param {bigint} block_index
536
+ * @param {string} hash_alg
463
537
  * @returns {string}
464
538
  */
465
- export function nonce_cache_info() {
466
- let deferred1_0;
467
- let deferred1_1;
539
+ export function create_accumulator_leaf_with_alg(user_id, chain_id, block_hash, block_index, hash_alg) {
540
+ let deferred5_0;
541
+ let deferred5_1;
468
542
  try {
469
- const ret = wasm.nonce_cache_info();
470
- deferred1_0 = ret[0];
471
- deferred1_1 = ret[1];
543
+ const ptr0 = passStringToWasm0(user_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
544
+ const len0 = WASM_VECTOR_LEN;
545
+ const ptr1 = passStringToWasm0(chain_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
546
+ const len1 = WASM_VECTOR_LEN;
547
+ const ptr2 = passStringToWasm0(block_hash, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
548
+ const len2 = WASM_VECTOR_LEN;
549
+ const ptr3 = passStringToWasm0(hash_alg, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
550
+ const len3 = WASM_VECTOR_LEN;
551
+ const ret = wasm.create_accumulator_leaf_with_alg(ptr0, len0, ptr1, len1, ptr2, len2, block_index, ptr3, len3);
552
+ deferred5_0 = ret[0];
553
+ deferred5_1 = ret[1];
472
554
  return getStringFromWasm0(ret[0], ret[1]);
473
555
  } finally {
474
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
556
+ wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
475
557
  }
476
558
  }
477
559
 
478
560
  /**
479
- * ML-DSA-65 signing (FIPS 204 compliant)
480
- * Security: Input validation prevents DoS; constant-time operations
481
- * @param {string} message_b64u
482
- * @param {string} secret_b64u
561
+ * Compute Merkle root from an array of leaf hashes
562
+ * Input: JSON array of hex hash strings
563
+ * Returns: { root: string, leaf_count: number }
564
+ * @param {string} leaves_json
565
+ * @param {string} hash_alg
483
566
  * @returns {string}
484
567
  */
485
- export function dilithium_sign(message_b64u, secret_b64u) {
568
+ export function compute_merkle_root(leaves_json, hash_alg) {
486
569
  let deferred3_0;
487
570
  let deferred3_1;
488
571
  try {
489
- const ptr0 = passStringToWasm0(message_b64u, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
572
+ const ptr0 = passStringToWasm0(leaves_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
490
573
  const len0 = WASM_VECTOR_LEN;
491
- const ptr1 = passStringToWasm0(secret_b64u, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
574
+ const ptr1 = passStringToWasm0(hash_alg, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
492
575
  const len1 = WASM_VECTOR_LEN;
493
- const ret = wasm.dilithium_sign(ptr0, len0, ptr1, len1);
576
+ const ret = wasm.compute_merkle_root(ptr0, len0, ptr1, len1);
494
577
  deferred3_0 = ret[0];
495
578
  deferred3_1 = ret[1];
496
579
  return getStringFromWasm0(ret[0], ret[1]);
@@ -500,18 +583,17 @@ export function dilithium_sign(message_b64u, secret_b64u) {
500
583
  }
501
584
 
502
585
  /**
503
- * Truncate a SHA3-384 hash (48 bytes) to bytes32 (32 bytes) for EVM
504
- * Uses first 32 bytes, preserving collision resistance
505
- * @param {string} hash_hex
586
+ * @param {string} receiver
587
+ * @param {number} bps
506
588
  * @returns {string}
507
589
  */
508
- export function truncate_to_bytes32(hash_hex) {
590
+ export function validate_royalty(receiver, bps) {
509
591
  let deferred2_0;
510
592
  let deferred2_1;
511
593
  try {
512
- const ptr0 = passStringToWasm0(hash_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
594
+ const ptr0 = passStringToWasm0(receiver, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
513
595
  const len0 = WASM_VECTOR_LEN;
514
- const ret = wasm.truncate_to_bytes32(ptr0, len0);
596
+ const ret = wasm.validate_royalty(ptr0, len0, bps);
515
597
  deferred2_0 = ret[0];
516
598
  deferred2_1 = ret[1];
517
599
  return getStringFromWasm0(ret[0], ret[1]);
@@ -521,32 +603,14 @@ export function truncate_to_bytes32(hash_hex) {
521
603
  }
522
604
 
523
605
  /**
606
+ * Get anchor configuration and gas estimates
524
607
  * @returns {string}
525
608
  */
526
- export function kyber_keygen() {
527
- let deferred1_0;
528
- let deferred1_1;
529
- try {
530
- const ret = wasm.kyber_keygen();
531
- deferred1_0 = ret[0];
532
- deferred1_1 = ret[1];
533
- return getStringFromWasm0(ret[0], ret[1]);
534
- } finally {
535
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
536
- }
537
- }
538
-
539
- /**
540
- * Get elastic hash table configuration for key caching
541
- * @param {number} capacity
542
- * @param {number} load_factor
543
- * @returns {string}
544
- */
545
- export function elastic_hash_config(capacity, load_factor) {
609
+ export function anchor_config_info() {
546
610
  let deferred1_0;
547
611
  let deferred1_1;
548
612
  try {
549
- const ret = wasm.elastic_hash_config(capacity, load_factor);
613
+ const ret = wasm.anchor_config_info();
550
614
  deferred1_0 = ret[0];
551
615
  deferred1_1 = ret[1];
552
616
  return getStringFromWasm0(ret[0], ret[1]);
@@ -556,18 +620,15 @@ export function elastic_hash_config(capacity, load_factor) {
556
620
  }
557
621
 
558
622
  /**
559
- * Create a nonce cache for replay attack prevention
560
- * capacity: maximum number of nonces to track
561
- * ttl_ms: time-to-live in milliseconds before nonces expire
562
- * @param {number} capacity
563
- * @param {bigint} ttl_ms
623
+ * Check if a nonce has been seen (for replay prevention)
624
+ * Returns info about the nonce cache algorithm
564
625
  * @returns {string}
565
626
  */
566
- export function create_nonce_cache(capacity, ttl_ms) {
627
+ export function nonce_cache_info() {
567
628
  let deferred1_0;
568
629
  let deferred1_1;
569
630
  try {
570
- const ret = wasm.create_nonce_cache(capacity, ttl_ms);
631
+ const ret = wasm.nonce_cache_info();
571
632
  deferred1_0 = ret[0];
572
633
  deferred1_1 = ret[1];
573
634
  return getStringFromWasm0(ret[0], ret[1]);
@@ -577,19 +638,21 @@ export function create_nonce_cache(capacity, ttl_ms) {
577
638
  }
578
639
 
579
640
  /**
641
+ * ML-DSA-65 signing (FIPS 204 compliant)
642
+ * Security: Input validation prevents DoS; constant-time operations
643
+ * @param {string} message_b64u
580
644
  * @param {string} secret_b64u
581
- * @param {string} kem_ct_b64u
582
645
  * @returns {string}
583
646
  */
584
- export function kyber_decaps(secret_b64u, kem_ct_b64u) {
647
+ export function dilithium_sign(message_b64u, secret_b64u) {
585
648
  let deferred3_0;
586
649
  let deferred3_1;
587
650
  try {
588
- const ptr0 = passStringToWasm0(secret_b64u, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
651
+ const ptr0 = passStringToWasm0(message_b64u, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
589
652
  const len0 = WASM_VECTOR_LEN;
590
- const ptr1 = passStringToWasm0(kem_ct_b64u, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
653
+ const ptr1 = passStringToWasm0(secret_b64u, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
591
654
  const len1 = WASM_VECTOR_LEN;
592
- const ret = wasm.kyber_decaps(ptr0, len0, ptr1, len1);
655
+ const ret = wasm.dilithium_sign(ptr0, len0, ptr1, len1);
593
656
  deferred3_0 = ret[0];
594
657
  deferred3_1 = ret[1];
595
658
  return getStringFromWasm0(ret[0], ret[1]);
@@ -599,39 +662,16 @@ export function kyber_decaps(secret_b64u, kem_ct_b64u) {
599
662
  }
600
663
 
601
664
  /**
602
- * @param {string} key_b64u
603
- * @param {string} dek_b64u
604
- * @param {string} aad_b64u
605
- * @returns {string}
606
- */
607
- export function aes_gcm_wrap(key_b64u, dek_b64u, aad_b64u) {
608
- let deferred4_0;
609
- let deferred4_1;
610
- try {
611
- const ptr0 = passStringToWasm0(key_b64u, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
612
- const len0 = WASM_VECTOR_LEN;
613
- const ptr1 = passStringToWasm0(dek_b64u, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
614
- const len1 = WASM_VECTOR_LEN;
615
- const ptr2 = passStringToWasm0(aad_b64u, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
616
- const len2 = WASM_VECTOR_LEN;
617
- const ret = wasm.aes_gcm_wrap(ptr0, len0, ptr1, len1, ptr2, len2);
618
- deferred4_0 = ret[0];
619
- deferred4_1 = ret[1];
620
- return getStringFromWasm0(ret[0], ret[1]);
621
- } finally {
622
- wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
623
- }
624
- }
625
-
626
- /**
627
- * Get anchor configuration and gas estimates
665
+ * Get elastic hash table configuration for key caching
666
+ * @param {number} capacity
667
+ * @param {number} load_factor
628
668
  * @returns {string}
629
669
  */
630
- export function anchor_config_info() {
670
+ export function elastic_hash_config(capacity, load_factor) {
631
671
  let deferred1_0;
632
672
  let deferred1_1;
633
673
  try {
634
- const ret = wasm.anchor_config_info();
674
+ const ret = wasm.elastic_hash_config(capacity, load_factor);
635
675
  deferred1_0 = ret[0];
636
676
  deferred1_1 = ret[1];
637
677
  return getStringFromWasm0(ret[0], ret[1]);
@@ -641,16 +681,13 @@ export function anchor_config_info() {
641
681
  }
642
682
 
643
683
  /**
644
- * Get SSSP algorithm configuration for graph verification
645
- * nodes: expected number of nodes in the graph
646
- * @param {number} nodes
647
684
  * @returns {string}
648
685
  */
649
- export function sssp_config(nodes) {
686
+ export function kyber_keygen() {
650
687
  let deferred1_0;
651
688
  let deferred1_1;
652
689
  try {
653
- const ret = wasm.sssp_config(nodes);
690
+ const ret = wasm.kyber_keygen();
654
691
  deferred1_0 = ret[0];
655
692
  deferred1_1 = ret[1];
656
693
  return getStringFromWasm0(ret[0], ret[1]);
@@ -660,16 +697,17 @@ export function sssp_config(nodes) {
660
697
  }
661
698
 
662
699
  /**
663
- * @param {string} header_json
700
+ * Decode a Bitcoin OP_RETURN payload
701
+ * @param {string} payload_hex
664
702
  * @returns {string}
665
703
  */
666
- export function preimage_asset_transfer(header_json) {
704
+ export function decode_bitcoin_anchor_payload(payload_hex) {
667
705
  let deferred2_0;
668
706
  let deferred2_1;
669
707
  try {
670
- const ptr0 = passStringToWasm0(header_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
708
+ const ptr0 = passStringToWasm0(payload_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
671
709
  const len0 = WASM_VECTOR_LEN;
672
- const ret = wasm.preimage_asset_transfer(ptr0, len0);
710
+ const ret = wasm.decode_bitcoin_anchor_payload(ptr0, len0);
673
711
  deferred2_0 = ret[0];
674
712
  deferred2_1 = ret[1];
675
713
  return getStringFromWasm0(ret[0], ret[1]);
@@ -679,49 +717,47 @@ export function preimage_asset_transfer(header_json) {
679
717
  }
680
718
 
681
719
  /**
682
- * ML-DSA-65 verification (FIPS 204 compliant)
683
- * Security: Input validation prevents DoS; constant-time comparison
684
- * @param {string} message_b64u
685
- * @param {string} signature_b64u
686
- * @param {string} public_b64u
720
+ * @param {string} user_id
721
+ * @param {string} root_hex
722
+ * @param {string} epoch
723
+ * @param {string} chains_json
687
724
  * @returns {string}
688
725
  */
689
- export function dilithium_verify(message_b64u, signature_b64u, public_b64u) {
690
- let deferred4_0;
691
- let deferred4_1;
726
+ export function preimage_anchor(user_id, root_hex, epoch, chains_json) {
727
+ let deferred5_0;
728
+ let deferred5_1;
692
729
  try {
693
- const ptr0 = passStringToWasm0(message_b64u, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
730
+ const ptr0 = passStringToWasm0(user_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
694
731
  const len0 = WASM_VECTOR_LEN;
695
- const ptr1 = passStringToWasm0(signature_b64u, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
732
+ const ptr1 = passStringToWasm0(root_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
696
733
  const len1 = WASM_VECTOR_LEN;
697
- const ptr2 = passStringToWasm0(public_b64u, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
734
+ const ptr2 = passStringToWasm0(epoch, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
698
735
  const len2 = WASM_VECTOR_LEN;
699
- const ret = wasm.dilithium_verify(ptr0, len0, ptr1, len1, ptr2, len2);
700
- deferred4_0 = ret[0];
701
- deferred4_1 = ret[1];
736
+ const ptr3 = passStringToWasm0(chains_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
737
+ const len3 = WASM_VECTOR_LEN;
738
+ const ret = wasm.preimage_anchor(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
739
+ deferred5_0 = ret[0];
740
+ deferred5_1 = ret[1];
702
741
  return getStringFromWasm0(ret[0], ret[1]);
703
742
  } finally {
704
- wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
743
+ wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
705
744
  }
706
745
  }
707
746
 
708
747
  /**
709
- * Compute Merkle root from an array of leaf hashes
710
- * Input: JSON array of hex hash strings
711
- * Returns: { root: string, leaf_count: number }
712
- * @param {string} leaves_json
713
- * @param {string} hash_alg
748
+ * @param {string} secret_b64u
749
+ * @param {string} kem_ct_b64u
714
750
  * @returns {string}
715
751
  */
716
- export function compute_merkle_root(leaves_json, hash_alg) {
752
+ export function kyber_decaps(secret_b64u, kem_ct_b64u) {
717
753
  let deferred3_0;
718
754
  let deferred3_1;
719
755
  try {
720
- const ptr0 = passStringToWasm0(leaves_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
756
+ const ptr0 = passStringToWasm0(secret_b64u, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
721
757
  const len0 = WASM_VECTOR_LEN;
722
- const ptr1 = passStringToWasm0(hash_alg, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
758
+ const ptr1 = passStringToWasm0(kem_ct_b64u, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
723
759
  const len1 = WASM_VECTOR_LEN;
724
- const ret = wasm.compute_merkle_root(ptr0, len0, ptr1, len1);
760
+ const ret = wasm.kyber_decaps(ptr0, len0, ptr1, len1);
725
761
  deferred3_0 = ret[0];
726
762
  deferred3_1 = ret[1];
727
763
  return getStringFromWasm0(ret[0], ret[1]);
@@ -730,10 +766,6 @@ export function compute_merkle_root(leaves_json, hash_alg) {
730
766
  }
731
767
  }
732
768
 
733
- export function start() {
734
- wasm.start();
735
- }
736
-
737
769
  const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
738
770
 
739
771
  async function __wbg_load(module, imports) {
@@ -791,7 +823,7 @@ function __wbg_get_imports() {
791
823
  imports.wbg.__wbg_getRandomValues_b8f5dbd5f3995a9e = function() { return handleError(function (arg0, arg1) {
792
824
  arg0.getRandomValues(arg1);
793
825
  }, arguments) };
794
- imports.wbg.__wbg_log_ec1ac28338db4ce3 = function(arg0, arg1) {
826
+ imports.wbg.__wbg_log_733c6468ea1b52fd = function(arg0, arg1) {
795
827
  console.log(getStringFromWasm0(arg0, arg1));
796
828
  };
797
829
  imports.wbg.__wbg_msCrypto_a61aeb35a24c1329 = function(arg0) {
Binary file
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@maatara/core-pqc-wasm",
3
3
  "type": "module",
4
4
  "description": "Ma'atara PQC WASM bindings with elastic hash and frontier SSSP algorithms",
5
- "version": "0.4.2",
5
+ "version": "0.4.4",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
8
8
  "type": "git",