holosphere 2.0.0-alpha2 → 2.0.0-alpha4
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/2019-D2OG2idw.js +6680 -0
- package/dist/2019-D2OG2idw.js.map +1 -0
- package/dist/2019-EION3wKo.cjs +8 -0
- package/dist/2019-EION3wKo.cjs.map +1 -0
- package/dist/_commonjsHelpers-C37NGDzP.cjs +2 -0
- package/dist/_commonjsHelpers-C37NGDzP.cjs.map +1 -0
- package/dist/_commonjsHelpers-CUmg6egw.js +7 -0
- package/dist/_commonjsHelpers-CUmg6egw.js.map +1 -0
- package/dist/browser-BSniCNqO.js +3058 -0
- package/dist/browser-BSniCNqO.js.map +1 -0
- package/dist/browser-Cq59Ij19.cjs +2 -0
- package/dist/browser-Cq59Ij19.cjs.map +1 -0
- package/dist/cjs/holosphere.cjs +1 -1
- package/dist/esm/holosphere.js +50 -53
- package/dist/index-BB_vVJgv.cjs +5 -0
- package/dist/index-BB_vVJgv.cjs.map +1 -0
- package/dist/index-CBitK71M.cjs +12 -0
- package/dist/index-CBitK71M.cjs.map +1 -0
- package/dist/index-CV0eOogK.js +37423 -0
- package/dist/index-CV0eOogK.js.map +1 -0
- package/dist/index-Cz-PLCUR.js +15104 -0
- package/dist/index-Cz-PLCUR.js.map +1 -0
- package/dist/indexeddb-storage-CRsZyB2f.cjs +2 -0
- package/dist/indexeddb-storage-CRsZyB2f.cjs.map +1 -0
- package/dist/{indexeddb-storage-CMW4qRQS.js → indexeddb-storage-DZaGlY_a.js} +49 -13
- package/dist/indexeddb-storage-DZaGlY_a.js.map +1 -0
- package/dist/{memory-storage-DQzcAZlf.js → memory-storage-BkUi6sZG.js} +6 -2
- package/dist/memory-storage-BkUi6sZG.js.map +1 -0
- package/dist/{memory-storage-DmePEP2q.cjs → memory-storage-C0DuUsdY.cjs} +2 -2
- package/dist/memory-storage-C0DuUsdY.cjs.map +1 -0
- package/dist/secp256k1-0kPdAVkK.cjs +12 -0
- package/dist/secp256k1-0kPdAVkK.cjs.map +1 -0
- package/dist/{secp256k1-vOXp40Fx.js → secp256k1-DN4FVXcv.js} +2 -393
- package/dist/secp256k1-DN4FVXcv.js.map +1 -0
- package/docs/CONTRACTS.md +797 -0
- package/examples/demo.html +47 -0
- package/package.json +10 -5
- package/src/contracts/abis/Appreciative.json +1280 -0
- package/src/contracts/abis/AppreciativeFactory.json +101 -0
- package/src/contracts/abis/Bundle.json +1435 -0
- package/src/contracts/abis/BundleFactory.json +106 -0
- package/src/contracts/abis/Holon.json +881 -0
- package/src/contracts/abis/Holons.json +330 -0
- package/src/contracts/abis/Managed.json +1262 -0
- package/src/contracts/abis/ManagedFactory.json +149 -0
- package/src/contracts/abis/Membrane.json +261 -0
- package/src/contracts/abis/Splitter.json +1624 -0
- package/src/contracts/abis/SplitterFactory.json +220 -0
- package/src/contracts/abis/TestToken.json +321 -0
- package/src/contracts/abis/Zoned.json +1461 -0
- package/src/contracts/abis/ZonedFactory.json +154 -0
- package/src/contracts/chain-manager.js +375 -0
- package/src/contracts/deployer.js +443 -0
- package/src/contracts/event-listener.js +507 -0
- package/src/contracts/holon-contracts.js +344 -0
- package/src/contracts/index.js +83 -0
- package/src/contracts/networks.js +224 -0
- package/src/contracts/operations.js +670 -0
- package/src/contracts/queries.js +589 -0
- package/src/core/holosphere.js +453 -1
- package/src/crypto/nostr-utils.js +263 -0
- package/src/federation/handshake.js +455 -0
- package/src/federation/hologram.js +1 -1
- package/src/hierarchical/upcast.js +6 -5
- package/src/index.js +463 -1939
- package/src/lib/ai-methods.js +308 -0
- package/src/lib/contract-methods.js +293 -0
- package/src/lib/errors.js +23 -0
- package/src/lib/federation-methods.js +238 -0
- package/src/lib/index.js +26 -0
- package/src/spatial/h3-operations.js +2 -2
- package/src/storage/backends/gundb-backend.js +377 -46
- package/src/storage/global-tables.js +28 -1
- package/src/storage/gun-auth.js +303 -0
- package/src/storage/gun-federation.js +776 -0
- package/src/storage/gun-references.js +198 -0
- package/src/storage/gun-schema.js +291 -0
- package/src/storage/gun-wrapper.js +347 -31
- package/src/storage/indexeddb-storage.js +49 -11
- package/src/storage/memory-storage.js +5 -0
- package/src/storage/nostr-async.js +45 -23
- package/src/storage/nostr-client.js +11 -5
- package/src/storage/persistent-storage.js +6 -1
- package/src/storage/unified-storage.js +119 -0
- package/src/subscriptions/manager.js +1 -1
- package/types/index.d.ts +133 -0
- package/dist/index-CDfIuXew.js +0 -15974
- package/dist/index-CDfIuXew.js.map +0 -1
- package/dist/index-ifOgtDvd.cjs +0 -3
- package/dist/index-ifOgtDvd.cjs.map +0 -1
- package/dist/indexeddb-storage-CMW4qRQS.js.map +0 -1
- package/dist/indexeddb-storage-DLZOgetM.cjs +0 -2
- package/dist/indexeddb-storage-DLZOgetM.cjs.map +0 -1
- package/dist/memory-storage-DQzcAZlf.js.map +0 -1
- package/dist/memory-storage-DmePEP2q.cjs.map +0 -1
- package/dist/secp256k1-CP0ZkpAx.cjs +0 -13
- package/dist/secp256k1-CP0ZkpAx.cjs.map +0 -1
- package/dist/secp256k1-vOXp40Fx.js.map +0 -1
|
@@ -1,395 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
3
|
-
function isBytes(a) {
|
|
4
|
-
return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
|
|
5
|
-
}
|
|
6
|
-
function anumber(n) {
|
|
7
|
-
if (!Number.isSafeInteger(n) || n < 0)
|
|
8
|
-
throw new Error("positive integer expected, got " + n);
|
|
9
|
-
}
|
|
10
|
-
function abytes(b, ...lengths) {
|
|
11
|
-
if (!isBytes(b))
|
|
12
|
-
throw new Error("Uint8Array expected");
|
|
13
|
-
if (lengths.length > 0 && !lengths.includes(b.length))
|
|
14
|
-
throw new Error("Uint8Array expected of length " + lengths + ", got length=" + b.length);
|
|
15
|
-
}
|
|
16
|
-
function ahash(h) {
|
|
17
|
-
if (typeof h !== "function" || typeof h.create !== "function")
|
|
18
|
-
throw new Error("Hash should be wrapped by utils.createHasher");
|
|
19
|
-
anumber(h.outputLen);
|
|
20
|
-
anumber(h.blockLen);
|
|
21
|
-
}
|
|
22
|
-
function aexists(instance, checkFinished = true) {
|
|
23
|
-
if (instance.destroyed)
|
|
24
|
-
throw new Error("Hash instance has been destroyed");
|
|
25
|
-
if (checkFinished && instance.finished)
|
|
26
|
-
throw new Error("Hash#digest() has already been called");
|
|
27
|
-
}
|
|
28
|
-
function aoutput(out, instance) {
|
|
29
|
-
abytes(out);
|
|
30
|
-
const min = instance.outputLen;
|
|
31
|
-
if (out.length < min) {
|
|
32
|
-
throw new Error("digestInto() expects output buffer of length at least " + min);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
function clean(...arrays) {
|
|
36
|
-
for (let i = 0; i < arrays.length; i++) {
|
|
37
|
-
arrays[i].fill(0);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
function createView(arr) {
|
|
41
|
-
return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
|
|
42
|
-
}
|
|
43
|
-
function rotr(word, shift) {
|
|
44
|
-
return word << 32 - shift | word >>> shift;
|
|
45
|
-
}
|
|
46
|
-
const hasHexBuiltin = /* @__PURE__ */ (() => (
|
|
47
|
-
// @ts-ignore
|
|
48
|
-
typeof Uint8Array.from([]).toHex === "function" && typeof Uint8Array.fromHex === "function"
|
|
49
|
-
))();
|
|
50
|
-
const hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
|
|
51
|
-
function bytesToHex(bytes) {
|
|
52
|
-
abytes(bytes);
|
|
53
|
-
if (hasHexBuiltin)
|
|
54
|
-
return bytes.toHex();
|
|
55
|
-
let hex = "";
|
|
56
|
-
for (let i = 0; i < bytes.length; i++) {
|
|
57
|
-
hex += hexes[bytes[i]];
|
|
58
|
-
}
|
|
59
|
-
return hex;
|
|
60
|
-
}
|
|
61
|
-
const asciis = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };
|
|
62
|
-
function asciiToBase16(ch) {
|
|
63
|
-
if (ch >= asciis._0 && ch <= asciis._9)
|
|
64
|
-
return ch - asciis._0;
|
|
65
|
-
if (ch >= asciis.A && ch <= asciis.F)
|
|
66
|
-
return ch - (asciis.A - 10);
|
|
67
|
-
if (ch >= asciis.a && ch <= asciis.f)
|
|
68
|
-
return ch - (asciis.a - 10);
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
function hexToBytes(hex) {
|
|
72
|
-
if (typeof hex !== "string")
|
|
73
|
-
throw new Error("hex string expected, got " + typeof hex);
|
|
74
|
-
if (hasHexBuiltin)
|
|
75
|
-
return Uint8Array.fromHex(hex);
|
|
76
|
-
const hl = hex.length;
|
|
77
|
-
const al = hl / 2;
|
|
78
|
-
if (hl % 2)
|
|
79
|
-
throw new Error("hex string expected, got unpadded hex of length " + hl);
|
|
80
|
-
const array = new Uint8Array(al);
|
|
81
|
-
for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) {
|
|
82
|
-
const n1 = asciiToBase16(hex.charCodeAt(hi));
|
|
83
|
-
const n2 = asciiToBase16(hex.charCodeAt(hi + 1));
|
|
84
|
-
if (n1 === void 0 || n2 === void 0) {
|
|
85
|
-
const char = hex[hi] + hex[hi + 1];
|
|
86
|
-
throw new Error('hex string expected, got non-hex character "' + char + '" at index ' + hi);
|
|
87
|
-
}
|
|
88
|
-
array[ai] = n1 * 16 + n2;
|
|
89
|
-
}
|
|
90
|
-
return array;
|
|
91
|
-
}
|
|
92
|
-
function utf8ToBytes(str) {
|
|
93
|
-
if (typeof str !== "string")
|
|
94
|
-
throw new Error("string expected");
|
|
95
|
-
return new Uint8Array(new TextEncoder().encode(str));
|
|
96
|
-
}
|
|
97
|
-
function toBytes(data) {
|
|
98
|
-
if (typeof data === "string")
|
|
99
|
-
data = utf8ToBytes(data);
|
|
100
|
-
abytes(data);
|
|
101
|
-
return data;
|
|
102
|
-
}
|
|
103
|
-
function concatBytes(...arrays) {
|
|
104
|
-
let sum = 0;
|
|
105
|
-
for (let i = 0; i < arrays.length; i++) {
|
|
106
|
-
const a = arrays[i];
|
|
107
|
-
abytes(a);
|
|
108
|
-
sum += a.length;
|
|
109
|
-
}
|
|
110
|
-
const res = new Uint8Array(sum);
|
|
111
|
-
for (let i = 0, pad = 0; i < arrays.length; i++) {
|
|
112
|
-
const a = arrays[i];
|
|
113
|
-
res.set(a, pad);
|
|
114
|
-
pad += a.length;
|
|
115
|
-
}
|
|
116
|
-
return res;
|
|
117
|
-
}
|
|
118
|
-
class Hash {
|
|
119
|
-
}
|
|
120
|
-
function createHasher(hashCons) {
|
|
121
|
-
const hashC = (msg) => hashCons().update(toBytes(msg)).digest();
|
|
122
|
-
const tmp = hashCons();
|
|
123
|
-
hashC.outputLen = tmp.outputLen;
|
|
124
|
-
hashC.blockLen = tmp.blockLen;
|
|
125
|
-
hashC.create = () => hashCons();
|
|
126
|
-
return hashC;
|
|
127
|
-
}
|
|
128
|
-
function randomBytes(bytesLength = 32) {
|
|
129
|
-
if (crypto && typeof crypto.getRandomValues === "function") {
|
|
130
|
-
return crypto.getRandomValues(new Uint8Array(bytesLength));
|
|
131
|
-
}
|
|
132
|
-
if (crypto && typeof crypto.randomBytes === "function") {
|
|
133
|
-
return Uint8Array.from(crypto.randomBytes(bytesLength));
|
|
134
|
-
}
|
|
135
|
-
throw new Error("crypto.getRandomValues must be defined");
|
|
136
|
-
}
|
|
137
|
-
function setBigUint64(view, byteOffset, value, isLE) {
|
|
138
|
-
if (typeof view.setBigUint64 === "function")
|
|
139
|
-
return view.setBigUint64(byteOffset, value, isLE);
|
|
140
|
-
const _32n = BigInt(32);
|
|
141
|
-
const _u32_max = BigInt(4294967295);
|
|
142
|
-
const wh = Number(value >> _32n & _u32_max);
|
|
143
|
-
const wl = Number(value & _u32_max);
|
|
144
|
-
const h = isLE ? 4 : 0;
|
|
145
|
-
const l = isLE ? 0 : 4;
|
|
146
|
-
view.setUint32(byteOffset + h, wh, isLE);
|
|
147
|
-
view.setUint32(byteOffset + l, wl, isLE);
|
|
148
|
-
}
|
|
149
|
-
function Chi(a, b, c) {
|
|
150
|
-
return a & b ^ ~a & c;
|
|
151
|
-
}
|
|
152
|
-
function Maj(a, b, c) {
|
|
153
|
-
return a & b ^ a & c ^ b & c;
|
|
154
|
-
}
|
|
155
|
-
class HashMD extends Hash {
|
|
156
|
-
constructor(blockLen, outputLen, padOffset, isLE) {
|
|
157
|
-
super();
|
|
158
|
-
this.finished = false;
|
|
159
|
-
this.length = 0;
|
|
160
|
-
this.pos = 0;
|
|
161
|
-
this.destroyed = false;
|
|
162
|
-
this.blockLen = blockLen;
|
|
163
|
-
this.outputLen = outputLen;
|
|
164
|
-
this.padOffset = padOffset;
|
|
165
|
-
this.isLE = isLE;
|
|
166
|
-
this.buffer = new Uint8Array(blockLen);
|
|
167
|
-
this.view = createView(this.buffer);
|
|
168
|
-
}
|
|
169
|
-
update(data) {
|
|
170
|
-
aexists(this);
|
|
171
|
-
data = toBytes(data);
|
|
172
|
-
abytes(data);
|
|
173
|
-
const { view, buffer, blockLen } = this;
|
|
174
|
-
const len = data.length;
|
|
175
|
-
for (let pos = 0; pos < len; ) {
|
|
176
|
-
const take = Math.min(blockLen - this.pos, len - pos);
|
|
177
|
-
if (take === blockLen) {
|
|
178
|
-
const dataView = createView(data);
|
|
179
|
-
for (; blockLen <= len - pos; pos += blockLen)
|
|
180
|
-
this.process(dataView, pos);
|
|
181
|
-
continue;
|
|
182
|
-
}
|
|
183
|
-
buffer.set(data.subarray(pos, pos + take), this.pos);
|
|
184
|
-
this.pos += take;
|
|
185
|
-
pos += take;
|
|
186
|
-
if (this.pos === blockLen) {
|
|
187
|
-
this.process(view, 0);
|
|
188
|
-
this.pos = 0;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
this.length += data.length;
|
|
192
|
-
this.roundClean();
|
|
193
|
-
return this;
|
|
194
|
-
}
|
|
195
|
-
digestInto(out) {
|
|
196
|
-
aexists(this);
|
|
197
|
-
aoutput(out, this);
|
|
198
|
-
this.finished = true;
|
|
199
|
-
const { buffer, view, blockLen, isLE } = this;
|
|
200
|
-
let { pos } = this;
|
|
201
|
-
buffer[pos++] = 128;
|
|
202
|
-
clean(this.buffer.subarray(pos));
|
|
203
|
-
if (this.padOffset > blockLen - pos) {
|
|
204
|
-
this.process(view, 0);
|
|
205
|
-
pos = 0;
|
|
206
|
-
}
|
|
207
|
-
for (let i = pos; i < blockLen; i++)
|
|
208
|
-
buffer[i] = 0;
|
|
209
|
-
setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE);
|
|
210
|
-
this.process(view, 0);
|
|
211
|
-
const oview = createView(out);
|
|
212
|
-
const len = this.outputLen;
|
|
213
|
-
if (len % 4)
|
|
214
|
-
throw new Error("_sha2: outputLen should be aligned to 32bit");
|
|
215
|
-
const outLen = len / 4;
|
|
216
|
-
const state = this.get();
|
|
217
|
-
if (outLen > state.length)
|
|
218
|
-
throw new Error("_sha2: outputLen bigger than state");
|
|
219
|
-
for (let i = 0; i < outLen; i++)
|
|
220
|
-
oview.setUint32(4 * i, state[i], isLE);
|
|
221
|
-
}
|
|
222
|
-
digest() {
|
|
223
|
-
const { buffer, outputLen } = this;
|
|
224
|
-
this.digestInto(buffer);
|
|
225
|
-
const res = buffer.slice(0, outputLen);
|
|
226
|
-
this.destroy();
|
|
227
|
-
return res;
|
|
228
|
-
}
|
|
229
|
-
_cloneInto(to) {
|
|
230
|
-
to || (to = new this.constructor());
|
|
231
|
-
to.set(...this.get());
|
|
232
|
-
const { blockLen, buffer, length, finished, destroyed, pos } = this;
|
|
233
|
-
to.destroyed = destroyed;
|
|
234
|
-
to.finished = finished;
|
|
235
|
-
to.length = length;
|
|
236
|
-
to.pos = pos;
|
|
237
|
-
if (length % blockLen)
|
|
238
|
-
to.buffer.set(buffer);
|
|
239
|
-
return to;
|
|
240
|
-
}
|
|
241
|
-
clone() {
|
|
242
|
-
return this._cloneInto();
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
const SHA256_IV = /* @__PURE__ */ Uint32Array.from([
|
|
246
|
-
1779033703,
|
|
247
|
-
3144134277,
|
|
248
|
-
1013904242,
|
|
249
|
-
2773480762,
|
|
250
|
-
1359893119,
|
|
251
|
-
2600822924,
|
|
252
|
-
528734635,
|
|
253
|
-
1541459225
|
|
254
|
-
]);
|
|
255
|
-
const SHA256_K = /* @__PURE__ */ Uint32Array.from([
|
|
256
|
-
1116352408,
|
|
257
|
-
1899447441,
|
|
258
|
-
3049323471,
|
|
259
|
-
3921009573,
|
|
260
|
-
961987163,
|
|
261
|
-
1508970993,
|
|
262
|
-
2453635748,
|
|
263
|
-
2870763221,
|
|
264
|
-
3624381080,
|
|
265
|
-
310598401,
|
|
266
|
-
607225278,
|
|
267
|
-
1426881987,
|
|
268
|
-
1925078388,
|
|
269
|
-
2162078206,
|
|
270
|
-
2614888103,
|
|
271
|
-
3248222580,
|
|
272
|
-
3835390401,
|
|
273
|
-
4022224774,
|
|
274
|
-
264347078,
|
|
275
|
-
604807628,
|
|
276
|
-
770255983,
|
|
277
|
-
1249150122,
|
|
278
|
-
1555081692,
|
|
279
|
-
1996064986,
|
|
280
|
-
2554220882,
|
|
281
|
-
2821834349,
|
|
282
|
-
2952996808,
|
|
283
|
-
3210313671,
|
|
284
|
-
3336571891,
|
|
285
|
-
3584528711,
|
|
286
|
-
113926993,
|
|
287
|
-
338241895,
|
|
288
|
-
666307205,
|
|
289
|
-
773529912,
|
|
290
|
-
1294757372,
|
|
291
|
-
1396182291,
|
|
292
|
-
1695183700,
|
|
293
|
-
1986661051,
|
|
294
|
-
2177026350,
|
|
295
|
-
2456956037,
|
|
296
|
-
2730485921,
|
|
297
|
-
2820302411,
|
|
298
|
-
3259730800,
|
|
299
|
-
3345764771,
|
|
300
|
-
3516065817,
|
|
301
|
-
3600352804,
|
|
302
|
-
4094571909,
|
|
303
|
-
275423344,
|
|
304
|
-
430227734,
|
|
305
|
-
506948616,
|
|
306
|
-
659060556,
|
|
307
|
-
883997877,
|
|
308
|
-
958139571,
|
|
309
|
-
1322822218,
|
|
310
|
-
1537002063,
|
|
311
|
-
1747873779,
|
|
312
|
-
1955562222,
|
|
313
|
-
2024104815,
|
|
314
|
-
2227730452,
|
|
315
|
-
2361852424,
|
|
316
|
-
2428436474,
|
|
317
|
-
2756734187,
|
|
318
|
-
3204031479,
|
|
319
|
-
3329325298
|
|
320
|
-
]);
|
|
321
|
-
const SHA256_W = /* @__PURE__ */ new Uint32Array(64);
|
|
322
|
-
class SHA256 extends HashMD {
|
|
323
|
-
constructor(outputLen = 32) {
|
|
324
|
-
super(64, outputLen, 8, false);
|
|
325
|
-
this.A = SHA256_IV[0] | 0;
|
|
326
|
-
this.B = SHA256_IV[1] | 0;
|
|
327
|
-
this.C = SHA256_IV[2] | 0;
|
|
328
|
-
this.D = SHA256_IV[3] | 0;
|
|
329
|
-
this.E = SHA256_IV[4] | 0;
|
|
330
|
-
this.F = SHA256_IV[5] | 0;
|
|
331
|
-
this.G = SHA256_IV[6] | 0;
|
|
332
|
-
this.H = SHA256_IV[7] | 0;
|
|
333
|
-
}
|
|
334
|
-
get() {
|
|
335
|
-
const { A, B, C, D, E, F, G, H } = this;
|
|
336
|
-
return [A, B, C, D, E, F, G, H];
|
|
337
|
-
}
|
|
338
|
-
// prettier-ignore
|
|
339
|
-
set(A, B, C, D, E, F, G, H) {
|
|
340
|
-
this.A = A | 0;
|
|
341
|
-
this.B = B | 0;
|
|
342
|
-
this.C = C | 0;
|
|
343
|
-
this.D = D | 0;
|
|
344
|
-
this.E = E | 0;
|
|
345
|
-
this.F = F | 0;
|
|
346
|
-
this.G = G | 0;
|
|
347
|
-
this.H = H | 0;
|
|
348
|
-
}
|
|
349
|
-
process(view, offset) {
|
|
350
|
-
for (let i = 0; i < 16; i++, offset += 4)
|
|
351
|
-
SHA256_W[i] = view.getUint32(offset, false);
|
|
352
|
-
for (let i = 16; i < 64; i++) {
|
|
353
|
-
const W15 = SHA256_W[i - 15];
|
|
354
|
-
const W2 = SHA256_W[i - 2];
|
|
355
|
-
const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ W15 >>> 3;
|
|
356
|
-
const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ W2 >>> 10;
|
|
357
|
-
SHA256_W[i] = s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16] | 0;
|
|
358
|
-
}
|
|
359
|
-
let { A, B, C, D, E, F, G, H } = this;
|
|
360
|
-
for (let i = 0; i < 64; i++) {
|
|
361
|
-
const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25);
|
|
362
|
-
const T1 = H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i] | 0;
|
|
363
|
-
const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22);
|
|
364
|
-
const T2 = sigma0 + Maj(A, B, C) | 0;
|
|
365
|
-
H = G;
|
|
366
|
-
G = F;
|
|
367
|
-
F = E;
|
|
368
|
-
E = D + T1 | 0;
|
|
369
|
-
D = C;
|
|
370
|
-
C = B;
|
|
371
|
-
B = A;
|
|
372
|
-
A = T1 + T2 | 0;
|
|
373
|
-
}
|
|
374
|
-
A = A + this.A | 0;
|
|
375
|
-
B = B + this.B | 0;
|
|
376
|
-
C = C + this.C | 0;
|
|
377
|
-
D = D + this.D | 0;
|
|
378
|
-
E = E + this.E | 0;
|
|
379
|
-
F = F + this.F | 0;
|
|
380
|
-
G = G + this.G | 0;
|
|
381
|
-
H = H + this.H | 0;
|
|
382
|
-
this.set(A, B, C, D, E, F, G, H);
|
|
383
|
-
}
|
|
384
|
-
roundClean() {
|
|
385
|
-
clean(SHA256_W);
|
|
386
|
-
}
|
|
387
|
-
destroy() {
|
|
388
|
-
this.set(0, 0, 0, 0, 0, 0, 0, 0);
|
|
389
|
-
clean(this.buffer);
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
const sha256 = /* @__PURE__ */ createHasher(() => new SHA256());
|
|
1
|
+
import { H as Hash, a as ahash, t as toBytes, c as clean, b as aexists, d as abytes, e as bytesToHex, i as isBytes, h as hexToBytes, f as concatBytes, g as anumber, r as randomBytes, s as sha256 } from "./index-CV0eOogK.js";
|
|
393
2
|
class HMAC extends Hash {
|
|
394
3
|
constructor(hash, _key) {
|
|
395
4
|
super();
|
|
@@ -2278,4 +1887,4 @@ const secp256k1 = createCurve({ ...secp256k1_CURVE, Fp: Fpk1, lowS: true, endo:
|
|
|
2278
1887
|
export {
|
|
2279
1888
|
secp256k1
|
|
2280
1889
|
};
|
|
2281
|
-
//# sourceMappingURL=secp256k1-
|
|
1890
|
+
//# sourceMappingURL=secp256k1-DN4FVXcv.js.map
|