@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/browser/index.js
CHANGED
|
@@ -2856,28 +2856,28 @@ async function verifyGroth16(wasmInstance, memory, initialPFree, verificationKey
|
|
|
2856
2856
|
if (signal >= r)
|
|
2857
2857
|
return false;
|
|
2858
2858
|
}
|
|
2859
|
-
const exports
|
|
2859
|
+
const exports = wasmInstance.exports;
|
|
2860
2860
|
const u8 = new Uint8Array(memory.buffer);
|
|
2861
2861
|
const u32 = new Uint32Array(memory.buffer);
|
|
2862
2862
|
// Reset the WASM allocator's heap pointer between invocations
|
|
2863
2863
|
u32[0] = initialPFree;
|
|
2864
|
-
const g1m_add = exports
|
|
2865
|
-
const g1m_timesScalar = exports
|
|
2866
|
-
const g1m_neg = exports
|
|
2867
|
-
const g1m_inCurve = exports
|
|
2868
|
-
const g2m_inCurve = exports
|
|
2869
|
-
const ftm_one = exports
|
|
2870
|
-
const bn128_pairingEq4 = exports
|
|
2864
|
+
const g1m_add = exports["g1m_add"];
|
|
2865
|
+
const g1m_timesScalar = exports["g1m_timesScalar"];
|
|
2866
|
+
const g1m_neg = exports["g1m_neg"];
|
|
2867
|
+
const g1m_inCurve = exports["g1m_inCurve"];
|
|
2868
|
+
const g2m_inCurve = exports["g2m_inCurve"];
|
|
2869
|
+
const ftm_one = exports["ftm_one"];
|
|
2870
|
+
const bn128_pairingEq4 = exports["bn128_pairingEq4"];
|
|
2871
2871
|
// Compute vk_x = IC[0] + sum(IC[i+1] * signal[i])
|
|
2872
2872
|
const pVkX = alloc(u32, g1size);
|
|
2873
2873
|
const pIC0 = alloc(u32, g1size);
|
|
2874
|
-
writeG1Point(u8, pIC0, vk.IC[0], exports
|
|
2874
|
+
writeG1Point(u8, pIC0, vk.IC[0], exports);
|
|
2875
2875
|
u8.set(u8.slice(pIC0, pIC0 + g1size), pVkX);
|
|
2876
2876
|
const pTemp = alloc(u32, g1size);
|
|
2877
2877
|
const pScalar = alloc(u32, n8r);
|
|
2878
2878
|
for (let i = 0; i < signals.length; i++) {
|
|
2879
2879
|
const pICi = alloc(u32, g1size);
|
|
2880
|
-
writeG1Point(u8, pICi, vk.IC[i + 1], exports
|
|
2880
|
+
writeG1Point(u8, pICi, vk.IC[i + 1], exports);
|
|
2881
2881
|
u8.set(bigIntToLE(signals[i], n8r), pScalar);
|
|
2882
2882
|
g1m_timesScalar(pICi, pScalar, n8r, pTemp);
|
|
2883
2883
|
const pSum = alloc(u32, g1size);
|
|
@@ -2889,9 +2889,9 @@ async function verifyGroth16(wasmInstance, memory, initialPFree, verificationKey
|
|
|
2889
2889
|
const pNegA = alloc(u32, g1size);
|
|
2890
2890
|
const pB = alloc(u32, g2size);
|
|
2891
2891
|
const pC = alloc(u32, g1size);
|
|
2892
|
-
writeG1Point(u8, pA, p.pi_a, exports
|
|
2893
|
-
writeG2Point(u8, pB, p.pi_b, exports
|
|
2894
|
-
writeG1Point(u8, pC, p.pi_c, exports
|
|
2892
|
+
writeG1Point(u8, pA, p.pi_a, exports);
|
|
2893
|
+
writeG2Point(u8, pB, p.pi_b, exports);
|
|
2894
|
+
writeG1Point(u8, pC, p.pi_c, exports);
|
|
2895
2895
|
// Subgroup / on-curve checks
|
|
2896
2896
|
if (!g1m_inCurve(pA))
|
|
2897
2897
|
return false;
|
|
@@ -2905,10 +2905,10 @@ async function verifyGroth16(wasmInstance, memory, initialPFree, verificationKey
|
|
|
2905
2905
|
const pBeta = alloc(u32, g2size);
|
|
2906
2906
|
const pGamma = alloc(u32, g2size);
|
|
2907
2907
|
const pDelta = alloc(u32, g2size);
|
|
2908
|
-
writeG1Point(u8, pAlpha, vk.vk_alpha_1, exports
|
|
2909
|
-
writeG2Point(u8, pBeta, vk.vk_beta_2, exports
|
|
2910
|
-
writeG2Point(u8, pGamma, vk.vk_gamma_2, exports
|
|
2911
|
-
writeG2Point(u8, pDelta, vk.vk_delta_2, exports
|
|
2908
|
+
writeG1Point(u8, pAlpha, vk.vk_alpha_1, exports);
|
|
2909
|
+
writeG2Point(u8, pBeta, vk.vk_beta_2, exports);
|
|
2910
|
+
writeG2Point(u8, pGamma, vk.vk_gamma_2, exports);
|
|
2911
|
+
writeG2Point(u8, pDelta, vk.vk_delta_2, exports);
|
|
2912
2912
|
// Target: F12 element representing 1
|
|
2913
2913
|
const pOne = alloc(u32, ftsize);
|
|
2914
2914
|
ftm_one(pOne);
|
|
@@ -2976,19 +2976,19 @@ function validateG1InField(point) {
|
|
|
2976
2976
|
const y = typeof point[1] === "bigint" ? point[1] : BigInt(String(point[1]));
|
|
2977
2977
|
return x < q && y < q;
|
|
2978
2978
|
}
|
|
2979
|
-
function writeG1Point(u8, offset, point, exports
|
|
2979
|
+
function writeG1Point(u8, offset, point, exports) {
|
|
2980
2980
|
const x = point[0];
|
|
2981
2981
|
const y = point[1];
|
|
2982
2982
|
const z = point.length > 2 ? point[2] : 1n;
|
|
2983
2983
|
u8.set(bigIntToLE(x, f1size), offset);
|
|
2984
2984
|
u8.set(bigIntToLE(y, f1size), offset + f1size);
|
|
2985
2985
|
u8.set(bigIntToLE(z, f1size), offset + 2 * f1size);
|
|
2986
|
-
const f1m_toMontgomery = exports
|
|
2986
|
+
const f1m_toMontgomery = exports["f1m_toMontgomery"];
|
|
2987
2987
|
f1m_toMontgomery(offset, offset);
|
|
2988
2988
|
f1m_toMontgomery(offset + f1size, offset + f1size);
|
|
2989
2989
|
f1m_toMontgomery(offset + 2 * f1size, offset + 2 * f1size);
|
|
2990
2990
|
}
|
|
2991
|
-
function writeG2Point(u8, offset, point, exports
|
|
2991
|
+
function writeG2Point(u8, offset, point, exports) {
|
|
2992
2992
|
const x = point[0];
|
|
2993
2993
|
const y = point[1];
|
|
2994
2994
|
const z = point.length > 2 ? point[2] : [1n, 0n];
|
|
@@ -2998,7 +2998,7 @@ function writeG2Point(u8, offset, point, exports$1) {
|
|
|
2998
2998
|
u8.set(bigIntToLE(y[1], f1size), offset + 3 * f1size);
|
|
2999
2999
|
u8.set(bigIntToLE(z[0], f1size), offset + 4 * f1size);
|
|
3000
3000
|
u8.set(bigIntToLE(z[1], f1size), offset + 5 * f1size);
|
|
3001
|
-
const f1m_toMontgomery = exports
|
|
3001
|
+
const f1m_toMontgomery = exports["f1m_toMontgomery"];
|
|
3002
3002
|
for (let i = 0; i < 6; i++) {
|
|
3003
3003
|
f1m_toMontgomery(offset + i * f1size, offset + i * f1size);
|
|
3004
3004
|
}
|