@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/server/index.js
CHANGED
|
@@ -5224,28 +5224,28 @@ async function verifyGroth16(wasmInstance, memory, initialPFree, verificationKey
|
|
|
5224
5224
|
if (signal >= r)
|
|
5225
5225
|
return false;
|
|
5226
5226
|
}
|
|
5227
|
-
const exports
|
|
5227
|
+
const exports = wasmInstance.exports;
|
|
5228
5228
|
const u8 = new Uint8Array(memory.buffer);
|
|
5229
5229
|
const u32 = new Uint32Array(memory.buffer);
|
|
5230
5230
|
// Reset the WASM allocator's heap pointer between invocations
|
|
5231
5231
|
u32[0] = initialPFree;
|
|
5232
|
-
const g1m_add = exports
|
|
5233
|
-
const g1m_timesScalar = exports
|
|
5234
|
-
const g1m_neg = exports
|
|
5235
|
-
const g1m_inCurve = exports
|
|
5236
|
-
const g2m_inCurve = exports
|
|
5237
|
-
const ftm_one = exports
|
|
5238
|
-
const bn128_pairingEq4 = exports
|
|
5232
|
+
const g1m_add = exports["g1m_add"];
|
|
5233
|
+
const g1m_timesScalar = exports["g1m_timesScalar"];
|
|
5234
|
+
const g1m_neg = exports["g1m_neg"];
|
|
5235
|
+
const g1m_inCurve = exports["g1m_inCurve"];
|
|
5236
|
+
const g2m_inCurve = exports["g2m_inCurve"];
|
|
5237
|
+
const ftm_one = exports["ftm_one"];
|
|
5238
|
+
const bn128_pairingEq4 = exports["bn128_pairingEq4"];
|
|
5239
5239
|
// Compute vk_x = IC[0] + sum(IC[i+1] * signal[i])
|
|
5240
5240
|
const pVkX = alloc(u32, g1size);
|
|
5241
5241
|
const pIC0 = alloc(u32, g1size);
|
|
5242
|
-
writeG1Point(u8, pIC0, vk.IC[0], exports
|
|
5242
|
+
writeG1Point(u8, pIC0, vk.IC[0], exports);
|
|
5243
5243
|
u8.set(u8.slice(pIC0, pIC0 + g1size), pVkX);
|
|
5244
5244
|
const pTemp = alloc(u32, g1size);
|
|
5245
5245
|
const pScalar = alloc(u32, n8r);
|
|
5246
5246
|
for (let i = 0; i < signals.length; i++) {
|
|
5247
5247
|
const pICi = alloc(u32, g1size);
|
|
5248
|
-
writeG1Point(u8, pICi, vk.IC[i + 1], exports
|
|
5248
|
+
writeG1Point(u8, pICi, vk.IC[i + 1], exports);
|
|
5249
5249
|
u8.set(bigIntToLE(signals[i], n8r), pScalar);
|
|
5250
5250
|
g1m_timesScalar(pICi, pScalar, n8r, pTemp);
|
|
5251
5251
|
const pSum = alloc(u32, g1size);
|
|
@@ -5257,9 +5257,9 @@ async function verifyGroth16(wasmInstance, memory, initialPFree, verificationKey
|
|
|
5257
5257
|
const pNegA = alloc(u32, g1size);
|
|
5258
5258
|
const pB = alloc(u32, g2size);
|
|
5259
5259
|
const pC = alloc(u32, g1size);
|
|
5260
|
-
writeG1Point(u8, pA, p.pi_a, exports
|
|
5261
|
-
writeG2Point(u8, pB, p.pi_b, exports
|
|
5262
|
-
writeG1Point(u8, pC, p.pi_c, exports
|
|
5260
|
+
writeG1Point(u8, pA, p.pi_a, exports);
|
|
5261
|
+
writeG2Point(u8, pB, p.pi_b, exports);
|
|
5262
|
+
writeG1Point(u8, pC, p.pi_c, exports);
|
|
5263
5263
|
// Subgroup / on-curve checks
|
|
5264
5264
|
if (!g1m_inCurve(pA))
|
|
5265
5265
|
return false;
|
|
@@ -5273,10 +5273,10 @@ async function verifyGroth16(wasmInstance, memory, initialPFree, verificationKey
|
|
|
5273
5273
|
const pBeta = alloc(u32, g2size);
|
|
5274
5274
|
const pGamma = alloc(u32, g2size);
|
|
5275
5275
|
const pDelta = alloc(u32, g2size);
|
|
5276
|
-
writeG1Point(u8, pAlpha, vk.vk_alpha_1, exports
|
|
5277
|
-
writeG2Point(u8, pBeta, vk.vk_beta_2, exports
|
|
5278
|
-
writeG2Point(u8, pGamma, vk.vk_gamma_2, exports
|
|
5279
|
-
writeG2Point(u8, pDelta, vk.vk_delta_2, exports
|
|
5276
|
+
writeG1Point(u8, pAlpha, vk.vk_alpha_1, exports);
|
|
5277
|
+
writeG2Point(u8, pBeta, vk.vk_beta_2, exports);
|
|
5278
|
+
writeG2Point(u8, pGamma, vk.vk_gamma_2, exports);
|
|
5279
|
+
writeG2Point(u8, pDelta, vk.vk_delta_2, exports);
|
|
5280
5280
|
// Target: F12 element representing 1
|
|
5281
5281
|
const pOne = alloc(u32, ftsize);
|
|
5282
5282
|
ftm_one(pOne);
|
|
@@ -5344,19 +5344,19 @@ function validateG1InField(point) {
|
|
|
5344
5344
|
const y = typeof point[1] === "bigint" ? point[1] : BigInt(String(point[1]));
|
|
5345
5345
|
return x < q && y < q;
|
|
5346
5346
|
}
|
|
5347
|
-
function writeG1Point(u8, offset, point, exports
|
|
5347
|
+
function writeG1Point(u8, offset, point, exports) {
|
|
5348
5348
|
const x = point[0];
|
|
5349
5349
|
const y = point[1];
|
|
5350
5350
|
const z = point.length > 2 ? point[2] : 1n;
|
|
5351
5351
|
u8.set(bigIntToLE(x, f1size), offset);
|
|
5352
5352
|
u8.set(bigIntToLE(y, f1size), offset + f1size);
|
|
5353
5353
|
u8.set(bigIntToLE(z, f1size), offset + 2 * f1size);
|
|
5354
|
-
const f1m_toMontgomery = exports
|
|
5354
|
+
const f1m_toMontgomery = exports["f1m_toMontgomery"];
|
|
5355
5355
|
f1m_toMontgomery(offset, offset);
|
|
5356
5356
|
f1m_toMontgomery(offset + f1size, offset + f1size);
|
|
5357
5357
|
f1m_toMontgomery(offset + 2 * f1size, offset + 2 * f1size);
|
|
5358
5358
|
}
|
|
5359
|
-
function writeG2Point(u8, offset, point, exports
|
|
5359
|
+
function writeG2Point(u8, offset, point, exports) {
|
|
5360
5360
|
const x = point[0];
|
|
5361
5361
|
const y = point[1];
|
|
5362
5362
|
const z = point.length > 2 ? point[2] : [1n, 0n];
|
|
@@ -5366,7 +5366,7 @@ function writeG2Point(u8, offset, point, exports$1) {
|
|
|
5366
5366
|
u8.set(bigIntToLE(y[1], f1size), offset + 3 * f1size);
|
|
5367
5367
|
u8.set(bigIntToLE(z[0], f1size), offset + 4 * f1size);
|
|
5368
5368
|
u8.set(bigIntToLE(z[1], f1size), offset + 5 * f1size);
|
|
5369
|
-
const f1m_toMontgomery = exports
|
|
5369
|
+
const f1m_toMontgomery = exports["f1m_toMontgomery"];
|
|
5370
5370
|
for (let i = 0; i < 6; i++) {
|
|
5371
5371
|
f1m_toMontgomery(offset + i * f1size, offset + i * f1size);
|
|
5372
5372
|
}
|