cojson-core-wasm 0.18.20 → 0.18.22
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 +9 -7
- package/public/cojson_core_wasm.d.ts +118 -140
- package/public/cojson_core_wasm.js +258 -305
- package/public/cojson_core_wasm.wasm +0 -0
- package/public/cojson_core_wasm.wasm.js +1 -1
|
@@ -206,14 +206,14 @@ function getArrayU8FromWasm0(ptr, len) {
|
|
|
206
206
|
* @param {Uint8Array} plaintext
|
|
207
207
|
* @returns {Uint8Array}
|
|
208
208
|
*/
|
|
209
|
-
export function
|
|
209
|
+
export function encryptXsalsa20(key, nonce_material, plaintext) {
|
|
210
210
|
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
211
211
|
const len0 = WASM_VECTOR_LEN;
|
|
212
212
|
const ptr1 = passArray8ToWasm0(nonce_material, wasm.__wbindgen_malloc);
|
|
213
213
|
const len1 = WASM_VECTOR_LEN;
|
|
214
214
|
const ptr2 = passArray8ToWasm0(plaintext, wasm.__wbindgen_malloc);
|
|
215
215
|
const len2 = WASM_VECTOR_LEN;
|
|
216
|
-
const ret = wasm.
|
|
216
|
+
const ret = wasm.encryptXsalsa20(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
217
217
|
if (ret[3]) {
|
|
218
218
|
throw takeFromExternrefTable0(ret[2]);
|
|
219
219
|
}
|
|
@@ -234,14 +234,14 @@ export function encrypt_xsalsa20(key, nonce_material, plaintext) {
|
|
|
234
234
|
* @param {Uint8Array} ciphertext
|
|
235
235
|
* @returns {Uint8Array}
|
|
236
236
|
*/
|
|
237
|
-
export function
|
|
237
|
+
export function decryptXsalsa20(key, nonce_material, ciphertext) {
|
|
238
238
|
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
239
239
|
const len0 = WASM_VECTOR_LEN;
|
|
240
240
|
const ptr1 = passArray8ToWasm0(nonce_material, wasm.__wbindgen_malloc);
|
|
241
241
|
const len1 = WASM_VECTOR_LEN;
|
|
242
242
|
const ptr2 = passArray8ToWasm0(ciphertext, wasm.__wbindgen_malloc);
|
|
243
243
|
const len2 = WASM_VECTOR_LEN;
|
|
244
|
-
const ret = wasm.
|
|
244
|
+
const ret = wasm.decryptXsalsa20(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
245
245
|
if (ret[3]) {
|
|
246
246
|
throw takeFromExternrefTable0(ret[2]);
|
|
247
247
|
}
|
|
@@ -251,28 +251,29 @@ export function decrypt_xsalsa20(key, nonce_material, ciphertext) {
|
|
|
251
251
|
}
|
|
252
252
|
|
|
253
253
|
/**
|
|
254
|
-
* Generate a new
|
|
255
|
-
* Returns 32 bytes of raw key material suitable for use with other
|
|
254
|
+
* Generate a new X25519 private key using secure random number generation.
|
|
255
|
+
* Returns 32 bytes of raw key material suitable for use with other X25519 functions.
|
|
256
|
+
* This key can be reused for multiple Diffie-Hellman exchanges.
|
|
256
257
|
* @returns {Uint8Array}
|
|
257
258
|
*/
|
|
258
|
-
export function
|
|
259
|
-
const ret = wasm.
|
|
259
|
+
export function newX25519PrivateKey() {
|
|
260
|
+
const ret = wasm.newX25519PrivateKey();
|
|
260
261
|
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
261
262
|
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
262
263
|
return v1;
|
|
263
264
|
}
|
|
264
265
|
|
|
265
266
|
/**
|
|
266
|
-
* WASM-exposed function to derive an
|
|
267
|
-
* - `
|
|
268
|
-
* Returns 32 bytes of
|
|
269
|
-
* @param {Uint8Array}
|
|
267
|
+
* WASM-exposed function to derive an X25519 public key from a private key.
|
|
268
|
+
* - `private_key`: 32 bytes of private key material
|
|
269
|
+
* Returns 32 bytes of public key material or throws JsError if key is invalid.
|
|
270
|
+
* @param {Uint8Array} private_key
|
|
270
271
|
* @returns {Uint8Array}
|
|
271
272
|
*/
|
|
272
|
-
export function
|
|
273
|
-
const ptr0 = passArray8ToWasm0(
|
|
273
|
+
export function x25519PublicKey(private_key) {
|
|
274
|
+
const ptr0 = passArray8ToWasm0(private_key, wasm.__wbindgen_malloc);
|
|
274
275
|
const len0 = WASM_VECTOR_LEN;
|
|
275
|
-
const ret = wasm.
|
|
276
|
+
const ret = wasm.x25519PublicKey(ptr0, len0);
|
|
276
277
|
if (ret[3]) {
|
|
277
278
|
throw takeFromExternrefTable0(ret[2]);
|
|
278
279
|
}
|
|
@@ -282,20 +283,20 @@ export function ed25519_verifying_key(signing_key) {
|
|
|
282
283
|
}
|
|
283
284
|
|
|
284
285
|
/**
|
|
285
|
-
* WASM-exposed function to
|
|
286
|
-
* - `
|
|
287
|
-
* - `
|
|
288
|
-
* Returns
|
|
289
|
-
* @param {Uint8Array}
|
|
290
|
-
* @param {Uint8Array}
|
|
286
|
+
* WASM-exposed function to perform X25519 Diffie-Hellman key exchange.
|
|
287
|
+
* - `private_key`: 32 bytes of private key material
|
|
288
|
+
* - `public_key`: 32 bytes of public key material
|
|
289
|
+
* Returns 32 bytes of shared secret material or throws JsError if key exchange fails.
|
|
290
|
+
* @param {Uint8Array} private_key
|
|
291
|
+
* @param {Uint8Array} public_key
|
|
291
292
|
* @returns {Uint8Array}
|
|
292
293
|
*/
|
|
293
|
-
export function
|
|
294
|
-
const ptr0 = passArray8ToWasm0(
|
|
294
|
+
export function x25519DiffieHellman(private_key, public_key) {
|
|
295
|
+
const ptr0 = passArray8ToWasm0(private_key, wasm.__wbindgen_malloc);
|
|
295
296
|
const len0 = WASM_VECTOR_LEN;
|
|
296
|
-
const ptr1 = passArray8ToWasm0(
|
|
297
|
+
const ptr1 = passArray8ToWasm0(public_key, wasm.__wbindgen_malloc);
|
|
297
298
|
const len1 = WASM_VECTOR_LEN;
|
|
298
|
-
const ret = wasm.
|
|
299
|
+
const ret = wasm.x25519DiffieHellman(ptr0, len0, ptr1, len1);
|
|
299
300
|
if (ret[3]) {
|
|
300
301
|
throw takeFromExternrefTable0(ret[2]);
|
|
301
302
|
}
|
|
@@ -305,129 +306,206 @@ export function ed25519_sign(signing_key, message) {
|
|
|
305
306
|
}
|
|
306
307
|
|
|
307
308
|
/**
|
|
308
|
-
* WASM-exposed function to
|
|
309
|
-
* - `
|
|
310
|
-
* -
|
|
311
|
-
*
|
|
312
|
-
*
|
|
313
|
-
* @param {Uint8Array} verifying_key
|
|
314
|
-
* @param {Uint8Array} message
|
|
315
|
-
* @param {Uint8Array} signature
|
|
316
|
-
* @returns {boolean}
|
|
309
|
+
* WASM-exposed function to derive a sealer ID from a sealer secret.
|
|
310
|
+
* - `secret`: Raw bytes of the sealer secret
|
|
311
|
+
* Returns a base58-encoded sealer ID with "sealer_z" prefix or throws JsError if derivation fails.
|
|
312
|
+
* @param {Uint8Array} secret
|
|
313
|
+
* @returns {string}
|
|
317
314
|
*/
|
|
318
|
-
export function
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
315
|
+
export function getSealerId(secret) {
|
|
316
|
+
let deferred3_0;
|
|
317
|
+
let deferred3_1;
|
|
318
|
+
try {
|
|
319
|
+
const ptr0 = passArray8ToWasm0(secret, wasm.__wbindgen_malloc);
|
|
320
|
+
const len0 = WASM_VECTOR_LEN;
|
|
321
|
+
const ret = wasm.getSealerId(ptr0, len0);
|
|
322
|
+
var ptr2 = ret[0];
|
|
323
|
+
var len2 = ret[1];
|
|
324
|
+
if (ret[3]) {
|
|
325
|
+
ptr2 = 0; len2 = 0;
|
|
326
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
327
|
+
}
|
|
328
|
+
deferred3_0 = ptr2;
|
|
329
|
+
deferred3_1 = len2;
|
|
330
|
+
return getStringFromWasm0(ptr2, len2);
|
|
331
|
+
} finally {
|
|
332
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
328
333
|
}
|
|
329
|
-
return ret[0] !== 0;
|
|
330
334
|
}
|
|
331
335
|
|
|
332
336
|
/**
|
|
333
|
-
* WASM-exposed function to
|
|
334
|
-
* - `
|
|
335
|
-
*
|
|
336
|
-
*
|
|
337
|
+
* WASM-exposed function to encrypt bytes with a key secret and nonce material.
|
|
338
|
+
* - `value`: The raw bytes to encrypt
|
|
339
|
+
* - `key_secret`: A base58-encoded key secret with "keySecret_z" prefix
|
|
340
|
+
* - `nonce_material`: Raw bytes used to generate the nonce
|
|
341
|
+
* Returns the encrypted bytes or throws a JsError if encryption fails.
|
|
342
|
+
* @param {Uint8Array} value
|
|
343
|
+
* @param {string} key_secret
|
|
344
|
+
* @param {Uint8Array} nonce_material
|
|
337
345
|
* @returns {Uint8Array}
|
|
338
346
|
*/
|
|
339
|
-
export function
|
|
340
|
-
const ptr0 = passArray8ToWasm0(
|
|
347
|
+
export function encrypt(value, key_secret, nonce_material) {
|
|
348
|
+
const ptr0 = passArray8ToWasm0(value, wasm.__wbindgen_malloc);
|
|
341
349
|
const len0 = WASM_VECTOR_LEN;
|
|
342
|
-
const
|
|
350
|
+
const ptr1 = passStringToWasm0(key_secret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
351
|
+
const len1 = WASM_VECTOR_LEN;
|
|
352
|
+
const ptr2 = passArray8ToWasm0(nonce_material, wasm.__wbindgen_malloc);
|
|
353
|
+
const len2 = WASM_VECTOR_LEN;
|
|
354
|
+
const ret = wasm.encrypt(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
343
355
|
if (ret[3]) {
|
|
344
356
|
throw takeFromExternrefTable0(ret[2]);
|
|
345
357
|
}
|
|
346
|
-
var
|
|
358
|
+
var v4 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
347
359
|
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
348
|
-
return
|
|
360
|
+
return v4;
|
|
349
361
|
}
|
|
350
362
|
|
|
351
363
|
/**
|
|
352
|
-
* WASM-exposed function to
|
|
353
|
-
* - `
|
|
354
|
-
*
|
|
355
|
-
*
|
|
364
|
+
* WASM-exposed function to decrypt bytes with a key secret and nonce material.
|
|
365
|
+
* - `ciphertext`: The encrypted bytes to decrypt
|
|
366
|
+
* - `key_secret`: A base58-encoded key secret with "keySecret_z" prefix
|
|
367
|
+
* - `nonce_material`: Raw bytes used to generate the nonce (must match encryption)
|
|
368
|
+
* Returns the decrypted bytes or throws a JsError if decryption fails.
|
|
369
|
+
* @param {Uint8Array} ciphertext
|
|
370
|
+
* @param {string} key_secret
|
|
371
|
+
* @param {Uint8Array} nonce_material
|
|
356
372
|
* @returns {Uint8Array}
|
|
357
373
|
*/
|
|
358
|
-
export function
|
|
359
|
-
const ptr0 = passArray8ToWasm0(
|
|
374
|
+
export function decrypt(ciphertext, key_secret, nonce_material) {
|
|
375
|
+
const ptr0 = passArray8ToWasm0(ciphertext, wasm.__wbindgen_malloc);
|
|
360
376
|
const len0 = WASM_VECTOR_LEN;
|
|
361
|
-
const
|
|
377
|
+
const ptr1 = passStringToWasm0(key_secret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
378
|
+
const len1 = WASM_VECTOR_LEN;
|
|
379
|
+
const ptr2 = passArray8ToWasm0(nonce_material, wasm.__wbindgen_malloc);
|
|
380
|
+
const len2 = WASM_VECTOR_LEN;
|
|
381
|
+
const ret = wasm.decrypt(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
362
382
|
if (ret[3]) {
|
|
363
383
|
throw takeFromExternrefTable0(ret[2]);
|
|
364
384
|
}
|
|
365
|
-
var
|
|
385
|
+
var v4 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
366
386
|
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
367
|
-
return
|
|
387
|
+
return v4;
|
|
368
388
|
}
|
|
369
389
|
|
|
370
390
|
/**
|
|
371
|
-
* WASM-exposed function
|
|
372
|
-
*
|
|
373
|
-
* - `message`: Raw bytes to
|
|
374
|
-
*
|
|
375
|
-
*
|
|
391
|
+
* WASM-exposed function for sealing a message using X25519 + XSalsa20-Poly1305.
|
|
392
|
+
* Provides authenticated encryption with perfect forward secrecy.
|
|
393
|
+
* - `message`: Raw bytes to seal
|
|
394
|
+
* - `sender_secret`: Base58-encoded sender's private key with "sealerSecret_z" prefix
|
|
395
|
+
* - `recipient_id`: Base58-encoded recipient's public key with "sealer_z" prefix
|
|
396
|
+
* - `nonce_material`: Raw bytes used to generate the nonce
|
|
397
|
+
* Returns sealed bytes or throws JsError if sealing fails.
|
|
376
398
|
* @param {Uint8Array} message
|
|
399
|
+
* @param {string} sender_secret
|
|
400
|
+
* @param {string} recipient_id
|
|
401
|
+
* @param {Uint8Array} nonce_material
|
|
377
402
|
* @returns {Uint8Array}
|
|
378
403
|
*/
|
|
379
|
-
export function
|
|
380
|
-
const ptr0 = passArray8ToWasm0(
|
|
404
|
+
export function seal(message, sender_secret, recipient_id, nonce_material) {
|
|
405
|
+
const ptr0 = passArray8ToWasm0(message, wasm.__wbindgen_malloc);
|
|
381
406
|
const len0 = WASM_VECTOR_LEN;
|
|
382
|
-
const ptr1 =
|
|
407
|
+
const ptr1 = passStringToWasm0(sender_secret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
383
408
|
const len1 = WASM_VECTOR_LEN;
|
|
384
|
-
const
|
|
409
|
+
const ptr2 = passStringToWasm0(recipient_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
410
|
+
const len2 = WASM_VECTOR_LEN;
|
|
411
|
+
const ptr3 = passArray8ToWasm0(nonce_material, wasm.__wbindgen_malloc);
|
|
412
|
+
const len3 = WASM_VECTOR_LEN;
|
|
413
|
+
const ret = wasm.seal(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
385
414
|
if (ret[3]) {
|
|
386
415
|
throw takeFromExternrefTable0(ret[2]);
|
|
387
416
|
}
|
|
388
|
-
var
|
|
417
|
+
var v5 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
389
418
|
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
390
|
-
return
|
|
419
|
+
return v5;
|
|
391
420
|
}
|
|
392
421
|
|
|
393
422
|
/**
|
|
394
|
-
* WASM-exposed function
|
|
395
|
-
*
|
|
396
|
-
*
|
|
397
|
-
*
|
|
423
|
+
* WASM-exposed function for unsealing a message using X25519 + XSalsa20-Poly1305.
|
|
424
|
+
* Provides authenticated decryption with perfect forward secrecy.
|
|
425
|
+
* - `sealed_message`: The sealed bytes to decrypt
|
|
426
|
+
* - `recipient_secret`: Base58-encoded recipient's private key with "sealerSecret_z" prefix
|
|
427
|
+
* - `sender_id`: Base58-encoded sender's public key with "sealer_z" prefix
|
|
428
|
+
* - `nonce_material`: Raw bytes used to generate the nonce (must match sealing)
|
|
429
|
+
* Returns unsealed bytes or throws JsError if unsealing fails.
|
|
430
|
+
* @param {Uint8Array} sealed_message
|
|
431
|
+
* @param {string} recipient_secret
|
|
432
|
+
* @param {string} sender_id
|
|
433
|
+
* @param {Uint8Array} nonce_material
|
|
398
434
|
* @returns {Uint8Array}
|
|
399
435
|
*/
|
|
400
|
-
export function
|
|
401
|
-
const ptr0 = passArray8ToWasm0(
|
|
436
|
+
export function unseal(sealed_message, recipient_secret, sender_id, nonce_material) {
|
|
437
|
+
const ptr0 = passArray8ToWasm0(sealed_message, wasm.__wbindgen_malloc);
|
|
402
438
|
const len0 = WASM_VECTOR_LEN;
|
|
403
|
-
const
|
|
439
|
+
const ptr1 = passStringToWasm0(recipient_secret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
440
|
+
const len1 = WASM_VECTOR_LEN;
|
|
441
|
+
const ptr2 = passStringToWasm0(sender_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
442
|
+
const len2 = WASM_VECTOR_LEN;
|
|
443
|
+
const ptr3 = passArray8ToWasm0(nonce_material, wasm.__wbindgen_malloc);
|
|
444
|
+
const len3 = WASM_VECTOR_LEN;
|
|
445
|
+
const ret = wasm.unseal(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
404
446
|
if (ret[3]) {
|
|
405
447
|
throw takeFromExternrefTable0(ret[2]);
|
|
406
448
|
}
|
|
449
|
+
var v5 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
450
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
451
|
+
return v5;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
/**
|
|
455
|
+
* Generate a 24-byte nonce from input material using BLAKE3.
|
|
456
|
+
* - `nonce_material`: Raw bytes to derive the nonce from
|
|
457
|
+
* Returns 24 bytes suitable for use as a nonce in cryptographic operations.
|
|
458
|
+
* This function is deterministic - the same input will produce the same nonce.
|
|
459
|
+
* @param {Uint8Array} nonce_material
|
|
460
|
+
* @returns {Uint8Array}
|
|
461
|
+
*/
|
|
462
|
+
export function generateNonce(nonce_material) {
|
|
463
|
+
const ptr0 = passArray8ToWasm0(nonce_material, wasm.__wbindgen_malloc);
|
|
464
|
+
const len0 = WASM_VECTOR_LEN;
|
|
465
|
+
const ret = wasm.generateNonce(ptr0, len0);
|
|
407
466
|
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
408
467
|
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
409
468
|
return v2;
|
|
410
469
|
}
|
|
411
470
|
|
|
412
471
|
/**
|
|
413
|
-
*
|
|
414
|
-
* - `
|
|
415
|
-
* Returns
|
|
416
|
-
*
|
|
472
|
+
* Hash data once using BLAKE3.
|
|
473
|
+
* - `data`: Raw bytes to hash
|
|
474
|
+
* Returns 32 bytes of hash output.
|
|
475
|
+
* This is the simplest way to compute a BLAKE3 hash of a single piece of data.
|
|
476
|
+
* @param {Uint8Array} data
|
|
417
477
|
* @returns {Uint8Array}
|
|
418
478
|
*/
|
|
419
|
-
export function
|
|
420
|
-
const ptr0 = passArray8ToWasm0(
|
|
479
|
+
export function blake3HashOnce(data) {
|
|
480
|
+
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
421
481
|
const len0 = WASM_VECTOR_LEN;
|
|
422
|
-
const ret = wasm.
|
|
423
|
-
if (ret[3]) {
|
|
424
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
425
|
-
}
|
|
482
|
+
const ret = wasm.blake3HashOnce(ptr0, len0);
|
|
426
483
|
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
427
484
|
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
428
485
|
return v2;
|
|
429
486
|
}
|
|
430
487
|
|
|
488
|
+
/**
|
|
489
|
+
* Hash data once using BLAKE3 with a context prefix.
|
|
490
|
+
* - `data`: Raw bytes to hash
|
|
491
|
+
* - `context`: Context bytes to prefix to the data
|
|
492
|
+
* Returns 32 bytes of hash output.
|
|
493
|
+
* This is useful for domain separation - the same data hashed with different contexts will produce different outputs.
|
|
494
|
+
* @param {Uint8Array} data
|
|
495
|
+
* @param {Uint8Array} context
|
|
496
|
+
* @returns {Uint8Array}
|
|
497
|
+
*/
|
|
498
|
+
export function blake3HashOnceWithContext(data, context) {
|
|
499
|
+
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
500
|
+
const len0 = WASM_VECTOR_LEN;
|
|
501
|
+
const ptr1 = passArray8ToWasm0(context, wasm.__wbindgen_malloc);
|
|
502
|
+
const len1 = WASM_VECTOR_LEN;
|
|
503
|
+
const ret = wasm.blake3HashOnceWithContext(ptr0, len0, ptr1, len1);
|
|
504
|
+
var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
505
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
506
|
+
return v3;
|
|
507
|
+
}
|
|
508
|
+
|
|
431
509
|
/**
|
|
432
510
|
* WASM-exposed function to sign a message using Ed25519.
|
|
433
511
|
* - `message`: Raw bytes to sign
|
|
@@ -492,13 +570,13 @@ export function verify(signature, message, id) {
|
|
|
492
570
|
* @param {Uint8Array} secret
|
|
493
571
|
* @returns {string}
|
|
494
572
|
*/
|
|
495
|
-
export function
|
|
573
|
+
export function getSignerId(secret) {
|
|
496
574
|
let deferred3_0;
|
|
497
575
|
let deferred3_1;
|
|
498
576
|
try {
|
|
499
577
|
const ptr0 = passArray8ToWasm0(secret, wasm.__wbindgen_malloc);
|
|
500
578
|
const len0 = WASM_VECTOR_LEN;
|
|
501
|
-
const ret = wasm.
|
|
579
|
+
const ret = wasm.getSignerId(ptr0, len0);
|
|
502
580
|
var ptr2 = ret[0];
|
|
503
581
|
var len2 = ret[1];
|
|
504
582
|
if (ret[3]) {
|
|
@@ -514,29 +592,28 @@ export function get_signer_id(secret) {
|
|
|
514
592
|
}
|
|
515
593
|
|
|
516
594
|
/**
|
|
517
|
-
* Generate a new
|
|
518
|
-
* Returns 32 bytes of raw key material suitable for use with other
|
|
519
|
-
* This key can be reused for multiple Diffie-Hellman exchanges.
|
|
595
|
+
* Generate a new Ed25519 signing key using secure random number generation.
|
|
596
|
+
* Returns 32 bytes of raw key material suitable for use with other Ed25519 functions.
|
|
520
597
|
* @returns {Uint8Array}
|
|
521
598
|
*/
|
|
522
|
-
export function
|
|
523
|
-
const ret = wasm.
|
|
599
|
+
export function newEd25519SigningKey() {
|
|
600
|
+
const ret = wasm.newEd25519SigningKey();
|
|
524
601
|
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
525
602
|
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
526
603
|
return v1;
|
|
527
604
|
}
|
|
528
605
|
|
|
529
606
|
/**
|
|
530
|
-
* WASM-exposed function to derive an
|
|
531
|
-
* - `
|
|
532
|
-
* Returns 32 bytes of
|
|
533
|
-
* @param {Uint8Array}
|
|
607
|
+
* WASM-exposed function to derive an Ed25519 verifying key from a signing key.
|
|
608
|
+
* - `signing_key`: 32 bytes of signing key material
|
|
609
|
+
* Returns 32 bytes of verifying key material or throws JsError if key is invalid.
|
|
610
|
+
* @param {Uint8Array} signing_key
|
|
534
611
|
* @returns {Uint8Array}
|
|
535
612
|
*/
|
|
536
|
-
export function
|
|
537
|
-
const ptr0 = passArray8ToWasm0(
|
|
613
|
+
export function ed25519VerifyingKey(signing_key) {
|
|
614
|
+
const ptr0 = passArray8ToWasm0(signing_key, wasm.__wbindgen_malloc);
|
|
538
615
|
const len0 = WASM_VECTOR_LEN;
|
|
539
|
-
const ret = wasm.
|
|
616
|
+
const ret = wasm.ed25519VerifyingKey(ptr0, len0);
|
|
540
617
|
if (ret[3]) {
|
|
541
618
|
throw takeFromExternrefTable0(ret[2]);
|
|
542
619
|
}
|
|
@@ -546,20 +623,20 @@ export function x25519_public_key(private_key) {
|
|
|
546
623
|
}
|
|
547
624
|
|
|
548
625
|
/**
|
|
549
|
-
* WASM-exposed function to
|
|
550
|
-
* - `
|
|
551
|
-
* - `
|
|
552
|
-
* Returns
|
|
553
|
-
* @param {Uint8Array}
|
|
554
|
-
* @param {Uint8Array}
|
|
626
|
+
* WASM-exposed function to sign a message using Ed25519.
|
|
627
|
+
* - `signing_key`: 32 bytes of signing key material
|
|
628
|
+
* - `message`: Raw bytes to sign
|
|
629
|
+
* Returns 64 bytes of signature material or throws JsError if signing fails.
|
|
630
|
+
* @param {Uint8Array} signing_key
|
|
631
|
+
* @param {Uint8Array} message
|
|
555
632
|
* @returns {Uint8Array}
|
|
556
633
|
*/
|
|
557
|
-
export function
|
|
558
|
-
const ptr0 = passArray8ToWasm0(
|
|
634
|
+
export function ed25519Sign(signing_key, message) {
|
|
635
|
+
const ptr0 = passArray8ToWasm0(signing_key, wasm.__wbindgen_malloc);
|
|
559
636
|
const len0 = WASM_VECTOR_LEN;
|
|
560
|
-
const ptr1 = passArray8ToWasm0(
|
|
637
|
+
const ptr1 = passArray8ToWasm0(message, wasm.__wbindgen_malloc);
|
|
561
638
|
const len1 = WASM_VECTOR_LEN;
|
|
562
|
-
const ret = wasm.
|
|
639
|
+
const ret = wasm.ed25519Sign(ptr0, len0, ptr1, len1);
|
|
563
640
|
if (ret[3]) {
|
|
564
641
|
throw takeFromExternrefTable0(ret[2]);
|
|
565
642
|
}
|
|
@@ -569,251 +646,127 @@ export function x25519_diffie_hellman(private_key, public_key) {
|
|
|
569
646
|
}
|
|
570
647
|
|
|
571
648
|
/**
|
|
572
|
-
* WASM-exposed function to
|
|
573
|
-
* - `
|
|
574
|
-
*
|
|
575
|
-
*
|
|
576
|
-
*
|
|
577
|
-
|
|
578
|
-
export function get_sealer_id(secret) {
|
|
579
|
-
let deferred3_0;
|
|
580
|
-
let deferred3_1;
|
|
581
|
-
try {
|
|
582
|
-
const ptr0 = passArray8ToWasm0(secret, wasm.__wbindgen_malloc);
|
|
583
|
-
const len0 = WASM_VECTOR_LEN;
|
|
584
|
-
const ret = wasm.get_sealer_id(ptr0, len0);
|
|
585
|
-
var ptr2 = ret[0];
|
|
586
|
-
var len2 = ret[1];
|
|
587
|
-
if (ret[3]) {
|
|
588
|
-
ptr2 = 0; len2 = 0;
|
|
589
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
590
|
-
}
|
|
591
|
-
deferred3_0 = ptr2;
|
|
592
|
-
deferred3_1 = len2;
|
|
593
|
-
return getStringFromWasm0(ptr2, len2);
|
|
594
|
-
} finally {
|
|
595
|
-
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
|
|
599
|
-
/**
|
|
600
|
-
* WASM-exposed function for sealing a message using X25519 + XSalsa20-Poly1305.
|
|
601
|
-
* Provides authenticated encryption with perfect forward secrecy.
|
|
602
|
-
* - `message`: Raw bytes to seal
|
|
603
|
-
* - `sender_secret`: Base58-encoded sender's private key with "sealerSecret_z" prefix
|
|
604
|
-
* - `recipient_id`: Base58-encoded recipient's public key with "sealer_z" prefix
|
|
605
|
-
* - `nonce_material`: Raw bytes used to generate the nonce
|
|
606
|
-
* Returns sealed bytes or throws JsError if sealing fails.
|
|
649
|
+
* WASM-exposed function to verify an Ed25519 signature.
|
|
650
|
+
* - `verifying_key`: 32 bytes of verifying key material
|
|
651
|
+
* - `message`: Raw bytes that were signed
|
|
652
|
+
* - `signature`: 64 bytes of signature material
|
|
653
|
+
* Returns true if signature is valid, false otherwise, or throws JsError if verification fails.
|
|
654
|
+
* @param {Uint8Array} verifying_key
|
|
607
655
|
* @param {Uint8Array} message
|
|
608
|
-
* @param {
|
|
609
|
-
* @
|
|
610
|
-
* @param {Uint8Array} nonce_material
|
|
611
|
-
* @returns {Uint8Array}
|
|
656
|
+
* @param {Uint8Array} signature
|
|
657
|
+
* @returns {boolean}
|
|
612
658
|
*/
|
|
613
|
-
export function
|
|
614
|
-
const ptr0 = passArray8ToWasm0(
|
|
659
|
+
export function ed25519Verify(verifying_key, message, signature) {
|
|
660
|
+
const ptr0 = passArray8ToWasm0(verifying_key, wasm.__wbindgen_malloc);
|
|
615
661
|
const len0 = WASM_VECTOR_LEN;
|
|
616
|
-
const ptr1 =
|
|
662
|
+
const ptr1 = passArray8ToWasm0(message, wasm.__wbindgen_malloc);
|
|
617
663
|
const len1 = WASM_VECTOR_LEN;
|
|
618
|
-
const ptr2 =
|
|
664
|
+
const ptr2 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
619
665
|
const len2 = WASM_VECTOR_LEN;
|
|
620
|
-
const
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
if (ret[3]) {
|
|
624
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
666
|
+
const ret = wasm.ed25519Verify(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
667
|
+
if (ret[2]) {
|
|
668
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
625
669
|
}
|
|
626
|
-
|
|
627
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
628
|
-
return v5;
|
|
670
|
+
return ret[0] !== 0;
|
|
629
671
|
}
|
|
630
672
|
|
|
631
673
|
/**
|
|
632
|
-
* WASM-exposed function
|
|
633
|
-
*
|
|
634
|
-
*
|
|
635
|
-
*
|
|
636
|
-
* - `sender_id`: Base58-encoded sender's public key with "sealer_z" prefix
|
|
637
|
-
* - `nonce_material`: Raw bytes used to generate the nonce (must match sealing)
|
|
638
|
-
* Returns unsealed bytes or throws JsError if unsealing fails.
|
|
639
|
-
* @param {Uint8Array} sealed_message
|
|
640
|
-
* @param {string} recipient_secret
|
|
641
|
-
* @param {string} sender_id
|
|
642
|
-
* @param {Uint8Array} nonce_material
|
|
674
|
+
* WASM-exposed function to validate and copy Ed25519 signing key bytes.
|
|
675
|
+
* - `bytes`: 32 bytes of signing key material to validate
|
|
676
|
+
* Returns the same 32 bytes if valid or throws JsError if invalid.
|
|
677
|
+
* @param {Uint8Array} bytes
|
|
643
678
|
* @returns {Uint8Array}
|
|
644
679
|
*/
|
|
645
|
-
export function
|
|
646
|
-
const ptr0 = passArray8ToWasm0(
|
|
680
|
+
export function ed25519SigningKeyFromBytes(bytes) {
|
|
681
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
647
682
|
const len0 = WASM_VECTOR_LEN;
|
|
648
|
-
const
|
|
649
|
-
const len1 = WASM_VECTOR_LEN;
|
|
650
|
-
const ptr2 = passStringToWasm0(sender_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
651
|
-
const len2 = WASM_VECTOR_LEN;
|
|
652
|
-
const ptr3 = passArray8ToWasm0(nonce_material, wasm.__wbindgen_malloc);
|
|
653
|
-
const len3 = WASM_VECTOR_LEN;
|
|
654
|
-
const ret = wasm.unseal(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
683
|
+
const ret = wasm.ed25519SigningKeyFromBytes(ptr0, len0);
|
|
655
684
|
if (ret[3]) {
|
|
656
685
|
throw takeFromExternrefTable0(ret[2]);
|
|
657
686
|
}
|
|
658
|
-
var v5 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
659
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
660
|
-
return v5;
|
|
661
|
-
}
|
|
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
687
|
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
676
688
|
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
677
689
|
return v2;
|
|
678
690
|
}
|
|
679
691
|
|
|
680
692
|
/**
|
|
681
|
-
*
|
|
682
|
-
* - `
|
|
683
|
-
* Returns 32 bytes of
|
|
684
|
-
*
|
|
685
|
-
* @param {Uint8Array} data
|
|
693
|
+
* WASM-exposed function to derive the public key from an Ed25519 signing key.
|
|
694
|
+
* - `signing_key`: 32 bytes of signing key material
|
|
695
|
+
* Returns 32 bytes of public key material or throws JsError if key is invalid.
|
|
696
|
+
* @param {Uint8Array} signing_key
|
|
686
697
|
* @returns {Uint8Array}
|
|
687
698
|
*/
|
|
688
|
-
export function
|
|
689
|
-
const ptr0 = passArray8ToWasm0(
|
|
699
|
+
export function ed25519SigningKeyToPublic(signing_key) {
|
|
700
|
+
const ptr0 = passArray8ToWasm0(signing_key, wasm.__wbindgen_malloc);
|
|
690
701
|
const len0 = WASM_VECTOR_LEN;
|
|
691
|
-
const ret = wasm.
|
|
702
|
+
const ret = wasm.ed25519SigningKeyToPublic(ptr0, len0);
|
|
703
|
+
if (ret[3]) {
|
|
704
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
705
|
+
}
|
|
692
706
|
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
693
707
|
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
694
708
|
return v2;
|
|
695
709
|
}
|
|
696
710
|
|
|
697
711
|
/**
|
|
698
|
-
*
|
|
699
|
-
* - `
|
|
700
|
-
* - `
|
|
701
|
-
* Returns
|
|
702
|
-
*
|
|
703
|
-
* @param {Uint8Array}
|
|
704
|
-
* @param {Uint8Array} context
|
|
712
|
+
* WASM-exposed function to sign a message with an Ed25519 signing key.
|
|
713
|
+
* - `signing_key`: 32 bytes of signing key material
|
|
714
|
+
* - `message`: Raw bytes to sign
|
|
715
|
+
* Returns 64 bytes of signature material or throws JsError if signing fails.
|
|
716
|
+
* @param {Uint8Array} signing_key
|
|
717
|
+
* @param {Uint8Array} message
|
|
705
718
|
* @returns {Uint8Array}
|
|
706
719
|
*/
|
|
707
|
-
export function
|
|
708
|
-
const ptr0 = passArray8ToWasm0(
|
|
720
|
+
export function ed25519SigningKeySign(signing_key, message) {
|
|
721
|
+
const ptr0 = passArray8ToWasm0(signing_key, wasm.__wbindgen_malloc);
|
|
709
722
|
const len0 = WASM_VECTOR_LEN;
|
|
710
|
-
const ptr1 = passArray8ToWasm0(
|
|
723
|
+
const ptr1 = passArray8ToWasm0(message, wasm.__wbindgen_malloc);
|
|
711
724
|
const len1 = WASM_VECTOR_LEN;
|
|
712
|
-
const ret = wasm.
|
|
725
|
+
const ret = wasm.ed25519SigningKeySign(ptr0, len0, ptr1, len1);
|
|
726
|
+
if (ret[3]) {
|
|
727
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
728
|
+
}
|
|
713
729
|
var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
714
730
|
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
715
731
|
return v3;
|
|
716
732
|
}
|
|
717
733
|
|
|
718
734
|
/**
|
|
719
|
-
*
|
|
720
|
-
*
|
|
721
|
-
*
|
|
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
|
-
|
|
765
|
-
/**
|
|
766
|
-
* WASM-exposed function to encrypt bytes with a key secret and nonce material.
|
|
767
|
-
* - `value`: The raw bytes to encrypt
|
|
768
|
-
* - `key_secret`: A base58-encoded key secret with "keySecret_z" prefix
|
|
769
|
-
* - `nonce_material`: Raw bytes used to generate the nonce
|
|
770
|
-
* Returns the encrypted bytes or throws a JsError if encryption fails.
|
|
771
|
-
* @param {Uint8Array} value
|
|
772
|
-
* @param {string} key_secret
|
|
773
|
-
* @param {Uint8Array} nonce_material
|
|
735
|
+
* WASM-exposed function to validate and copy Ed25519 verifying key bytes.
|
|
736
|
+
* - `bytes`: 32 bytes of verifying key material to validate
|
|
737
|
+
* Returns the same 32 bytes if valid or throws JsError if invalid.
|
|
738
|
+
* @param {Uint8Array} bytes
|
|
774
739
|
* @returns {Uint8Array}
|
|
775
740
|
*/
|
|
776
|
-
export function
|
|
777
|
-
const ptr0 = passArray8ToWasm0(
|
|
741
|
+
export function ed25519VerifyingKeyFromBytes(bytes) {
|
|
742
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
778
743
|
const len0 = WASM_VECTOR_LEN;
|
|
779
|
-
const
|
|
780
|
-
const len1 = WASM_VECTOR_LEN;
|
|
781
|
-
const ptr2 = passArray8ToWasm0(nonce_material, wasm.__wbindgen_malloc);
|
|
782
|
-
const len2 = WASM_VECTOR_LEN;
|
|
783
|
-
const ret = wasm.encrypt(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
744
|
+
const ret = wasm.ed25519VerifyingKeyFromBytes(ptr0, len0);
|
|
784
745
|
if (ret[3]) {
|
|
785
746
|
throw takeFromExternrefTable0(ret[2]);
|
|
786
747
|
}
|
|
787
|
-
var
|
|
748
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
788
749
|
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
789
|
-
return
|
|
750
|
+
return v2;
|
|
790
751
|
}
|
|
791
752
|
|
|
792
753
|
/**
|
|
793
|
-
* WASM-exposed function to
|
|
794
|
-
* - `
|
|
795
|
-
*
|
|
796
|
-
*
|
|
797
|
-
* Returns the decrypted bytes or throws a JsError if decryption fails.
|
|
798
|
-
* @param {Uint8Array} ciphertext
|
|
799
|
-
* @param {string} key_secret
|
|
800
|
-
* @param {Uint8Array} nonce_material
|
|
754
|
+
* WASM-exposed function to validate and copy Ed25519 signature bytes.
|
|
755
|
+
* - `bytes`: 64 bytes of signature material to validate
|
|
756
|
+
* Returns the same 64 bytes if valid or throws JsError if invalid.
|
|
757
|
+
* @param {Uint8Array} bytes
|
|
801
758
|
* @returns {Uint8Array}
|
|
802
759
|
*/
|
|
803
|
-
export function
|
|
804
|
-
const ptr0 = passArray8ToWasm0(
|
|
760
|
+
export function ed25519SignatureFromBytes(bytes) {
|
|
761
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
805
762
|
const len0 = WASM_VECTOR_LEN;
|
|
806
|
-
const
|
|
807
|
-
const len1 = WASM_VECTOR_LEN;
|
|
808
|
-
const ptr2 = passArray8ToWasm0(nonce_material, wasm.__wbindgen_malloc);
|
|
809
|
-
const len2 = WASM_VECTOR_LEN;
|
|
810
|
-
const ret = wasm.decrypt(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
763
|
+
const ret = wasm.ed25519SignatureFromBytes(ptr0, len0);
|
|
811
764
|
if (ret[3]) {
|
|
812
765
|
throw takeFromExternrefTable0(ret[2]);
|
|
813
766
|
}
|
|
814
|
-
var
|
|
767
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
815
768
|
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
816
|
-
return
|
|
769
|
+
return v2;
|
|
817
770
|
}
|
|
818
771
|
|
|
819
772
|
const Blake3HasherFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
@@ -842,7 +795,7 @@ export class Blake3Hasher {
|
|
|
842
795
|
wasm.__wbg_blake3hasher_free(ptr, 0);
|
|
843
796
|
}
|
|
844
797
|
constructor() {
|
|
845
|
-
const ret = wasm.
|
|
798
|
+
const ret = wasm.blake3hasher_new();
|
|
846
799
|
this.__wbg_ptr = ret >>> 0;
|
|
847
800
|
Blake3HasherFinalization.register(this, this.__wbg_ptr, this);
|
|
848
801
|
return this;
|
|
@@ -853,7 +806,7 @@ export class Blake3Hasher {
|
|
|
853
806
|
update(data) {
|
|
854
807
|
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
855
808
|
const len0 = WASM_VECTOR_LEN;
|
|
856
|
-
wasm.
|
|
809
|
+
wasm.blake3hasher_update(this.__wbg_ptr, ptr0, len0);
|
|
857
810
|
}
|
|
858
811
|
/**
|
|
859
812
|
* @returns {Uint8Array}
|