@muhkoo/connect 0.1.0-alpha.1 → 0.1.0-alpha.2
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/dist/browser/index.js +21 -21
- package/dist/browser/index.js.map +1 -1
- package/dist/server/index.js +21 -21
- package/dist/server/index.js.map +1 -1
- package/dist/workers/index.js +21 -21
- package/dist/workers/index.js.map +1 -1
- package/package.json +8 -2
package/dist/workers/index.js
CHANGED
|
@@ -2366,28 +2366,28 @@ async function verifyGroth16(wasmInstance, memory, initialPFree, verificationKey
|
|
|
2366
2366
|
if (signal >= r)
|
|
2367
2367
|
return false;
|
|
2368
2368
|
}
|
|
2369
|
-
const exports
|
|
2369
|
+
const exports = wasmInstance.exports;
|
|
2370
2370
|
const u8 = new Uint8Array(memory.buffer);
|
|
2371
2371
|
const u32 = new Uint32Array(memory.buffer);
|
|
2372
2372
|
// Reset the WASM allocator's heap pointer between invocations
|
|
2373
2373
|
u32[0] = initialPFree;
|
|
2374
|
-
const g1m_add = exports
|
|
2375
|
-
const g1m_timesScalar = exports
|
|
2376
|
-
const g1m_neg = exports
|
|
2377
|
-
const g1m_inCurve = exports
|
|
2378
|
-
const g2m_inCurve = exports
|
|
2379
|
-
const ftm_one = exports
|
|
2380
|
-
const bn128_pairingEq4 = exports
|
|
2374
|
+
const g1m_add = exports["g1m_add"];
|
|
2375
|
+
const g1m_timesScalar = exports["g1m_timesScalar"];
|
|
2376
|
+
const g1m_neg = exports["g1m_neg"];
|
|
2377
|
+
const g1m_inCurve = exports["g1m_inCurve"];
|
|
2378
|
+
const g2m_inCurve = exports["g2m_inCurve"];
|
|
2379
|
+
const ftm_one = exports["ftm_one"];
|
|
2380
|
+
const bn128_pairingEq4 = exports["bn128_pairingEq4"];
|
|
2381
2381
|
// Compute vk_x = IC[0] + sum(IC[i+1] * signal[i])
|
|
2382
2382
|
const pVkX = alloc(u32, g1size);
|
|
2383
2383
|
const pIC0 = alloc(u32, g1size);
|
|
2384
|
-
writeG1Point(u8, pIC0, vk.IC[0], exports
|
|
2384
|
+
writeG1Point(u8, pIC0, vk.IC[0], exports);
|
|
2385
2385
|
u8.set(u8.slice(pIC0, pIC0 + g1size), pVkX);
|
|
2386
2386
|
const pTemp = alloc(u32, g1size);
|
|
2387
2387
|
const pScalar = alloc(u32, n8r);
|
|
2388
2388
|
for (let i = 0; i < signals.length; i++) {
|
|
2389
2389
|
const pICi = alloc(u32, g1size);
|
|
2390
|
-
writeG1Point(u8, pICi, vk.IC[i + 1], exports
|
|
2390
|
+
writeG1Point(u8, pICi, vk.IC[i + 1], exports);
|
|
2391
2391
|
u8.set(bigIntToLE(signals[i], n8r), pScalar);
|
|
2392
2392
|
g1m_timesScalar(pICi, pScalar, n8r, pTemp);
|
|
2393
2393
|
const pSum = alloc(u32, g1size);
|
|
@@ -2399,9 +2399,9 @@ async function verifyGroth16(wasmInstance, memory, initialPFree, verificationKey
|
|
|
2399
2399
|
const pNegA = alloc(u32, g1size);
|
|
2400
2400
|
const pB = alloc(u32, g2size);
|
|
2401
2401
|
const pC = alloc(u32, g1size);
|
|
2402
|
-
writeG1Point(u8, pA, p.pi_a, exports
|
|
2403
|
-
writeG2Point(u8, pB, p.pi_b, exports
|
|
2404
|
-
writeG1Point(u8, pC, p.pi_c, exports
|
|
2402
|
+
writeG1Point(u8, pA, p.pi_a, exports);
|
|
2403
|
+
writeG2Point(u8, pB, p.pi_b, exports);
|
|
2404
|
+
writeG1Point(u8, pC, p.pi_c, exports);
|
|
2405
2405
|
// Subgroup / on-curve checks
|
|
2406
2406
|
if (!g1m_inCurve(pA))
|
|
2407
2407
|
return false;
|
|
@@ -2415,10 +2415,10 @@ async function verifyGroth16(wasmInstance, memory, initialPFree, verificationKey
|
|
|
2415
2415
|
const pBeta = alloc(u32, g2size);
|
|
2416
2416
|
const pGamma = alloc(u32, g2size);
|
|
2417
2417
|
const pDelta = alloc(u32, g2size);
|
|
2418
|
-
writeG1Point(u8, pAlpha, vk.vk_alpha_1, exports
|
|
2419
|
-
writeG2Point(u8, pBeta, vk.vk_beta_2, exports
|
|
2420
|
-
writeG2Point(u8, pGamma, vk.vk_gamma_2, exports
|
|
2421
|
-
writeG2Point(u8, pDelta, vk.vk_delta_2, exports
|
|
2418
|
+
writeG1Point(u8, pAlpha, vk.vk_alpha_1, exports);
|
|
2419
|
+
writeG2Point(u8, pBeta, vk.vk_beta_2, exports);
|
|
2420
|
+
writeG2Point(u8, pGamma, vk.vk_gamma_2, exports);
|
|
2421
|
+
writeG2Point(u8, pDelta, vk.vk_delta_2, exports);
|
|
2422
2422
|
// Target: F12 element representing 1
|
|
2423
2423
|
const pOne = alloc(u32, ftsize);
|
|
2424
2424
|
ftm_one(pOne);
|
|
@@ -2486,19 +2486,19 @@ function validateG1InField(point) {
|
|
|
2486
2486
|
const y = typeof point[1] === "bigint" ? point[1] : BigInt(String(point[1]));
|
|
2487
2487
|
return x < q && y < q;
|
|
2488
2488
|
}
|
|
2489
|
-
function writeG1Point(u8, offset, point, exports
|
|
2489
|
+
function writeG1Point(u8, offset, point, exports) {
|
|
2490
2490
|
const x = point[0];
|
|
2491
2491
|
const y = point[1];
|
|
2492
2492
|
const z = point.length > 2 ? point[2] : 1n;
|
|
2493
2493
|
u8.set(bigIntToLE(x, f1size), offset);
|
|
2494
2494
|
u8.set(bigIntToLE(y, f1size), offset + f1size);
|
|
2495
2495
|
u8.set(bigIntToLE(z, f1size), offset + 2 * f1size);
|
|
2496
|
-
const f1m_toMontgomery = exports
|
|
2496
|
+
const f1m_toMontgomery = exports["f1m_toMontgomery"];
|
|
2497
2497
|
f1m_toMontgomery(offset, offset);
|
|
2498
2498
|
f1m_toMontgomery(offset + f1size, offset + f1size);
|
|
2499
2499
|
f1m_toMontgomery(offset + 2 * f1size, offset + 2 * f1size);
|
|
2500
2500
|
}
|
|
2501
|
-
function writeG2Point(u8, offset, point, exports
|
|
2501
|
+
function writeG2Point(u8, offset, point, exports) {
|
|
2502
2502
|
const x = point[0];
|
|
2503
2503
|
const y = point[1];
|
|
2504
2504
|
const z = point.length > 2 ? point[2] : [1n, 0n];
|
|
@@ -2508,7 +2508,7 @@ function writeG2Point(u8, offset, point, exports$1) {
|
|
|
2508
2508
|
u8.set(bigIntToLE(y[1], f1size), offset + 3 * f1size);
|
|
2509
2509
|
u8.set(bigIntToLE(z[0], f1size), offset + 4 * f1size);
|
|
2510
2510
|
u8.set(bigIntToLE(z[1], f1size), offset + 5 * f1size);
|
|
2511
|
-
const f1m_toMontgomery = exports
|
|
2511
|
+
const f1m_toMontgomery = exports["f1m_toMontgomery"];
|
|
2512
2512
|
for (let i = 0; i < 6; i++) {
|
|
2513
2513
|
f1m_toMontgomery(offset + i * f1size, offset + i * f1size);
|
|
2514
2514
|
}
|