@nihilium/client-sdk 0.1.1 → 0.2.0
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.esm-kreqNYRZ-7qAQ13Pg.js +16272 -0
- package/dist/{browser/browser.esm-kreqNYRZ-CV3K9CfO-I-qnoSbY.mjs → browser.esm-kreqNYRZ-CV3K9CfO-Crj74K-4.js} +1 -1
- package/dist/index-3PKMWW6b.js +48913 -0
- package/dist/{browser/index-CaU6sT7E-DPVApZD5.mjs → index-DEtC2xfH-DOqvYJY5.js} +80 -79
- package/dist/index-DFD-0QrS-CQSN52v_.js +1552 -0
- package/dist/index-DFD-0QrS-T8cg-3OU-Dqbi8PAZ.js +1551 -0
- package/dist/index.d.ts +7064 -10
- package/dist/index.mjs +39 -0
- package/dist/{browser/index-BbrmIoGc.mjs → types-C-XvYweP.js} +69257 -88210
- package/dist/types.d.ts +989 -0
- package/dist/types.mjs +29 -0
- package/package.json +19 -12
- package/dist/api-endpoints/index.d.ts +0 -7
- package/dist/api-endpoints/index.js +0 -7
- package/dist/browser/index.es.js +0 -40
- package/dist/browser/index.umd.js +0 -614
- package/dist/index.js +0 -51
- package/dist/lib/endpoint-selection.d.ts +0 -14
- package/dist/lib/endpoint-selection.js +0 -79
- package/dist/lib/nihiliumapi.d.ts +0 -19
- package/dist/lib/nihiliumapi.js +0 -49
- package/dist/lib/server-client.d.ts +0 -7
- package/dist/lib/server-client.js +0 -31
- package/dist/lib/types.d.ts +0 -12
- package/dist/lib/types.js +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { X as Dt, B as Ct } from "./types-C-XvYweP.js";
|
|
2
|
+
import { b as Lt } from "./index-3PKMWW6b.js";
|
|
3
|
+
var I = Dt();
|
|
3
4
|
/**
|
|
4
5
|
* @module @zk-kit/utils
|
|
5
6
|
* @version 1.2.1
|
|
@@ -22,19 +23,19 @@ const Zt = [
|
|
|
22
23
|
"bignumber",
|
|
23
24
|
"bignumberish"
|
|
24
25
|
];
|
|
25
|
-
function
|
|
26
|
+
function mt(t) {
|
|
26
27
|
return typeof t == "number";
|
|
27
28
|
}
|
|
28
29
|
function Y(t) {
|
|
29
30
|
return typeof t == "string";
|
|
30
31
|
}
|
|
31
|
-
function
|
|
32
|
+
function Xt(t) {
|
|
32
33
|
return typeof t == "function";
|
|
33
34
|
}
|
|
34
35
|
function kt(t) {
|
|
35
36
|
return typeof t == "object";
|
|
36
37
|
}
|
|
37
|
-
function
|
|
38
|
+
function Vt(t) {
|
|
38
39
|
return kt(t) && Array.isArray(t);
|
|
39
40
|
}
|
|
40
41
|
function It(t) {
|
|
@@ -62,18 +63,18 @@ function Nt(t) {
|
|
|
62
63
|
return F(t) || tt(t);
|
|
63
64
|
}
|
|
64
65
|
function Gt(t) {
|
|
65
|
-
return
|
|
66
|
+
return mt(t) || F(t) || tt(t) || vt(t) || At(t) || It(t);
|
|
66
67
|
}
|
|
67
68
|
function Jt(t, e) {
|
|
68
69
|
switch (e) {
|
|
69
70
|
case "number":
|
|
70
|
-
return
|
|
71
|
+
return mt(t);
|
|
71
72
|
case "string":
|
|
72
73
|
return Y(t);
|
|
73
74
|
case "function":
|
|
74
|
-
return Vt(t);
|
|
75
|
-
case "Array":
|
|
76
75
|
return Xt(t);
|
|
76
|
+
case "Array":
|
|
77
|
+
return Vt(t);
|
|
77
78
|
case "Uint8Array":
|
|
78
79
|
return It(t);
|
|
79
80
|
case "Buffer":
|
|
@@ -351,7 +352,7 @@ function ie(t, e) {
|
|
|
351
352
|
const l = r.pow(r.mul(r.square(s), t), BigInt(2 ** (n - 1)));
|
|
352
353
|
if (r.eq(l, r._negone))
|
|
353
354
|
return null;
|
|
354
|
-
let c = n,
|
|
355
|
+
let c = n, w = r.mul(t, s), b = r.mul(w, s), g = o;
|
|
355
356
|
for (; !r.eq(b, r.one); ) {
|
|
356
357
|
let _ = r.square(b), k = 1;
|
|
357
358
|
for (; !r.eq(_, r.one); )
|
|
@@ -359,9 +360,9 @@ function ie(t, e) {
|
|
|
359
360
|
s = g;
|
|
360
361
|
for (let a = 0; a < c - k - 1; a += 1)
|
|
361
362
|
s = r.square(s);
|
|
362
|
-
g = r.square(s), b = r.mul(b, g),
|
|
363
|
+
g = r.square(s), b = r.mul(b, g), w = r.mul(w, s), c = k;
|
|
363
364
|
}
|
|
364
|
-
return r.geq(
|
|
365
|
+
return r.geq(w, r.zero) ? w : r.neg(w);
|
|
365
366
|
}
|
|
366
367
|
const J = BigInt("21888242871839275222246405745257275088548364400416034343698204186575808495617"), y = new $t(J), q = [
|
|
367
368
|
y.e(BigInt("5299619240641551281634865583518297030282874472190772894086521144482721001553")),
|
|
@@ -531,7 +532,7 @@ function Kt(t, e) {
|
|
|
531
532
|
if (!st(t))
|
|
532
533
|
throw new TypeError(`Parameter '${e}' is not a bignumber-ish`);
|
|
533
534
|
}
|
|
534
|
-
function
|
|
535
|
+
function M(t, e, r) {
|
|
535
536
|
for (const n of r)
|
|
536
537
|
if (!ge(n))
|
|
537
538
|
throw new Error(`Type '${n}' is not supported`);
|
|
@@ -554,15 +555,15 @@ function pe(t) {
|
|
|
554
555
|
return e.length % 2 !== 0 && (e = `0${e}`), e;
|
|
555
556
|
}
|
|
556
557
|
function ye(t) {
|
|
557
|
-
return
|
|
558
|
+
return M(t, "value", ["Buffer", "Uint8Array"]), BigInt(`0x${I.Buffer.from(t).toString("hex")}`);
|
|
558
559
|
}
|
|
559
560
|
function z(t) {
|
|
560
|
-
return
|
|
561
|
+
return M(t, "value", ["Buffer", "Uint8Array"]), BigInt(`0x${I.Buffer.from(t).reverse().toString("hex")}`);
|
|
561
562
|
}
|
|
562
563
|
function Ot(t) {
|
|
563
564
|
return ye(t);
|
|
564
565
|
}
|
|
565
|
-
function
|
|
566
|
+
function D(t, e) {
|
|
566
567
|
const r = pe(t), n = Math.ceil(r.length / 2);
|
|
567
568
|
if (e < n)
|
|
568
569
|
throw Error(`Size ${e} is too small, need at least ${n} bytes`);
|
|
@@ -589,7 +590,7 @@ function lt(t, e) {
|
|
|
589
590
|
function _e(t, e) {
|
|
590
591
|
return t * e;
|
|
591
592
|
}
|
|
592
|
-
function
|
|
593
|
+
function we(t) {
|
|
593
594
|
const e = [];
|
|
594
595
|
let r = t;
|
|
595
596
|
for (; r; )
|
|
@@ -752,7 +753,7 @@ class Be {
|
|
|
752
753
|
if (de(r))
|
|
753
754
|
return this.one;
|
|
754
755
|
r < 0n && (e = this.inv(e), r = -r);
|
|
755
|
-
const n =
|
|
756
|
+
const n = we(r);
|
|
756
757
|
if (n.length === 0)
|
|
757
758
|
return this.one;
|
|
758
759
|
let o = e;
|
|
@@ -761,7 +762,7 @@ class Be {
|
|
|
761
762
|
return o;
|
|
762
763
|
}
|
|
763
764
|
}
|
|
764
|
-
var at =
|
|
765
|
+
var at = Lt(), C, ht;
|
|
765
766
|
function jt() {
|
|
766
767
|
if (ht) return C;
|
|
767
768
|
ht = 1;
|
|
@@ -785,29 +786,29 @@ function jt() {
|
|
|
785
786
|
return (4294967296 + s).toString(16).substring(1);
|
|
786
787
|
}
|
|
787
788
|
function o(s, l, c) {
|
|
788
|
-
let
|
|
789
|
+
let w = `
|
|
789
790
|
` + s + " = ";
|
|
790
791
|
for (let b = 0; b < l.length; b += 2) {
|
|
791
792
|
if (c === 32)
|
|
792
|
-
|
|
793
|
+
w += n(l[b]).toUpperCase(), w += " ", w += n(l[b + 1]).toUpperCase();
|
|
793
794
|
else if (c === 64)
|
|
794
|
-
|
|
795
|
+
w += n(l[b + 1]).toUpperCase(), w += n(l[b]).toUpperCase();
|
|
795
796
|
else throw new Error("Invalid size " + c);
|
|
796
|
-
b % 6 === 4 ?
|
|
797
|
-
` + new Array(s.length + 4).join(" ") : b < l.length - 2 && (
|
|
797
|
+
b % 6 === 4 ? w += `
|
|
798
|
+
` + new Array(s.length + 4).join(" ") : b < l.length - 2 && (w += " ");
|
|
798
799
|
}
|
|
799
|
-
console.log(
|
|
800
|
+
console.log(w);
|
|
800
801
|
}
|
|
801
802
|
function h(s, l, c) {
|
|
802
|
-
let
|
|
803
|
+
let w = (/* @__PURE__ */ new Date()).getTime();
|
|
803
804
|
const b = new Uint8Array(l);
|
|
804
805
|
for (let _ = 0; _ < l; _++)
|
|
805
806
|
b[_] = _ % 256;
|
|
806
807
|
const g = (/* @__PURE__ */ new Date()).getTime();
|
|
807
|
-
console.log("Generated random input in " + (g -
|
|
808
|
+
console.log("Generated random input in " + (g - w) + "ms"), w = g;
|
|
808
809
|
for (let _ = 0; _ < c; _++) {
|
|
809
|
-
const k = s(b), a = (/* @__PURE__ */ new Date()).getTime(), d = a -
|
|
810
|
-
|
|
810
|
+
const k = s(b), a = (/* @__PURE__ */ new Date()).getTime(), d = a - w;
|
|
811
|
+
w = a, console.log("Hashed in " + d + "ms: " + k.substring(0, 20) + "..."), console.log(
|
|
811
812
|
Math.round(l / (1 << 20) / (d / 1e3) * 100) / 100 + " MB PER SECOND"
|
|
812
813
|
);
|
|
813
814
|
}
|
|
@@ -820,29 +821,29 @@ function jt() {
|
|
|
820
821
|
}, C;
|
|
821
822
|
}
|
|
822
823
|
var L, gt;
|
|
823
|
-
function
|
|
824
|
+
function me() {
|
|
824
825
|
if (gt) return L;
|
|
825
826
|
gt = 1;
|
|
826
827
|
const t = jt();
|
|
827
828
|
function e(i, p, u) {
|
|
828
829
|
const B = i[p] + i[u];
|
|
829
|
-
let
|
|
830
|
-
B >= 4294967296 &&
|
|
830
|
+
let m = i[p + 1] + i[u + 1];
|
|
831
|
+
B >= 4294967296 && m++, i[p] = B, i[p + 1] = m;
|
|
831
832
|
}
|
|
832
833
|
function r(i, p, u, B) {
|
|
833
|
-
let
|
|
834
|
-
u < 0 && (
|
|
834
|
+
let m = i[p] + u;
|
|
835
|
+
u < 0 && (m += 4294967296);
|
|
835
836
|
let A = i[p + 1] + B;
|
|
836
|
-
|
|
837
|
+
m >= 4294967296 && A++, i[p] = m, i[p + 1] = A;
|
|
837
838
|
}
|
|
838
839
|
function n(i, p) {
|
|
839
840
|
return i[p] ^ i[p + 1] << 8 ^ i[p + 2] << 16 ^ i[p + 3] << 24;
|
|
840
841
|
}
|
|
841
|
-
function o(i, p, u, B,
|
|
842
|
-
const Tt = m
|
|
842
|
+
function o(i, p, u, B, m, A) {
|
|
843
|
+
const Tt = w[m], Ft = w[m + 1], Ht = w[A], Mt = w[A + 1];
|
|
843
844
|
e(c, i, p), r(c, i, Tt, Ft);
|
|
844
845
|
let v = c[B] ^ c[i], U = c[B + 1] ^ c[i + 1];
|
|
845
|
-
c[B] = U, c[B + 1] = v, e(c, u, B), v = c[p] ^ c[u], U = c[p + 1] ^ c[u + 1], c[p] = v >>> 24 ^ U << 8, c[p + 1] = U >>> 24 ^ v << 8, e(c, i, p), r(c, i, Ht,
|
|
846
|
+
c[B] = U, c[B + 1] = v, e(c, u, B), v = c[p] ^ c[u], U = c[p + 1] ^ c[u + 1], c[p] = v >>> 24 ^ U << 8, c[p + 1] = U >>> 24 ^ v << 8, e(c, i, p), r(c, i, Ht, Mt), v = c[B] ^ c[i], U = c[B + 1] ^ c[i + 1], c[B] = v >>> 16 ^ U << 16, c[B + 1] = U >>> 16 ^ v << 16, e(c, u, B), v = c[p] ^ c[u], U = c[p + 1] ^ c[u + 1], c[p] = U >>> 31 ^ v << 1, c[p + 1] = v >>> 31 ^ U << 1;
|
|
846
847
|
}
|
|
847
848
|
const h = new Uint32Array([
|
|
848
849
|
4089235720,
|
|
@@ -1058,13 +1059,13 @@ function we() {
|
|
|
1058
1059
|
s.map(function(i) {
|
|
1059
1060
|
return i * 2;
|
|
1060
1061
|
})
|
|
1061
|
-
), c = new Uint32Array(32),
|
|
1062
|
+
), c = new Uint32Array(32), w = new Uint32Array(32);
|
|
1062
1063
|
function b(i, p) {
|
|
1063
1064
|
let u = 0;
|
|
1064
1065
|
for (u = 0; u < 16; u++)
|
|
1065
1066
|
c[u] = i.h[u], c[u + 16] = h[u];
|
|
1066
1067
|
for (c[24] = c[24] ^ i.t, c[25] = c[25] ^ i.t / 4294967296, p && (c[28] = ~c[28], c[29] = ~c[29]), u = 0; u < 32; u++)
|
|
1067
|
-
|
|
1068
|
+
w[u] = n(i.b, 4 * u);
|
|
1068
1069
|
for (u = 0; u < 12; u++)
|
|
1069
1070
|
o(0, 8, 16, 24, l[u * 16 + 0], l[u * 16 + 1]), o(2, 10, 18, 26, l[u * 16 + 2], l[u * 16 + 3]), o(4, 12, 20, 28, l[u * 16 + 4], l[u * 16 + 5]), o(6, 14, 22, 30, l[u * 16 + 6], l[u * 16 + 7]), o(0, 10, 20, 30, l[u * 16 + 8], l[u * 16 + 9]), o(2, 12, 22, 24, l[u * 16 + 10], l[u * 16 + 11]), o(4, 14, 16, 26, l[u * 16 + 12], l[u * 16 + 13]), o(6, 8, 18, 28, l[u * 16 + 14], l[u * 16 + 15]);
|
|
1070
1071
|
for (u = 0; u < 16; u++)
|
|
@@ -1161,7 +1162,7 @@ function we() {
|
|
|
1161
1162
|
throw new Error("Illegal salt, expected Uint8Array with length is 16");
|
|
1162
1163
|
if (B && B.length !== 16)
|
|
1163
1164
|
throw new Error("Illegal personal, expected Uint8Array with length is 16");
|
|
1164
|
-
const
|
|
1165
|
+
const m = {
|
|
1165
1166
|
b: new Uint8Array(128),
|
|
1166
1167
|
h: new Uint32Array(16),
|
|
1167
1168
|
t: 0,
|
|
@@ -1173,8 +1174,8 @@ function we() {
|
|
|
1173
1174
|
};
|
|
1174
1175
|
g.fill(0), g[0] = i, p && (g[1] = p.length), g[2] = 1, g[3] = 1, u && g.set(u, 32), B && g.set(B, 48);
|
|
1175
1176
|
for (let A = 0; A < 16; A++)
|
|
1176
|
-
|
|
1177
|
-
return p && (k(
|
|
1177
|
+
m.h[A] = h[A] ^ n(g, A * 4);
|
|
1178
|
+
return p && (k(m, p), m.c = 128), m;
|
|
1178
1179
|
}
|
|
1179
1180
|
function k(i, p) {
|
|
1180
1181
|
for (let u = 0; u < p.length; u++)
|
|
@@ -1189,13 +1190,13 @@ function we() {
|
|
|
1189
1190
|
p[u] = i.h[u >> 2] >> 8 * (u & 3);
|
|
1190
1191
|
return p;
|
|
1191
1192
|
}
|
|
1192
|
-
function d(i, p, u, B,
|
|
1193
|
-
u = u || 64, i = t.normalizeInput(i), B && (B = t.normalizeInput(B)),
|
|
1194
|
-
const A = _(u, p, B,
|
|
1193
|
+
function d(i, p, u, B, m) {
|
|
1194
|
+
u = u || 64, i = t.normalizeInput(i), B && (B = t.normalizeInput(B)), m && (m = t.normalizeInput(m));
|
|
1195
|
+
const A = _(u, p, B, m);
|
|
1195
1196
|
return k(A, i), a(A);
|
|
1196
1197
|
}
|
|
1197
|
-
function f(i, p, u, B,
|
|
1198
|
-
const A = d(i, p, u, B,
|
|
1198
|
+
function f(i, p, u, B, m) {
|
|
1199
|
+
const A = d(i, p, u, B, m);
|
|
1199
1200
|
return t.toHex(A);
|
|
1200
1201
|
}
|
|
1201
1202
|
return L = {
|
|
@@ -1402,7 +1403,7 @@ function ke() {
|
|
|
1402
1403
|
for (f = 0; f < 8; f++)
|
|
1403
1404
|
a.h[f] ^= s[f] ^ s[f + 8];
|
|
1404
1405
|
}
|
|
1405
|
-
function
|
|
1406
|
+
function w(a, d) {
|
|
1406
1407
|
if (!(a > 0 && a <= 32))
|
|
1407
1408
|
throw new Error("Incorrect output length, should be in [1, 32]");
|
|
1408
1409
|
const f = d ? d.length : 0;
|
|
@@ -1437,7 +1438,7 @@ function ke() {
|
|
|
1437
1438
|
}
|
|
1438
1439
|
function _(a, d, f) {
|
|
1439
1440
|
f = f || 32, a = t.normalizeInput(a);
|
|
1440
|
-
const i =
|
|
1441
|
+
const i = w(f, d);
|
|
1441
1442
|
return b(i, a), g(i);
|
|
1442
1443
|
}
|
|
1443
1444
|
function k(a, d, f) {
|
|
@@ -1447,17 +1448,17 @@ function ke() {
|
|
|
1447
1448
|
return Z = {
|
|
1448
1449
|
blake2s: _,
|
|
1449
1450
|
blake2sHex: k,
|
|
1450
|
-
blake2sInit:
|
|
1451
|
+
blake2sInit: w,
|
|
1451
1452
|
blake2sUpdate: b,
|
|
1452
1453
|
blake2sFinal: g
|
|
1453
1454
|
}, Z;
|
|
1454
1455
|
}
|
|
1455
|
-
var
|
|
1456
|
+
var X, pt;
|
|
1456
1457
|
function Ie() {
|
|
1457
|
-
if (pt) return
|
|
1458
|
+
if (pt) return X;
|
|
1458
1459
|
pt = 1;
|
|
1459
|
-
const t =
|
|
1460
|
-
return
|
|
1460
|
+
const t = me(), e = ke();
|
|
1461
|
+
return X = {
|
|
1461
1462
|
blake2b: t.blake2b,
|
|
1462
1463
|
blake2bHex: t.blake2bHex,
|
|
1463
1464
|
blake2bInit: t.blake2bInit,
|
|
@@ -1468,9 +1469,9 @@ function Ie() {
|
|
|
1468
1469
|
blake2sInit: e.blake2sInit,
|
|
1469
1470
|
blake2sUpdate: e.blake2sUpdate,
|
|
1470
1471
|
blake2sFinal: e.blake2sFinal
|
|
1471
|
-
},
|
|
1472
|
+
}, X;
|
|
1472
1473
|
}
|
|
1473
|
-
var
|
|
1474
|
+
var V = Ie();
|
|
1474
1475
|
/**
|
|
1475
1476
|
* @module @zk-kit/eddsa-poseidon
|
|
1476
1477
|
* @version 1.1.0
|
|
@@ -1772,7 +1773,7 @@ class Se {
|
|
|
1772
1773
|
constructor(e = 64, r) {
|
|
1773
1774
|
if (this.key = null, this.outlen = 64, r && (this.key = r), e <= 0 || e > 64)
|
|
1774
1775
|
throw new Error("Illegal output length, expected 0 < length <= 64");
|
|
1775
|
-
this.outlen = e, this.context =
|
|
1776
|
+
this.outlen = e, this.context = V.blake2bInit(this.outlen, r);
|
|
1776
1777
|
}
|
|
1777
1778
|
/**
|
|
1778
1779
|
* Updates the hash with new data. This method can be called multiple
|
|
@@ -1781,7 +1782,7 @@ class Se {
|
|
|
1781
1782
|
* @returns The instance, to allow method chaining.
|
|
1782
1783
|
*/
|
|
1783
1784
|
update(e) {
|
|
1784
|
-
return
|
|
1785
|
+
return V.blake2bUpdate(this.context, e), this;
|
|
1785
1786
|
}
|
|
1786
1787
|
/**
|
|
1787
1788
|
* Completes the hash computation and returns the final hash value.
|
|
@@ -1790,7 +1791,7 @@ class Se {
|
|
|
1790
1791
|
* @returns The Blake2b hash of the input data.
|
|
1791
1792
|
*/
|
|
1792
1793
|
digest() {
|
|
1793
|
-
return
|
|
1794
|
+
return Ct.from(V.blake2bFinal(this.context));
|
|
1794
1795
|
}
|
|
1795
1796
|
}
|
|
1796
1797
|
function dt(t) {
|
|
@@ -1802,11 +1803,11 @@ function W(t) {
|
|
|
1802
1803
|
function _t(t) {
|
|
1803
1804
|
return nt(t) && Object.prototype.hasOwnProperty.call(t, "R8") && Object.prototype.hasOwnProperty.call(t, "S") && W(t.R8) && T(t.S);
|
|
1804
1805
|
}
|
|
1805
|
-
function
|
|
1806
|
-
return
|
|
1806
|
+
function wt(t) {
|
|
1807
|
+
return M(t, "privateKey", ["Buffer", "Uint8Array", "string"]), I.Buffer.from(t);
|
|
1807
1808
|
}
|
|
1808
1809
|
function Bt(t) {
|
|
1809
|
-
return
|
|
1810
|
+
return M(t, "message", ["bignumberish", "string"]), st(t) ? Rt(t) : Ot(I.Buffer.from(t));
|
|
1810
1811
|
}
|
|
1811
1812
|
function G(t, e) {
|
|
1812
1813
|
let r;
|
|
@@ -1830,7 +1831,7 @@ var P;
|
|
|
1830
1831
|
})(P || (P = {}));
|
|
1831
1832
|
const Ee = (t) => {
|
|
1832
1833
|
const e = (b) => {
|
|
1833
|
-
b =
|
|
1834
|
+
b = wt(b);
|
|
1834
1835
|
let g = G(b, t);
|
|
1835
1836
|
return g = g.slice(0, 32), g = dt(g), lt(z(g), BigInt(3)) % K;
|
|
1836
1837
|
};
|
|
@@ -1839,8 +1840,8 @@ const Ee = (t) => {
|
|
|
1839
1840
|
return $(q, g);
|
|
1840
1841
|
}
|
|
1841
1842
|
function n(b, g) {
|
|
1842
|
-
b =
|
|
1843
|
-
const _ = G(b, t), k = dt(_.slice(0, 32)), a = z(k), d = $(q, lt(a, BigInt(3))), f =
|
|
1843
|
+
b = wt(b), g = Bt(g);
|
|
1844
|
+
const _ = G(b, t), k = dt(_.slice(0, 32)), a = z(k), d = $(q, lt(a, BigInt(3))), f = D(g, 32), i = G(I.Buffer.concat([_.slice(32, 64), f]), t), p = new Be(K), u = p.e(z(i)), B = $(q, u), m = at.poseidon5([B[0], B[1], d[0], d[1], g]), A = p.add(u, p.mul(m, a));
|
|
1844
1845
|
return { R8: B, S: A };
|
|
1845
1846
|
}
|
|
1846
1847
|
function o(b, g, _) {
|
|
@@ -1874,7 +1875,7 @@ const Ee = (t) => {
|
|
|
1874
1875
|
R8: b.R8.map((a) => BigInt(a)),
|
|
1875
1876
|
S: BigInt(b.S)
|
|
1876
1877
|
}, _ = ft(g.R8), k = I.Buffer.alloc(64);
|
|
1877
|
-
return k.set(
|
|
1878
|
+
return k.set(D(_, 32), 0), k.set(D(g.S, 32), 32), k;
|
|
1878
1879
|
}
|
|
1879
1880
|
function c(b) {
|
|
1880
1881
|
if (se(b, "packedSignature"), b.length !== 64)
|
|
@@ -1887,7 +1888,7 @@ const Ee = (t) => {
|
|
|
1887
1888
|
S: z(_)
|
|
1888
1889
|
};
|
|
1889
1890
|
}
|
|
1890
|
-
class
|
|
1891
|
+
class w {
|
|
1891
1892
|
/**
|
|
1892
1893
|
* Initializes a new instance, deriving necessary cryptographic parameters from the provided private key.
|
|
1893
1894
|
* If the private key is not passed as a parameter, a random 32-byte hexadecimal key is generated.
|
|
@@ -1930,17 +1931,17 @@ const Ee = (t) => {
|
|
|
1930
1931
|
unpackPublicKey: s,
|
|
1931
1932
|
packSignature: l,
|
|
1932
1933
|
unpackSignature: c,
|
|
1933
|
-
EdDSAPoseidon:
|
|
1934
|
+
EdDSAPoseidon: w
|
|
1934
1935
|
};
|
|
1935
|
-
}, { EdDSAPoseidon:
|
|
1936
|
+
}, { EdDSAPoseidon: ze, derivePublicKey: Pe, deriveSecretScalar: qe, packPublicKey: Ke, packSignature: Oe, signMessage: Re, unpackPublicKey: je, unpackSignature: Te, verifySignature: Fe } = Ee(P.BLAKE1);
|
|
1936
1937
|
export {
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1938
|
+
ze as EdDSAPoseidon,
|
|
1939
|
+
Pe as derivePublicKey,
|
|
1940
|
+
qe as deriveSecretScalar,
|
|
1941
|
+
Ke as packPublicKey,
|
|
1942
|
+
Oe as packSignature,
|
|
1943
|
+
Re as signMessage,
|
|
1944
|
+
je as unpackPublicKey,
|
|
1945
|
+
Te as unpackSignature,
|
|
1946
|
+
Fe as verifySignature
|
|
1946
1947
|
};
|