@rozoai/checkout 0.1.0 → 0.1.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/README.md +292 -214
- package/docs/QUICKSTART.es.md +338 -0
- package/docs/QUICKSTART.ja.md +315 -0
- package/docs/QUICKSTART.md +328 -0
- package/docs/QUICKSTART.zh.md +289 -0
- package/docs/README.es.md +348 -0
- package/docs/README.ja.md +337 -0
- package/docs/README.zh.md +307 -0
- package/docs/how-it-works.md +43 -0
- package/docs/safety.md +78 -0
- package/llms.txt +53 -7
- package/package.json +3 -8
- package/scripts/dist/cli.js +1526 -720
- package/scripts/dist/send-evm.js +6715 -6286
- package/scripts/dist/send-sol.js +1738 -674
- package/QUICKSTART.es.md +0 -192
- package/QUICKSTART.ja.md +0 -187
- package/QUICKSTART.md +0 -188
- package/QUICKSTART.zh.md +0 -178
- package/README.es.md +0 -287
- package/README.ja.md +0 -265
- package/README.zh.md +0 -187
package/scripts/dist/send-sol.js
CHANGED
|
@@ -41,6 +41,676 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
41
41
|
));
|
|
42
42
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
43
43
|
|
|
44
|
+
// node_modules/viem/_esm/utils/data/isHex.js
|
|
45
|
+
function isHex(value, { strict = true } = {}) {
|
|
46
|
+
if (!value)
|
|
47
|
+
return false;
|
|
48
|
+
if (typeof value !== "string")
|
|
49
|
+
return false;
|
|
50
|
+
return strict ? /^0x[0-9a-fA-F]*$/.test(value) : value.startsWith("0x");
|
|
51
|
+
}
|
|
52
|
+
var init_isHex = __esm({
|
|
53
|
+
"node_modules/viem/_esm/utils/data/isHex.js"() {
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
// node_modules/viem/_esm/utils/data/size.js
|
|
58
|
+
function size(value) {
|
|
59
|
+
if (isHex(value, { strict: false }))
|
|
60
|
+
return Math.ceil((value.length - 2) / 2);
|
|
61
|
+
return value.length;
|
|
62
|
+
}
|
|
63
|
+
var init_size = __esm({
|
|
64
|
+
"node_modules/viem/_esm/utils/data/size.js"() {
|
|
65
|
+
init_isHex();
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
// node_modules/viem/_esm/errors/version.js
|
|
70
|
+
var version;
|
|
71
|
+
var init_version = __esm({
|
|
72
|
+
"node_modules/viem/_esm/errors/version.js"() {
|
|
73
|
+
version = "2.55.11";
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
// node_modules/viem/_esm/errors/base.js
|
|
78
|
+
function walk(err, fn) {
|
|
79
|
+
if (fn?.(err))
|
|
80
|
+
return err;
|
|
81
|
+
if (err && typeof err === "object" && "cause" in err && err.cause !== void 0)
|
|
82
|
+
return walk(err.cause, fn);
|
|
83
|
+
return fn ? null : err;
|
|
84
|
+
}
|
|
85
|
+
var errorConfig, BaseError;
|
|
86
|
+
var init_base = __esm({
|
|
87
|
+
"node_modules/viem/_esm/errors/base.js"() {
|
|
88
|
+
init_version();
|
|
89
|
+
errorConfig = {
|
|
90
|
+
getDocsUrl: ({ docsBaseUrl, docsPath = "", docsSlug }) => docsPath ? `${docsBaseUrl ?? "https://viem.sh"}${docsPath}${docsSlug ? `#${docsSlug}` : ""}` : void 0,
|
|
91
|
+
version: `viem@${version}`
|
|
92
|
+
};
|
|
93
|
+
BaseError = class _BaseError extends Error {
|
|
94
|
+
constructor(shortMessage, args = {}) {
|
|
95
|
+
const details = (() => {
|
|
96
|
+
if (args.cause instanceof _BaseError)
|
|
97
|
+
return args.cause.details;
|
|
98
|
+
if (args.cause?.message)
|
|
99
|
+
return args.cause.message;
|
|
100
|
+
return args.details;
|
|
101
|
+
})();
|
|
102
|
+
const docsPath = (() => {
|
|
103
|
+
if (args.cause instanceof _BaseError)
|
|
104
|
+
return args.cause.docsPath || args.docsPath;
|
|
105
|
+
return args.docsPath;
|
|
106
|
+
})();
|
|
107
|
+
const docsUrl = errorConfig.getDocsUrl?.({ ...args, docsPath });
|
|
108
|
+
const message = [
|
|
109
|
+
shortMessage || "An error occurred.",
|
|
110
|
+
"",
|
|
111
|
+
...args.metaMessages ? [...args.metaMessages, ""] : [],
|
|
112
|
+
...docsUrl ? [`Docs: ${docsUrl}`] : [],
|
|
113
|
+
...details ? [`Details: ${details}`] : [],
|
|
114
|
+
...errorConfig.version ? [`Version: ${errorConfig.version}`] : []
|
|
115
|
+
].join("\n");
|
|
116
|
+
super(message, args.cause ? { cause: args.cause } : void 0);
|
|
117
|
+
Object.defineProperty(this, "details", {
|
|
118
|
+
enumerable: true,
|
|
119
|
+
configurable: true,
|
|
120
|
+
writable: true,
|
|
121
|
+
value: void 0
|
|
122
|
+
});
|
|
123
|
+
Object.defineProperty(this, "docsPath", {
|
|
124
|
+
enumerable: true,
|
|
125
|
+
configurable: true,
|
|
126
|
+
writable: true,
|
|
127
|
+
value: void 0
|
|
128
|
+
});
|
|
129
|
+
Object.defineProperty(this, "metaMessages", {
|
|
130
|
+
enumerable: true,
|
|
131
|
+
configurable: true,
|
|
132
|
+
writable: true,
|
|
133
|
+
value: void 0
|
|
134
|
+
});
|
|
135
|
+
Object.defineProperty(this, "shortMessage", {
|
|
136
|
+
enumerable: true,
|
|
137
|
+
configurable: true,
|
|
138
|
+
writable: true,
|
|
139
|
+
value: void 0
|
|
140
|
+
});
|
|
141
|
+
Object.defineProperty(this, "version", {
|
|
142
|
+
enumerable: true,
|
|
143
|
+
configurable: true,
|
|
144
|
+
writable: true,
|
|
145
|
+
value: void 0
|
|
146
|
+
});
|
|
147
|
+
Object.defineProperty(this, "name", {
|
|
148
|
+
enumerable: true,
|
|
149
|
+
configurable: true,
|
|
150
|
+
writable: true,
|
|
151
|
+
value: "BaseError"
|
|
152
|
+
});
|
|
153
|
+
this.details = details;
|
|
154
|
+
this.docsPath = docsPath;
|
|
155
|
+
this.metaMessages = args.metaMessages;
|
|
156
|
+
this.name = args.name ?? this.name;
|
|
157
|
+
this.shortMessage = shortMessage;
|
|
158
|
+
this.version = version;
|
|
159
|
+
}
|
|
160
|
+
walk(fn) {
|
|
161
|
+
return walk(this, fn);
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
// node_modules/viem/_esm/errors/data.js
|
|
168
|
+
var SizeExceedsPaddingSizeError;
|
|
169
|
+
var init_data = __esm({
|
|
170
|
+
"node_modules/viem/_esm/errors/data.js"() {
|
|
171
|
+
init_base();
|
|
172
|
+
SizeExceedsPaddingSizeError = class extends BaseError {
|
|
173
|
+
constructor({ size: size2, targetSize, type }) {
|
|
174
|
+
super(`${type.charAt(0).toUpperCase()}${type.slice(1).toLowerCase()} size (${size2}) exceeds padding size (${targetSize}).`, { name: "SizeExceedsPaddingSizeError" });
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
// node_modules/viem/_esm/utils/data/pad.js
|
|
181
|
+
function pad(hexOrBytes, { dir, size: size2 = 32 } = {}) {
|
|
182
|
+
if (typeof hexOrBytes === "string")
|
|
183
|
+
return padHex(hexOrBytes, { dir, size: size2 });
|
|
184
|
+
return padBytes(hexOrBytes, { dir, size: size2 });
|
|
185
|
+
}
|
|
186
|
+
function padHex(hex_, { dir, size: size2 = 32 } = {}) {
|
|
187
|
+
if (size2 === null)
|
|
188
|
+
return hex_;
|
|
189
|
+
const hex = hex_.replace("0x", "");
|
|
190
|
+
if (hex.length > size2 * 2)
|
|
191
|
+
throw new SizeExceedsPaddingSizeError({
|
|
192
|
+
size: Math.ceil(hex.length / 2),
|
|
193
|
+
targetSize: size2,
|
|
194
|
+
type: "hex"
|
|
195
|
+
});
|
|
196
|
+
return `0x${hex[dir === "right" ? "padEnd" : "padStart"](size2 * 2, "0")}`;
|
|
197
|
+
}
|
|
198
|
+
function padBytes(bytes, { dir, size: size2 = 32 } = {}) {
|
|
199
|
+
if (size2 === null)
|
|
200
|
+
return bytes;
|
|
201
|
+
if (bytes.length > size2)
|
|
202
|
+
throw new SizeExceedsPaddingSizeError({
|
|
203
|
+
size: bytes.length,
|
|
204
|
+
targetSize: size2,
|
|
205
|
+
type: "bytes"
|
|
206
|
+
});
|
|
207
|
+
const paddedBytes = new Uint8Array(size2);
|
|
208
|
+
for (let i = 0; i < size2; i++) {
|
|
209
|
+
const padEnd = dir === "right";
|
|
210
|
+
paddedBytes[padEnd ? i : size2 - i - 1] = bytes[padEnd ? i : bytes.length - i - 1];
|
|
211
|
+
}
|
|
212
|
+
return paddedBytes;
|
|
213
|
+
}
|
|
214
|
+
var init_pad = __esm({
|
|
215
|
+
"node_modules/viem/_esm/utils/data/pad.js"() {
|
|
216
|
+
init_data();
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
// node_modules/viem/_esm/errors/encoding.js
|
|
221
|
+
var IntegerOutOfRangeError, SizeOverflowError;
|
|
222
|
+
var init_encoding = __esm({
|
|
223
|
+
"node_modules/viem/_esm/errors/encoding.js"() {
|
|
224
|
+
init_base();
|
|
225
|
+
IntegerOutOfRangeError = class extends BaseError {
|
|
226
|
+
constructor({ max, min, signed, size: size2, value }) {
|
|
227
|
+
super(`Number "${value}" is not in safe ${size2 ? `${size2 * 8}-bit ${signed ? "signed" : "unsigned"} ` : ""}integer range ${max ? `(${min} to ${max})` : `(above ${min})`}`, { name: "IntegerOutOfRangeError" });
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
SizeOverflowError = class extends BaseError {
|
|
231
|
+
constructor({ givenSize, maxSize }) {
|
|
232
|
+
super(`Size cannot exceed ${maxSize} bytes. Given size: ${givenSize} bytes.`, { name: "SizeOverflowError" });
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
// node_modules/viem/_esm/utils/encoding/fromHex.js
|
|
239
|
+
function assertSize(hexOrBytes, { size: size2 }) {
|
|
240
|
+
if (size(hexOrBytes) > size2)
|
|
241
|
+
throw new SizeOverflowError({
|
|
242
|
+
givenSize: size(hexOrBytes),
|
|
243
|
+
maxSize: size2
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
var init_fromHex = __esm({
|
|
247
|
+
"node_modules/viem/_esm/utils/encoding/fromHex.js"() {
|
|
248
|
+
init_encoding();
|
|
249
|
+
init_size();
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
// node_modules/viem/_esm/utils/encoding/toHex.js
|
|
254
|
+
function toHex(value, opts = {}) {
|
|
255
|
+
if (typeof value === "number" || typeof value === "bigint")
|
|
256
|
+
return numberToHex(value, opts);
|
|
257
|
+
if (typeof value === "string") {
|
|
258
|
+
return stringToHex(value, opts);
|
|
259
|
+
}
|
|
260
|
+
if (typeof value === "boolean")
|
|
261
|
+
return boolToHex(value, opts);
|
|
262
|
+
return bytesToHex(value, opts);
|
|
263
|
+
}
|
|
264
|
+
function boolToHex(value, opts = {}) {
|
|
265
|
+
const hex = `0x${Number(value)}`;
|
|
266
|
+
if (typeof opts.size === "number") {
|
|
267
|
+
assertSize(hex, { size: opts.size });
|
|
268
|
+
return pad(hex, { size: opts.size });
|
|
269
|
+
}
|
|
270
|
+
return hex;
|
|
271
|
+
}
|
|
272
|
+
function bytesToHex(value, opts = {}) {
|
|
273
|
+
let string = "";
|
|
274
|
+
for (let i = 0; i < value.length; i++) {
|
|
275
|
+
string += hexes[value[i]];
|
|
276
|
+
}
|
|
277
|
+
const hex = `0x${string}`;
|
|
278
|
+
if (typeof opts.size === "number") {
|
|
279
|
+
assertSize(hex, { size: opts.size });
|
|
280
|
+
return pad(hex, { dir: "right", size: opts.size });
|
|
281
|
+
}
|
|
282
|
+
return hex;
|
|
283
|
+
}
|
|
284
|
+
function numberToHex(value_, opts = {}) {
|
|
285
|
+
const { signed, size: size2 } = opts;
|
|
286
|
+
const value = BigInt(value_);
|
|
287
|
+
let maxValue;
|
|
288
|
+
if (size2) {
|
|
289
|
+
if (signed)
|
|
290
|
+
maxValue = (1n << BigInt(size2) * 8n - 1n) - 1n;
|
|
291
|
+
else
|
|
292
|
+
maxValue = 2n ** (BigInt(size2) * 8n) - 1n;
|
|
293
|
+
} else if (typeof value_ === "number") {
|
|
294
|
+
maxValue = BigInt(Number.MAX_SAFE_INTEGER);
|
|
295
|
+
}
|
|
296
|
+
const minValue = typeof maxValue === "bigint" && signed ? -maxValue - 1n : 0;
|
|
297
|
+
if (maxValue && value > maxValue || value < minValue) {
|
|
298
|
+
const suffix = typeof value_ === "bigint" ? "n" : "";
|
|
299
|
+
throw new IntegerOutOfRangeError({
|
|
300
|
+
max: maxValue ? `${maxValue}${suffix}` : void 0,
|
|
301
|
+
min: `${minValue}${suffix}`,
|
|
302
|
+
signed,
|
|
303
|
+
size: size2,
|
|
304
|
+
value: `${value_}${suffix}`
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
const hex = `0x${(signed && value < 0 ? (1n << BigInt(size2 * 8)) + BigInt(value) : value).toString(16)}`;
|
|
308
|
+
if (size2)
|
|
309
|
+
return pad(hex, { size: size2 });
|
|
310
|
+
return hex;
|
|
311
|
+
}
|
|
312
|
+
function stringToHex(value_, opts = {}) {
|
|
313
|
+
const value = encoder.encode(value_);
|
|
314
|
+
return bytesToHex(value, opts);
|
|
315
|
+
}
|
|
316
|
+
var hexes, encoder;
|
|
317
|
+
var init_toHex = __esm({
|
|
318
|
+
"node_modules/viem/_esm/utils/encoding/toHex.js"() {
|
|
319
|
+
init_encoding();
|
|
320
|
+
init_pad();
|
|
321
|
+
init_fromHex();
|
|
322
|
+
hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_v, i) => i.toString(16).padStart(2, "0"));
|
|
323
|
+
encoder = /* @__PURE__ */ new TextEncoder();
|
|
324
|
+
}
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
// node_modules/viem/_esm/utils/encoding/toBytes.js
|
|
328
|
+
function toBytes(value, opts = {}) {
|
|
329
|
+
if (typeof value === "number" || typeof value === "bigint")
|
|
330
|
+
return numberToBytes(value, opts);
|
|
331
|
+
if (typeof value === "boolean")
|
|
332
|
+
return boolToBytes(value, opts);
|
|
333
|
+
if (isHex(value))
|
|
334
|
+
return hexToBytes(value, opts);
|
|
335
|
+
return stringToBytes(value, opts);
|
|
336
|
+
}
|
|
337
|
+
function boolToBytes(value, opts = {}) {
|
|
338
|
+
const bytes = new Uint8Array(1);
|
|
339
|
+
bytes[0] = Number(value);
|
|
340
|
+
if (typeof opts.size === "number") {
|
|
341
|
+
assertSize(bytes, { size: opts.size });
|
|
342
|
+
return pad(bytes, { size: opts.size });
|
|
343
|
+
}
|
|
344
|
+
return bytes;
|
|
345
|
+
}
|
|
346
|
+
function charCodeToBase16(char) {
|
|
347
|
+
if (char >= charCodeMap.zero && char <= charCodeMap.nine)
|
|
348
|
+
return char - charCodeMap.zero;
|
|
349
|
+
if (char >= charCodeMap.A && char <= charCodeMap.F)
|
|
350
|
+
return char - (charCodeMap.A - 10);
|
|
351
|
+
if (char >= charCodeMap.a && char <= charCodeMap.f)
|
|
352
|
+
return char - (charCodeMap.a - 10);
|
|
353
|
+
return void 0;
|
|
354
|
+
}
|
|
355
|
+
function hexToBytes(hex_, opts = {}) {
|
|
356
|
+
let hex = hex_;
|
|
357
|
+
if (opts.size) {
|
|
358
|
+
assertSize(hex, { size: opts.size });
|
|
359
|
+
hex = pad(hex, { dir: "right", size: opts.size });
|
|
360
|
+
}
|
|
361
|
+
let hexString = hex.slice(2);
|
|
362
|
+
if (hexString.length % 2)
|
|
363
|
+
hexString = `0${hexString}`;
|
|
364
|
+
const length = hexString.length / 2;
|
|
365
|
+
const bytes = new Uint8Array(length);
|
|
366
|
+
for (let index = 0, j = 0; index < length; index++) {
|
|
367
|
+
const nibbleLeft = charCodeToBase16(hexString.charCodeAt(j++));
|
|
368
|
+
const nibbleRight = charCodeToBase16(hexString.charCodeAt(j++));
|
|
369
|
+
if (nibbleLeft === void 0 || nibbleRight === void 0) {
|
|
370
|
+
throw new BaseError(`Invalid byte sequence ("${hexString[j - 2]}${hexString[j - 1]}" in "${hexString}").`);
|
|
371
|
+
}
|
|
372
|
+
bytes[index] = nibbleLeft * 16 + nibbleRight;
|
|
373
|
+
}
|
|
374
|
+
return bytes;
|
|
375
|
+
}
|
|
376
|
+
function numberToBytes(value, opts) {
|
|
377
|
+
const hex = numberToHex(value, opts);
|
|
378
|
+
return hexToBytes(hex);
|
|
379
|
+
}
|
|
380
|
+
function stringToBytes(value, opts = {}) {
|
|
381
|
+
const bytes = encoder2.encode(value);
|
|
382
|
+
if (typeof opts.size === "number") {
|
|
383
|
+
assertSize(bytes, { size: opts.size });
|
|
384
|
+
return pad(bytes, { dir: "right", size: opts.size });
|
|
385
|
+
}
|
|
386
|
+
return bytes;
|
|
387
|
+
}
|
|
388
|
+
var encoder2, charCodeMap;
|
|
389
|
+
var init_toBytes = __esm({
|
|
390
|
+
"node_modules/viem/_esm/utils/encoding/toBytes.js"() {
|
|
391
|
+
init_base();
|
|
392
|
+
init_isHex();
|
|
393
|
+
init_pad();
|
|
394
|
+
init_fromHex();
|
|
395
|
+
init_toHex();
|
|
396
|
+
encoder2 = /* @__PURE__ */ new TextEncoder();
|
|
397
|
+
charCodeMap = {
|
|
398
|
+
zero: 48,
|
|
399
|
+
nine: 57,
|
|
400
|
+
A: 65,
|
|
401
|
+
F: 70,
|
|
402
|
+
a: 97,
|
|
403
|
+
f: 102
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
});
|
|
407
|
+
|
|
408
|
+
// node_modules/@noble/hashes/esm/_u64.js
|
|
409
|
+
function fromBig(n, le = false) {
|
|
410
|
+
if (le)
|
|
411
|
+
return { h: Number(n & U32_MASK64), l: Number(n >> _32n & U32_MASK64) };
|
|
412
|
+
return { h: Number(n >> _32n & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
|
|
413
|
+
}
|
|
414
|
+
function split(lst, le = false) {
|
|
415
|
+
const len = lst.length;
|
|
416
|
+
let Ah = new Uint32Array(len);
|
|
417
|
+
let Al = new Uint32Array(len);
|
|
418
|
+
for (let i = 0; i < len; i++) {
|
|
419
|
+
const { h, l } = fromBig(lst[i], le);
|
|
420
|
+
[Ah[i], Al[i]] = [h, l];
|
|
421
|
+
}
|
|
422
|
+
return [Ah, Al];
|
|
423
|
+
}
|
|
424
|
+
var U32_MASK64, _32n, rotlSH, rotlSL, rotlBH, rotlBL;
|
|
425
|
+
var init_u64 = __esm({
|
|
426
|
+
"node_modules/@noble/hashes/esm/_u64.js"() {
|
|
427
|
+
U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
|
|
428
|
+
_32n = /* @__PURE__ */ BigInt(32);
|
|
429
|
+
rotlSH = (h, l, s) => h << s | l >>> 32 - s;
|
|
430
|
+
rotlSL = (h, l, s) => l << s | h >>> 32 - s;
|
|
431
|
+
rotlBH = (h, l, s) => l << s - 32 | h >>> 64 - s;
|
|
432
|
+
rotlBL = (h, l, s) => h << s - 32 | l >>> 64 - s;
|
|
433
|
+
}
|
|
434
|
+
});
|
|
435
|
+
|
|
436
|
+
// node_modules/@noble/hashes/esm/utils.js
|
|
437
|
+
function isBytes(a) {
|
|
438
|
+
return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
|
|
439
|
+
}
|
|
440
|
+
function anumber(n) {
|
|
441
|
+
if (!Number.isSafeInteger(n) || n < 0)
|
|
442
|
+
throw new Error("positive integer expected, got " + n);
|
|
443
|
+
}
|
|
444
|
+
function abytes(b, ...lengths) {
|
|
445
|
+
if (!isBytes(b))
|
|
446
|
+
throw new Error("Uint8Array expected");
|
|
447
|
+
if (lengths.length > 0 && !lengths.includes(b.length))
|
|
448
|
+
throw new Error("Uint8Array expected of length " + lengths + ", got length=" + b.length);
|
|
449
|
+
}
|
|
450
|
+
function aexists(instance, checkFinished = true) {
|
|
451
|
+
if (instance.destroyed)
|
|
452
|
+
throw new Error("Hash instance has been destroyed");
|
|
453
|
+
if (checkFinished && instance.finished)
|
|
454
|
+
throw new Error("Hash#digest() has already been called");
|
|
455
|
+
}
|
|
456
|
+
function aoutput(out, instance) {
|
|
457
|
+
abytes(out);
|
|
458
|
+
const min = instance.outputLen;
|
|
459
|
+
if (out.length < min) {
|
|
460
|
+
throw new Error("digestInto() expects output buffer of length at least " + min);
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
function u32(arr) {
|
|
464
|
+
return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
|
|
465
|
+
}
|
|
466
|
+
function clean(...arrays) {
|
|
467
|
+
for (let i = 0; i < arrays.length; i++) {
|
|
468
|
+
arrays[i].fill(0);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
function byteSwap(word) {
|
|
472
|
+
return word << 24 & 4278190080 | word << 8 & 16711680 | word >>> 8 & 65280 | word >>> 24 & 255;
|
|
473
|
+
}
|
|
474
|
+
function byteSwap32(arr) {
|
|
475
|
+
for (let i = 0; i < arr.length; i++) {
|
|
476
|
+
arr[i] = byteSwap(arr[i]);
|
|
477
|
+
}
|
|
478
|
+
return arr;
|
|
479
|
+
}
|
|
480
|
+
function utf8ToBytes(str) {
|
|
481
|
+
if (typeof str !== "string")
|
|
482
|
+
throw new Error("string expected");
|
|
483
|
+
return new Uint8Array(new TextEncoder().encode(str));
|
|
484
|
+
}
|
|
485
|
+
function toBytes2(data) {
|
|
486
|
+
if (typeof data === "string")
|
|
487
|
+
data = utf8ToBytes(data);
|
|
488
|
+
abytes(data);
|
|
489
|
+
return data;
|
|
490
|
+
}
|
|
491
|
+
function createHasher(hashCons) {
|
|
492
|
+
const hashC = (msg) => hashCons().update(toBytes2(msg)).digest();
|
|
493
|
+
const tmp = hashCons();
|
|
494
|
+
hashC.outputLen = tmp.outputLen;
|
|
495
|
+
hashC.blockLen = tmp.blockLen;
|
|
496
|
+
hashC.create = () => hashCons();
|
|
497
|
+
return hashC;
|
|
498
|
+
}
|
|
499
|
+
var isLE, swap32IfBE, Hash;
|
|
500
|
+
var init_utils = __esm({
|
|
501
|
+
"node_modules/@noble/hashes/esm/utils.js"() {
|
|
502
|
+
isLE = /* @__PURE__ */ (() => new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68)();
|
|
503
|
+
swap32IfBE = isLE ? (u) => u : byteSwap32;
|
|
504
|
+
Hash = class {
|
|
505
|
+
};
|
|
506
|
+
}
|
|
507
|
+
});
|
|
508
|
+
|
|
509
|
+
// node_modules/@noble/hashes/esm/sha3.js
|
|
510
|
+
function keccakP(s, rounds = 24) {
|
|
511
|
+
const B = new Uint32Array(5 * 2);
|
|
512
|
+
for (let round = 24 - rounds; round < 24; round++) {
|
|
513
|
+
for (let x = 0; x < 10; x++)
|
|
514
|
+
B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];
|
|
515
|
+
for (let x = 0; x < 10; x += 2) {
|
|
516
|
+
const idx1 = (x + 8) % 10;
|
|
517
|
+
const idx0 = (x + 2) % 10;
|
|
518
|
+
const B0 = B[idx0];
|
|
519
|
+
const B1 = B[idx0 + 1];
|
|
520
|
+
const Th = rotlH(B0, B1, 1) ^ B[idx1];
|
|
521
|
+
const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];
|
|
522
|
+
for (let y = 0; y < 50; y += 10) {
|
|
523
|
+
s[x + y] ^= Th;
|
|
524
|
+
s[x + y + 1] ^= Tl;
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
let curH = s[2];
|
|
528
|
+
let curL = s[3];
|
|
529
|
+
for (let t = 0; t < 24; t++) {
|
|
530
|
+
const shift = SHA3_ROTL[t];
|
|
531
|
+
const Th = rotlH(curH, curL, shift);
|
|
532
|
+
const Tl = rotlL(curH, curL, shift);
|
|
533
|
+
const PI = SHA3_PI[t];
|
|
534
|
+
curH = s[PI];
|
|
535
|
+
curL = s[PI + 1];
|
|
536
|
+
s[PI] = Th;
|
|
537
|
+
s[PI + 1] = Tl;
|
|
538
|
+
}
|
|
539
|
+
for (let y = 0; y < 50; y += 10) {
|
|
540
|
+
for (let x = 0; x < 10; x++)
|
|
541
|
+
B[x] = s[y + x];
|
|
542
|
+
for (let x = 0; x < 10; x++)
|
|
543
|
+
s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];
|
|
544
|
+
}
|
|
545
|
+
s[0] ^= SHA3_IOTA_H[round];
|
|
546
|
+
s[1] ^= SHA3_IOTA_L[round];
|
|
547
|
+
}
|
|
548
|
+
clean(B);
|
|
549
|
+
}
|
|
550
|
+
var _0n, _1n, _2n, _7n, _256n, _0x71n, SHA3_PI, SHA3_ROTL, _SHA3_IOTA, IOTAS, SHA3_IOTA_H, SHA3_IOTA_L, rotlH, rotlL, Keccak, gen, keccak_256;
|
|
551
|
+
var init_sha3 = __esm({
|
|
552
|
+
"node_modules/@noble/hashes/esm/sha3.js"() {
|
|
553
|
+
init_u64();
|
|
554
|
+
init_utils();
|
|
555
|
+
_0n = BigInt(0);
|
|
556
|
+
_1n = BigInt(1);
|
|
557
|
+
_2n = BigInt(2);
|
|
558
|
+
_7n = BigInt(7);
|
|
559
|
+
_256n = BigInt(256);
|
|
560
|
+
_0x71n = BigInt(113);
|
|
561
|
+
SHA3_PI = [];
|
|
562
|
+
SHA3_ROTL = [];
|
|
563
|
+
_SHA3_IOTA = [];
|
|
564
|
+
for (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) {
|
|
565
|
+
[x, y] = [y, (2 * x + 3 * y) % 5];
|
|
566
|
+
SHA3_PI.push(2 * (5 * y + x));
|
|
567
|
+
SHA3_ROTL.push((round + 1) * (round + 2) / 2 % 64);
|
|
568
|
+
let t = _0n;
|
|
569
|
+
for (let j = 0; j < 7; j++) {
|
|
570
|
+
R = (R << _1n ^ (R >> _7n) * _0x71n) % _256n;
|
|
571
|
+
if (R & _2n)
|
|
572
|
+
t ^= _1n << (_1n << /* @__PURE__ */ BigInt(j)) - _1n;
|
|
573
|
+
}
|
|
574
|
+
_SHA3_IOTA.push(t);
|
|
575
|
+
}
|
|
576
|
+
IOTAS = split(_SHA3_IOTA, true);
|
|
577
|
+
SHA3_IOTA_H = IOTAS[0];
|
|
578
|
+
SHA3_IOTA_L = IOTAS[1];
|
|
579
|
+
rotlH = (h, l, s) => s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s);
|
|
580
|
+
rotlL = (h, l, s) => s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s);
|
|
581
|
+
Keccak = class _Keccak extends Hash {
|
|
582
|
+
// NOTE: we accept arguments in bytes instead of bits here.
|
|
583
|
+
constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {
|
|
584
|
+
super();
|
|
585
|
+
this.pos = 0;
|
|
586
|
+
this.posOut = 0;
|
|
587
|
+
this.finished = false;
|
|
588
|
+
this.destroyed = false;
|
|
589
|
+
this.enableXOF = false;
|
|
590
|
+
this.blockLen = blockLen;
|
|
591
|
+
this.suffix = suffix;
|
|
592
|
+
this.outputLen = outputLen;
|
|
593
|
+
this.enableXOF = enableXOF;
|
|
594
|
+
this.rounds = rounds;
|
|
595
|
+
anumber(outputLen);
|
|
596
|
+
if (!(0 < blockLen && blockLen < 200))
|
|
597
|
+
throw new Error("only keccak-f1600 function is supported");
|
|
598
|
+
this.state = new Uint8Array(200);
|
|
599
|
+
this.state32 = u32(this.state);
|
|
600
|
+
}
|
|
601
|
+
clone() {
|
|
602
|
+
return this._cloneInto();
|
|
603
|
+
}
|
|
604
|
+
keccak() {
|
|
605
|
+
swap32IfBE(this.state32);
|
|
606
|
+
keccakP(this.state32, this.rounds);
|
|
607
|
+
swap32IfBE(this.state32);
|
|
608
|
+
this.posOut = 0;
|
|
609
|
+
this.pos = 0;
|
|
610
|
+
}
|
|
611
|
+
update(data) {
|
|
612
|
+
aexists(this);
|
|
613
|
+
data = toBytes2(data);
|
|
614
|
+
abytes(data);
|
|
615
|
+
const { blockLen, state } = this;
|
|
616
|
+
const len = data.length;
|
|
617
|
+
for (let pos = 0; pos < len; ) {
|
|
618
|
+
const take = Math.min(blockLen - this.pos, len - pos);
|
|
619
|
+
for (let i = 0; i < take; i++)
|
|
620
|
+
state[this.pos++] ^= data[pos++];
|
|
621
|
+
if (this.pos === blockLen)
|
|
622
|
+
this.keccak();
|
|
623
|
+
}
|
|
624
|
+
return this;
|
|
625
|
+
}
|
|
626
|
+
finish() {
|
|
627
|
+
if (this.finished)
|
|
628
|
+
return;
|
|
629
|
+
this.finished = true;
|
|
630
|
+
const { state, suffix, pos, blockLen } = this;
|
|
631
|
+
state[pos] ^= suffix;
|
|
632
|
+
if ((suffix & 128) !== 0 && pos === blockLen - 1)
|
|
633
|
+
this.keccak();
|
|
634
|
+
state[blockLen - 1] ^= 128;
|
|
635
|
+
this.keccak();
|
|
636
|
+
}
|
|
637
|
+
writeInto(out) {
|
|
638
|
+
aexists(this, false);
|
|
639
|
+
abytes(out);
|
|
640
|
+
this.finish();
|
|
641
|
+
const bufferOut = this.state;
|
|
642
|
+
const { blockLen } = this;
|
|
643
|
+
for (let pos = 0, len = out.length; pos < len; ) {
|
|
644
|
+
if (this.posOut >= blockLen)
|
|
645
|
+
this.keccak();
|
|
646
|
+
const take = Math.min(blockLen - this.posOut, len - pos);
|
|
647
|
+
out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);
|
|
648
|
+
this.posOut += take;
|
|
649
|
+
pos += take;
|
|
650
|
+
}
|
|
651
|
+
return out;
|
|
652
|
+
}
|
|
653
|
+
xofInto(out) {
|
|
654
|
+
if (!this.enableXOF)
|
|
655
|
+
throw new Error("XOF is not possible for this instance");
|
|
656
|
+
return this.writeInto(out);
|
|
657
|
+
}
|
|
658
|
+
xof(bytes) {
|
|
659
|
+
anumber(bytes);
|
|
660
|
+
return this.xofInto(new Uint8Array(bytes));
|
|
661
|
+
}
|
|
662
|
+
digestInto(out) {
|
|
663
|
+
aoutput(out, this);
|
|
664
|
+
if (this.finished)
|
|
665
|
+
throw new Error("digest() was already called");
|
|
666
|
+
this.writeInto(out);
|
|
667
|
+
this.destroy();
|
|
668
|
+
return out;
|
|
669
|
+
}
|
|
670
|
+
digest() {
|
|
671
|
+
return this.digestInto(new Uint8Array(this.outputLen));
|
|
672
|
+
}
|
|
673
|
+
destroy() {
|
|
674
|
+
this.destroyed = true;
|
|
675
|
+
clean(this.state);
|
|
676
|
+
}
|
|
677
|
+
_cloneInto(to) {
|
|
678
|
+
const { blockLen, suffix, outputLen, rounds, enableXOF } = this;
|
|
679
|
+
to || (to = new _Keccak(blockLen, suffix, outputLen, enableXOF, rounds));
|
|
680
|
+
to.state32.set(this.state32);
|
|
681
|
+
to.pos = this.pos;
|
|
682
|
+
to.posOut = this.posOut;
|
|
683
|
+
to.finished = this.finished;
|
|
684
|
+
to.rounds = rounds;
|
|
685
|
+
to.suffix = suffix;
|
|
686
|
+
to.outputLen = outputLen;
|
|
687
|
+
to.enableXOF = enableXOF;
|
|
688
|
+
to.destroyed = this.destroyed;
|
|
689
|
+
return to;
|
|
690
|
+
}
|
|
691
|
+
};
|
|
692
|
+
gen = (suffix, blockLen, outputLen) => createHasher(() => new Keccak(blockLen, suffix, outputLen));
|
|
693
|
+
keccak_256 = /* @__PURE__ */ (() => gen(1, 136, 256 / 8))();
|
|
694
|
+
}
|
|
695
|
+
});
|
|
696
|
+
|
|
697
|
+
// node_modules/viem/_esm/utils/hash/keccak256.js
|
|
698
|
+
function keccak256(value, to_) {
|
|
699
|
+
const to = to_ || "hex";
|
|
700
|
+
const bytes = keccak_256(isHex(value, { strict: false }) ? toBytes(value) : value);
|
|
701
|
+
if (to === "bytes")
|
|
702
|
+
return bytes;
|
|
703
|
+
return toHex(bytes);
|
|
704
|
+
}
|
|
705
|
+
var init_keccak256 = __esm({
|
|
706
|
+
"node_modules/viem/_esm/utils/hash/keccak256.js"() {
|
|
707
|
+
init_sha3();
|
|
708
|
+
init_isHex();
|
|
709
|
+
init_toBytes();
|
|
710
|
+
init_toHex();
|
|
711
|
+
}
|
|
712
|
+
});
|
|
713
|
+
|
|
44
714
|
// node_modules/@noble/hashes/cryptoNode.js
|
|
45
715
|
var require_cryptoNode = __commonJS({
|
|
46
716
|
"node_modules/@noble/hashes/cryptoNode.js"(exports) {
|
|
@@ -58,43 +728,43 @@ var require_utils = __commonJS({
|
|
|
58
728
|
"use strict";
|
|
59
729
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
60
730
|
exports.wrapXOFConstructorWithOpts = exports.wrapConstructorWithOpts = exports.wrapConstructor = exports.Hash = exports.nextTick = exports.swap32IfBE = exports.byteSwapIfBE = exports.swap8IfBE = exports.isLE = void 0;
|
|
61
|
-
exports.isBytes =
|
|
62
|
-
exports.anumber =
|
|
63
|
-
exports.abytes =
|
|
731
|
+
exports.isBytes = isBytes2;
|
|
732
|
+
exports.anumber = anumber2;
|
|
733
|
+
exports.abytes = abytes2;
|
|
64
734
|
exports.ahash = ahash;
|
|
65
|
-
exports.aexists =
|
|
66
|
-
exports.aoutput =
|
|
735
|
+
exports.aexists = aexists2;
|
|
736
|
+
exports.aoutput = aoutput2;
|
|
67
737
|
exports.u8 = u86;
|
|
68
|
-
exports.u32 =
|
|
69
|
-
exports.clean =
|
|
738
|
+
exports.u32 = u324;
|
|
739
|
+
exports.clean = clean2;
|
|
70
740
|
exports.createView = createView;
|
|
71
741
|
exports.rotr = rotr;
|
|
72
742
|
exports.rotl = rotl;
|
|
73
|
-
exports.byteSwap =
|
|
74
|
-
exports.byteSwap32 =
|
|
75
|
-
exports.bytesToHex =
|
|
76
|
-
exports.hexToBytes =
|
|
743
|
+
exports.byteSwap = byteSwap2;
|
|
744
|
+
exports.byteSwap32 = byteSwap322;
|
|
745
|
+
exports.bytesToHex = bytesToHex2;
|
|
746
|
+
exports.hexToBytes = hexToBytes2;
|
|
77
747
|
exports.asyncLoop = asyncLoop;
|
|
78
|
-
exports.utf8ToBytes =
|
|
748
|
+
exports.utf8ToBytes = utf8ToBytes2;
|
|
79
749
|
exports.bytesToUtf8 = bytesToUtf8;
|
|
80
|
-
exports.toBytes =
|
|
750
|
+
exports.toBytes = toBytes3;
|
|
81
751
|
exports.kdfInputToBytes = kdfInputToBytes;
|
|
82
752
|
exports.concatBytes = concatBytes;
|
|
83
753
|
exports.checkOpts = checkOpts;
|
|
84
|
-
exports.createHasher =
|
|
754
|
+
exports.createHasher = createHasher2;
|
|
85
755
|
exports.createOptHasher = createOptHasher;
|
|
86
|
-
exports.createXOFer =
|
|
756
|
+
exports.createXOFer = createXOFer2;
|
|
87
757
|
exports.randomBytes = randomBytes;
|
|
88
758
|
var crypto_1 = require_cryptoNode();
|
|
89
|
-
function
|
|
759
|
+
function isBytes2(a) {
|
|
90
760
|
return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
|
|
91
761
|
}
|
|
92
|
-
function
|
|
762
|
+
function anumber2(n) {
|
|
93
763
|
if (!Number.isSafeInteger(n) || n < 0)
|
|
94
764
|
throw new Error("positive integer expected, got " + n);
|
|
95
765
|
}
|
|
96
|
-
function
|
|
97
|
-
if (!
|
|
766
|
+
function abytes2(b, ...lengths) {
|
|
767
|
+
if (!isBytes2(b))
|
|
98
768
|
throw new Error("Uint8Array expected");
|
|
99
769
|
if (lengths.length > 0 && !lengths.includes(b.length))
|
|
100
770
|
throw new Error("Uint8Array expected of length " + lengths + ", got length=" + b.length);
|
|
@@ -102,17 +772,17 @@ var require_utils = __commonJS({
|
|
|
102
772
|
function ahash(h) {
|
|
103
773
|
if (typeof h !== "function" || typeof h.create !== "function")
|
|
104
774
|
throw new Error("Hash should be wrapped by utils.createHasher");
|
|
105
|
-
|
|
106
|
-
|
|
775
|
+
anumber2(h.outputLen);
|
|
776
|
+
anumber2(h.blockLen);
|
|
107
777
|
}
|
|
108
|
-
function
|
|
778
|
+
function aexists2(instance, checkFinished = true) {
|
|
109
779
|
if (instance.destroyed)
|
|
110
780
|
throw new Error("Hash instance has been destroyed");
|
|
111
781
|
if (checkFinished && instance.finished)
|
|
112
782
|
throw new Error("Hash#digest() has already been called");
|
|
113
783
|
}
|
|
114
|
-
function
|
|
115
|
-
|
|
784
|
+
function aoutput2(out, instance) {
|
|
785
|
+
abytes2(out);
|
|
116
786
|
const min = instance.outputLen;
|
|
117
787
|
if (out.length < min) {
|
|
118
788
|
throw new Error("digestInto() expects output buffer of length at least " + min);
|
|
@@ -121,10 +791,10 @@ var require_utils = __commonJS({
|
|
|
121
791
|
function u86(arr) {
|
|
122
792
|
return new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);
|
|
123
793
|
}
|
|
124
|
-
function
|
|
794
|
+
function u324(arr) {
|
|
125
795
|
return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
|
|
126
796
|
}
|
|
127
|
-
function
|
|
797
|
+
function clean2(...arrays) {
|
|
128
798
|
for (let i = 0; i < arrays.length; i++) {
|
|
129
799
|
arrays[i].fill(0);
|
|
130
800
|
}
|
|
@@ -139,30 +809,30 @@ var require_utils = __commonJS({
|
|
|
139
809
|
return word << shift | word >>> 32 - shift >>> 0;
|
|
140
810
|
}
|
|
141
811
|
exports.isLE = (() => new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68)();
|
|
142
|
-
function
|
|
812
|
+
function byteSwap2(word) {
|
|
143
813
|
return word << 24 & 4278190080 | word << 8 & 16711680 | word >>> 8 & 65280 | word >>> 24 & 255;
|
|
144
814
|
}
|
|
145
|
-
exports.swap8IfBE = exports.isLE ? (n) => n : (n) =>
|
|
815
|
+
exports.swap8IfBE = exports.isLE ? (n) => n : (n) => byteSwap2(n);
|
|
146
816
|
exports.byteSwapIfBE = exports.swap8IfBE;
|
|
147
|
-
function
|
|
817
|
+
function byteSwap322(arr) {
|
|
148
818
|
for (let i = 0; i < arr.length; i++) {
|
|
149
|
-
arr[i] =
|
|
819
|
+
arr[i] = byteSwap2(arr[i]);
|
|
150
820
|
}
|
|
151
821
|
return arr;
|
|
152
822
|
}
|
|
153
|
-
exports.swap32IfBE = exports.isLE ? (u) => u :
|
|
823
|
+
exports.swap32IfBE = exports.isLE ? (u) => u : byteSwap322;
|
|
154
824
|
var hasHexBuiltin = /* @__PURE__ */ (() => (
|
|
155
825
|
// @ts-ignore
|
|
156
826
|
typeof Uint8Array.from([]).toHex === "function" && typeof Uint8Array.fromHex === "function"
|
|
157
827
|
))();
|
|
158
|
-
var
|
|
159
|
-
function
|
|
160
|
-
|
|
828
|
+
var hexes2 = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
|
|
829
|
+
function bytesToHex2(bytes) {
|
|
830
|
+
abytes2(bytes);
|
|
161
831
|
if (hasHexBuiltin)
|
|
162
832
|
return bytes.toHex();
|
|
163
833
|
let hex = "";
|
|
164
834
|
for (let i = 0; i < bytes.length; i++) {
|
|
165
|
-
hex +=
|
|
835
|
+
hex += hexes2[bytes[i]];
|
|
166
836
|
}
|
|
167
837
|
return hex;
|
|
168
838
|
}
|
|
@@ -176,7 +846,7 @@ var require_utils = __commonJS({
|
|
|
176
846
|
return ch - (asciis.a - 10);
|
|
177
847
|
return;
|
|
178
848
|
}
|
|
179
|
-
function
|
|
849
|
+
function hexToBytes2(hex) {
|
|
180
850
|
if (typeof hex !== "string")
|
|
181
851
|
throw new Error("hex string expected, got " + typeof hex);
|
|
182
852
|
if (hasHexBuiltin)
|
|
@@ -211,7 +881,7 @@ var require_utils = __commonJS({
|
|
|
211
881
|
ts += diff;
|
|
212
882
|
}
|
|
213
883
|
}
|
|
214
|
-
function
|
|
884
|
+
function utf8ToBytes2(str) {
|
|
215
885
|
if (typeof str !== "string")
|
|
216
886
|
throw new Error("string expected");
|
|
217
887
|
return new Uint8Array(new TextEncoder().encode(str));
|
|
@@ -219,30 +889,30 @@ var require_utils = __commonJS({
|
|
|
219
889
|
function bytesToUtf8(bytes) {
|
|
220
890
|
return new TextDecoder().decode(bytes);
|
|
221
891
|
}
|
|
222
|
-
function
|
|
892
|
+
function toBytes3(data) {
|
|
223
893
|
if (typeof data === "string")
|
|
224
|
-
data =
|
|
225
|
-
|
|
894
|
+
data = utf8ToBytes2(data);
|
|
895
|
+
abytes2(data);
|
|
226
896
|
return data;
|
|
227
897
|
}
|
|
228
898
|
function kdfInputToBytes(data) {
|
|
229
899
|
if (typeof data === "string")
|
|
230
|
-
data =
|
|
231
|
-
|
|
900
|
+
data = utf8ToBytes2(data);
|
|
901
|
+
abytes2(data);
|
|
232
902
|
return data;
|
|
233
903
|
}
|
|
234
904
|
function concatBytes(...arrays) {
|
|
235
905
|
let sum = 0;
|
|
236
906
|
for (let i = 0; i < arrays.length; i++) {
|
|
237
907
|
const a = arrays[i];
|
|
238
|
-
|
|
908
|
+
abytes2(a);
|
|
239
909
|
sum += a.length;
|
|
240
910
|
}
|
|
241
911
|
const res = new Uint8Array(sum);
|
|
242
|
-
for (let i = 0,
|
|
912
|
+
for (let i = 0, pad2 = 0; i < arrays.length; i++) {
|
|
243
913
|
const a = arrays[i];
|
|
244
|
-
res.set(a,
|
|
245
|
-
|
|
914
|
+
res.set(a, pad2);
|
|
915
|
+
pad2 += a.length;
|
|
246
916
|
}
|
|
247
917
|
return res;
|
|
248
918
|
}
|
|
@@ -252,11 +922,11 @@ var require_utils = __commonJS({
|
|
|
252
922
|
const merged = Object.assign(defaults, opts);
|
|
253
923
|
return merged;
|
|
254
924
|
}
|
|
255
|
-
var
|
|
925
|
+
var Hash2 = class {
|
|
256
926
|
};
|
|
257
|
-
exports.Hash =
|
|
258
|
-
function
|
|
259
|
-
const hashC = (msg) => hashCons().update(
|
|
927
|
+
exports.Hash = Hash2;
|
|
928
|
+
function createHasher2(hashCons) {
|
|
929
|
+
const hashC = (msg) => hashCons().update(toBytes3(msg)).digest();
|
|
260
930
|
const tmp = hashCons();
|
|
261
931
|
hashC.outputLen = tmp.outputLen;
|
|
262
932
|
hashC.blockLen = tmp.blockLen;
|
|
@@ -264,24 +934,24 @@ var require_utils = __commonJS({
|
|
|
264
934
|
return hashC;
|
|
265
935
|
}
|
|
266
936
|
function createOptHasher(hashCons) {
|
|
267
|
-
const hashC = (msg, opts) => hashCons(opts).update(
|
|
937
|
+
const hashC = (msg, opts) => hashCons(opts).update(toBytes3(msg)).digest();
|
|
268
938
|
const tmp = hashCons({});
|
|
269
939
|
hashC.outputLen = tmp.outputLen;
|
|
270
940
|
hashC.blockLen = tmp.blockLen;
|
|
271
941
|
hashC.create = (opts) => hashCons(opts);
|
|
272
942
|
return hashC;
|
|
273
943
|
}
|
|
274
|
-
function
|
|
275
|
-
const hashC = (msg, opts) => hashCons(opts).update(
|
|
944
|
+
function createXOFer2(hashCons) {
|
|
945
|
+
const hashC = (msg, opts) => hashCons(opts).update(toBytes3(msg)).digest();
|
|
276
946
|
const tmp = hashCons({});
|
|
277
947
|
hashC.outputLen = tmp.outputLen;
|
|
278
948
|
hashC.blockLen = tmp.blockLen;
|
|
279
949
|
hashC.create = (opts) => hashCons(opts);
|
|
280
950
|
return hashC;
|
|
281
951
|
}
|
|
282
|
-
exports.wrapConstructor =
|
|
952
|
+
exports.wrapConstructor = createHasher2;
|
|
283
953
|
exports.wrapConstructorWithOpts = createOptHasher;
|
|
284
|
-
exports.wrapXOFConstructorWithOpts =
|
|
954
|
+
exports.wrapXOFConstructorWithOpts = createXOFer2;
|
|
285
955
|
function randomBytes(bytesLength = 32) {
|
|
286
956
|
if (crypto_1.crypto && typeof crypto_1.crypto.getRandomValues === "function") {
|
|
287
957
|
return crypto_1.crypto.getRandomValues(new Uint8Array(bytesLength));
|
|
@@ -304,17 +974,17 @@ var require_md = __commonJS({
|
|
|
304
974
|
exports.Chi = Chi;
|
|
305
975
|
exports.Maj = Maj;
|
|
306
976
|
var utils_ts_1 = require_utils();
|
|
307
|
-
function setBigUint64(view, byteOffset, value,
|
|
977
|
+
function setBigUint64(view, byteOffset, value, isLE2) {
|
|
308
978
|
if (typeof view.setBigUint64 === "function")
|
|
309
|
-
return view.setBigUint64(byteOffset, value,
|
|
310
|
-
const
|
|
979
|
+
return view.setBigUint64(byteOffset, value, isLE2);
|
|
980
|
+
const _32n2 = BigInt(32);
|
|
311
981
|
const _u32_max = BigInt(4294967295);
|
|
312
|
-
const wh = Number(value >>
|
|
982
|
+
const wh = Number(value >> _32n2 & _u32_max);
|
|
313
983
|
const wl = Number(value & _u32_max);
|
|
314
|
-
const h =
|
|
315
|
-
const l =
|
|
316
|
-
view.setUint32(byteOffset + h, wh,
|
|
317
|
-
view.setUint32(byteOffset + l, wl,
|
|
984
|
+
const h = isLE2 ? 4 : 0;
|
|
985
|
+
const l = isLE2 ? 0 : 4;
|
|
986
|
+
view.setUint32(byteOffset + h, wh, isLE2);
|
|
987
|
+
view.setUint32(byteOffset + l, wl, isLE2);
|
|
318
988
|
}
|
|
319
989
|
function Chi(a, b, c) {
|
|
320
990
|
return a & b ^ ~a & c;
|
|
@@ -323,7 +993,7 @@ var require_md = __commonJS({
|
|
|
323
993
|
return a & b ^ a & c ^ b & c;
|
|
324
994
|
}
|
|
325
995
|
var HashMD = class extends utils_ts_1.Hash {
|
|
326
|
-
constructor(blockLen, outputLen, padOffset,
|
|
996
|
+
constructor(blockLen, outputLen, padOffset, isLE2) {
|
|
327
997
|
super();
|
|
328
998
|
this.finished = false;
|
|
329
999
|
this.length = 0;
|
|
@@ -332,7 +1002,7 @@ var require_md = __commonJS({
|
|
|
332
1002
|
this.blockLen = blockLen;
|
|
333
1003
|
this.outputLen = outputLen;
|
|
334
1004
|
this.padOffset = padOffset;
|
|
335
|
-
this.isLE =
|
|
1005
|
+
this.isLE = isLE2;
|
|
336
1006
|
this.buffer = new Uint8Array(blockLen);
|
|
337
1007
|
this.view = (0, utils_ts_1.createView)(this.buffer);
|
|
338
1008
|
}
|
|
@@ -366,7 +1036,7 @@ var require_md = __commonJS({
|
|
|
366
1036
|
(0, utils_ts_1.aexists)(this);
|
|
367
1037
|
(0, utils_ts_1.aoutput)(out, this);
|
|
368
1038
|
this.finished = true;
|
|
369
|
-
const { buffer, view, blockLen, isLE } = this;
|
|
1039
|
+
const { buffer, view, blockLen, isLE: isLE2 } = this;
|
|
370
1040
|
let { pos } = this;
|
|
371
1041
|
buffer[pos++] = 128;
|
|
372
1042
|
(0, utils_ts_1.clean)(this.buffer.subarray(pos));
|
|
@@ -376,7 +1046,7 @@ var require_md = __commonJS({
|
|
|
376
1046
|
}
|
|
377
1047
|
for (let i = pos; i < blockLen; i++)
|
|
378
1048
|
buffer[i] = 0;
|
|
379
|
-
setBigUint64(view, blockLen - 8, BigInt(this.length * 8),
|
|
1049
|
+
setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE2);
|
|
380
1050
|
this.process(view, 0);
|
|
381
1051
|
const oview = (0, utils_ts_1.createView)(out);
|
|
382
1052
|
const len = this.outputLen;
|
|
@@ -387,7 +1057,7 @@ var require_md = __commonJS({
|
|
|
387
1057
|
if (outLen > state.length)
|
|
388
1058
|
throw new Error("_sha2: outputLen bigger than state");
|
|
389
1059
|
for (let i = 0; i < outLen; i++)
|
|
390
|
-
oview.setUint32(4 * i, state[i],
|
|
1060
|
+
oview.setUint32(4 * i, state[i], isLE2);
|
|
391
1061
|
}
|
|
392
1062
|
digest() {
|
|
393
1063
|
const { buffer, outputLen } = this;
|
|
@@ -479,26 +1149,26 @@ var require_u64 = __commonJS({
|
|
|
479
1149
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
480
1150
|
exports.toBig = exports.shrSL = exports.shrSH = exports.rotrSL = exports.rotrSH = exports.rotrBL = exports.rotrBH = exports.rotr32L = exports.rotr32H = exports.rotlSL = exports.rotlSH = exports.rotlBL = exports.rotlBH = exports.add5L = exports.add5H = exports.add4L = exports.add4H = exports.add3L = exports.add3H = void 0;
|
|
481
1151
|
exports.add = add;
|
|
482
|
-
exports.fromBig =
|
|
483
|
-
exports.split =
|
|
484
|
-
var
|
|
485
|
-
var
|
|
486
|
-
function
|
|
1152
|
+
exports.fromBig = fromBig2;
|
|
1153
|
+
exports.split = split2;
|
|
1154
|
+
var U32_MASK642 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
|
|
1155
|
+
var _32n2 = /* @__PURE__ */ BigInt(32);
|
|
1156
|
+
function fromBig2(n, le = false) {
|
|
487
1157
|
if (le)
|
|
488
|
-
return { h: Number(n &
|
|
489
|
-
return { h: Number(n >>
|
|
1158
|
+
return { h: Number(n & U32_MASK642), l: Number(n >> _32n2 & U32_MASK642) };
|
|
1159
|
+
return { h: Number(n >> _32n2 & U32_MASK642) | 0, l: Number(n & U32_MASK642) | 0 };
|
|
490
1160
|
}
|
|
491
|
-
function
|
|
1161
|
+
function split2(lst, le = false) {
|
|
492
1162
|
const len = lst.length;
|
|
493
1163
|
let Ah = new Uint32Array(len);
|
|
494
1164
|
let Al = new Uint32Array(len);
|
|
495
1165
|
for (let i = 0; i < len; i++) {
|
|
496
|
-
const { h, l } =
|
|
1166
|
+
const { h, l } = fromBig2(lst[i], le);
|
|
497
1167
|
[Ah[i], Al[i]] = [h, l];
|
|
498
1168
|
}
|
|
499
1169
|
return [Ah, Al];
|
|
500
1170
|
}
|
|
501
|
-
var toBig = (h, l) => BigInt(h >>> 0) <<
|
|
1171
|
+
var toBig = (h, l) => BigInt(h >>> 0) << _32n2 | BigInt(l >>> 0);
|
|
502
1172
|
exports.toBig = toBig;
|
|
503
1173
|
var shrSH = (h, _l, s) => h >>> s;
|
|
504
1174
|
exports.shrSH = shrSH;
|
|
@@ -516,14 +1186,14 @@ var require_u64 = __commonJS({
|
|
|
516
1186
|
exports.rotr32H = rotr32H;
|
|
517
1187
|
var rotr32L = (h, _l) => h;
|
|
518
1188
|
exports.rotr32L = rotr32L;
|
|
519
|
-
var
|
|
520
|
-
exports.rotlSH =
|
|
521
|
-
var
|
|
522
|
-
exports.rotlSL =
|
|
523
|
-
var
|
|
524
|
-
exports.rotlBH =
|
|
525
|
-
var
|
|
526
|
-
exports.rotlBL =
|
|
1189
|
+
var rotlSH2 = (h, l, s) => h << s | l >>> 32 - s;
|
|
1190
|
+
exports.rotlSH = rotlSH2;
|
|
1191
|
+
var rotlSL2 = (h, l, s) => l << s | h >>> 32 - s;
|
|
1192
|
+
exports.rotlSL = rotlSL2;
|
|
1193
|
+
var rotlBH2 = (h, l, s) => l << s - 32 | h >>> 64 - s;
|
|
1194
|
+
exports.rotlBH = rotlBH2;
|
|
1195
|
+
var rotlBL2 = (h, l, s) => h << s - 32 | l >>> 64 - s;
|
|
1196
|
+
exports.rotlBL = rotlBL2;
|
|
527
1197
|
function add(Ah, Al, Bh, Bl) {
|
|
528
1198
|
const l = (Al >>> 0) + (Bl >>> 0);
|
|
529
1199
|
return { h: Ah + Bh + (l / 2 ** 32 | 0) | 0, l: l | 0 };
|
|
@@ -541,8 +1211,8 @@ var require_u64 = __commonJS({
|
|
|
541
1211
|
var add5H = (low, Ah, Bh, Ch, Dh, Eh) => Ah + Bh + Ch + Dh + Eh + (low / 2 ** 32 | 0) | 0;
|
|
542
1212
|
exports.add5H = add5H;
|
|
543
1213
|
var u642 = {
|
|
544
|
-
fromBig,
|
|
545
|
-
split,
|
|
1214
|
+
fromBig: fromBig2,
|
|
1215
|
+
split: split2,
|
|
546
1216
|
toBig,
|
|
547
1217
|
shrSH,
|
|
548
1218
|
shrSL,
|
|
@@ -552,10 +1222,10 @@ var require_u64 = __commonJS({
|
|
|
552
1222
|
rotrBL,
|
|
553
1223
|
rotr32H,
|
|
554
1224
|
rotr32L,
|
|
555
|
-
rotlSH,
|
|
556
|
-
rotlSL,
|
|
557
|
-
rotlBH,
|
|
558
|
-
rotlBL,
|
|
1225
|
+
rotlSH: rotlSH2,
|
|
1226
|
+
rotlSL: rotlSL2,
|
|
1227
|
+
rotlBH: rotlBH2,
|
|
1228
|
+
rotlBL: rotlBL2,
|
|
559
1229
|
add,
|
|
560
1230
|
add3L,
|
|
561
1231
|
add3H,
|
|
@@ -1097,8 +1767,8 @@ var require_utils2 = __commonJS({
|
|
|
1097
1767
|
Object.defineProperty(exports, "utf8ToBytes", { enumerable: true, get: function() {
|
|
1098
1768
|
return utils_js_2.utf8ToBytes;
|
|
1099
1769
|
} });
|
|
1100
|
-
var
|
|
1101
|
-
var
|
|
1770
|
+
var _0n2 = /* @__PURE__ */ BigInt(0);
|
|
1771
|
+
var _1n2 = /* @__PURE__ */ BigInt(1);
|
|
1102
1772
|
function abool(title, value) {
|
|
1103
1773
|
if (typeof value !== "boolean")
|
|
1104
1774
|
throw new Error(title + " boolean expected, got " + value);
|
|
@@ -1129,7 +1799,7 @@ var require_utils2 = __commonJS({
|
|
|
1129
1799
|
function hexToNumber(hex) {
|
|
1130
1800
|
if (typeof hex !== "string")
|
|
1131
1801
|
throw new Error("hex string expected, got " + typeof hex);
|
|
1132
|
-
return hex === "" ?
|
|
1802
|
+
return hex === "" ? _0n2 : BigInt("0x" + hex);
|
|
1133
1803
|
}
|
|
1134
1804
|
function bytesToNumberBE(bytes) {
|
|
1135
1805
|
return hexToNumber((0, utils_js_1.bytesToHex)(bytes));
|
|
@@ -1185,7 +1855,7 @@ var require_utils2 = __commonJS({
|
|
|
1185
1855
|
return charCode;
|
|
1186
1856
|
});
|
|
1187
1857
|
}
|
|
1188
|
-
var isPosBig = (n) => typeof n === "bigint" &&
|
|
1858
|
+
var isPosBig = (n) => typeof n === "bigint" && _0n2 <= n;
|
|
1189
1859
|
function inRange(n, min, max) {
|
|
1190
1860
|
return isPosBig(n) && isPosBig(min) && isPosBig(max) && min <= n && n < max;
|
|
1191
1861
|
}
|
|
@@ -1195,17 +1865,17 @@ var require_utils2 = __commonJS({
|
|
|
1195
1865
|
}
|
|
1196
1866
|
function bitLen(n) {
|
|
1197
1867
|
let len;
|
|
1198
|
-
for (len = 0; n >
|
|
1868
|
+
for (len = 0; n > _0n2; n >>= _1n2, len += 1)
|
|
1199
1869
|
;
|
|
1200
1870
|
return len;
|
|
1201
1871
|
}
|
|
1202
1872
|
function bitGet(n, pos) {
|
|
1203
|
-
return n >> BigInt(pos) &
|
|
1873
|
+
return n >> BigInt(pos) & _1n2;
|
|
1204
1874
|
}
|
|
1205
1875
|
function bitSet(n, pos, value) {
|
|
1206
|
-
return n | (value ?
|
|
1876
|
+
return n | (value ? _1n2 : _0n2) << BigInt(pos);
|
|
1207
1877
|
}
|
|
1208
|
-
var bitMask = (n) => (
|
|
1878
|
+
var bitMask = (n) => (_1n2 << BigInt(n)) - _1n2;
|
|
1209
1879
|
exports.bitMask = bitMask;
|
|
1210
1880
|
function createHmacDrbg(hashLen, qByteLen, hmacFn) {
|
|
1211
1881
|
if (typeof hashLen !== "number" || hashLen < 2)
|
|
@@ -1233,7 +1903,7 @@ var require_utils2 = __commonJS({
|
|
|
1233
1903
|
k = h(u8of(1), seed);
|
|
1234
1904
|
v = h();
|
|
1235
1905
|
};
|
|
1236
|
-
const
|
|
1906
|
+
const gen2 = () => {
|
|
1237
1907
|
if (i++ >= 1e3)
|
|
1238
1908
|
throw new Error("drbg: tried 1000 values");
|
|
1239
1909
|
let len = 0;
|
|
@@ -1250,7 +1920,7 @@ var require_utils2 = __commonJS({
|
|
|
1250
1920
|
reset();
|
|
1251
1921
|
reseed(seed);
|
|
1252
1922
|
let res = void 0;
|
|
1253
|
-
while (!(res = pred(
|
|
1923
|
+
while (!(res = pred(gen2())))
|
|
1254
1924
|
reseed();
|
|
1255
1925
|
reset();
|
|
1256
1926
|
return res;
|
|
@@ -1348,40 +2018,40 @@ var require_modular = __commonJS({
|
|
|
1348
2018
|
exports.getMinHashLength = getMinHashLength;
|
|
1349
2019
|
exports.mapHashToField = mapHashToField;
|
|
1350
2020
|
var utils_ts_1 = require_utils2();
|
|
1351
|
-
var
|
|
1352
|
-
var
|
|
1353
|
-
var
|
|
2021
|
+
var _0n2 = BigInt(0);
|
|
2022
|
+
var _1n2 = BigInt(1);
|
|
2023
|
+
var _2n2 = /* @__PURE__ */ BigInt(2);
|
|
1354
2024
|
var _3n = /* @__PURE__ */ BigInt(3);
|
|
1355
2025
|
var _4n = /* @__PURE__ */ BigInt(4);
|
|
1356
2026
|
var _5n = /* @__PURE__ */ BigInt(5);
|
|
1357
|
-
var
|
|
2027
|
+
var _7n2 = /* @__PURE__ */ BigInt(7);
|
|
1358
2028
|
var _8n = /* @__PURE__ */ BigInt(8);
|
|
1359
2029
|
var _9n = /* @__PURE__ */ BigInt(9);
|
|
1360
2030
|
var _16n = /* @__PURE__ */ BigInt(16);
|
|
1361
2031
|
function mod(a, b) {
|
|
1362
2032
|
const result = a % b;
|
|
1363
|
-
return result >=
|
|
2033
|
+
return result >= _0n2 ? result : b + result;
|
|
1364
2034
|
}
|
|
1365
2035
|
function pow(num, power, modulo) {
|
|
1366
2036
|
return FpPow(Field(modulo), num, power);
|
|
1367
2037
|
}
|
|
1368
2038
|
function pow2(x, power, modulo) {
|
|
1369
2039
|
let res = x;
|
|
1370
|
-
while (power-- >
|
|
2040
|
+
while (power-- > _0n2) {
|
|
1371
2041
|
res *= res;
|
|
1372
2042
|
res %= modulo;
|
|
1373
2043
|
}
|
|
1374
2044
|
return res;
|
|
1375
2045
|
}
|
|
1376
2046
|
function invert(number, modulo) {
|
|
1377
|
-
if (number ===
|
|
2047
|
+
if (number === _0n2)
|
|
1378
2048
|
throw new Error("invert: expected non-zero number");
|
|
1379
|
-
if (modulo <=
|
|
2049
|
+
if (modulo <= _0n2)
|
|
1380
2050
|
throw new Error("invert: expected positive modulus, got " + modulo);
|
|
1381
2051
|
let a = mod(number, modulo);
|
|
1382
2052
|
let b = modulo;
|
|
1383
|
-
let x =
|
|
1384
|
-
while (a !==
|
|
2053
|
+
let x = _0n2, y = _1n2, u = _1n2, v = _0n2;
|
|
2054
|
+
while (a !== _0n2) {
|
|
1385
2055
|
const q = b / a;
|
|
1386
2056
|
const r = b % a;
|
|
1387
2057
|
const m = x - u * q;
|
|
@@ -1389,7 +2059,7 @@ var require_modular = __commonJS({
|
|
|
1389
2059
|
b = a, a = r, x = u, y = v, u = m, v = n;
|
|
1390
2060
|
}
|
|
1391
2061
|
const gcd = b;
|
|
1392
|
-
if (gcd !==
|
|
2062
|
+
if (gcd !== _1n2)
|
|
1393
2063
|
throw new Error("invert: does not exist");
|
|
1394
2064
|
return mod(x, modulo);
|
|
1395
2065
|
}
|
|
@@ -1398,17 +2068,17 @@ var require_modular = __commonJS({
|
|
|
1398
2068
|
throw new Error("Cannot find square root");
|
|
1399
2069
|
}
|
|
1400
2070
|
function sqrt3mod4(Fp, n) {
|
|
1401
|
-
const p1div4 = (Fp.ORDER +
|
|
2071
|
+
const p1div4 = (Fp.ORDER + _1n2) / _4n;
|
|
1402
2072
|
const root = Fp.pow(n, p1div4);
|
|
1403
2073
|
assertIsSquare(Fp, root, n);
|
|
1404
2074
|
return root;
|
|
1405
2075
|
}
|
|
1406
2076
|
function sqrt5mod8(Fp, n) {
|
|
1407
2077
|
const p5div8 = (Fp.ORDER - _5n) / _8n;
|
|
1408
|
-
const n2 = Fp.mul(n,
|
|
2078
|
+
const n2 = Fp.mul(n, _2n2);
|
|
1409
2079
|
const v = Fp.pow(n2, p5div8);
|
|
1410
2080
|
const nv = Fp.mul(n, v);
|
|
1411
|
-
const i = Fp.mul(Fp.mul(nv,
|
|
2081
|
+
const i = Fp.mul(Fp.mul(nv, _2n2), v);
|
|
1412
2082
|
const root = Fp.mul(nv, Fp.sub(i, Fp.ONE));
|
|
1413
2083
|
assertIsSquare(Fp, root, n);
|
|
1414
2084
|
return root;
|
|
@@ -1419,7 +2089,7 @@ var require_modular = __commonJS({
|
|
|
1419
2089
|
const c1 = tn(Fp_, Fp_.neg(Fp_.ONE));
|
|
1420
2090
|
const c2 = tn(Fp_, c1);
|
|
1421
2091
|
const c3 = tn(Fp_, Fp_.neg(c1));
|
|
1422
|
-
const c4 = (P +
|
|
2092
|
+
const c4 = (P + _7n2) / _16n;
|
|
1423
2093
|
return (Fp, n) => {
|
|
1424
2094
|
let tv1 = Fp.pow(n, c4);
|
|
1425
2095
|
let tv2 = Fp.mul(tv1, c1);
|
|
@@ -1438,13 +2108,13 @@ var require_modular = __commonJS({
|
|
|
1438
2108
|
function tonelliShanks(P) {
|
|
1439
2109
|
if (P < _3n)
|
|
1440
2110
|
throw new Error("sqrt is not defined for small field");
|
|
1441
|
-
let Q = P -
|
|
2111
|
+
let Q = P - _1n2;
|
|
1442
2112
|
let S = 0;
|
|
1443
|
-
while (Q %
|
|
1444
|
-
Q /=
|
|
2113
|
+
while (Q % _2n2 === _0n2) {
|
|
2114
|
+
Q /= _2n2;
|
|
1445
2115
|
S++;
|
|
1446
2116
|
}
|
|
1447
|
-
let Z =
|
|
2117
|
+
let Z = _2n2;
|
|
1448
2118
|
const _Fp = Field(P);
|
|
1449
2119
|
while (FpLegendre(_Fp, Z) === 1) {
|
|
1450
2120
|
if (Z++ > 1e3)
|
|
@@ -1453,7 +2123,7 @@ var require_modular = __commonJS({
|
|
|
1453
2123
|
if (S === 1)
|
|
1454
2124
|
return sqrt3mod4;
|
|
1455
2125
|
let cc = _Fp.pow(Z, Q);
|
|
1456
|
-
const Q1div2 = (Q +
|
|
2126
|
+
const Q1div2 = (Q + _1n2) / _2n2;
|
|
1457
2127
|
return function tonelliSlow(Fp, n) {
|
|
1458
2128
|
if (Fp.is0(n))
|
|
1459
2129
|
return n;
|
|
@@ -1474,7 +2144,7 @@ var require_modular = __commonJS({
|
|
|
1474
2144
|
if (i === M)
|
|
1475
2145
|
throw new Error("Cannot find square root");
|
|
1476
2146
|
}
|
|
1477
|
-
const exponent =
|
|
2147
|
+
const exponent = _1n2 << BigInt(M - i - 1);
|
|
1478
2148
|
const b = Fp.pow(c, exponent);
|
|
1479
2149
|
M = i;
|
|
1480
2150
|
c = Fp.sqr(b);
|
|
@@ -1493,7 +2163,7 @@ var require_modular = __commonJS({
|
|
|
1493
2163
|
return sqrt9mod16(P);
|
|
1494
2164
|
return tonelliShanks(P);
|
|
1495
2165
|
}
|
|
1496
|
-
var isNegativeLE = (num, modulo) => (mod(num, modulo) &
|
|
2166
|
+
var isNegativeLE = (num, modulo) => (mod(num, modulo) & _1n2) === _1n2;
|
|
1497
2167
|
exports.isNegativeLE = isNegativeLE;
|
|
1498
2168
|
var FIELD_FIELDS = [
|
|
1499
2169
|
"create",
|
|
@@ -1529,19 +2199,19 @@ var require_modular = __commonJS({
|
|
|
1529
2199
|
return field;
|
|
1530
2200
|
}
|
|
1531
2201
|
function FpPow(Fp, num, power) {
|
|
1532
|
-
if (power <
|
|
2202
|
+
if (power < _0n2)
|
|
1533
2203
|
throw new Error("invalid exponent, negatives unsupported");
|
|
1534
|
-
if (power ===
|
|
2204
|
+
if (power === _0n2)
|
|
1535
2205
|
return Fp.ONE;
|
|
1536
|
-
if (power ===
|
|
2206
|
+
if (power === _1n2)
|
|
1537
2207
|
return num;
|
|
1538
2208
|
let p = Fp.ONE;
|
|
1539
2209
|
let d = num;
|
|
1540
|
-
while (power >
|
|
1541
|
-
if (power &
|
|
2210
|
+
while (power > _0n2) {
|
|
2211
|
+
if (power & _1n2)
|
|
1542
2212
|
p = Fp.mul(p, d);
|
|
1543
2213
|
d = Fp.sqr(d);
|
|
1544
|
-
power >>=
|
|
2214
|
+
power >>= _1n2;
|
|
1545
2215
|
}
|
|
1546
2216
|
return p;
|
|
1547
2217
|
}
|
|
@@ -1566,7 +2236,7 @@ var require_modular = __commonJS({
|
|
|
1566
2236
|
return Fp.mul(lhs, typeof rhs === "bigint" ? invert(rhs, Fp.ORDER) : Fp.inv(rhs));
|
|
1567
2237
|
}
|
|
1568
2238
|
function FpLegendre(Fp, n) {
|
|
1569
|
-
const p1mod2 = (Fp.ORDER -
|
|
2239
|
+
const p1mod2 = (Fp.ORDER - _1n2) / _2n2;
|
|
1570
2240
|
const powered = Fp.pow(n, p1mod2);
|
|
1571
2241
|
const yes = Fp.eql(powered, Fp.ONE);
|
|
1572
2242
|
const zero = Fp.eql(powered, Fp.ZERO);
|
|
@@ -1586,15 +2256,15 @@ var require_modular = __commonJS({
|
|
|
1586
2256
|
const nByteLength = Math.ceil(_nBitLength / 8);
|
|
1587
2257
|
return { nBitLength: _nBitLength, nByteLength };
|
|
1588
2258
|
}
|
|
1589
|
-
function Field(ORDER, bitLenOrOpts,
|
|
1590
|
-
if (ORDER <=
|
|
2259
|
+
function Field(ORDER, bitLenOrOpts, isLE2 = false, opts = {}) {
|
|
2260
|
+
if (ORDER <= _0n2)
|
|
1591
2261
|
throw new Error("invalid field: expected ORDER > 0, got " + ORDER);
|
|
1592
2262
|
let _nbitLength = void 0;
|
|
1593
2263
|
let _sqrt = void 0;
|
|
1594
2264
|
let modFromBytes = false;
|
|
1595
2265
|
let allowedLengths = void 0;
|
|
1596
2266
|
if (typeof bitLenOrOpts === "object" && bitLenOrOpts != null) {
|
|
1597
|
-
if (opts.sqrt ||
|
|
2267
|
+
if (opts.sqrt || isLE2)
|
|
1598
2268
|
throw new Error("cannot specify opts in two arguments");
|
|
1599
2269
|
const _opts = bitLenOrOpts;
|
|
1600
2270
|
if (_opts.BITS)
|
|
@@ -1602,7 +2272,7 @@ var require_modular = __commonJS({
|
|
|
1602
2272
|
if (_opts.sqrt)
|
|
1603
2273
|
_sqrt = _opts.sqrt;
|
|
1604
2274
|
if (typeof _opts.isLE === "boolean")
|
|
1605
|
-
|
|
2275
|
+
isLE2 = _opts.isLE;
|
|
1606
2276
|
if (typeof _opts.modFromBytes === "boolean")
|
|
1607
2277
|
modFromBytes = _opts.modFromBytes;
|
|
1608
2278
|
allowedLengths = _opts.allowedLengths;
|
|
@@ -1618,23 +2288,23 @@ var require_modular = __commonJS({
|
|
|
1618
2288
|
let sqrtP;
|
|
1619
2289
|
const f = Object.freeze({
|
|
1620
2290
|
ORDER,
|
|
1621
|
-
isLE,
|
|
2291
|
+
isLE: isLE2,
|
|
1622
2292
|
BITS,
|
|
1623
2293
|
BYTES,
|
|
1624
2294
|
MASK: (0, utils_ts_1.bitMask)(BITS),
|
|
1625
|
-
ZERO:
|
|
1626
|
-
ONE:
|
|
2295
|
+
ZERO: _0n2,
|
|
2296
|
+
ONE: _1n2,
|
|
1627
2297
|
allowedLengths,
|
|
1628
2298
|
create: (num) => mod(num, ORDER),
|
|
1629
2299
|
isValid: (num) => {
|
|
1630
2300
|
if (typeof num !== "bigint")
|
|
1631
2301
|
throw new Error("invalid field element: expected bigint, got " + typeof num);
|
|
1632
|
-
return
|
|
2302
|
+
return _0n2 <= num && num < ORDER;
|
|
1633
2303
|
},
|
|
1634
|
-
is0: (num) => num ===
|
|
2304
|
+
is0: (num) => num === _0n2,
|
|
1635
2305
|
// is valid and invertible
|
|
1636
2306
|
isValidNot0: (num) => !f.is0(num) && f.isValid(num),
|
|
1637
|
-
isOdd: (num) => (num &
|
|
2307
|
+
isOdd: (num) => (num & _1n2) === _1n2,
|
|
1638
2308
|
neg: (num) => mod(-num, ORDER),
|
|
1639
2309
|
eql: (lhs, rhs) => lhs === rhs,
|
|
1640
2310
|
sqr: (num) => mod(num * num, ORDER),
|
|
@@ -1654,19 +2324,19 @@ var require_modular = __commonJS({
|
|
|
1654
2324
|
sqrtP = FpSqrt(ORDER);
|
|
1655
2325
|
return sqrtP(f, n);
|
|
1656
2326
|
}),
|
|
1657
|
-
toBytes: (num) =>
|
|
2327
|
+
toBytes: (num) => isLE2 ? (0, utils_ts_1.numberToBytesLE)(num, BYTES) : (0, utils_ts_1.numberToBytesBE)(num, BYTES),
|
|
1658
2328
|
fromBytes: (bytes, skipValidation = true) => {
|
|
1659
2329
|
if (allowedLengths) {
|
|
1660
2330
|
if (!allowedLengths.includes(bytes.length) || bytes.length > BYTES) {
|
|
1661
2331
|
throw new Error("Field.fromBytes: expected " + allowedLengths + " bytes, got " + bytes.length);
|
|
1662
2332
|
}
|
|
1663
2333
|
const padded = new Uint8Array(BYTES);
|
|
1664
|
-
padded.set(bytes,
|
|
2334
|
+
padded.set(bytes, isLE2 ? 0 : padded.length - bytes.length);
|
|
1665
2335
|
bytes = padded;
|
|
1666
2336
|
}
|
|
1667
2337
|
if (bytes.length !== BYTES)
|
|
1668
2338
|
throw new Error("Field.fromBytes: expected " + BYTES + " bytes, got " + bytes.length);
|
|
1669
|
-
let scalar =
|
|
2339
|
+
let scalar = isLE2 ? (0, utils_ts_1.bytesToNumberLE)(bytes) : (0, utils_ts_1.bytesToNumberBE)(bytes);
|
|
1670
2340
|
if (modFromBytes)
|
|
1671
2341
|
scalar = mod(scalar, ORDER);
|
|
1672
2342
|
if (!skipValidation) {
|
|
@@ -1695,14 +2365,14 @@ var require_modular = __commonJS({
|
|
|
1695
2365
|
const root = Fp.sqrt(elm);
|
|
1696
2366
|
return Fp.isOdd(root) ? Fp.neg(root) : root;
|
|
1697
2367
|
}
|
|
1698
|
-
function hashToPrivateScalar(hash, groupOrder,
|
|
2368
|
+
function hashToPrivateScalar(hash, groupOrder, isLE2 = false) {
|
|
1699
2369
|
hash = (0, utils_ts_1.ensureBytes)("privateHash", hash);
|
|
1700
2370
|
const hashLen = hash.length;
|
|
1701
2371
|
const minLen = nLength(groupOrder).nByteLength + 8;
|
|
1702
2372
|
if (minLen < 24 || hashLen < minLen || hashLen > 1024)
|
|
1703
2373
|
throw new Error("hashToPrivateScalar: expected " + minLen + "-1024 bytes of input, got " + hashLen);
|
|
1704
|
-
const num =
|
|
1705
|
-
return mod(num, groupOrder -
|
|
2374
|
+
const num = isLE2 ? (0, utils_ts_1.bytesToNumberLE)(hash) : (0, utils_ts_1.bytesToNumberBE)(hash);
|
|
2375
|
+
return mod(num, groupOrder - _1n2) + _1n2;
|
|
1706
2376
|
}
|
|
1707
2377
|
function getFieldBytesLength(fieldOrder) {
|
|
1708
2378
|
if (typeof fieldOrder !== "bigint")
|
|
@@ -1714,15 +2384,15 @@ var require_modular = __commonJS({
|
|
|
1714
2384
|
const length = getFieldBytesLength(fieldOrder);
|
|
1715
2385
|
return length + Math.ceil(length / 2);
|
|
1716
2386
|
}
|
|
1717
|
-
function mapHashToField(key, fieldOrder,
|
|
2387
|
+
function mapHashToField(key, fieldOrder, isLE2 = false) {
|
|
1718
2388
|
const len = key.length;
|
|
1719
2389
|
const fieldLen = getFieldBytesLength(fieldOrder);
|
|
1720
2390
|
const minLen = getMinHashLength(fieldOrder);
|
|
1721
2391
|
if (len < 16 || len < minLen || len > 1024)
|
|
1722
2392
|
throw new Error("expected " + minLen + "-1024 bytes of input, got " + len);
|
|
1723
|
-
const num =
|
|
1724
|
-
const reduced = mod(num, fieldOrder -
|
|
1725
|
-
return
|
|
2393
|
+
const num = isLE2 ? (0, utils_ts_1.bytesToNumberLE)(key) : (0, utils_ts_1.bytesToNumberBE)(key);
|
|
2394
|
+
const reduced = mod(num, fieldOrder - _1n2) + _1n2;
|
|
2395
|
+
return isLE2 ? (0, utils_ts_1.numberToBytesLE)(reduced, fieldLen) : (0, utils_ts_1.numberToBytesBE)(reduced, fieldLen);
|
|
1726
2396
|
}
|
|
1727
2397
|
}
|
|
1728
2398
|
});
|
|
@@ -1742,8 +2412,8 @@ var require_curve = __commonJS({
|
|
|
1742
2412
|
exports._createCurveFields = _createCurveFields;
|
|
1743
2413
|
var utils_ts_1 = require_utils2();
|
|
1744
2414
|
var modular_ts_1 = require_modular();
|
|
1745
|
-
var
|
|
1746
|
-
var
|
|
2415
|
+
var _0n2 = BigInt(0);
|
|
2416
|
+
var _1n2 = BigInt(1);
|
|
1747
2417
|
function negateCt(condition, item) {
|
|
1748
2418
|
const neg = item.negate();
|
|
1749
2419
|
return condition ? neg : item;
|
|
@@ -1771,7 +2441,7 @@ var require_curve = __commonJS({
|
|
|
1771
2441
|
let nextN = n >> shiftBy;
|
|
1772
2442
|
if (wbits > windowSize) {
|
|
1773
2443
|
wbits -= maxNumber;
|
|
1774
|
-
nextN +=
|
|
2444
|
+
nextN += _1n2;
|
|
1775
2445
|
}
|
|
1776
2446
|
const offsetStart = window2 * windowSize;
|
|
1777
2447
|
const offset = offsetStart + Math.abs(wbits) - 1;
|
|
@@ -1803,7 +2473,7 @@ var require_curve = __commonJS({
|
|
|
1803
2473
|
return pointWindowSizes.get(P) || 1;
|
|
1804
2474
|
}
|
|
1805
2475
|
function assert0(n) {
|
|
1806
|
-
if (n !==
|
|
2476
|
+
if (n !== _0n2)
|
|
1807
2477
|
throw new Error("invalid wNAF");
|
|
1808
2478
|
}
|
|
1809
2479
|
var wNAF = class {
|
|
@@ -1817,11 +2487,11 @@ var require_curve = __commonJS({
|
|
|
1817
2487
|
// non-const time multiplication ladder
|
|
1818
2488
|
_unsafeLadder(elm, n, p = this.ZERO) {
|
|
1819
2489
|
let d = elm;
|
|
1820
|
-
while (n >
|
|
1821
|
-
if (n &
|
|
2490
|
+
while (n > _0n2) {
|
|
2491
|
+
if (n & _1n2)
|
|
1822
2492
|
p = p.add(d);
|
|
1823
2493
|
d = d.double();
|
|
1824
|
-
n >>=
|
|
2494
|
+
n >>= _1n2;
|
|
1825
2495
|
}
|
|
1826
2496
|
return p;
|
|
1827
2497
|
}
|
|
@@ -1885,7 +2555,7 @@ var require_curve = __commonJS({
|
|
|
1885
2555
|
wNAFUnsafe(W, precomputes, n, acc = this.ZERO) {
|
|
1886
2556
|
const wo = calcWOpts(W, this.bits);
|
|
1887
2557
|
for (let window2 = 0; window2 < wo.windows; window2++) {
|
|
1888
|
-
if (n ===
|
|
2558
|
+
if (n === _0n2)
|
|
1889
2559
|
break;
|
|
1890
2560
|
const { nextN, offset, isZero, isNeg } = calcOffsets(n, window2, wo);
|
|
1891
2561
|
n = nextN;
|
|
@@ -1938,14 +2608,14 @@ var require_curve = __commonJS({
|
|
|
1938
2608
|
let acc = point;
|
|
1939
2609
|
let p1 = Point.ZERO;
|
|
1940
2610
|
let p2 = Point.ZERO;
|
|
1941
|
-
while (k1 >
|
|
1942
|
-
if (k1 &
|
|
2611
|
+
while (k1 > _0n2 || k2 > _0n2) {
|
|
2612
|
+
if (k1 & _1n2)
|
|
1943
2613
|
p1 = p1.add(acc);
|
|
1944
|
-
if (k2 &
|
|
2614
|
+
if (k2 & _1n2)
|
|
1945
2615
|
p2 = p2.add(acc);
|
|
1946
2616
|
acc = acc.double();
|
|
1947
|
-
k1 >>=
|
|
1948
|
-
k2 >>=
|
|
2617
|
+
k1 >>= _1n2;
|
|
2618
|
+
k2 >>= _1n2;
|
|
1949
2619
|
}
|
|
1950
2620
|
return { p1, p2 };
|
|
1951
2621
|
}
|
|
@@ -2041,14 +2711,14 @@ var require_curve = __commonJS({
|
|
|
2041
2711
|
...{ p: curve.Fp.ORDER }
|
|
2042
2712
|
});
|
|
2043
2713
|
}
|
|
2044
|
-
function createField(order, field,
|
|
2714
|
+
function createField(order, field, isLE2) {
|
|
2045
2715
|
if (field) {
|
|
2046
2716
|
if (field.ORDER !== order)
|
|
2047
2717
|
throw new Error("Field.ORDER must match order: Fp == p, Fn == n");
|
|
2048
2718
|
(0, modular_ts_1.validateField)(field);
|
|
2049
2719
|
return field;
|
|
2050
2720
|
} else {
|
|
2051
|
-
return (0, modular_ts_1.Field)(order, { isLE });
|
|
2721
|
+
return (0, modular_ts_1.Field)(order, { isLE: isLE2 });
|
|
2052
2722
|
}
|
|
2053
2723
|
}
|
|
2054
2724
|
function _createCurveFields(type, CURVE, curveOpts = {}, FpFnLE) {
|
|
@@ -2058,7 +2728,7 @@ var require_curve = __commonJS({
|
|
|
2058
2728
|
throw new Error(`expected valid ${type} CURVE object`);
|
|
2059
2729
|
for (const p of ["p", "n", "h"]) {
|
|
2060
2730
|
const val = CURVE[p];
|
|
2061
|
-
if (!(typeof val === "bigint" && val >
|
|
2731
|
+
if (!(typeof val === "bigint" && val > _0n2))
|
|
2062
2732
|
throw new Error(`CURVE.${p} must be positive bigint`);
|
|
2063
2733
|
}
|
|
2064
2734
|
const Fp = createField(CURVE.p, curveOpts.Fp, FpFnLE);
|
|
@@ -2087,9 +2757,9 @@ var require_edwards = __commonJS({
|
|
|
2087
2757
|
var utils_ts_1 = require_utils2();
|
|
2088
2758
|
var curve_ts_1 = require_curve();
|
|
2089
2759
|
var modular_ts_1 = require_modular();
|
|
2090
|
-
var
|
|
2091
|
-
var
|
|
2092
|
-
var
|
|
2760
|
+
var _0n2 = BigInt(0);
|
|
2761
|
+
var _1n2 = BigInt(1);
|
|
2762
|
+
var _2n2 = BigInt(2);
|
|
2093
2763
|
var _8n = BigInt(8);
|
|
2094
2764
|
function isEdValidXY(Fp, CURVE, x, y) {
|
|
2095
2765
|
const x2 = Fp.sqr(x);
|
|
@@ -2104,19 +2774,19 @@ var require_edwards = __commonJS({
|
|
|
2104
2774
|
let CURVE = validated.CURVE;
|
|
2105
2775
|
const { h: cofactor } = CURVE;
|
|
2106
2776
|
(0, utils_ts_1._validateObject)(extraOpts, {}, { uvRatio: "function" });
|
|
2107
|
-
const MASK =
|
|
2777
|
+
const MASK = _2n2 << BigInt(Fn.BYTES * 8) - _1n2;
|
|
2108
2778
|
const modP = (n) => Fp.create(n);
|
|
2109
2779
|
const uvRatio = extraOpts.uvRatio || ((u, v) => {
|
|
2110
2780
|
try {
|
|
2111
2781
|
return { isValid: true, value: Fp.sqrt(Fp.div(u, v)) };
|
|
2112
2782
|
} catch (e) {
|
|
2113
|
-
return { isValid: false, value:
|
|
2783
|
+
return { isValid: false, value: _0n2 };
|
|
2114
2784
|
}
|
|
2115
2785
|
});
|
|
2116
2786
|
if (!isEdValidXY(Fp, CURVE, CURVE.Gx, CURVE.Gy))
|
|
2117
2787
|
throw new Error("bad curve params: generator point");
|
|
2118
2788
|
function acoord(title, n, banZero = false) {
|
|
2119
|
-
const min = banZero ?
|
|
2789
|
+
const min = banZero ? _1n2 : _0n2;
|
|
2120
2790
|
(0, utils_ts_1.aInRange)("coordinate " + title, n, min, MASK);
|
|
2121
2791
|
return n;
|
|
2122
2792
|
}
|
|
@@ -2133,8 +2803,8 @@ var require_edwards = __commonJS({
|
|
|
2133
2803
|
const y = modP(Y * iz);
|
|
2134
2804
|
const zz = Fp.mul(Z, iz);
|
|
2135
2805
|
if (is0)
|
|
2136
|
-
return { x:
|
|
2137
|
-
if (zz !==
|
|
2806
|
+
return { x: _0n2, y: _1n2 };
|
|
2807
|
+
if (zz !== _1n2)
|
|
2138
2808
|
throw new Error("invZ was invalid");
|
|
2139
2809
|
return { x, y };
|
|
2140
2810
|
});
|
|
@@ -2175,7 +2845,7 @@ var require_edwards = __commonJS({
|
|
|
2175
2845
|
const { x, y } = p || {};
|
|
2176
2846
|
acoord("x", x);
|
|
2177
2847
|
acoord("y", y);
|
|
2178
|
-
return new Point(x, y,
|
|
2848
|
+
return new Point(x, y, _1n2, modP(x * y));
|
|
2179
2849
|
}
|
|
2180
2850
|
// Uses algo from RFC8032 5.1.3.
|
|
2181
2851
|
static fromBytes(bytes, zip215 = false) {
|
|
@@ -2188,16 +2858,16 @@ var require_edwards = __commonJS({
|
|
|
2188
2858
|
normed[len - 1] = lastByte & ~128;
|
|
2189
2859
|
const y = (0, utils_ts_1.bytesToNumberLE)(normed);
|
|
2190
2860
|
const max = zip215 ? MASK : Fp.ORDER;
|
|
2191
|
-
(0, utils_ts_1.aInRange)("point.y", y,
|
|
2861
|
+
(0, utils_ts_1.aInRange)("point.y", y, _0n2, max);
|
|
2192
2862
|
const y2 = modP(y * y);
|
|
2193
|
-
const u = modP(y2 -
|
|
2863
|
+
const u = modP(y2 - _1n2);
|
|
2194
2864
|
const v = modP(d * y2 - a);
|
|
2195
2865
|
let { isValid, value: x } = uvRatio(u, v);
|
|
2196
2866
|
if (!isValid)
|
|
2197
2867
|
throw new Error("bad point: invalid y coordinate");
|
|
2198
|
-
const isXOdd = (x &
|
|
2868
|
+
const isXOdd = (x & _1n2) === _1n2;
|
|
2199
2869
|
const isLastByteOdd = (lastByte & 128) !== 0;
|
|
2200
|
-
if (!zip215 && x ===
|
|
2870
|
+
if (!zip215 && x === _0n2 && isLastByteOdd)
|
|
2201
2871
|
throw new Error("bad point: x=0 and x_0=1");
|
|
2202
2872
|
if (isLastByteOdd !== isXOdd)
|
|
2203
2873
|
x = modP(-x);
|
|
@@ -2215,7 +2885,7 @@ var require_edwards = __commonJS({
|
|
|
2215
2885
|
precompute(windowSize = 8, isLazy = true) {
|
|
2216
2886
|
wnaf.createCache(this, windowSize);
|
|
2217
2887
|
if (!isLazy)
|
|
2218
|
-
this.multiply(
|
|
2888
|
+
this.multiply(_2n2);
|
|
2219
2889
|
return this;
|
|
2220
2890
|
}
|
|
2221
2891
|
// Useful in fromAffine() - not for fromBytes(), which always created valid points.
|
|
@@ -2247,7 +2917,7 @@ var require_edwards = __commonJS({
|
|
|
2247
2917
|
const { X: X1, Y: Y1, Z: Z1 } = this;
|
|
2248
2918
|
const A = modP(X1 * X1);
|
|
2249
2919
|
const B = modP(Y1 * Y1);
|
|
2250
|
-
const C = modP(
|
|
2920
|
+
const C = modP(_2n2 * modP(Z1 * Z1));
|
|
2251
2921
|
const D = modP(a * A);
|
|
2252
2922
|
const x1y1 = X1 + Y1;
|
|
2253
2923
|
const E = modP(modP(x1y1 * x1y1) - A - B);
|
|
@@ -2300,9 +2970,9 @@ var require_edwards = __commonJS({
|
|
|
2300
2970
|
multiplyUnsafe(scalar, acc = Point.ZERO) {
|
|
2301
2971
|
if (!Fn.isValid(scalar))
|
|
2302
2972
|
throw new Error("invalid scalar: expected 0 <= sc < curve.n");
|
|
2303
|
-
if (scalar ===
|
|
2973
|
+
if (scalar === _0n2)
|
|
2304
2974
|
return Point.ZERO;
|
|
2305
|
-
if (this.is0() || scalar ===
|
|
2975
|
+
if (this.is0() || scalar === _1n2)
|
|
2306
2976
|
return this;
|
|
2307
2977
|
return wnaf.unsafe(this, scalar, (p) => (0, curve_ts_1.normalizeZ)(Point, p), acc);
|
|
2308
2978
|
}
|
|
@@ -2324,14 +2994,14 @@ var require_edwards = __commonJS({
|
|
|
2324
2994
|
return toAffineMemo(this, invertedZ);
|
|
2325
2995
|
}
|
|
2326
2996
|
clearCofactor() {
|
|
2327
|
-
if (cofactor ===
|
|
2997
|
+
if (cofactor === _1n2)
|
|
2328
2998
|
return this;
|
|
2329
2999
|
return this.multiplyUnsafe(cofactor);
|
|
2330
3000
|
}
|
|
2331
3001
|
toBytes() {
|
|
2332
3002
|
const { x, y } = this.toAffine();
|
|
2333
3003
|
const bytes = Fp.toBytes(y);
|
|
2334
|
-
bytes[bytes.length - 1] |= x &
|
|
3004
|
+
bytes[bytes.length - 1] |= x & _1n2 ? 128 : 0;
|
|
2335
3005
|
return bytes;
|
|
2336
3006
|
}
|
|
2337
3007
|
toHex() {
|
|
@@ -2366,8 +3036,8 @@ var require_edwards = __commonJS({
|
|
|
2366
3036
|
return this.toBytes();
|
|
2367
3037
|
}
|
|
2368
3038
|
}
|
|
2369
|
-
Point.BASE = new Point(CURVE.Gx, CURVE.Gy,
|
|
2370
|
-
Point.ZERO = new Point(
|
|
3039
|
+
Point.BASE = new Point(CURVE.Gx, CURVE.Gy, _1n2, modP(CURVE.Gx * CURVE.Gy));
|
|
3040
|
+
Point.ZERO = new Point(_0n2, _1n2, _1n2, _0n2);
|
|
2371
3041
|
Point.Fp = Fp;
|
|
2372
3042
|
Point.Fn = Fn;
|
|
2373
3043
|
const wnaf = new curve_ts_1.wNAF(Point, Fn.BITS);
|
|
@@ -2569,18 +3239,18 @@ var require_edwards = __commonJS({
|
|
|
2569
3239
|
*/
|
|
2570
3240
|
toMontgomery(publicKey2) {
|
|
2571
3241
|
const { y } = Point.fromBytes(publicKey2);
|
|
2572
|
-
const
|
|
2573
|
-
const is25519 =
|
|
2574
|
-
if (!is25519 &&
|
|
3242
|
+
const size2 = lengths.publicKey;
|
|
3243
|
+
const is25519 = size2 === 32;
|
|
3244
|
+
if (!is25519 && size2 !== 57)
|
|
2575
3245
|
throw new Error("only defined for 25519 and 448");
|
|
2576
|
-
const u = is25519 ? Fp.div(
|
|
3246
|
+
const u = is25519 ? Fp.div(_1n2 + y, _1n2 - y) : Fp.div(y - _1n2, y + _1n2);
|
|
2577
3247
|
return Fp.toBytes(u);
|
|
2578
3248
|
},
|
|
2579
3249
|
toMontgomerySecret(secretKey) {
|
|
2580
|
-
const
|
|
2581
|
-
(0, utils_ts_1._abytes2)(secretKey,
|
|
2582
|
-
const hashed = cHash(secretKey.subarray(0,
|
|
2583
|
-
return adjustScalarBytes(hashed).subarray(0,
|
|
3250
|
+
const size2 = lengths.secretKey;
|
|
3251
|
+
(0, utils_ts_1._abytes2)(secretKey, size2);
|
|
3252
|
+
const hashed = cHash(secretKey.subarray(0, size2));
|
|
3253
|
+
return adjustScalarBytes(hashed).subarray(0, size2);
|
|
2584
3254
|
},
|
|
2585
3255
|
/** @deprecated */
|
|
2586
3256
|
randomPrivateKey: randomSecretKey,
|
|
@@ -2650,7 +3320,7 @@ var require_hash_to_curve = __commonJS({
|
|
|
2650
3320
|
exports.expand_message_xof = expand_message_xof;
|
|
2651
3321
|
exports.hash_to_field = hash_to_field;
|
|
2652
3322
|
exports.isogenyMap = isogenyMap;
|
|
2653
|
-
exports.createHasher =
|
|
3323
|
+
exports.createHasher = createHasher2;
|
|
2654
3324
|
var utils_ts_1 = require_utils2();
|
|
2655
3325
|
var modular_ts_1 = require_modular();
|
|
2656
3326
|
var os2ip = utils_ts_1.bytesToNumberBE;
|
|
@@ -2765,7 +3435,7 @@ var require_hash_to_curve = __commonJS({
|
|
|
2765
3435
|
};
|
|
2766
3436
|
}
|
|
2767
3437
|
exports._DST_scalar = (0, utils_ts_1.utf8ToBytes)("HashToScalar-");
|
|
2768
|
-
function
|
|
3438
|
+
function createHasher2(Point, mapToCurve, defaults) {
|
|
2769
3439
|
if (typeof mapToCurve !== "function")
|
|
2770
3440
|
throw new Error("mapToCurve() must be defined");
|
|
2771
3441
|
function map(num) {
|
|
@@ -2823,9 +3493,9 @@ var require_montgomery = __commonJS({
|
|
|
2823
3493
|
exports.montgomery = montgomery;
|
|
2824
3494
|
var utils_ts_1 = require_utils2();
|
|
2825
3495
|
var modular_ts_1 = require_modular();
|
|
2826
|
-
var
|
|
2827
|
-
var
|
|
2828
|
-
var
|
|
3496
|
+
var _0n2 = BigInt(0);
|
|
3497
|
+
var _1n2 = BigInt(1);
|
|
3498
|
+
var _2n2 = BigInt(2);
|
|
2829
3499
|
function validateOpts(curve) {
|
|
2830
3500
|
(0, utils_ts_1._validateObject)(curve, {
|
|
2831
3501
|
adjustScalarBytes: "function",
|
|
@@ -2844,9 +3514,9 @@ var require_montgomery = __commonJS({
|
|
|
2844
3514
|
const fieldLen = is25519 ? 32 : 56;
|
|
2845
3515
|
const Gu = is25519 ? BigInt(9) : BigInt(5);
|
|
2846
3516
|
const a24 = is25519 ? BigInt(121665) : BigInt(39081);
|
|
2847
|
-
const minScalar = is25519 ?
|
|
2848
|
-
const maxAdded = is25519 ? BigInt(8) *
|
|
2849
|
-
const maxScalar = minScalar + maxAdded +
|
|
3517
|
+
const minScalar = is25519 ? _2n2 ** BigInt(254) : _2n2 ** BigInt(447);
|
|
3518
|
+
const maxAdded = is25519 ? BigInt(8) * _2n2 ** BigInt(251) - _1n2 : BigInt(4) * _2n2 ** BigInt(445) - _1n2;
|
|
3519
|
+
const maxScalar = minScalar + maxAdded + _1n2;
|
|
2850
3520
|
const modP = (n) => (0, modular_ts_1.mod)(n, P);
|
|
2851
3521
|
const GuBytes = encodeU(Gu);
|
|
2852
3522
|
function encodeU(u) {
|
|
@@ -2863,7 +3533,7 @@ var require_montgomery = __commonJS({
|
|
|
2863
3533
|
}
|
|
2864
3534
|
function scalarMult(scalar, u) {
|
|
2865
3535
|
const pu = montgomeryLadder(decodeU(u), decodeScalar(scalar));
|
|
2866
|
-
if (pu ===
|
|
3536
|
+
if (pu === _0n2)
|
|
2867
3537
|
throw new Error("invalid private or public key received");
|
|
2868
3538
|
return encodeU(pu);
|
|
2869
3539
|
}
|
|
@@ -2877,17 +3547,17 @@ var require_montgomery = __commonJS({
|
|
|
2877
3547
|
return { x_2, x_3 };
|
|
2878
3548
|
}
|
|
2879
3549
|
function montgomeryLadder(u, scalar) {
|
|
2880
|
-
(0, utils_ts_1.aInRange)("u", u,
|
|
3550
|
+
(0, utils_ts_1.aInRange)("u", u, _0n2, P);
|
|
2881
3551
|
(0, utils_ts_1.aInRange)("scalar", scalar, minScalar, maxScalar);
|
|
2882
3552
|
const k = scalar;
|
|
2883
3553
|
const x_1 = u;
|
|
2884
|
-
let x_2 =
|
|
2885
|
-
let z_2 =
|
|
3554
|
+
let x_2 = _1n2;
|
|
3555
|
+
let z_2 = _0n2;
|
|
2886
3556
|
let x_3 = u;
|
|
2887
|
-
let z_3 =
|
|
2888
|
-
let swap =
|
|
2889
|
-
for (let t = BigInt(montgomeryBits - 1); t >=
|
|
2890
|
-
const k_t = k >> t &
|
|
3557
|
+
let z_3 = _1n2;
|
|
3558
|
+
let swap = _0n2;
|
|
3559
|
+
for (let t = BigInt(montgomeryBits - 1); t >= _0n2; t--) {
|
|
3560
|
+
const k_t = k >> t & _1n2;
|
|
2891
3561
|
swap ^= k_t;
|
|
2892
3562
|
({ x_2, x_3 } = cswap(swap, x_2, x_3));
|
|
2893
3563
|
({ x_2: z_2, x_3: z_3 } = cswap(swap, z_2, z_3));
|
|
@@ -2960,9 +3630,9 @@ var require_ed25519 = __commonJS({
|
|
|
2960
3630
|
var modular_ts_1 = require_modular();
|
|
2961
3631
|
var montgomery_ts_1 = require_montgomery();
|
|
2962
3632
|
var utils_ts_1 = require_utils2();
|
|
2963
|
-
var
|
|
2964
|
-
var
|
|
2965
|
-
var
|
|
3633
|
+
var _0n2 = /* @__PURE__ */ BigInt(0);
|
|
3634
|
+
var _1n2 = BigInt(1);
|
|
3635
|
+
var _2n2 = BigInt(2);
|
|
2966
3636
|
var _3n = BigInt(3);
|
|
2967
3637
|
var _5n = BigInt(5);
|
|
2968
3638
|
var _8n = BigInt(8);
|
|
@@ -2981,8 +3651,8 @@ var require_ed25519 = __commonJS({
|
|
|
2981
3651
|
const P = ed25519_CURVE_p;
|
|
2982
3652
|
const x2 = x * x % P;
|
|
2983
3653
|
const b2 = x2 * x % P;
|
|
2984
|
-
const b4 = (0, modular_ts_1.pow2)(b2,
|
|
2985
|
-
const b5 = (0, modular_ts_1.pow2)(b4,
|
|
3654
|
+
const b4 = (0, modular_ts_1.pow2)(b2, _2n2, P) * b2 % P;
|
|
3655
|
+
const b5 = (0, modular_ts_1.pow2)(b4, _1n2, P) * x % P;
|
|
2986
3656
|
const b10 = (0, modular_ts_1.pow2)(b5, _5n, P) * b5 % P;
|
|
2987
3657
|
const b20 = (0, modular_ts_1.pow2)(b10, _10n, P) * b10 % P;
|
|
2988
3658
|
const b40 = (0, modular_ts_1.pow2)(b20, _20n, P) * b20 % P;
|
|
@@ -2990,7 +3660,7 @@ var require_ed25519 = __commonJS({
|
|
|
2990
3660
|
const b160 = (0, modular_ts_1.pow2)(b80, _80n, P) * b80 % P;
|
|
2991
3661
|
const b240 = (0, modular_ts_1.pow2)(b160, _80n, P) * b80 % P;
|
|
2992
3662
|
const b250 = (0, modular_ts_1.pow2)(b240, _10n, P) * b10 % P;
|
|
2993
|
-
const pow_p_5_8 = (0, modular_ts_1.pow2)(b250,
|
|
3663
|
+
const pow_p_5_8 = (0, modular_ts_1.pow2)(b250, _2n2, P) * x % P;
|
|
2994
3664
|
return { pow_p_5_8, b2 };
|
|
2995
3665
|
}
|
|
2996
3666
|
function adjustScalarBytes(bytes) {
|
|
@@ -3059,13 +3729,13 @@ var require_ed25519 = __commonJS({
|
|
|
3059
3729
|
});
|
|
3060
3730
|
})();
|
|
3061
3731
|
var ELL2_C1 = /* @__PURE__ */ (() => (ed25519_CURVE_p + _3n) / _8n)();
|
|
3062
|
-
var ELL2_C2 = /* @__PURE__ */ (() => Fp.pow(
|
|
3732
|
+
var ELL2_C2 = /* @__PURE__ */ (() => Fp.pow(_2n2, ELL2_C1))();
|
|
3063
3733
|
var ELL2_C3 = /* @__PURE__ */ (() => Fp.sqrt(Fp.neg(Fp.ONE)))();
|
|
3064
3734
|
function map_to_curve_elligator2_curve25519(u) {
|
|
3065
3735
|
const ELL2_C4 = (ed25519_CURVE_p - _5n) / _8n;
|
|
3066
3736
|
const ELL2_J = BigInt(486662);
|
|
3067
3737
|
let tv1 = Fp.sqr(u);
|
|
3068
|
-
tv1 = Fp.mul(tv1,
|
|
3738
|
+
tv1 = Fp.mul(tv1, _2n2);
|
|
3069
3739
|
let xd = Fp.add(tv1, Fp.ONE);
|
|
3070
3740
|
let x1n = Fp.neg(ELL2_J);
|
|
3071
3741
|
let tv2 = Fp.sqr(xd);
|
|
@@ -3102,7 +3772,7 @@ var require_ed25519 = __commonJS({
|
|
|
3102
3772
|
let y = Fp.cmov(y2, y1, e3);
|
|
3103
3773
|
let e4 = Fp.isOdd(y);
|
|
3104
3774
|
y = Fp.cmov(y, Fp.neg(y), e3 !== e4);
|
|
3105
|
-
return { xMn: xn, xMd: xd, yMn: y, yMd:
|
|
3775
|
+
return { xMn: xn, xMd: xd, yMn: y, yMd: _1n2 };
|
|
3106
3776
|
}
|
|
3107
3777
|
var ELL2_C1_EDWARDS = /* @__PURE__ */ (() => (0, modular_ts_1.FpSqrtEven)(Fp, Fp.neg(BigInt(486664))))();
|
|
3108
3778
|
function map_to_curve_elligator2_edwards25519(u) {
|
|
@@ -3135,7 +3805,7 @@ var require_ed25519 = __commonJS({
|
|
|
3135
3805
|
var INVSQRT_A_MINUS_D = /* @__PURE__ */ BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578");
|
|
3136
3806
|
var ONE_MINUS_D_SQ = /* @__PURE__ */ BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838");
|
|
3137
3807
|
var D_MINUS_ONE_SQ = /* @__PURE__ */ BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952");
|
|
3138
|
-
var invertSqrt = (number) => uvRatio(
|
|
3808
|
+
var invertSqrt = (number) => uvRatio(_1n2, number);
|
|
3139
3809
|
var MAX_255B = /* @__PURE__ */ BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
|
|
3140
3810
|
var bytes255ToNumberLE = (bytes) => exports.ed25519.Point.Fp.create((0, utils_ts_1.bytesToNumberLE)(bytes) & MAX_255B);
|
|
3141
3811
|
function calcElligatorRistrettoMap(r0) {
|
|
@@ -3143,7 +3813,7 @@ var require_ed25519 = __commonJS({
|
|
|
3143
3813
|
const P = ed25519_CURVE_p;
|
|
3144
3814
|
const mod = (n) => Fp.create(n);
|
|
3145
3815
|
const r = mod(SQRT_M1 * r0 * r0);
|
|
3146
|
-
const Ns = mod((r +
|
|
3816
|
+
const Ns = mod((r + _1n2) * ONE_MINUS_D_SQ);
|
|
3147
3817
|
let c = BigInt(-1);
|
|
3148
3818
|
const D = mod((c - d * r) * mod(r + d));
|
|
3149
3819
|
let { isValid: Ns_D_is_sq, value: s } = uvRatio(Ns, D);
|
|
@@ -3154,12 +3824,12 @@ var require_ed25519 = __commonJS({
|
|
|
3154
3824
|
s = s_;
|
|
3155
3825
|
if (!Ns_D_is_sq)
|
|
3156
3826
|
c = r;
|
|
3157
|
-
const Nt = mod(c * (r -
|
|
3827
|
+
const Nt = mod(c * (r - _1n2) * D_MINUS_ONE_SQ - D);
|
|
3158
3828
|
const s2 = s * s;
|
|
3159
3829
|
const W0 = mod((s + s) * D);
|
|
3160
3830
|
const W1 = mod(Nt * SQRT_AD_MINUS_ONE);
|
|
3161
|
-
const W2 = mod(
|
|
3162
|
-
const W3 = mod(
|
|
3831
|
+
const W2 = mod(_1n2 - s2);
|
|
3832
|
+
const W3 = mod(_1n2 + s2);
|
|
3163
3833
|
return new exports.ed25519.Point(mod(W0 * W3), mod(W2 * W1), mod(W1 * W3), mod(W0 * W2));
|
|
3164
3834
|
}
|
|
3165
3835
|
function ristretto255_map(bytes) {
|
|
@@ -3197,8 +3867,8 @@ var require_ed25519 = __commonJS({
|
|
|
3197
3867
|
if (!(0, utils_ts_1.equalBytes)(Fp.toBytes(s), bytes) || (0, modular_ts_1.isNegativeLE)(s, P))
|
|
3198
3868
|
throw new Error("invalid ristretto255 encoding 1");
|
|
3199
3869
|
const s2 = mod(s * s);
|
|
3200
|
-
const u1 = mod(
|
|
3201
|
-
const u2 = mod(
|
|
3870
|
+
const u1 = mod(_1n2 + a * s2);
|
|
3871
|
+
const u2 = mod(_1n2 - a * s2);
|
|
3202
3872
|
const u1_2 = mod(u1 * u1);
|
|
3203
3873
|
const u2_2 = mod(u2 * u2);
|
|
3204
3874
|
const v = mod(a * d * u1_2 - u2_2);
|
|
@@ -3210,9 +3880,9 @@ var require_ed25519 = __commonJS({
|
|
|
3210
3880
|
x = mod(-x);
|
|
3211
3881
|
const y = mod(u1 * Dy);
|
|
3212
3882
|
const t = mod(x * y);
|
|
3213
|
-
if (!isValid || (0, modular_ts_1.isNegativeLE)(t, P) || y ===
|
|
3883
|
+
if (!isValid || (0, modular_ts_1.isNegativeLE)(t, P) || y === _0n2)
|
|
3214
3884
|
throw new Error("invalid ristretto255 encoding 2");
|
|
3215
|
-
return new __RistrettoPoint(new exports.ed25519.Point(x, y,
|
|
3885
|
+
return new __RistrettoPoint(new exports.ed25519.Point(x, y, _1n2, t));
|
|
3216
3886
|
}
|
|
3217
3887
|
/**
|
|
3218
3888
|
* Converts ristretto-encoded string to ristretto point.
|
|
@@ -3604,8 +4274,8 @@ var require_bn = __commonJS({
|
|
|
3604
4274
|
this.copy(r);
|
|
3605
4275
|
return r;
|
|
3606
4276
|
};
|
|
3607
|
-
BN.prototype._expand = function _expand(
|
|
3608
|
-
while (this.length <
|
|
4277
|
+
BN.prototype._expand = function _expand(size2) {
|
|
4278
|
+
while (this.length < size2) {
|
|
3609
4279
|
this.words[this.length++] = 0;
|
|
3610
4280
|
}
|
|
3611
4281
|
return this;
|
|
@@ -3824,11 +4494,11 @@ var require_bn = __commonJS({
|
|
|
3824
4494
|
BN.prototype.toArray = function toArray(endian, length) {
|
|
3825
4495
|
return this.toArrayLike(Array, endian, length);
|
|
3826
4496
|
};
|
|
3827
|
-
var allocate = function allocate2(ArrayType,
|
|
4497
|
+
var allocate = function allocate2(ArrayType, size2) {
|
|
3828
4498
|
if (ArrayType.allocUnsafe) {
|
|
3829
|
-
return ArrayType.allocUnsafe(
|
|
4499
|
+
return ArrayType.allocUnsafe(size2);
|
|
3830
4500
|
}
|
|
3831
|
-
return new ArrayType(
|
|
4501
|
+
return new ArrayType(size2);
|
|
3832
4502
|
};
|
|
3833
4503
|
BN.prototype.toArrayLike = function toArrayLike(ArrayType, endian, length) {
|
|
3834
4504
|
this._strip();
|
|
@@ -5855,7 +6525,7 @@ var require_bn = __commonJS({
|
|
|
5855
6525
|
}
|
|
5856
6526
|
return r;
|
|
5857
6527
|
};
|
|
5858
|
-
MPrime.prototype.split = function
|
|
6528
|
+
MPrime.prototype.split = function split2(input, out) {
|
|
5859
6529
|
input.iushrn(this.n, 0, out);
|
|
5860
6530
|
};
|
|
5861
6531
|
MPrime.prototype.imulK = function imulK(num) {
|
|
@@ -5869,7 +6539,7 @@ var require_bn = __commonJS({
|
|
|
5869
6539
|
);
|
|
5870
6540
|
}
|
|
5871
6541
|
inherits(K256, MPrime);
|
|
5872
|
-
K256.prototype.split = function
|
|
6542
|
+
K256.prototype.split = function split2(input, output) {
|
|
5873
6543
|
var mask = 4194303;
|
|
5874
6544
|
var outLen = Math.min(input.length, 9);
|
|
5875
6545
|
for (var i = 0; i < outLen; i++) {
|
|
@@ -6242,11 +6912,11 @@ var require_safe_buffer = __commonJS({
|
|
|
6242
6912
|
}
|
|
6243
6913
|
return Buffer3(arg, encodingOrOffset, length);
|
|
6244
6914
|
};
|
|
6245
|
-
SafeBuffer.alloc = function(
|
|
6246
|
-
if (typeof
|
|
6915
|
+
SafeBuffer.alloc = function(size2, fill, encoding) {
|
|
6916
|
+
if (typeof size2 !== "number") {
|
|
6247
6917
|
throw new TypeError("Argument must be a number");
|
|
6248
6918
|
}
|
|
6249
|
-
var buf = Buffer3(
|
|
6919
|
+
var buf = Buffer3(size2);
|
|
6250
6920
|
if (fill !== void 0) {
|
|
6251
6921
|
if (typeof encoding === "string") {
|
|
6252
6922
|
buf.fill(fill, encoding);
|
|
@@ -6258,17 +6928,17 @@ var require_safe_buffer = __commonJS({
|
|
|
6258
6928
|
}
|
|
6259
6929
|
return buf;
|
|
6260
6930
|
};
|
|
6261
|
-
SafeBuffer.allocUnsafe = function(
|
|
6262
|
-
if (typeof
|
|
6931
|
+
SafeBuffer.allocUnsafe = function(size2) {
|
|
6932
|
+
if (typeof size2 !== "number") {
|
|
6263
6933
|
throw new TypeError("Argument must be a number");
|
|
6264
6934
|
}
|
|
6265
|
-
return Buffer3(
|
|
6935
|
+
return Buffer3(size2);
|
|
6266
6936
|
};
|
|
6267
|
-
SafeBuffer.allocUnsafeSlow = function(
|
|
6268
|
-
if (typeof
|
|
6937
|
+
SafeBuffer.allocUnsafeSlow = function(size2) {
|
|
6938
|
+
if (typeof size2 !== "number") {
|
|
6269
6939
|
throw new TypeError("Argument must be a number");
|
|
6270
6940
|
}
|
|
6271
|
-
return buffer.SlowBuffer(
|
|
6941
|
+
return buffer.SlowBuffer(size2);
|
|
6272
6942
|
};
|
|
6273
6943
|
}
|
|
6274
6944
|
});
|
|
@@ -6316,12 +6986,12 @@ var require_src = __commonJS({
|
|
|
6316
6986
|
pbegin++;
|
|
6317
6987
|
zeroes++;
|
|
6318
6988
|
}
|
|
6319
|
-
var
|
|
6320
|
-
var b58 = new Uint8Array(
|
|
6989
|
+
var size2 = (pend - pbegin) * iFACTOR + 1 >>> 0;
|
|
6990
|
+
var b58 = new Uint8Array(size2);
|
|
6321
6991
|
while (pbegin !== pend) {
|
|
6322
6992
|
var carry = source[pbegin];
|
|
6323
6993
|
var i2 = 0;
|
|
6324
|
-
for (var it1 =
|
|
6994
|
+
for (var it1 = size2 - 1; (carry !== 0 || i2 < length) && it1 !== -1; it1--, i2++) {
|
|
6325
6995
|
carry += 256 * b58[it1] >>> 0;
|
|
6326
6996
|
b58[it1] = carry % BASE2 >>> 0;
|
|
6327
6997
|
carry = carry / BASE2 >>> 0;
|
|
@@ -6332,12 +7002,12 @@ var require_src = __commonJS({
|
|
|
6332
7002
|
length = i2;
|
|
6333
7003
|
pbegin++;
|
|
6334
7004
|
}
|
|
6335
|
-
var it2 =
|
|
6336
|
-
while (it2 !==
|
|
7005
|
+
var it2 = size2 - length;
|
|
7006
|
+
while (it2 !== size2 && b58[it2] === 0) {
|
|
6337
7007
|
it2++;
|
|
6338
7008
|
}
|
|
6339
7009
|
var str = LEADER.repeat(zeroes);
|
|
6340
|
-
for (; it2 <
|
|
7010
|
+
for (; it2 < size2; ++it2) {
|
|
6341
7011
|
str += ALPHABET.charAt(b58[it2]);
|
|
6342
7012
|
}
|
|
6343
7013
|
return str;
|
|
@@ -6356,8 +7026,8 @@ var require_src = __commonJS({
|
|
|
6356
7026
|
zeroes++;
|
|
6357
7027
|
psz++;
|
|
6358
7028
|
}
|
|
6359
|
-
var
|
|
6360
|
-
var b256 = new Uint8Array(
|
|
7029
|
+
var size2 = (source.length - psz) * FACTOR + 1 >>> 0;
|
|
7030
|
+
var b256 = new Uint8Array(size2);
|
|
6361
7031
|
while (psz < source.length) {
|
|
6362
7032
|
var charCode = source.charCodeAt(psz);
|
|
6363
7033
|
if (charCode > 255) {
|
|
@@ -6368,7 +7038,7 @@ var require_src = __commonJS({
|
|
|
6368
7038
|
return;
|
|
6369
7039
|
}
|
|
6370
7040
|
var i2 = 0;
|
|
6371
|
-
for (var it3 =
|
|
7041
|
+
for (var it3 = size2 - 1; (carry !== 0 || i2 < length) && it3 !== -1; it3--, i2++) {
|
|
6372
7042
|
carry += BASE2 * b256[it3] >>> 0;
|
|
6373
7043
|
b256[it3] = carry % 256 >>> 0;
|
|
6374
7044
|
carry = carry / 256 >>> 0;
|
|
@@ -6379,14 +7049,14 @@ var require_src = __commonJS({
|
|
|
6379
7049
|
length = i2;
|
|
6380
7050
|
psz++;
|
|
6381
7051
|
}
|
|
6382
|
-
var it4 =
|
|
6383
|
-
while (it4 !==
|
|
7052
|
+
var it4 = size2 - length;
|
|
7053
|
+
while (it4 !== size2 && b256[it4] === 0) {
|
|
6384
7054
|
it4++;
|
|
6385
7055
|
}
|
|
6386
|
-
var vch = _Buffer.allocUnsafe(zeroes + (
|
|
7056
|
+
var vch = _Buffer.allocUnsafe(zeroes + (size2 - it4));
|
|
6387
7057
|
vch.fill(0, 0, zeroes);
|
|
6388
7058
|
var j2 = zeroes;
|
|
6389
|
-
while (it4 !==
|
|
7059
|
+
while (it4 !== size2) {
|
|
6390
7060
|
vch[j2++] = b256[it4++];
|
|
6391
7061
|
}
|
|
6392
7062
|
return vch;
|
|
@@ -7536,10 +8206,10 @@ var require_Layout = __commonJS({
|
|
|
7536
8206
|
}
|
|
7537
8207
|
/** @override */
|
|
7538
8208
|
encode(src, b, offset = 0) {
|
|
7539
|
-
const
|
|
8209
|
+
const split2 = divmodInt64(src);
|
|
7540
8210
|
const buffer = uint8ArrayToBuffer(b);
|
|
7541
|
-
buffer.writeUInt32LE(
|
|
7542
|
-
buffer.writeUInt32LE(
|
|
8211
|
+
buffer.writeUInt32LE(split2.lo32, offset);
|
|
8212
|
+
buffer.writeUInt32LE(split2.hi32, offset + 4);
|
|
7543
8213
|
return 8;
|
|
7544
8214
|
}
|
|
7545
8215
|
};
|
|
@@ -7557,10 +8227,10 @@ var require_Layout = __commonJS({
|
|
|
7557
8227
|
}
|
|
7558
8228
|
/** @override */
|
|
7559
8229
|
encode(src, b, offset = 0) {
|
|
7560
|
-
const
|
|
8230
|
+
const split2 = divmodInt64(src);
|
|
7561
8231
|
const buffer = uint8ArrayToBuffer(b);
|
|
7562
|
-
buffer.writeUInt32BE(
|
|
7563
|
-
buffer.writeUInt32BE(
|
|
8232
|
+
buffer.writeUInt32BE(split2.hi32, offset);
|
|
8233
|
+
buffer.writeUInt32BE(split2.lo32, offset + 4);
|
|
7564
8234
|
return 8;
|
|
7565
8235
|
}
|
|
7566
8236
|
};
|
|
@@ -7578,10 +8248,10 @@ var require_Layout = __commonJS({
|
|
|
7578
8248
|
}
|
|
7579
8249
|
/** @override */
|
|
7580
8250
|
encode(src, b, offset = 0) {
|
|
7581
|
-
const
|
|
8251
|
+
const split2 = divmodInt64(src);
|
|
7582
8252
|
const buffer = uint8ArrayToBuffer(b);
|
|
7583
|
-
buffer.writeUInt32LE(
|
|
7584
|
-
buffer.writeInt32LE(
|
|
8253
|
+
buffer.writeUInt32LE(split2.lo32, offset);
|
|
8254
|
+
buffer.writeInt32LE(split2.hi32, offset + 4);
|
|
7585
8255
|
return 8;
|
|
7586
8256
|
}
|
|
7587
8257
|
};
|
|
@@ -7599,10 +8269,10 @@ var require_Layout = __commonJS({
|
|
|
7599
8269
|
}
|
|
7600
8270
|
/** @override */
|
|
7601
8271
|
encode(src, b, offset = 0) {
|
|
7602
|
-
const
|
|
8272
|
+
const split2 = divmodInt64(src);
|
|
7603
8273
|
const buffer = uint8ArrayToBuffer(b);
|
|
7604
|
-
buffer.writeInt32BE(
|
|
7605
|
-
buffer.writeUInt32BE(
|
|
8274
|
+
buffer.writeInt32BE(split2.hi32, offset);
|
|
8275
|
+
buffer.writeUInt32BE(split2.lo32, offset + 4);
|
|
7606
8276
|
return 8;
|
|
7607
8277
|
}
|
|
7608
8278
|
};
|
|
@@ -9701,27 +10371,27 @@ var require_index_node2 = __commonJS({
|
|
|
9701
10371
|
});
|
|
9702
10372
|
return result;
|
|
9703
10373
|
};
|
|
9704
|
-
var
|
|
10374
|
+
var padBytes2 = (bytes, length) => {
|
|
9705
10375
|
if (bytes.length >= length) return bytes;
|
|
9706
10376
|
const paddedBytes = new Uint8Array(length).fill(0);
|
|
9707
10377
|
paddedBytes.set(bytes);
|
|
9708
10378
|
return paddedBytes;
|
|
9709
10379
|
};
|
|
9710
|
-
var fixBytes = (bytes, length) =>
|
|
10380
|
+
var fixBytes = (bytes, length) => padBytes2(bytes.length <= length ? bytes : bytes.slice(0, length), length);
|
|
9711
10381
|
function containsBytes(data, bytes, offset) {
|
|
9712
10382
|
const slice = offset === 0 && data.length === bytes.length ? data : data.slice(offset, offset + bytes.length);
|
|
9713
10383
|
if (slice.length !== bytes.length) return false;
|
|
9714
10384
|
return bytes.every((b, i) => b === slice[i]);
|
|
9715
10385
|
}
|
|
9716
|
-
function getEncodedSize(value,
|
|
9717
|
-
return "fixedSize" in
|
|
10386
|
+
function getEncodedSize(value, encoder3) {
|
|
10387
|
+
return "fixedSize" in encoder3 ? encoder3.fixedSize : encoder3.getSizeFromValue(value);
|
|
9718
10388
|
}
|
|
9719
|
-
function createEncoder(
|
|
10389
|
+
function createEncoder(encoder3) {
|
|
9720
10390
|
return Object.freeze({
|
|
9721
|
-
...
|
|
10391
|
+
...encoder3,
|
|
9722
10392
|
encode: (value) => {
|
|
9723
|
-
const bytes = new Uint8Array(getEncodedSize(value,
|
|
9724
|
-
|
|
10393
|
+
const bytes = new Uint8Array(getEncodedSize(value, encoder3));
|
|
10394
|
+
encoder3.write(value, bytes, 0);
|
|
9725
10395
|
return bytes;
|
|
9726
10396
|
}
|
|
9727
10397
|
});
|
|
@@ -9759,34 +10429,34 @@ var require_index_node2 = __commonJS({
|
|
|
9759
10429
|
throw new errors.SolanaError(errors.SOLANA_ERROR__CODECS__EXPECTED_VARIABLE_LENGTH);
|
|
9760
10430
|
}
|
|
9761
10431
|
}
|
|
9762
|
-
function combineCodec(
|
|
9763
|
-
if (isFixedSize(
|
|
10432
|
+
function combineCodec(encoder3, decoder) {
|
|
10433
|
+
if (isFixedSize(encoder3) !== isFixedSize(decoder)) {
|
|
9764
10434
|
throw new errors.SolanaError(errors.SOLANA_ERROR__CODECS__ENCODER_DECODER_SIZE_COMPATIBILITY_MISMATCH);
|
|
9765
10435
|
}
|
|
9766
|
-
if (isFixedSize(
|
|
10436
|
+
if (isFixedSize(encoder3) && isFixedSize(decoder) && encoder3.fixedSize !== decoder.fixedSize) {
|
|
9767
10437
|
throw new errors.SolanaError(errors.SOLANA_ERROR__CODECS__ENCODER_DECODER_FIXED_SIZE_MISMATCH, {
|
|
9768
10438
|
decoderFixedSize: decoder.fixedSize,
|
|
9769
|
-
encoderFixedSize:
|
|
10439
|
+
encoderFixedSize: encoder3.fixedSize
|
|
9770
10440
|
});
|
|
9771
10441
|
}
|
|
9772
|
-
if (!isFixedSize(
|
|
10442
|
+
if (!isFixedSize(encoder3) && !isFixedSize(decoder) && encoder3.maxSize !== decoder.maxSize) {
|
|
9773
10443
|
throw new errors.SolanaError(errors.SOLANA_ERROR__CODECS__ENCODER_DECODER_MAX_SIZE_MISMATCH, {
|
|
9774
10444
|
decoderMaxSize: decoder.maxSize,
|
|
9775
|
-
encoderMaxSize:
|
|
10445
|
+
encoderMaxSize: encoder3.maxSize
|
|
9776
10446
|
});
|
|
9777
10447
|
}
|
|
9778
10448
|
return {
|
|
9779
10449
|
...decoder,
|
|
9780
|
-
...
|
|
10450
|
+
...encoder3,
|
|
9781
10451
|
decode: decoder.decode,
|
|
9782
|
-
encode:
|
|
10452
|
+
encode: encoder3.encode,
|
|
9783
10453
|
read: decoder.read,
|
|
9784
|
-
write:
|
|
10454
|
+
write: encoder3.write
|
|
9785
10455
|
};
|
|
9786
10456
|
}
|
|
9787
|
-
function addEncoderSentinel(
|
|
10457
|
+
function addEncoderSentinel(encoder3, sentinel) {
|
|
9788
10458
|
const write = (value, bytes, offset) => {
|
|
9789
|
-
const encoderBytes =
|
|
10459
|
+
const encoderBytes = encoder3.encode(value);
|
|
9790
10460
|
if (findSentinelIndex(encoderBytes, sentinel) >= 0) {
|
|
9791
10461
|
throw new errors.SolanaError(errors.SOLANA_ERROR__CODECS__ENCODED_BYTES_MUST_NOT_INCLUDE_SENTINEL, {
|
|
9792
10462
|
encodedBytes: encoderBytes,
|
|
@@ -9801,13 +10471,13 @@ var require_index_node2 = __commonJS({
|
|
|
9801
10471
|
offset += sentinel.length;
|
|
9802
10472
|
return offset;
|
|
9803
10473
|
};
|
|
9804
|
-
if (isFixedSize(
|
|
9805
|
-
return createEncoder({ ...
|
|
10474
|
+
if (isFixedSize(encoder3)) {
|
|
10475
|
+
return createEncoder({ ...encoder3, fixedSize: encoder3.fixedSize + sentinel.length, write });
|
|
9806
10476
|
}
|
|
9807
10477
|
return createEncoder({
|
|
9808
|
-
...
|
|
9809
|
-
...
|
|
9810
|
-
getSizeFromValue: (value) =>
|
|
10478
|
+
...encoder3,
|
|
10479
|
+
...encoder3.maxSize != null ? { maxSize: encoder3.maxSize + sentinel.length } : {},
|
|
10480
|
+
getSizeFromValue: (value) => encoder3.getSizeFromValue(value) + sentinel.length,
|
|
9811
10481
|
write
|
|
9812
10482
|
});
|
|
9813
10483
|
}
|
|
@@ -9873,24 +10543,24 @@ var require_index_node2 = __commonJS({
|
|
|
9873
10543
|
});
|
|
9874
10544
|
}
|
|
9875
10545
|
}
|
|
9876
|
-
function addEncoderSizePrefix(
|
|
10546
|
+
function addEncoderSizePrefix(encoder3, prefix) {
|
|
9877
10547
|
const write = (value, bytes, offset) => {
|
|
9878
|
-
const encoderBytes =
|
|
10548
|
+
const encoderBytes = encoder3.encode(value);
|
|
9879
10549
|
offset = prefix.write(encoderBytes.length, bytes, offset);
|
|
9880
10550
|
bytes.set(encoderBytes, offset);
|
|
9881
10551
|
return offset + encoderBytes.length;
|
|
9882
10552
|
};
|
|
9883
|
-
if (isFixedSize(prefix) && isFixedSize(
|
|
9884
|
-
return createEncoder({ ...
|
|
10553
|
+
if (isFixedSize(prefix) && isFixedSize(encoder3)) {
|
|
10554
|
+
return createEncoder({ ...encoder3, fixedSize: prefix.fixedSize + encoder3.fixedSize, write });
|
|
9885
10555
|
}
|
|
9886
10556
|
const prefixMaxSize = isFixedSize(prefix) ? prefix.fixedSize : prefix.maxSize ?? null;
|
|
9887
|
-
const encoderMaxSize = isFixedSize(
|
|
10557
|
+
const encoderMaxSize = isFixedSize(encoder3) ? encoder3.fixedSize : encoder3.maxSize ?? null;
|
|
9888
10558
|
const maxSize = prefixMaxSize !== null && encoderMaxSize !== null ? prefixMaxSize + encoderMaxSize : null;
|
|
9889
10559
|
return createEncoder({
|
|
9890
|
-
...
|
|
10560
|
+
...encoder3,
|
|
9891
10561
|
...maxSize !== null ? { maxSize } : {},
|
|
9892
10562
|
getSizeFromValue: (value) => {
|
|
9893
|
-
const encoderSize = getEncodedSize(value,
|
|
10563
|
+
const encoderSize = getEncodedSize(value, encoder3);
|
|
9894
10564
|
return getEncodedSize(encoderSize, prefix) + encoderSize;
|
|
9895
10565
|
},
|
|
9896
10566
|
write
|
|
@@ -9899,13 +10569,13 @@ var require_index_node2 = __commonJS({
|
|
|
9899
10569
|
function addDecoderSizePrefix(decoder, prefix) {
|
|
9900
10570
|
const read = (bytes, offset) => {
|
|
9901
10571
|
const [bigintSize, decoderOffset] = prefix.read(bytes, offset);
|
|
9902
|
-
const
|
|
10572
|
+
const size2 = Number(bigintSize);
|
|
9903
10573
|
offset = decoderOffset;
|
|
9904
|
-
if (offset > 0 || bytes.length >
|
|
9905
|
-
bytes = bytes.slice(offset, offset +
|
|
10574
|
+
if (offset > 0 || bytes.length > size2) {
|
|
10575
|
+
bytes = bytes.slice(offset, offset + size2);
|
|
9906
10576
|
}
|
|
9907
|
-
assertByteArrayHasEnoughBytesForCodec("addDecoderSizePrefix",
|
|
9908
|
-
return [decoder.decode(bytes), offset +
|
|
10577
|
+
assertByteArrayHasEnoughBytesForCodec("addDecoderSizePrefix", size2, bytes);
|
|
10578
|
+
return [decoder.decode(bytes), offset + size2];
|
|
9909
10579
|
};
|
|
9910
10580
|
if (isFixedSize(prefix) && isFixedSize(decoder)) {
|
|
9911
10581
|
return createDecoder({ ...decoder, fixedSize: prefix.fixedSize + decoder.fixedSize, read });
|
|
@@ -9918,11 +10588,11 @@ var require_index_node2 = __commonJS({
|
|
|
9918
10588
|
function addCodecSizePrefix(codec, prefix) {
|
|
9919
10589
|
return combineCodec(addEncoderSizePrefix(codec, prefix), addDecoderSizePrefix(codec, prefix));
|
|
9920
10590
|
}
|
|
9921
|
-
function fixEncoderSize(
|
|
10591
|
+
function fixEncoderSize(encoder3, fixedBytes) {
|
|
9922
10592
|
return createEncoder({
|
|
9923
10593
|
fixedSize: fixedBytes,
|
|
9924
10594
|
write: (value, bytes, offset) => {
|
|
9925
|
-
const variableByteArray =
|
|
10595
|
+
const variableByteArray = encoder3.encode(value);
|
|
9926
10596
|
const fixedByteArray = variableByteArray.length > fixedBytes ? variableByteArray.slice(0, fixedBytes) : variableByteArray;
|
|
9927
10597
|
bytes.set(fixedByteArray, offset);
|
|
9928
10598
|
return offset + fixedBytes;
|
|
@@ -9948,14 +10618,14 @@ var require_index_node2 = __commonJS({
|
|
|
9948
10618
|
function fixCodecSize(codec, fixedBytes) {
|
|
9949
10619
|
return combineCodec(fixEncoderSize(codec, fixedBytes), fixDecoderSize(codec, fixedBytes));
|
|
9950
10620
|
}
|
|
9951
|
-
function offsetEncoder(
|
|
10621
|
+
function offsetEncoder(encoder3, config) {
|
|
9952
10622
|
return createEncoder({
|
|
9953
|
-
...
|
|
10623
|
+
...encoder3,
|
|
9954
10624
|
write: (value, bytes, preOffset) => {
|
|
9955
10625
|
const wrapBytes = (offset) => modulo(offset, bytes.length);
|
|
9956
10626
|
const newPreOffset = config.preOffset ? config.preOffset({ bytes, preOffset, wrapBytes }) : preOffset;
|
|
9957
10627
|
assertByteArrayOffsetIsNotOutOfRange("offsetEncoder", newPreOffset, bytes.length);
|
|
9958
|
-
const postOffset =
|
|
10628
|
+
const postOffset = encoder3.write(value, bytes, newPreOffset);
|
|
9959
10629
|
const newPostOffset = config.postOffset ? config.postOffset({ bytes, newPreOffset, postOffset, preOffset, wrapBytes }) : postOffset;
|
|
9960
10630
|
assertByteArrayOffsetIsNotOutOfRange("offsetEncoder", newPostOffset, bytes.length);
|
|
9961
10631
|
return newPostOffset;
|
|
@@ -9983,21 +10653,21 @@ var require_index_node2 = __commonJS({
|
|
|
9983
10653
|
if (divisor === 0) return 0;
|
|
9984
10654
|
return (dividend % divisor + divisor) % divisor;
|
|
9985
10655
|
}
|
|
9986
|
-
function resizeEncoder(
|
|
9987
|
-
if (isFixedSize(
|
|
9988
|
-
const fixedSize = resize(
|
|
10656
|
+
function resizeEncoder(encoder3, resize) {
|
|
10657
|
+
if (isFixedSize(encoder3)) {
|
|
10658
|
+
const fixedSize = resize(encoder3.fixedSize);
|
|
9989
10659
|
if (fixedSize < 0) {
|
|
9990
10660
|
throw new errors.SolanaError(errors.SOLANA_ERROR__CODECS__EXPECTED_POSITIVE_BYTE_LENGTH, {
|
|
9991
10661
|
bytesLength: fixedSize,
|
|
9992
10662
|
codecDescription: "resizeEncoder"
|
|
9993
10663
|
});
|
|
9994
10664
|
}
|
|
9995
|
-
return createEncoder({ ...
|
|
10665
|
+
return createEncoder({ ...encoder3, fixedSize });
|
|
9996
10666
|
}
|
|
9997
10667
|
return createEncoder({
|
|
9998
|
-
...
|
|
10668
|
+
...encoder3,
|
|
9999
10669
|
getSizeFromValue: (value) => {
|
|
10000
|
-
const newSize = resize(
|
|
10670
|
+
const newSize = resize(encoder3.getSizeFromValue(value));
|
|
10001
10671
|
if (newSize < 0) {
|
|
10002
10672
|
throw new errors.SolanaError(errors.SOLANA_ERROR__CODECS__EXPECTED_POSITIVE_BYTE_LENGTH, {
|
|
10003
10673
|
bytesLength: newSize,
|
|
@@ -10024,27 +10694,27 @@ var require_index_node2 = __commonJS({
|
|
|
10024
10694
|
function resizeCodec(codec, resize) {
|
|
10025
10695
|
return combineCodec(resizeEncoder(codec, resize), resizeDecoder(codec, resize));
|
|
10026
10696
|
}
|
|
10027
|
-
function padLeftEncoder(
|
|
10697
|
+
function padLeftEncoder(encoder3, offset) {
|
|
10028
10698
|
return offsetEncoder(
|
|
10029
|
-
resizeEncoder(
|
|
10699
|
+
resizeEncoder(encoder3, (size2) => size2 + offset),
|
|
10030
10700
|
{ preOffset: ({ preOffset }) => preOffset + offset }
|
|
10031
10701
|
);
|
|
10032
10702
|
}
|
|
10033
|
-
function padRightEncoder(
|
|
10703
|
+
function padRightEncoder(encoder3, offset) {
|
|
10034
10704
|
return offsetEncoder(
|
|
10035
|
-
resizeEncoder(
|
|
10705
|
+
resizeEncoder(encoder3, (size2) => size2 + offset),
|
|
10036
10706
|
{ postOffset: ({ postOffset }) => postOffset + offset }
|
|
10037
10707
|
);
|
|
10038
10708
|
}
|
|
10039
10709
|
function padLeftDecoder(decoder, offset) {
|
|
10040
10710
|
return offsetDecoder(
|
|
10041
|
-
resizeDecoder(decoder, (
|
|
10711
|
+
resizeDecoder(decoder, (size2) => size2 + offset),
|
|
10042
10712
|
{ preOffset: ({ preOffset }) => preOffset + offset }
|
|
10043
10713
|
);
|
|
10044
10714
|
}
|
|
10045
10715
|
function padRightDecoder(decoder, offset) {
|
|
10046
10716
|
return offsetDecoder(
|
|
10047
|
-
resizeDecoder(decoder, (
|
|
10717
|
+
resizeDecoder(decoder, (size2) => size2 + offset),
|
|
10048
10718
|
{ postOffset: ({ postOffset }) => postOffset + offset }
|
|
10049
10719
|
);
|
|
10050
10720
|
}
|
|
@@ -10065,17 +10735,17 @@ var require_index_node2 = __commonJS({
|
|
|
10065
10735
|
target_WILL_MUTATE[sourceOffset + targetOffset] = source[sourceOffset];
|
|
10066
10736
|
}
|
|
10067
10737
|
}
|
|
10068
|
-
function reverseEncoder(
|
|
10069
|
-
assertIsFixedSize(
|
|
10738
|
+
function reverseEncoder(encoder3) {
|
|
10739
|
+
assertIsFixedSize(encoder3);
|
|
10070
10740
|
return createEncoder({
|
|
10071
|
-
...
|
|
10741
|
+
...encoder3,
|
|
10072
10742
|
write: (value, bytes, offset) => {
|
|
10073
|
-
const newOffset =
|
|
10743
|
+
const newOffset = encoder3.write(value, bytes, offset);
|
|
10074
10744
|
copySourceToTargetInReverse(
|
|
10075
10745
|
bytes,
|
|
10076
10746
|
bytes,
|
|
10077
10747
|
offset,
|
|
10078
|
-
offset +
|
|
10748
|
+
offset + encoder3.fixedSize
|
|
10079
10749
|
);
|
|
10080
10750
|
return newOffset;
|
|
10081
10751
|
}
|
|
@@ -10100,10 +10770,10 @@ var require_index_node2 = __commonJS({
|
|
|
10100
10770
|
function reverseCodec(codec) {
|
|
10101
10771
|
return combineCodec(reverseEncoder(codec), reverseDecoder(codec));
|
|
10102
10772
|
}
|
|
10103
|
-
function transformEncoder(
|
|
10773
|
+
function transformEncoder(encoder3, unmap) {
|
|
10104
10774
|
return createEncoder({
|
|
10105
|
-
...isVariableSize(
|
|
10106
|
-
write: (value, bytes, offset) =>
|
|
10775
|
+
...isVariableSize(encoder3) ? { ...encoder3, getSizeFromValue: (value) => encoder3.getSizeFromValue(unmap(value)) } : encoder3,
|
|
10776
|
+
write: (value, bytes, offset) => encoder3.write(unmap(value), bytes, offset)
|
|
10107
10777
|
});
|
|
10108
10778
|
}
|
|
10109
10779
|
function transformDecoder(decoder, map) {
|
|
@@ -10148,7 +10818,7 @@ var require_index_node2 = __commonJS({
|
|
|
10148
10818
|
exports.offsetCodec = offsetCodec;
|
|
10149
10819
|
exports.offsetDecoder = offsetDecoder;
|
|
10150
10820
|
exports.offsetEncoder = offsetEncoder;
|
|
10151
|
-
exports.padBytes =
|
|
10821
|
+
exports.padBytes = padBytes2;
|
|
10152
10822
|
exports.padLeftCodec = padLeftCodec;
|
|
10153
10823
|
exports.padLeftDecoder = padLeftDecoder;
|
|
10154
10824
|
exports.padLeftEncoder = padLeftEncoder;
|
|
@@ -10505,8 +11175,8 @@ var require_dist = __commonJS({
|
|
|
10505
11175
|
constructor(failure, failures) {
|
|
10506
11176
|
let cached2;
|
|
10507
11177
|
const { message, explanation, ...rest } = failure;
|
|
10508
|
-
const { path:
|
|
10509
|
-
const msg =
|
|
11178
|
+
const { path: path6 } = failure;
|
|
11179
|
+
const msg = path6.length === 0 ? message : `At path: ${path6.join(".")} -- ${message}`;
|
|
10510
11180
|
super(explanation ?? msg);
|
|
10511
11181
|
if (explanation != null)
|
|
10512
11182
|
this.cause = msg;
|
|
@@ -10551,15 +11221,15 @@ var require_dist = __commonJS({
|
|
|
10551
11221
|
} else if (typeof result === "string") {
|
|
10552
11222
|
result = { message: result };
|
|
10553
11223
|
}
|
|
10554
|
-
const { path:
|
|
11224
|
+
const { path: path6, branch } = context;
|
|
10555
11225
|
const { type: type2 } = struct6;
|
|
10556
11226
|
const { refinement, message = `Expected a value of type \`${type2}\`${refinement ? ` with refinement \`${refinement}\`` : ""}, but received: \`${print(value)}\`` } = result;
|
|
10557
11227
|
return {
|
|
10558
11228
|
value,
|
|
10559
11229
|
type: type2,
|
|
10560
11230
|
refinement,
|
|
10561
|
-
key:
|
|
10562
|
-
path:
|
|
11231
|
+
key: path6[path6.length - 1],
|
|
11232
|
+
path: path6,
|
|
10563
11233
|
branch,
|
|
10564
11234
|
...result,
|
|
10565
11235
|
message
|
|
@@ -10577,8 +11247,8 @@ var require_dist = __commonJS({
|
|
|
10577
11247
|
}
|
|
10578
11248
|
}
|
|
10579
11249
|
function* run2(value, struct6, options = {}) {
|
|
10580
|
-
const { path:
|
|
10581
|
-
const ctx = { path:
|
|
11250
|
+
const { path: path6 = [], branch = [value], coerce: coerce2 = false, mask: mask2 = false } = options;
|
|
11251
|
+
const ctx = { path: path6, branch, mask: mask2 };
|
|
10582
11252
|
if (coerce2) {
|
|
10583
11253
|
value = struct6.coercer(value, ctx);
|
|
10584
11254
|
}
|
|
@@ -10590,7 +11260,7 @@ var require_dist = __commonJS({
|
|
|
10590
11260
|
}
|
|
10591
11261
|
for (let [k, v, s] of struct6.entries(value, ctx)) {
|
|
10592
11262
|
const ts = run2(v, s, {
|
|
10593
|
-
path: k === void 0 ?
|
|
11263
|
+
path: k === void 0 ? path6 : [...path6, k],
|
|
10594
11264
|
branch: k === void 0 ? branch : [...branch, v],
|
|
10595
11265
|
coerce: coerce2,
|
|
10596
11266
|
mask: mask2,
|
|
@@ -11187,8 +11857,8 @@ var require_dist = __commonJS({
|
|
|
11187
11857
|
}
|
|
11188
11858
|
function empty(struct6) {
|
|
11189
11859
|
return refine(struct6, "empty", (value) => {
|
|
11190
|
-
const
|
|
11191
|
-
return
|
|
11860
|
+
const size3 = getSize(value);
|
|
11861
|
+
return size3 === 0 || `Expected an empty ${struct6.type} but received one with a size of \`${size3}\``;
|
|
11192
11862
|
});
|
|
11193
11863
|
}
|
|
11194
11864
|
function getSize(value) {
|
|
@@ -11212,8 +11882,8 @@ var require_dist = __commonJS({
|
|
|
11212
11882
|
}
|
|
11213
11883
|
function nonempty(struct6) {
|
|
11214
11884
|
return refine(struct6, "nonempty", (value) => {
|
|
11215
|
-
const
|
|
11216
|
-
return
|
|
11885
|
+
const size3 = getSize(value);
|
|
11886
|
+
return size3 > 0 || `Expected a nonempty ${struct6.type} but received an empty one`;
|
|
11217
11887
|
});
|
|
11218
11888
|
}
|
|
11219
11889
|
function pattern(struct6, regexp2) {
|
|
@@ -11221,15 +11891,15 @@ var require_dist = __commonJS({
|
|
|
11221
11891
|
return regexp2.test(value) || `Expected a ${struct6.type} matching \`/${regexp2.source}/\` but received "${value}"`;
|
|
11222
11892
|
});
|
|
11223
11893
|
}
|
|
11224
|
-
function
|
|
11894
|
+
function size2(struct6, min2, max2 = min2) {
|
|
11225
11895
|
const expected = `Expected a ${struct6.type}`;
|
|
11226
11896
|
const of = min2 === max2 ? `of \`${min2}\`` : `between \`${min2}\` and \`${max2}\``;
|
|
11227
11897
|
return refine(struct6, "size", (value) => {
|
|
11228
11898
|
if (typeof value === "number" || value instanceof Date) {
|
|
11229
11899
|
return min2 <= value && value <= max2 || `${expected} ${of} but received \`${value}\``;
|
|
11230
11900
|
} else if (value instanceof Map || value instanceof Set) {
|
|
11231
|
-
const { size:
|
|
11232
|
-
return min2 <=
|
|
11901
|
+
const { size: size3 } = value;
|
|
11902
|
+
return min2 <= size3 && size3 <= max2 || `${expected} with a size ${of} but received one with a size of \`${size3}\``;
|
|
11233
11903
|
} else {
|
|
11234
11904
|
const { length } = value;
|
|
11235
11905
|
return min2 <= length && length <= max2 || `${expected} with a length ${of} but received one with a length of \`${length}\``;
|
|
@@ -11291,7 +11961,7 @@ var require_dist = __commonJS({
|
|
|
11291
11961
|
exports2.refine = refine;
|
|
11292
11962
|
exports2.regexp = regexp;
|
|
11293
11963
|
exports2.set = set;
|
|
11294
|
-
exports2.size =
|
|
11964
|
+
exports2.size = size2;
|
|
11295
11965
|
exports2.string = string;
|
|
11296
11966
|
exports2.struct = struct5;
|
|
11297
11967
|
exports2.trimmed = trimmed;
|
|
@@ -11305,10 +11975,10 @@ var require_dist = __commonJS({
|
|
|
11305
11975
|
});
|
|
11306
11976
|
|
|
11307
11977
|
// node_modules/uuid/dist/esm-node/rng.js
|
|
11308
|
-
import
|
|
11978
|
+
import crypto5 from "crypto";
|
|
11309
11979
|
function rng() {
|
|
11310
11980
|
if (poolPtr > rnds8Pool.length - 16) {
|
|
11311
|
-
|
|
11981
|
+
crypto5.randomFillSync(rnds8Pool);
|
|
11312
11982
|
poolPtr = 0;
|
|
11313
11983
|
}
|
|
11314
11984
|
return rnds8Pool.slice(poolPtr, poolPtr += 16);
|
|
@@ -11455,7 +12125,7 @@ var init_parse = __esm({
|
|
|
11455
12125
|
});
|
|
11456
12126
|
|
|
11457
12127
|
// node_modules/uuid/dist/esm-node/v35.js
|
|
11458
|
-
function
|
|
12128
|
+
function stringToBytes2(str) {
|
|
11459
12129
|
str = unescape(encodeURIComponent(str));
|
|
11460
12130
|
const bytes = [];
|
|
11461
12131
|
for (let i = 0; i < str.length; ++i) {
|
|
@@ -11463,10 +12133,10 @@ function stringToBytes(str) {
|
|
|
11463
12133
|
}
|
|
11464
12134
|
return bytes;
|
|
11465
12135
|
}
|
|
11466
|
-
function v35_default(name,
|
|
12136
|
+
function v35_default(name, version4, hashfunc) {
|
|
11467
12137
|
function generateUUID(value, namespace, buf, offset) {
|
|
11468
12138
|
if (typeof value === "string") {
|
|
11469
|
-
value =
|
|
12139
|
+
value = stringToBytes2(value);
|
|
11470
12140
|
}
|
|
11471
12141
|
if (typeof namespace === "string") {
|
|
11472
12142
|
namespace = parse_default(namespace);
|
|
@@ -11478,7 +12148,7 @@ function v35_default(name, version3, hashfunc) {
|
|
|
11478
12148
|
bytes.set(namespace);
|
|
11479
12149
|
bytes.set(value, namespace.length);
|
|
11480
12150
|
bytes = hashfunc(bytes);
|
|
11481
|
-
bytes[6] = bytes[6] & 15 |
|
|
12151
|
+
bytes[6] = bytes[6] & 15 | version4;
|
|
11482
12152
|
bytes[8] = bytes[8] & 63 | 128;
|
|
11483
12153
|
if (buf) {
|
|
11484
12154
|
offset = offset || 0;
|
|
@@ -11508,14 +12178,14 @@ var init_v35 = __esm({
|
|
|
11508
12178
|
});
|
|
11509
12179
|
|
|
11510
12180
|
// node_modules/uuid/dist/esm-node/md5.js
|
|
11511
|
-
import
|
|
12181
|
+
import crypto6 from "crypto";
|
|
11512
12182
|
function md5(bytes) {
|
|
11513
12183
|
if (Array.isArray(bytes)) {
|
|
11514
12184
|
bytes = Buffer.from(bytes);
|
|
11515
12185
|
} else if (typeof bytes === "string") {
|
|
11516
12186
|
bytes = Buffer.from(bytes, "utf8");
|
|
11517
12187
|
}
|
|
11518
|
-
return
|
|
12188
|
+
return crypto6.createHash("md5").update(bytes).digest();
|
|
11519
12189
|
}
|
|
11520
12190
|
var md5_default;
|
|
11521
12191
|
var init_md5 = __esm({
|
|
@@ -11560,14 +12230,14 @@ var init_v4 = __esm({
|
|
|
11560
12230
|
});
|
|
11561
12231
|
|
|
11562
12232
|
// node_modules/uuid/dist/esm-node/sha1.js
|
|
11563
|
-
import
|
|
12233
|
+
import crypto7 from "crypto";
|
|
11564
12234
|
function sha1(bytes) {
|
|
11565
12235
|
if (Array.isArray(bytes)) {
|
|
11566
12236
|
bytes = Buffer.from(bytes);
|
|
11567
12237
|
} else if (typeof bytes === "string") {
|
|
11568
12238
|
bytes = Buffer.from(bytes, "utf8");
|
|
11569
12239
|
}
|
|
11570
|
-
return
|
|
12240
|
+
return crypto7.createHash("sha1").update(bytes).digest();
|
|
11571
12241
|
}
|
|
11572
12242
|
var sha1_default;
|
|
11573
12243
|
var init_sha1 = __esm({
|
|
@@ -11596,17 +12266,17 @@ var init_nil = __esm({
|
|
|
11596
12266
|
});
|
|
11597
12267
|
|
|
11598
12268
|
// node_modules/uuid/dist/esm-node/version.js
|
|
11599
|
-
function
|
|
12269
|
+
function version2(uuid) {
|
|
11600
12270
|
if (!validate_default(uuid)) {
|
|
11601
12271
|
throw TypeError("Invalid UUID");
|
|
11602
12272
|
}
|
|
11603
12273
|
return parseInt(uuid.substr(14, 1), 16);
|
|
11604
12274
|
}
|
|
11605
12275
|
var version_default;
|
|
11606
|
-
var
|
|
12276
|
+
var init_version2 = __esm({
|
|
11607
12277
|
"node_modules/uuid/dist/esm-node/version.js"() {
|
|
11608
12278
|
init_validate();
|
|
11609
|
-
version_default =
|
|
12279
|
+
version_default = version2;
|
|
11610
12280
|
}
|
|
11611
12281
|
});
|
|
11612
12282
|
|
|
@@ -11630,7 +12300,7 @@ var init_esm_node = __esm({
|
|
|
11630
12300
|
init_v4();
|
|
11631
12301
|
init_v5();
|
|
11632
12302
|
init_nil();
|
|
11633
|
-
|
|
12303
|
+
init_version2();
|
|
11634
12304
|
init_validate();
|
|
11635
12305
|
init_stringify();
|
|
11636
12306
|
init_parse();
|
|
@@ -11647,14 +12317,14 @@ var require_generateRequest = __commonJS({
|
|
|
11647
12317
|
throw new TypeError(method + " must be a string");
|
|
11648
12318
|
}
|
|
11649
12319
|
options = options || {};
|
|
11650
|
-
const
|
|
11651
|
-
if (
|
|
11652
|
-
throw new TypeError(
|
|
12320
|
+
const version4 = typeof options.version === "number" ? options.version : 2;
|
|
12321
|
+
if (version4 !== 1 && version4 !== 2) {
|
|
12322
|
+
throw new TypeError(version4 + " must be 1 or 2");
|
|
11653
12323
|
}
|
|
11654
12324
|
const request2 = {
|
|
11655
12325
|
method
|
|
11656
12326
|
};
|
|
11657
|
-
if (
|
|
12327
|
+
if (version4 === 2) {
|
|
11658
12328
|
request2.jsonrpc = "2.0";
|
|
11659
12329
|
}
|
|
11660
12330
|
if (params) {
|
|
@@ -11668,7 +12338,7 @@ var require_generateRequest = __commonJS({
|
|
|
11668
12338
|
return uuid();
|
|
11669
12339
|
};
|
|
11670
12340
|
request2.id = generator(request2, options);
|
|
11671
|
-
} else if (
|
|
12341
|
+
} else if (version4 === 2 && id === null) {
|
|
11672
12342
|
if (options.notificationIdNull) {
|
|
11673
12343
|
request2.id = null;
|
|
11674
12344
|
}
|
|
@@ -12520,14 +13190,14 @@ var require_url_state_machine = __commonJS({
|
|
|
12520
13190
|
return url.replace(/\u0009|\u000A|\u000D/g, "");
|
|
12521
13191
|
}
|
|
12522
13192
|
function shortenPath(url) {
|
|
12523
|
-
const
|
|
12524
|
-
if (
|
|
13193
|
+
const path6 = url.path;
|
|
13194
|
+
if (path6.length === 0) {
|
|
12525
13195
|
return;
|
|
12526
13196
|
}
|
|
12527
|
-
if (url.scheme === "file" &&
|
|
13197
|
+
if (url.scheme === "file" && path6.length === 1 && isNormalizedWindowsDriveLetter(path6[0])) {
|
|
12528
13198
|
return;
|
|
12529
13199
|
}
|
|
12530
|
-
|
|
13200
|
+
path6.pop();
|
|
12531
13201
|
}
|
|
12532
13202
|
function includesCredentials(url) {
|
|
12533
13203
|
return url.username !== "" || url.password !== "";
|
|
@@ -13580,7 +14250,7 @@ var require_lib3 = __commonJS({
|
|
|
13580
14250
|
const blobParts = arguments[0];
|
|
13581
14251
|
const options = arguments[1];
|
|
13582
14252
|
const buffers = [];
|
|
13583
|
-
let
|
|
14253
|
+
let size2 = 0;
|
|
13584
14254
|
if (blobParts) {
|
|
13585
14255
|
const a = blobParts;
|
|
13586
14256
|
const length = Number(a.length);
|
|
@@ -13598,7 +14268,7 @@ var require_lib3 = __commonJS({
|
|
|
13598
14268
|
} else {
|
|
13599
14269
|
buffer = Buffer.from(typeof element === "string" ? element : String(element));
|
|
13600
14270
|
}
|
|
13601
|
-
|
|
14271
|
+
size2 += buffer.length;
|
|
13602
14272
|
buffers.push(buffer);
|
|
13603
14273
|
}
|
|
13604
14274
|
}
|
|
@@ -13634,23 +14304,23 @@ var require_lib3 = __commonJS({
|
|
|
13634
14304
|
return "[object Blob]";
|
|
13635
14305
|
}
|
|
13636
14306
|
slice() {
|
|
13637
|
-
const
|
|
14307
|
+
const size2 = this.size;
|
|
13638
14308
|
const start = arguments[0];
|
|
13639
14309
|
const end = arguments[1];
|
|
13640
14310
|
let relativeStart, relativeEnd;
|
|
13641
14311
|
if (start === void 0) {
|
|
13642
14312
|
relativeStart = 0;
|
|
13643
14313
|
} else if (start < 0) {
|
|
13644
|
-
relativeStart = Math.max(
|
|
14314
|
+
relativeStart = Math.max(size2 + start, 0);
|
|
13645
14315
|
} else {
|
|
13646
|
-
relativeStart = Math.min(start,
|
|
14316
|
+
relativeStart = Math.min(start, size2);
|
|
13647
14317
|
}
|
|
13648
14318
|
if (end === void 0) {
|
|
13649
|
-
relativeEnd =
|
|
14319
|
+
relativeEnd = size2;
|
|
13650
14320
|
} else if (end < 0) {
|
|
13651
|
-
relativeEnd = Math.max(
|
|
14321
|
+
relativeEnd = Math.max(size2 + end, 0);
|
|
13652
14322
|
} else {
|
|
13653
|
-
relativeEnd = Math.min(end,
|
|
14323
|
+
relativeEnd = Math.min(end, size2);
|
|
13654
14324
|
}
|
|
13655
14325
|
const span = Math.max(relativeEnd - relativeStart, 0);
|
|
13656
14326
|
const buffer = this[BUFFER];
|
|
@@ -13693,7 +14363,7 @@ var require_lib3 = __commonJS({
|
|
|
13693
14363
|
function Body(body) {
|
|
13694
14364
|
var _this = this;
|
|
13695
14365
|
var _ref = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, _ref$size = _ref.size;
|
|
13696
|
-
let
|
|
14366
|
+
let size2 = _ref$size === void 0 ? 0 : _ref$size;
|
|
13697
14367
|
var _ref$timeout = _ref.timeout;
|
|
13698
14368
|
let timeout = _ref$timeout === void 0 ? 0 : _ref$timeout;
|
|
13699
14369
|
if (body == null) {
|
|
@@ -13715,7 +14385,7 @@ var require_lib3 = __commonJS({
|
|
|
13715
14385
|
disturbed: false,
|
|
13716
14386
|
error: null
|
|
13717
14387
|
};
|
|
13718
|
-
this.size =
|
|
14388
|
+
this.size = size2;
|
|
13719
14389
|
this.timeout = timeout;
|
|
13720
14390
|
if (body instanceof Stream) {
|
|
13721
14391
|
body.on("error", function(err) {
|
|
@@ -14822,16 +15492,16 @@ var require_constants = __commonJS({
|
|
|
14822
15492
|
// node_modules/node-gyp-build/node-gyp-build.js
|
|
14823
15493
|
var require_node_gyp_build = __commonJS({
|
|
14824
15494
|
"node_modules/node-gyp-build/node-gyp-build.js"(exports, module) {
|
|
14825
|
-
var
|
|
14826
|
-
var
|
|
14827
|
-
var
|
|
15495
|
+
var fs6 = __require("fs");
|
|
15496
|
+
var path6 = __require("path");
|
|
15497
|
+
var os3 = __require("os");
|
|
14828
15498
|
var runtimeRequire = typeof __webpack_require__ === "function" ? __non_webpack_require__ : __require;
|
|
14829
15499
|
var vars = process.config && process.config.variables || {};
|
|
14830
15500
|
var prebuildsOnly = !!process.env.PREBUILDS_ONLY;
|
|
14831
15501
|
var abi = process.versions.modules;
|
|
14832
15502
|
var runtime = isElectron() ? "electron" : isNwjs() ? "node-webkit" : "node";
|
|
14833
|
-
var arch = process.env.npm_config_arch ||
|
|
14834
|
-
var platform = process.env.npm_config_platform ||
|
|
15503
|
+
var arch = process.env.npm_config_arch || os3.arch();
|
|
15504
|
+
var platform = process.env.npm_config_platform || os3.platform();
|
|
14835
15505
|
var libc = process.env.LIBC || (isAlpine(platform) ? "musl" : "glibc");
|
|
14836
15506
|
var armv = process.env.ARM_VERSION || (arch === "arm64" ? "8" : vars.arm_version) || "";
|
|
14837
15507
|
var uv = (process.versions.uv || "").split(".")[0];
|
|
@@ -14840,21 +15510,21 @@ var require_node_gyp_build = __commonJS({
|
|
|
14840
15510
|
return runtimeRequire(load.resolve(dir));
|
|
14841
15511
|
}
|
|
14842
15512
|
load.resolve = load.path = function(dir) {
|
|
14843
|
-
dir =
|
|
15513
|
+
dir = path6.resolve(dir || ".");
|
|
14844
15514
|
try {
|
|
14845
|
-
var name = runtimeRequire(
|
|
15515
|
+
var name = runtimeRequire(path6.join(dir, "package.json")).name.toUpperCase().replace(/-/g, "_");
|
|
14846
15516
|
if (process.env[name + "_PREBUILD"]) dir = process.env[name + "_PREBUILD"];
|
|
14847
15517
|
} catch (err) {
|
|
14848
15518
|
}
|
|
14849
15519
|
if (!prebuildsOnly) {
|
|
14850
|
-
var release = getFirst(
|
|
15520
|
+
var release = getFirst(path6.join(dir, "build/Release"), matchBuild);
|
|
14851
15521
|
if (release) return release;
|
|
14852
|
-
var debug = getFirst(
|
|
15522
|
+
var debug = getFirst(path6.join(dir, "build/Debug"), matchBuild);
|
|
14853
15523
|
if (debug) return debug;
|
|
14854
15524
|
}
|
|
14855
15525
|
var prebuild = resolve(dir);
|
|
14856
15526
|
if (prebuild) return prebuild;
|
|
14857
|
-
var nearby = resolve(
|
|
15527
|
+
var nearby = resolve(path6.dirname(process.execPath));
|
|
14858
15528
|
if (nearby) return nearby;
|
|
14859
15529
|
var target = [
|
|
14860
15530
|
"platform=" + platform,
|
|
@@ -14871,26 +15541,26 @@ var require_node_gyp_build = __commonJS({
|
|
|
14871
15541
|
].filter(Boolean).join(" ");
|
|
14872
15542
|
throw new Error("No native build was found for " + target + "\n loaded from: " + dir + "\n");
|
|
14873
15543
|
function resolve(dir2) {
|
|
14874
|
-
var tuples = readdirSync(
|
|
15544
|
+
var tuples = readdirSync(path6.join(dir2, "prebuilds")).map(parseTuple);
|
|
14875
15545
|
var tuple = tuples.filter(matchTuple(platform, arch)).sort(compareTuples)[0];
|
|
14876
15546
|
if (!tuple) return;
|
|
14877
|
-
var prebuilds =
|
|
15547
|
+
var prebuilds = path6.join(dir2, "prebuilds", tuple.name);
|
|
14878
15548
|
var parsed = readdirSync(prebuilds).map(parseTags);
|
|
14879
15549
|
var candidates = parsed.filter(matchTags(runtime, abi));
|
|
14880
15550
|
var winner = candidates.sort(compareTags(runtime))[0];
|
|
14881
|
-
if (winner) return
|
|
15551
|
+
if (winner) return path6.join(prebuilds, winner.file);
|
|
14882
15552
|
}
|
|
14883
15553
|
};
|
|
14884
15554
|
function readdirSync(dir) {
|
|
14885
15555
|
try {
|
|
14886
|
-
return
|
|
15556
|
+
return fs6.readdirSync(dir);
|
|
14887
15557
|
} catch (err) {
|
|
14888
15558
|
return [];
|
|
14889
15559
|
}
|
|
14890
15560
|
}
|
|
14891
15561
|
function getFirst(dir, filter) {
|
|
14892
15562
|
var files = readdirSync(dir).filter(filter);
|
|
14893
|
-
return files[0] &&
|
|
15563
|
+
return files[0] && path6.join(dir, files[0]);
|
|
14894
15564
|
}
|
|
14895
15565
|
function matchBuild(name) {
|
|
14896
15566
|
return /\.node$/.test(name);
|
|
@@ -14977,7 +15647,7 @@ var require_node_gyp_build = __commonJS({
|
|
|
14977
15647
|
return typeof window !== "undefined" && window.process && window.process.type === "renderer";
|
|
14978
15648
|
}
|
|
14979
15649
|
function isAlpine(platform2) {
|
|
14980
|
-
return platform2 === "linux" &&
|
|
15650
|
+
return platform2 === "linux" && fs6.existsSync("/etc/alpine-release");
|
|
14981
15651
|
}
|
|
14982
15652
|
load.parseTags = parseTags;
|
|
14983
15653
|
load.matchTags = matchTags;
|
|
@@ -18534,7 +19204,7 @@ var require_websocket_server = __commonJS({
|
|
|
18534
19204
|
socket.on("error", socketOnError);
|
|
18535
19205
|
const key = req.headers["sec-websocket-key"];
|
|
18536
19206
|
const upgrade = req.headers.upgrade;
|
|
18537
|
-
const
|
|
19207
|
+
const version4 = +req.headers["sec-websocket-version"];
|
|
18538
19208
|
if (req.method !== "GET") {
|
|
18539
19209
|
const message = "Invalid HTTP method";
|
|
18540
19210
|
abortHandshakeOrEmitwsClientError(this, req, socket, 405, message);
|
|
@@ -18550,7 +19220,7 @@ var require_websocket_server = __commonJS({
|
|
|
18550
19220
|
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
|
|
18551
19221
|
return;
|
|
18552
19222
|
}
|
|
18553
|
-
if (
|
|
19223
|
+
if (version4 !== 13 && version4 !== 8) {
|
|
18554
19224
|
const message = "Missing or invalid Sec-WebSocket-Version header";
|
|
18555
19225
|
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message, {
|
|
18556
19226
|
"Sec-WebSocket-Version": "13, 8"
|
|
@@ -18594,7 +19264,7 @@ var require_websocket_server = __commonJS({
|
|
|
18594
19264
|
}
|
|
18595
19265
|
if (this.options.verifyClient) {
|
|
18596
19266
|
const info = {
|
|
18597
|
-
origin: req.headers[`${
|
|
19267
|
+
origin: req.headers[`${version4 === 8 ? "sec-websocket-origin" : "origin"}`],
|
|
18598
19268
|
secure: !!(req.socket.authorized || req.socket.encrypted),
|
|
18599
19269
|
req
|
|
18600
19270
|
};
|
|
@@ -19120,7 +19790,7 @@ var init_md52 = __esm({
|
|
|
19120
19790
|
});
|
|
19121
19791
|
|
|
19122
19792
|
// node_modules/rpc-websockets/node_modules/uuid/dist-node/v35.js
|
|
19123
|
-
function
|
|
19793
|
+
function stringToBytes3(str) {
|
|
19124
19794
|
str = unescape(encodeURIComponent(str));
|
|
19125
19795
|
const bytes = new Uint8Array(str.length);
|
|
19126
19796
|
for (let i = 0; i < str.length; ++i) {
|
|
@@ -19128,8 +19798,8 @@ function stringToBytes2(str) {
|
|
|
19128
19798
|
}
|
|
19129
19799
|
return bytes;
|
|
19130
19800
|
}
|
|
19131
|
-
function v35(
|
|
19132
|
-
const valueBytes = typeof value === "string" ?
|
|
19801
|
+
function v35(version4, hash, value, namespace, buf, offset) {
|
|
19802
|
+
const valueBytes = typeof value === "string" ? stringToBytes3(value) : value;
|
|
19133
19803
|
const namespaceBytes = typeof namespace === "string" ? parse_default2(namespace) : namespace;
|
|
19134
19804
|
if (typeof namespace === "string") {
|
|
19135
19805
|
namespace = parse_default2(namespace);
|
|
@@ -19141,7 +19811,7 @@ function v35(version3, hash, value, namespace, buf, offset) {
|
|
|
19141
19811
|
bytes.set(namespaceBytes);
|
|
19142
19812
|
bytes.set(valueBytes, namespaceBytes.length);
|
|
19143
19813
|
bytes = hash(bytes);
|
|
19144
|
-
bytes[6] = bytes[6] & 15 |
|
|
19814
|
+
bytes[6] = bytes[6] & 15 | version4;
|
|
19145
19815
|
bytes[8] = bytes[8] & 63 | 128;
|
|
19146
19816
|
if (buf) {
|
|
19147
19817
|
offset ??= 0;
|
|
@@ -19361,17 +20031,17 @@ var init_v7 = __esm({
|
|
|
19361
20031
|
});
|
|
19362
20032
|
|
|
19363
20033
|
// node_modules/rpc-websockets/node_modules/uuid/dist-node/version.js
|
|
19364
|
-
function
|
|
20034
|
+
function version3(uuid) {
|
|
19365
20035
|
if (!validate_default2(uuid)) {
|
|
19366
20036
|
throw TypeError("Invalid UUID");
|
|
19367
20037
|
}
|
|
19368
20038
|
return parseInt(uuid.slice(14, 15), 16);
|
|
19369
20039
|
}
|
|
19370
20040
|
var version_default2;
|
|
19371
|
-
var
|
|
20041
|
+
var init_version3 = __esm({
|
|
19372
20042
|
"node_modules/rpc-websockets/node_modules/uuid/dist-node/version.js"() {
|
|
19373
20043
|
init_validate2();
|
|
19374
|
-
version_default2 =
|
|
20044
|
+
version_default2 = version3;
|
|
19375
20045
|
}
|
|
19376
20046
|
});
|
|
19377
20047
|
|
|
@@ -19408,7 +20078,7 @@ var init_dist_node = __esm({
|
|
|
19408
20078
|
init_v6ToV1();
|
|
19409
20079
|
init_v7();
|
|
19410
20080
|
init_validate2();
|
|
19411
|
-
|
|
20081
|
+
init_version3();
|
|
19412
20082
|
}
|
|
19413
20083
|
});
|
|
19414
20084
|
|
|
@@ -20350,36 +21020,36 @@ var require_sha3 = __commonJS({
|
|
|
20350
21020
|
"use strict";
|
|
20351
21021
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20352
21022
|
exports.shake256 = exports.shake128 = exports.keccak_512 = exports.keccak_384 = exports.keccak_256 = exports.keccak_224 = exports.sha3_512 = exports.sha3_384 = exports.sha3_256 = exports.sha3_224 = exports.Keccak = void 0;
|
|
20353
|
-
exports.keccakP =
|
|
21023
|
+
exports.keccakP = keccakP2;
|
|
20354
21024
|
var _u64_ts_1 = require_u64();
|
|
20355
21025
|
var utils_ts_1 = require_utils();
|
|
20356
|
-
var
|
|
20357
|
-
var
|
|
20358
|
-
var
|
|
20359
|
-
var
|
|
20360
|
-
var
|
|
20361
|
-
var
|
|
20362
|
-
var
|
|
20363
|
-
var
|
|
20364
|
-
var
|
|
20365
|
-
for (let round = 0, R =
|
|
21026
|
+
var _0n2 = BigInt(0);
|
|
21027
|
+
var _1n2 = BigInt(1);
|
|
21028
|
+
var _2n2 = BigInt(2);
|
|
21029
|
+
var _7n2 = BigInt(7);
|
|
21030
|
+
var _256n2 = BigInt(256);
|
|
21031
|
+
var _0x71n2 = BigInt(113);
|
|
21032
|
+
var SHA3_PI2 = [];
|
|
21033
|
+
var SHA3_ROTL2 = [];
|
|
21034
|
+
var _SHA3_IOTA2 = [];
|
|
21035
|
+
for (let round = 0, R = _1n2, x = 1, y = 0; round < 24; round++) {
|
|
20366
21036
|
[x, y] = [y, (2 * x + 3 * y) % 5];
|
|
20367
|
-
|
|
20368
|
-
|
|
20369
|
-
let t =
|
|
21037
|
+
SHA3_PI2.push(2 * (5 * y + x));
|
|
21038
|
+
SHA3_ROTL2.push((round + 1) * (round + 2) / 2 % 64);
|
|
21039
|
+
let t = _0n2;
|
|
20370
21040
|
for (let j = 0; j < 7; j++) {
|
|
20371
|
-
R = (R <<
|
|
20372
|
-
if (R &
|
|
20373
|
-
t ^=
|
|
20374
|
-
}
|
|
20375
|
-
|
|
20376
|
-
}
|
|
20377
|
-
var
|
|
20378
|
-
var
|
|
20379
|
-
var
|
|
20380
|
-
var
|
|
20381
|
-
var
|
|
20382
|
-
function
|
|
21041
|
+
R = (R << _1n2 ^ (R >> _7n2) * _0x71n2) % _256n2;
|
|
21042
|
+
if (R & _2n2)
|
|
21043
|
+
t ^= _1n2 << (_1n2 << /* @__PURE__ */ BigInt(j)) - _1n2;
|
|
21044
|
+
}
|
|
21045
|
+
_SHA3_IOTA2.push(t);
|
|
21046
|
+
}
|
|
21047
|
+
var IOTAS2 = (0, _u64_ts_1.split)(_SHA3_IOTA2, true);
|
|
21048
|
+
var SHA3_IOTA_H2 = IOTAS2[0];
|
|
21049
|
+
var SHA3_IOTA_L2 = IOTAS2[1];
|
|
21050
|
+
var rotlH2 = (h, l, s) => s > 32 ? (0, _u64_ts_1.rotlBH)(h, l, s) : (0, _u64_ts_1.rotlSH)(h, l, s);
|
|
21051
|
+
var rotlL2 = (h, l, s) => s > 32 ? (0, _u64_ts_1.rotlBL)(h, l, s) : (0, _u64_ts_1.rotlSL)(h, l, s);
|
|
21052
|
+
function keccakP2(s, rounds = 24) {
|
|
20383
21053
|
const B = new Uint32Array(5 * 2);
|
|
20384
21054
|
for (let round = 24 - rounds; round < 24; round++) {
|
|
20385
21055
|
for (let x = 0; x < 10; x++)
|
|
@@ -20389,8 +21059,8 @@ var require_sha3 = __commonJS({
|
|
|
20389
21059
|
const idx0 = (x + 2) % 10;
|
|
20390
21060
|
const B0 = B[idx0];
|
|
20391
21061
|
const B1 = B[idx0 + 1];
|
|
20392
|
-
const Th =
|
|
20393
|
-
const Tl =
|
|
21062
|
+
const Th = rotlH2(B0, B1, 1) ^ B[idx1];
|
|
21063
|
+
const Tl = rotlL2(B0, B1, 1) ^ B[idx1 + 1];
|
|
20394
21064
|
for (let y = 0; y < 50; y += 10) {
|
|
20395
21065
|
s[x + y] ^= Th;
|
|
20396
21066
|
s[x + y + 1] ^= Tl;
|
|
@@ -20399,10 +21069,10 @@ var require_sha3 = __commonJS({
|
|
|
20399
21069
|
let curH = s[2];
|
|
20400
21070
|
let curL = s[3];
|
|
20401
21071
|
for (let t = 0; t < 24; t++) {
|
|
20402
|
-
const shift =
|
|
20403
|
-
const Th =
|
|
20404
|
-
const Tl =
|
|
20405
|
-
const PI =
|
|
21072
|
+
const shift = SHA3_ROTL2[t];
|
|
21073
|
+
const Th = rotlH2(curH, curL, shift);
|
|
21074
|
+
const Tl = rotlL2(curH, curL, shift);
|
|
21075
|
+
const PI = SHA3_PI2[t];
|
|
20406
21076
|
curH = s[PI];
|
|
20407
21077
|
curL = s[PI + 1];
|
|
20408
21078
|
s[PI] = Th;
|
|
@@ -20414,12 +21084,12 @@ var require_sha3 = __commonJS({
|
|
|
20414
21084
|
for (let x = 0; x < 10; x++)
|
|
20415
21085
|
s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];
|
|
20416
21086
|
}
|
|
20417
|
-
s[0] ^=
|
|
20418
|
-
s[1] ^=
|
|
21087
|
+
s[0] ^= SHA3_IOTA_H2[round];
|
|
21088
|
+
s[1] ^= SHA3_IOTA_L2[round];
|
|
20419
21089
|
}
|
|
20420
21090
|
(0, utils_ts_1.clean)(B);
|
|
20421
21091
|
}
|
|
20422
|
-
var
|
|
21092
|
+
var Keccak2 = class _Keccak extends utils_ts_1.Hash {
|
|
20423
21093
|
// NOTE: we accept arguments in bytes instead of bits here.
|
|
20424
21094
|
constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {
|
|
20425
21095
|
super();
|
|
@@ -20444,7 +21114,7 @@ var require_sha3 = __commonJS({
|
|
|
20444
21114
|
}
|
|
20445
21115
|
keccak() {
|
|
20446
21116
|
(0, utils_ts_1.swap32IfBE)(this.state32);
|
|
20447
|
-
|
|
21117
|
+
keccakP2(this.state32, this.rounds);
|
|
20448
21118
|
(0, utils_ts_1.swap32IfBE)(this.state32);
|
|
20449
21119
|
this.posOut = 0;
|
|
20450
21120
|
this.pos = 0;
|
|
@@ -20530,17 +21200,17 @@ var require_sha3 = __commonJS({
|
|
|
20530
21200
|
return to;
|
|
20531
21201
|
}
|
|
20532
21202
|
};
|
|
20533
|
-
exports.Keccak =
|
|
20534
|
-
var
|
|
20535
|
-
exports.sha3_224 = (() =>
|
|
20536
|
-
exports.sha3_256 = (() =>
|
|
20537
|
-
exports.sha3_384 = (() =>
|
|
20538
|
-
exports.sha3_512 = (() =>
|
|
20539
|
-
exports.keccak_224 = (() =>
|
|
20540
|
-
exports.keccak_256 = (() =>
|
|
20541
|
-
exports.keccak_384 = (() =>
|
|
20542
|
-
exports.keccak_512 = (() =>
|
|
20543
|
-
var genShake = (suffix, blockLen, outputLen) => (0, utils_ts_1.createXOFer)((opts = {}) => new
|
|
21203
|
+
exports.Keccak = Keccak2;
|
|
21204
|
+
var gen2 = (suffix, blockLen, outputLen) => (0, utils_ts_1.createHasher)(() => new Keccak2(blockLen, suffix, outputLen));
|
|
21205
|
+
exports.sha3_224 = (() => gen2(6, 144, 224 / 8))();
|
|
21206
|
+
exports.sha3_256 = (() => gen2(6, 136, 256 / 8))();
|
|
21207
|
+
exports.sha3_384 = (() => gen2(6, 104, 384 / 8))();
|
|
21208
|
+
exports.sha3_512 = (() => gen2(6, 72, 512 / 8))();
|
|
21209
|
+
exports.keccak_224 = (() => gen2(1, 144, 224 / 8))();
|
|
21210
|
+
exports.keccak_256 = (() => gen2(1, 136, 256 / 8))();
|
|
21211
|
+
exports.keccak_384 = (() => gen2(1, 104, 384 / 8))();
|
|
21212
|
+
exports.keccak_512 = (() => gen2(1, 72, 512 / 8))();
|
|
21213
|
+
var genShake = (suffix, blockLen, outputLen) => (0, utils_ts_1.createXOFer)((opts = {}) => new Keccak2(blockLen, suffix, opts.dkLen === void 0 ? outputLen : opts.dkLen, true));
|
|
20544
21214
|
exports.shake128 = (() => genShake(31, 168, 128 / 8))();
|
|
20545
21215
|
exports.shake256 = (() => genShake(31, 136, 256 / 8))();
|
|
20546
21216
|
}
|
|
@@ -20566,16 +21236,16 @@ var require_hmac = __commonJS({
|
|
|
20566
21236
|
this.blockLen = this.iHash.blockLen;
|
|
20567
21237
|
this.outputLen = this.iHash.outputLen;
|
|
20568
21238
|
const blockLen = this.blockLen;
|
|
20569
|
-
const
|
|
20570
|
-
|
|
20571
|
-
for (let i = 0; i <
|
|
20572
|
-
|
|
20573
|
-
this.iHash.update(
|
|
21239
|
+
const pad2 = new Uint8Array(blockLen);
|
|
21240
|
+
pad2.set(key.length > blockLen ? hash.create().update(key).digest() : key);
|
|
21241
|
+
for (let i = 0; i < pad2.length; i++)
|
|
21242
|
+
pad2[i] ^= 54;
|
|
21243
|
+
this.iHash.update(pad2);
|
|
20574
21244
|
this.oHash = hash.create();
|
|
20575
|
-
for (let i = 0; i <
|
|
20576
|
-
|
|
20577
|
-
this.oHash.update(
|
|
20578
|
-
(0, utils_ts_1.clean)(
|
|
21245
|
+
for (let i = 0; i < pad2.length; i++)
|
|
21246
|
+
pad2[i] ^= 54 ^ 92;
|
|
21247
|
+
this.oHash.update(pad2);
|
|
21248
|
+
(0, utils_ts_1.clean)(pad2);
|
|
20579
21249
|
}
|
|
20580
21250
|
update(buf) {
|
|
20581
21251
|
(0, utils_ts_1.aexists)(this);
|
|
@@ -20645,21 +21315,21 @@ var require_weierstrass = __commonJS({
|
|
|
20645
21315
|
var utils_ts_1 = require_utils2();
|
|
20646
21316
|
var curve_ts_1 = require_curve();
|
|
20647
21317
|
var modular_ts_1 = require_modular();
|
|
20648
|
-
var divNearest = (num, den) => (num + (num >= 0 ? den : -den) /
|
|
21318
|
+
var divNearest = (num, den) => (num + (num >= 0 ? den : -den) / _2n2) / den;
|
|
20649
21319
|
function _splitEndoScalar(k, basis, n) {
|
|
20650
21320
|
const [[a1, b1], [a2, b2]] = basis;
|
|
20651
21321
|
const c1 = divNearest(b2 * k, n);
|
|
20652
21322
|
const c2 = divNearest(-b1 * k, n);
|
|
20653
21323
|
let k1 = k - c1 * a1 - c2 * a2;
|
|
20654
21324
|
let k2 = -c1 * b1 - c2 * b2;
|
|
20655
|
-
const k1neg = k1 <
|
|
20656
|
-
const k2neg = k2 <
|
|
21325
|
+
const k1neg = k1 < _0n2;
|
|
21326
|
+
const k2neg = k2 < _0n2;
|
|
20657
21327
|
if (k1neg)
|
|
20658
21328
|
k1 = -k1;
|
|
20659
21329
|
if (k2neg)
|
|
20660
21330
|
k2 = -k2;
|
|
20661
|
-
const MAX_NUM = (0, utils_ts_1.bitMask)(Math.ceil((0, utils_ts_1.bitLen)(n) / 2)) +
|
|
20662
|
-
if (k1 <
|
|
21331
|
+
const MAX_NUM = (0, utils_ts_1.bitMask)(Math.ceil((0, utils_ts_1.bitLen)(n) / 2)) + _1n2;
|
|
21332
|
+
if (k1 < _0n2 || k1 >= MAX_NUM || k2 < _0n2 || k2 >= MAX_NUM) {
|
|
20663
21333
|
throw new Error("splitScalar (endomorphism): failed, k=" + k);
|
|
20664
21334
|
}
|
|
20665
21335
|
return { k1neg, k1, k2neg, k2 };
|
|
@@ -20748,7 +21418,7 @@ var require_weierstrass = __commonJS({
|
|
|
20748
21418
|
_int: {
|
|
20749
21419
|
encode(num) {
|
|
20750
21420
|
const { Err: E } = exports.DER;
|
|
20751
|
-
if (num <
|
|
21421
|
+
if (num < _0n2)
|
|
20752
21422
|
throw new E("integer: negative integers are not allowed");
|
|
20753
21423
|
let hex = (0, utils_ts_1.numberToHexUnpadded)(num);
|
|
20754
21424
|
if (Number.parseInt(hex[0], 16) & 8)
|
|
@@ -20786,9 +21456,9 @@ var require_weierstrass = __commonJS({
|
|
|
20786
21456
|
return tlv.encode(48, seq);
|
|
20787
21457
|
}
|
|
20788
21458
|
};
|
|
20789
|
-
var
|
|
20790
|
-
var
|
|
20791
|
-
var
|
|
21459
|
+
var _0n2 = BigInt(0);
|
|
21460
|
+
var _1n2 = BigInt(1);
|
|
21461
|
+
var _2n2 = BigInt(2);
|
|
20792
21462
|
var _3n = BigInt(3);
|
|
20793
21463
|
var _4n = BigInt(4);
|
|
20794
21464
|
function _normFnElement(Fn, key) {
|
|
@@ -21160,9 +21830,9 @@ var require_weierstrass = __commonJS({
|
|
|
21160
21830
|
const p = this;
|
|
21161
21831
|
if (!Fn.isValid(sc))
|
|
21162
21832
|
throw new Error("invalid scalar: out of range");
|
|
21163
|
-
if (sc ===
|
|
21833
|
+
if (sc === _0n2 || p.is0())
|
|
21164
21834
|
return Point.ZERO;
|
|
21165
|
-
if (sc ===
|
|
21835
|
+
if (sc === _1n2)
|
|
21166
21836
|
return p;
|
|
21167
21837
|
if (wnaf.hasCache(this))
|
|
21168
21838
|
return this.multiply(sc);
|
|
@@ -21191,7 +21861,7 @@ var require_weierstrass = __commonJS({
|
|
|
21191
21861
|
*/
|
|
21192
21862
|
isTorsionFree() {
|
|
21193
21863
|
const { isTorsionFree } = extraOpts;
|
|
21194
|
-
if (cofactor ===
|
|
21864
|
+
if (cofactor === _1n2)
|
|
21195
21865
|
return true;
|
|
21196
21866
|
if (isTorsionFree)
|
|
21197
21867
|
return isTorsionFree(Point, this);
|
|
@@ -21199,7 +21869,7 @@ var require_weierstrass = __commonJS({
|
|
|
21199
21869
|
}
|
|
21200
21870
|
clearCofactor() {
|
|
21201
21871
|
const { clearCofactor } = extraOpts;
|
|
21202
|
-
if (cofactor ===
|
|
21872
|
+
if (cofactor === _1n2)
|
|
21203
21873
|
return this;
|
|
21204
21874
|
if (clearCofactor)
|
|
21205
21875
|
return clearCofactor(Point, this);
|
|
@@ -21259,18 +21929,18 @@ var require_weierstrass = __commonJS({
|
|
|
21259
21929
|
}
|
|
21260
21930
|
function SWUFpSqrtRatio(Fp, Z) {
|
|
21261
21931
|
const q = Fp.ORDER;
|
|
21262
|
-
let l =
|
|
21263
|
-
for (let o = q -
|
|
21264
|
-
l +=
|
|
21932
|
+
let l = _0n2;
|
|
21933
|
+
for (let o = q - _1n2; o % _2n2 === _0n2; o /= _2n2)
|
|
21934
|
+
l += _1n2;
|
|
21265
21935
|
const c1 = l;
|
|
21266
|
-
const _2n_pow_c1_1 =
|
|
21267
|
-
const _2n_pow_c1 = _2n_pow_c1_1 *
|
|
21268
|
-
const c2 = (q -
|
|
21269
|
-
const c3 = (c2 -
|
|
21270
|
-
const c4 = _2n_pow_c1 -
|
|
21936
|
+
const _2n_pow_c1_1 = _2n2 << c1 - _1n2 - _1n2;
|
|
21937
|
+
const _2n_pow_c1 = _2n_pow_c1_1 * _2n2;
|
|
21938
|
+
const c2 = (q - _1n2) / _2n_pow_c1;
|
|
21939
|
+
const c3 = (c2 - _1n2) / _2n2;
|
|
21940
|
+
const c4 = _2n_pow_c1 - _1n2;
|
|
21271
21941
|
const c5 = _2n_pow_c1_1;
|
|
21272
21942
|
const c6 = Fp.pow(Z, c2);
|
|
21273
|
-
const c7 = Fp.pow(Z, (c2 +
|
|
21943
|
+
const c7 = Fp.pow(Z, (c2 + _1n2) / _2n2);
|
|
21274
21944
|
let sqrtRatio = (u, v) => {
|
|
21275
21945
|
let tv1 = c6;
|
|
21276
21946
|
let tv2 = Fp.pow(v, c4);
|
|
@@ -21288,9 +21958,9 @@ var require_weierstrass = __commonJS({
|
|
|
21288
21958
|
tv5 = Fp.mul(tv4, tv1);
|
|
21289
21959
|
tv3 = Fp.cmov(tv2, tv3, isQR);
|
|
21290
21960
|
tv4 = Fp.cmov(tv5, tv4, isQR);
|
|
21291
|
-
for (let i = c1; i >
|
|
21292
|
-
let tv52 = i -
|
|
21293
|
-
tv52 =
|
|
21961
|
+
for (let i = c1; i > _1n2; i--) {
|
|
21962
|
+
let tv52 = i - _2n2;
|
|
21963
|
+
tv52 = _2n2 << tv52 - _1n2;
|
|
21294
21964
|
let tvv5 = Fp.pow(tv4, tv52);
|
|
21295
21965
|
const e1 = Fp.eql(tvv5, Fp.ONE);
|
|
21296
21966
|
tv2 = Fp.mul(tv3, tv1);
|
|
@@ -21458,7 +22128,7 @@ var require_weierstrass = __commonJS({
|
|
|
21458
22128
|
};
|
|
21459
22129
|
const defaultSigOpts_format = "compact";
|
|
21460
22130
|
function isBiggerThanHalfOrder(number) {
|
|
21461
|
-
const HALF = CURVE_ORDER >>
|
|
22131
|
+
const HALF = CURVE_ORDER >> _1n2;
|
|
21462
22132
|
return number > HALF;
|
|
21463
22133
|
}
|
|
21464
22134
|
function validateRS(title, num) {
|
|
@@ -21468,8 +22138,8 @@ var require_weierstrass = __commonJS({
|
|
|
21468
22138
|
}
|
|
21469
22139
|
function validateSigLength(bytes, format) {
|
|
21470
22140
|
validateSigFormat(format);
|
|
21471
|
-
const
|
|
21472
|
-
const sizer = format === "compact" ?
|
|
22141
|
+
const size2 = lengths.signature;
|
|
22142
|
+
const sizer = format === "compact" ? size2 : format === "recovered" ? size2 + 1 : void 0;
|
|
21473
22143
|
return (0, utils_ts_1._abytes2)(bytes, sizer, `${format} signature`);
|
|
21474
22144
|
}
|
|
21475
22145
|
class Signature {
|
|
@@ -21508,7 +22178,7 @@ var require_weierstrass = __commonJS({
|
|
|
21508
22178
|
const { r, s, recovery: rec } = this;
|
|
21509
22179
|
if (rec == null || ![0, 1, 2, 3].includes(rec))
|
|
21510
22180
|
throw new Error("recovery id invalid");
|
|
21511
|
-
const hasCofactor = CURVE_ORDER *
|
|
22181
|
+
const hasCofactor = CURVE_ORDER * _2n2 < FIELD_ORDER;
|
|
21512
22182
|
if (hasCofactor && rec > 1)
|
|
21513
22183
|
throw new Error("recovery id is ambiguous for h>1 curve");
|
|
21514
22184
|
const radj = rec === 2 || rec === 3 ? r + CURVE_ORDER : r;
|
|
@@ -21583,7 +22253,7 @@ var require_weierstrass = __commonJS({
|
|
|
21583
22253
|
};
|
|
21584
22254
|
const ORDER_MASK = (0, utils_ts_1.bitMask)(fnBits);
|
|
21585
22255
|
function int2octets(num) {
|
|
21586
|
-
(0, utils_ts_1.aInRange)("num < 2^" + fnBits, num,
|
|
22256
|
+
(0, utils_ts_1.aInRange)("num < 2^" + fnBits, num, _0n2, ORDER_MASK);
|
|
21587
22257
|
return Fn.toBytes(num);
|
|
21588
22258
|
}
|
|
21589
22259
|
function validateMsgAndHash(message, prehash) {
|
|
@@ -21611,12 +22281,12 @@ var require_weierstrass = __commonJS({
|
|
|
21611
22281
|
const ik = Fn.inv(k);
|
|
21612
22282
|
const q = Point.BASE.multiply(k).toAffine();
|
|
21613
22283
|
const r = Fn.create(q.x);
|
|
21614
|
-
if (r ===
|
|
22284
|
+
if (r === _0n2)
|
|
21615
22285
|
return;
|
|
21616
22286
|
const s = Fn.create(ik * Fn.create(m + r * d));
|
|
21617
|
-
if (s ===
|
|
22287
|
+
if (s === _0n2)
|
|
21618
22288
|
return;
|
|
21619
|
-
let recovery = (q.x === r ? 0 : 2) | Number(q.y &
|
|
22289
|
+
let recovery = (q.x === r ? 0 : 2) | Number(q.y & _1n2);
|
|
21620
22290
|
let normS = s;
|
|
21621
22291
|
if (lowS && isBiggerThanHalfOrder(s)) {
|
|
21622
22292
|
normS = Fn.neg(s);
|
|
@@ -21635,13 +22305,13 @@ var require_weierstrass = __commonJS({
|
|
|
21635
22305
|
}
|
|
21636
22306
|
function tryParsingSig(sg) {
|
|
21637
22307
|
let sig = void 0;
|
|
21638
|
-
const
|
|
21639
|
-
const isObj = !
|
|
21640
|
-
if (!
|
|
22308
|
+
const isHex2 = typeof sg === "string" || (0, utils_ts_1.isBytes)(sg);
|
|
22309
|
+
const isObj = !isHex2 && sg !== null && typeof sg === "object" && typeof sg.r === "bigint" && typeof sg.s === "bigint";
|
|
22310
|
+
if (!isHex2 && !isObj)
|
|
21641
22311
|
throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");
|
|
21642
22312
|
if (isObj) {
|
|
21643
22313
|
sig = new Signature(sg.r, sg.s);
|
|
21644
|
-
} else if (
|
|
22314
|
+
} else if (isHex2) {
|
|
21645
22315
|
try {
|
|
21646
22316
|
sig = Signature.fromBytes((0, utils_ts_1.ensureBytes)("sig", sg), "der");
|
|
21647
22317
|
} catch (derError) {
|
|
@@ -21762,7 +22432,7 @@ var require_weierstrass = __commonJS({
|
|
|
21762
22432
|
function _weierstrass_new_output_to_legacy(c, Point) {
|
|
21763
22433
|
const { Fp, Fn } = Point;
|
|
21764
22434
|
function isWithinCurveOrder(num) {
|
|
21765
|
-
return (0, utils_ts_1.inRange)(num,
|
|
22435
|
+
return (0, utils_ts_1.inRange)(num, _1n2, Fn.ORDER);
|
|
21766
22436
|
}
|
|
21767
22437
|
const weierstrassEquation = _legacyHelperEquat(Fp, c.a, c.b);
|
|
21768
22438
|
return Object.assign({}, {
|
|
@@ -21837,9 +22507,9 @@ var require_secp256k1 = __commonJS({
|
|
|
21837
22507
|
[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"), BigInt("0x3086d221a7d46bcde86c90e49284eb15")]
|
|
21838
22508
|
]
|
|
21839
22509
|
};
|
|
21840
|
-
var
|
|
21841
|
-
var
|
|
21842
|
-
var
|
|
22510
|
+
var _0n2 = /* @__PURE__ */ BigInt(0);
|
|
22511
|
+
var _1n2 = /* @__PURE__ */ BigInt(1);
|
|
22512
|
+
var _2n2 = /* @__PURE__ */ BigInt(2);
|
|
21843
22513
|
function sqrtMod(y) {
|
|
21844
22514
|
const P = secp256k1_CURVE.p;
|
|
21845
22515
|
const _3n = BigInt(3), _6n = BigInt(6), _11n = BigInt(11), _22n = BigInt(22);
|
|
@@ -21848,7 +22518,7 @@ var require_secp256k1 = __commonJS({
|
|
|
21848
22518
|
const b3 = b2 * b2 * y % P;
|
|
21849
22519
|
const b6 = (0, modular_ts_1.pow2)(b3, _3n, P) * b3 % P;
|
|
21850
22520
|
const b9 = (0, modular_ts_1.pow2)(b6, _3n, P) * b3 % P;
|
|
21851
|
-
const b11 = (0, modular_ts_1.pow2)(b9,
|
|
22521
|
+
const b11 = (0, modular_ts_1.pow2)(b9, _2n2, P) * b2 % P;
|
|
21852
22522
|
const b22 = (0, modular_ts_1.pow2)(b11, _11n, P) * b11 % P;
|
|
21853
22523
|
const b44 = (0, modular_ts_1.pow2)(b22, _22n, P) * b22 % P;
|
|
21854
22524
|
const b88 = (0, modular_ts_1.pow2)(b44, _44n, P) * b44 % P;
|
|
@@ -21857,7 +22527,7 @@ var require_secp256k1 = __commonJS({
|
|
|
21857
22527
|
const b223 = (0, modular_ts_1.pow2)(b220, _3n, P) * b3 % P;
|
|
21858
22528
|
const t1 = (0, modular_ts_1.pow2)(b223, _23n, P) * b22 % P;
|
|
21859
22529
|
const t2 = (0, modular_ts_1.pow2)(t1, _6n, P) * b2 % P;
|
|
21860
|
-
const root = (0, modular_ts_1.pow2)(t2,
|
|
22530
|
+
const root = (0, modular_ts_1.pow2)(t2, _2n2, P);
|
|
21861
22531
|
if (!Fpk1.eql(Fpk1.sqr(root), y))
|
|
21862
22532
|
throw new Error("Cannot find square root");
|
|
21863
22533
|
return root;
|
|
@@ -21876,7 +22546,7 @@ var require_secp256k1 = __commonJS({
|
|
|
21876
22546
|
}
|
|
21877
22547
|
var pointToBytes = (point) => point.toBytes(true).slice(1);
|
|
21878
22548
|
var Pointk1 = /* @__PURE__ */ (() => exports.secp256k1.Point)();
|
|
21879
|
-
var hasEven = (y) => y %
|
|
22549
|
+
var hasEven = (y) => y % _2n2 === _0n2;
|
|
21880
22550
|
function schnorrGetExtPubKey(priv) {
|
|
21881
22551
|
const { Fn, BASE: BASE2 } = Pointk1;
|
|
21882
22552
|
const d_ = (0, weierstrass_ts_1._normFnElement)(Fn, priv);
|
|
@@ -21928,10 +22598,10 @@ var require_secp256k1 = __commonJS({
|
|
|
21928
22598
|
try {
|
|
21929
22599
|
const P = lift_x(num(pub));
|
|
21930
22600
|
const r = num(sig.subarray(0, 32));
|
|
21931
|
-
if (!(0, utils_ts_1.inRange)(r,
|
|
22601
|
+
if (!(0, utils_ts_1.inRange)(r, _1n2, secp256k1_CURVE.p))
|
|
21932
22602
|
return false;
|
|
21933
22603
|
const s = num(sig.subarray(32, 64));
|
|
21934
|
-
if (!(0, utils_ts_1.inRange)(s,
|
|
22604
|
+
if (!(0, utils_ts_1.inRange)(s, _1n2, secp256k1_CURVE.n))
|
|
21935
22605
|
return false;
|
|
21936
22606
|
const e = challenge(Fn.toBytes(r), pointToBytes(P), m);
|
|
21937
22607
|
const R = BASE2.multiplyUnsafe(s).add(P.multiplyUnsafe(Fn.neg(e)));
|
|
@@ -21944,7 +22614,7 @@ var require_secp256k1 = __commonJS({
|
|
|
21944
22614
|
}
|
|
21945
22615
|
}
|
|
21946
22616
|
exports.schnorr = (() => {
|
|
21947
|
-
const
|
|
22617
|
+
const size2 = 32;
|
|
21948
22618
|
const seedLength = 48;
|
|
21949
22619
|
const randomSecretKey = (seed = (0, utils_js_1.randomBytes)(seedLength)) => {
|
|
21950
22620
|
return (0, modular_ts_1.mapHashToField)(seed, secp256k1_CURVE.n);
|
|
@@ -21972,10 +22642,10 @@ var require_secp256k1 = __commonJS({
|
|
|
21972
22642
|
mod: modular_ts_1.mod
|
|
21973
22643
|
},
|
|
21974
22644
|
lengths: {
|
|
21975
|
-
secretKey:
|
|
21976
|
-
publicKey:
|
|
22645
|
+
secretKey: size2,
|
|
22646
|
+
publicKey: size2,
|
|
21977
22647
|
publicKeyHasPrefix: false,
|
|
21978
|
-
signature:
|
|
22648
|
+
signature: size2 * 2,
|
|
21979
22649
|
seed: seedLength
|
|
21980
22650
|
}
|
|
21981
22651
|
};
|
|
@@ -22506,11 +23176,11 @@ var require_index_cjs = __commonJS({
|
|
|
22506
23176
|
}
|
|
22507
23177
|
function decodeLength(bytes) {
|
|
22508
23178
|
let len = 0;
|
|
22509
|
-
let
|
|
23179
|
+
let size2 = 0;
|
|
22510
23180
|
for (; ; ) {
|
|
22511
23181
|
let elem = bytes.shift();
|
|
22512
|
-
len |= (elem & 127) <<
|
|
22513
|
-
|
|
23182
|
+
len |= (elem & 127) << size2 * 7;
|
|
23183
|
+
size2 += 1;
|
|
22514
23184
|
if ((elem & 128) === 0) {
|
|
22515
23185
|
break;
|
|
22516
23186
|
}
|
|
@@ -22987,8 +23657,8 @@ var require_index_cjs = __commonJS({
|
|
|
22987
23657
|
const prefix = guardedShift(byteArray);
|
|
22988
23658
|
const maskedPrefix = prefix & VERSION_PREFIX_MASK;
|
|
22989
23659
|
assert(prefix !== maskedPrefix, `Expected versioned message but received legacy message`);
|
|
22990
|
-
const
|
|
22991
|
-
assert(
|
|
23660
|
+
const version4 = maskedPrefix;
|
|
23661
|
+
assert(version4 === 0, `Expected versioned message with version 0 but found version ${version4}`);
|
|
22992
23662
|
const header = {
|
|
22993
23663
|
numRequiredSignatures: guardedShift(byteArray),
|
|
22994
23664
|
numReadonlySignedAccounts: guardedShift(byteArray),
|
|
@@ -23047,14 +23717,14 @@ var require_index_cjs = __commonJS({
|
|
|
23047
23717
|
return maskedPrefix;
|
|
23048
23718
|
},
|
|
23049
23719
|
deserialize: (serializedMessage) => {
|
|
23050
|
-
const
|
|
23051
|
-
if (
|
|
23720
|
+
const version4 = VersionedMessage.deserializeMessageVersion(serializedMessage);
|
|
23721
|
+
if (version4 === "legacy") {
|
|
23052
23722
|
return Message.from(serializedMessage);
|
|
23053
23723
|
}
|
|
23054
|
-
if (
|
|
23724
|
+
if (version4 === 0) {
|
|
23055
23725
|
return MessageV0.deserialize(serializedMessage);
|
|
23056
23726
|
} else {
|
|
23057
|
-
throw new Error(`Transaction message version ${
|
|
23727
|
+
throw new Error(`Transaction message version ${version4} deserialization is not supported`);
|
|
23058
23728
|
}
|
|
23059
23729
|
}
|
|
23060
23730
|
};
|
|
@@ -25789,8 +26459,8 @@ Message: ${transactionMessage}.
|
|
|
25789
26459
|
value
|
|
25790
26460
|
});
|
|
25791
26461
|
}
|
|
25792
|
-
function versionedMessageFromResponse(
|
|
25793
|
-
if (
|
|
26462
|
+
function versionedMessageFromResponse(version4, response) {
|
|
26463
|
+
if (version4 === 0) {
|
|
25794
26464
|
return new MessageV0({
|
|
25795
26465
|
header: response.header,
|
|
25796
26466
|
staticAccountKeys: response.accountKeys.map((accountKey) => new PublicKey6(accountKey)),
|
|
@@ -27734,14 +28404,14 @@ Message: ${transactionMessage}.
|
|
|
27734
28404
|
transactions: result.transactions.map(({
|
|
27735
28405
|
transaction,
|
|
27736
28406
|
meta,
|
|
27737
|
-
version:
|
|
28407
|
+
version: version4
|
|
27738
28408
|
}) => ({
|
|
27739
28409
|
meta,
|
|
27740
28410
|
transaction: {
|
|
27741
28411
|
...transaction,
|
|
27742
|
-
message: versionedMessageFromResponse(
|
|
28412
|
+
message: versionedMessageFromResponse(version4, transaction.message)
|
|
27743
28413
|
},
|
|
27744
|
-
version:
|
|
28414
|
+
version: version4
|
|
27745
28415
|
}))
|
|
27746
28416
|
} : null;
|
|
27747
28417
|
}
|
|
@@ -31216,20 +31886,20 @@ var require_file_uri_to_path = __commonJS({
|
|
|
31216
31886
|
var rest = decodeURI(uri.substring(7));
|
|
31217
31887
|
var firstSlash = rest.indexOf("/");
|
|
31218
31888
|
var host = rest.substring(0, firstSlash);
|
|
31219
|
-
var
|
|
31889
|
+
var path6 = rest.substring(firstSlash + 1);
|
|
31220
31890
|
if ("localhost" == host) host = "";
|
|
31221
31891
|
if (host) {
|
|
31222
31892
|
host = sep + sep + host;
|
|
31223
31893
|
}
|
|
31224
|
-
|
|
31894
|
+
path6 = path6.replace(/^(.+)\|/, "$1:");
|
|
31225
31895
|
if (sep == "\\") {
|
|
31226
|
-
|
|
31896
|
+
path6 = path6.replace(/\//g, "\\");
|
|
31227
31897
|
}
|
|
31228
|
-
if (/^.+\:/.test(
|
|
31898
|
+
if (/^.+\:/.test(path6)) {
|
|
31229
31899
|
} else {
|
|
31230
|
-
|
|
31900
|
+
path6 = sep + path6;
|
|
31231
31901
|
}
|
|
31232
|
-
return host +
|
|
31902
|
+
return host + path6;
|
|
31233
31903
|
}
|
|
31234
31904
|
}
|
|
31235
31905
|
});
|
|
@@ -31237,19 +31907,19 @@ var require_file_uri_to_path = __commonJS({
|
|
|
31237
31907
|
// node_modules/bindings/bindings.js
|
|
31238
31908
|
var require_bindings = __commonJS({
|
|
31239
31909
|
"node_modules/bindings/bindings.js"(exports, module) {
|
|
31240
|
-
var
|
|
31241
|
-
var
|
|
31910
|
+
var fs6 = __require("fs");
|
|
31911
|
+
var path6 = __require("path");
|
|
31242
31912
|
var fileURLToPath2 = require_file_uri_to_path();
|
|
31243
|
-
var join =
|
|
31244
|
-
var dirname =
|
|
31245
|
-
var exists =
|
|
31913
|
+
var join = path6.join;
|
|
31914
|
+
var dirname = path6.dirname;
|
|
31915
|
+
var exists = fs6.accessSync && function(path7) {
|
|
31246
31916
|
try {
|
|
31247
|
-
|
|
31917
|
+
fs6.accessSync(path7);
|
|
31248
31918
|
} catch (e) {
|
|
31249
31919
|
return false;
|
|
31250
31920
|
}
|
|
31251
31921
|
return true;
|
|
31252
|
-
} ||
|
|
31922
|
+
} || fs6.existsSync || path6.existsSync;
|
|
31253
31923
|
var defaults = {
|
|
31254
31924
|
arrow: process.env.NODE_BINDINGS_ARROW || " \u2192 ",
|
|
31255
31925
|
compiled: process.env.NODE_BINDINGS_COMPILED_DIR || "compiled",
|
|
@@ -31294,7 +31964,7 @@ var require_bindings = __commonJS({
|
|
|
31294
31964
|
if (!opts.module_root) {
|
|
31295
31965
|
opts.module_root = exports.getRoot(exports.getFileName());
|
|
31296
31966
|
}
|
|
31297
|
-
if (
|
|
31967
|
+
if (path6.extname(opts.bindings) != ".node") {
|
|
31298
31968
|
opts.bindings += ".node";
|
|
31299
31969
|
}
|
|
31300
31970
|
var requireFunc = typeof __webpack_require__ === "function" ? __non_webpack_require__ : __require;
|
|
@@ -31675,20 +32345,51 @@ function chainFamily(chainId) {
|
|
|
31675
32345
|
|
|
31676
32346
|
// scripts/src/lib/keys.mjs
|
|
31677
32347
|
import fs from "node:fs";
|
|
32348
|
+
import path from "node:path";
|
|
31678
32349
|
import { execFileSync } from "node:child_process";
|
|
31679
|
-
var
|
|
31680
|
-
|
|
31681
|
-
|
|
31682
|
-
|
|
32350
|
+
var ENV_FILE_RE = /^\.env(\..+)?$/;
|
|
32351
|
+
var PUBLIC_ENV_RE = /^\.env\.(example|sample|template)$/;
|
|
32352
|
+
function insideGitWorkTree(dir, whatFor) {
|
|
32353
|
+
try {
|
|
32354
|
+
return execFileSync("git", ["rev-parse", "--is-inside-work-tree"], {
|
|
32355
|
+
cwd: dir,
|
|
32356
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
32357
|
+
encoding: "utf8"
|
|
32358
|
+
}).trim() === "true";
|
|
32359
|
+
} catch (err) {
|
|
32360
|
+
const stderr = String(err?.stderr || "");
|
|
32361
|
+
if (/not a git repository|does not appear to be a git repository/i.test(stderr)) return false;
|
|
31683
32362
|
throw new SkillError(
|
|
31684
|
-
"
|
|
31685
|
-
|
|
32363
|
+
"TRACKED_DOTENV_UNVERIFIABLE",
|
|
32364
|
+
`git could not be consulted (${err?.code || "unknown error"}), so it cannot be proved that ${whatFor} is untracked. Refusing rather than assuming it is safe.`
|
|
31686
32365
|
);
|
|
31687
32366
|
}
|
|
31688
|
-
return String(v).trim();
|
|
31689
32367
|
}
|
|
31690
|
-
|
|
31691
|
-
|
|
32368
|
+
function assertNotTrackedByGit(file) {
|
|
32369
|
+
const dir = path.dirname(path.resolve(file));
|
|
32370
|
+
const base = path.basename(file);
|
|
32371
|
+
if (!insideGitWorkTree(dir, "this key file")) return { checked: true, tracked: false };
|
|
32372
|
+
let out;
|
|
32373
|
+
try {
|
|
32374
|
+
out = execFileSync("git", ["ls-files", "-z", "--", base], {
|
|
32375
|
+
cwd: dir,
|
|
32376
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
32377
|
+
encoding: "utf8"
|
|
32378
|
+
});
|
|
32379
|
+
} catch {
|
|
32380
|
+
throw new SkillError(
|
|
32381
|
+
"TRACKED_DOTENV_UNVERIFIABLE",
|
|
32382
|
+
"git could not report whether this key file is tracked. Refusing to use it."
|
|
32383
|
+
);
|
|
32384
|
+
}
|
|
32385
|
+
if (out.split("\0").filter(Boolean).length) {
|
|
32386
|
+
throw new SkillError(
|
|
32387
|
+
"TRACKED_KEYFILE",
|
|
32388
|
+
`${base} is tracked by git. A committed key is one push from being public \u2014 untrack it (git rm --cached ${base}) and gitignore it before using it to sign.`
|
|
32389
|
+
);
|
|
32390
|
+
}
|
|
32391
|
+
return { checked: true, tracked: false };
|
|
32392
|
+
}
|
|
31692
32393
|
function assertNoTrackedDotEnv(cwd = process.cwd()) {
|
|
31693
32394
|
let candidates = [];
|
|
31694
32395
|
try {
|
|
@@ -31740,6 +32441,435 @@ function assertNoTrackedDotEnv(cwd = process.cwd()) {
|
|
|
31740
32441
|
return { checked: true, tracked: false, candidates };
|
|
31741
32442
|
}
|
|
31742
32443
|
|
|
32444
|
+
// scripts/src/lib/key-source.mjs
|
|
32445
|
+
import fs2 from "node:fs";
|
|
32446
|
+
import path2 from "node:path";
|
|
32447
|
+
import os from "node:os";
|
|
32448
|
+
import crypto2 from "node:crypto";
|
|
32449
|
+
|
|
32450
|
+
// node_modules/viem/_esm/index.js
|
|
32451
|
+
init_keccak256();
|
|
32452
|
+
|
|
32453
|
+
// scripts/src/lib/key-source.mjs
|
|
32454
|
+
var EVM_KEY_ENV = "ROZO_CHECKOUT_EVM_KEY";
|
|
32455
|
+
var SOL_KEY_ENV = "ROZO_CHECKOUT_SOL_KEY";
|
|
32456
|
+
var EVM_KEYSTORE_ENV = "ROZO_CHECKOUT_EVM_KEYSTORE";
|
|
32457
|
+
var KEYSTORE_PASSPHRASE_ENV = "ROZO_CHECKOUT_KEYSTORE_PASSPHRASE";
|
|
32458
|
+
function defaultSolanaKeypairPath() {
|
|
32459
|
+
return path2.join(os.homedir(), ".config", "solana", "id.json");
|
|
32460
|
+
}
|
|
32461
|
+
function assertKeyfileSafe(file) {
|
|
32462
|
+
let stat;
|
|
32463
|
+
try {
|
|
32464
|
+
stat = fs2.statSync(file);
|
|
32465
|
+
} catch (err) {
|
|
32466
|
+
throw new SkillError(
|
|
32467
|
+
"KEYFILE_UNREADABLE",
|
|
32468
|
+
`Cannot read key file (${err.code || "unknown error"}). Check the path.`
|
|
32469
|
+
);
|
|
32470
|
+
}
|
|
32471
|
+
if (!stat.isFile()) {
|
|
32472
|
+
throw new SkillError("KEYFILE_UNREADABLE", "That key file path is not a regular file.");
|
|
32473
|
+
}
|
|
32474
|
+
if (process.platform !== "win32" && stat.mode & 63) {
|
|
32475
|
+
const mode = (stat.mode & 511).toString(8).padStart(3, "0");
|
|
32476
|
+
throw new SkillError(
|
|
32477
|
+
"KEYFILE_PERMISSIONS",
|
|
32478
|
+
`That key file is readable by other users (mode ${mode}). Run: chmod 600 ${file}`
|
|
32479
|
+
);
|
|
32480
|
+
}
|
|
32481
|
+
assertNotTrackedByGit(file);
|
|
32482
|
+
return true;
|
|
32483
|
+
}
|
|
32484
|
+
function parseSolanaKeypairJson(text) {
|
|
32485
|
+
let arr;
|
|
32486
|
+
try {
|
|
32487
|
+
arr = JSON.parse(String(text));
|
|
32488
|
+
} catch {
|
|
32489
|
+
throw new SkillError(
|
|
32490
|
+
"BAD_KEYPAIR_FILE",
|
|
32491
|
+
"That file is not a Solana keypair: expected a JSON array of bytes."
|
|
32492
|
+
);
|
|
32493
|
+
}
|
|
32494
|
+
if (!Array.isArray(arr)) {
|
|
32495
|
+
throw new SkillError("BAD_KEYPAIR_FILE", "A Solana keypair file must contain a JSON array.");
|
|
32496
|
+
}
|
|
32497
|
+
if (arr.length !== 64 && arr.length !== 32) {
|
|
32498
|
+
throw new SkillError(
|
|
32499
|
+
"BAD_KEYPAIR_FILE",
|
|
32500
|
+
`A Solana keypair must be 64 bytes (or a 32-byte seed); this file has ${arr.length}.`
|
|
32501
|
+
);
|
|
32502
|
+
}
|
|
32503
|
+
for (const b of arr) {
|
|
32504
|
+
if (!Number.isInteger(b) || b < 0 || b > 255) {
|
|
32505
|
+
throw new SkillError("BAD_KEYPAIR_FILE", "A Solana keypair must contain byte values 0-255.");
|
|
32506
|
+
}
|
|
32507
|
+
}
|
|
32508
|
+
return Uint8Array.from(arr);
|
|
32509
|
+
}
|
|
32510
|
+
function normalizeEvmPrivateKey(raw) {
|
|
32511
|
+
const s = String(raw ?? "").trim();
|
|
32512
|
+
if (!s) {
|
|
32513
|
+
throw new SkillError("MISSING_KEY", "No EVM private key supplied.");
|
|
32514
|
+
}
|
|
32515
|
+
const body = /^0[xX]/.test(s) ? s.slice(2) : s;
|
|
32516
|
+
if (!/^[0-9a-fA-F]{64}$/.test(body)) {
|
|
32517
|
+
throw new SkillError(
|
|
32518
|
+
"BAD_KEY_FORMAT",
|
|
32519
|
+
`An EVM private key must be 64 hex characters, with or without a 0x prefix (got ${body.length} characters after any prefix). Value withheld.`
|
|
32520
|
+
);
|
|
32521
|
+
}
|
|
32522
|
+
return `0x${body.toLowerCase()}`;
|
|
32523
|
+
}
|
|
32524
|
+
function decodeSolanaEnvKey(raw) {
|
|
32525
|
+
const s = String(raw ?? "").trim();
|
|
32526
|
+
if (!s) throw new SkillError("MISSING_KEY", `${SOL_KEY_ENV} is empty.`);
|
|
32527
|
+
if (s.startsWith("[")) return parseSolanaKeypairJson(s);
|
|
32528
|
+
const bytes = base58Decode(s);
|
|
32529
|
+
if (bytes.length !== 64 && bytes.length !== 32) {
|
|
32530
|
+
throw new SkillError(
|
|
32531
|
+
"BAD_KEY_FORMAT",
|
|
32532
|
+
`${SOL_KEY_ENV} must be a base58 secret key or a JSON byte array.`
|
|
32533
|
+
);
|
|
32534
|
+
}
|
|
32535
|
+
return bytes;
|
|
32536
|
+
}
|
|
32537
|
+
var B58 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
32538
|
+
function base58Decode(str) {
|
|
32539
|
+
let num = 0n;
|
|
32540
|
+
for (const ch of str) {
|
|
32541
|
+
const idx = B58.indexOf(ch);
|
|
32542
|
+
if (idx < 0) throw new SkillError("BAD_KEY_FORMAT", "Not valid base58.");
|
|
32543
|
+
num = num * 58n + BigInt(idx);
|
|
32544
|
+
}
|
|
32545
|
+
const bytes = [];
|
|
32546
|
+
while (num > 0n) {
|
|
32547
|
+
bytes.unshift(Number(num % 256n));
|
|
32548
|
+
num /= 256n;
|
|
32549
|
+
}
|
|
32550
|
+
for (const ch of str) {
|
|
32551
|
+
if (ch === "1") bytes.unshift(0);
|
|
32552
|
+
else break;
|
|
32553
|
+
}
|
|
32554
|
+
return Uint8Array.from(bytes);
|
|
32555
|
+
}
|
|
32556
|
+
function decryptKeystoreV3(keystore, passphrase) {
|
|
32557
|
+
const ks = typeof keystore === "string" ? safeParseJson(keystore) : keystore;
|
|
32558
|
+
if (!ks || typeof ks !== "object" || !ks.crypto) {
|
|
32559
|
+
throw new SkillError(
|
|
32560
|
+
"BAD_KEYSTORE",
|
|
32561
|
+
'That file is not a V3 keystore (no "crypto" section). Export an encrypted JSON keystore from your wallet, or use a raw key in the environment.'
|
|
32562
|
+
);
|
|
32563
|
+
}
|
|
32564
|
+
if (ks.version !== void 0 && Number(ks.version) !== 3) {
|
|
32565
|
+
throw new SkillError("BAD_KEYSTORE", `Unsupported keystore version ${ks.version}; expected 3.`);
|
|
32566
|
+
}
|
|
32567
|
+
const c = ks.crypto;
|
|
32568
|
+
const kdfparams = c.kdfparams || {};
|
|
32569
|
+
const pass = Buffer.from(String(passphrase ?? ""), "utf8");
|
|
32570
|
+
let derived;
|
|
32571
|
+
if (c.kdf === "scrypt") {
|
|
32572
|
+
const { n, r, p, dklen, salt } = kdfparams;
|
|
32573
|
+
if (!n || !r || !p || !dklen || !salt) {
|
|
32574
|
+
throw new SkillError("BAD_KEYSTORE", "The keystore scrypt parameters are incomplete.");
|
|
32575
|
+
}
|
|
32576
|
+
derived = crypto2.scryptSync(pass, Buffer.from(salt, "hex"), dklen, {
|
|
32577
|
+
N: n,
|
|
32578
|
+
r,
|
|
32579
|
+
p,
|
|
32580
|
+
// geth's default N=262144 needs roughly 256 MB; the Node default cap is
|
|
32581
|
+
// far lower, so raise it with headroom rather than failing on a normal file.
|
|
32582
|
+
maxmem: 256 * n * r + 64 * 1024 * 1024
|
|
32583
|
+
});
|
|
32584
|
+
} else if (c.kdf === "pbkdf2") {
|
|
32585
|
+
const { c: iterations, dklen, salt, prf } = kdfparams;
|
|
32586
|
+
if (prf && prf !== "hmac-sha256") {
|
|
32587
|
+
throw new SkillError("BAD_KEYSTORE", `Unsupported keystore PRF "${prf}".`);
|
|
32588
|
+
}
|
|
32589
|
+
if (!iterations || !dklen || !salt) {
|
|
32590
|
+
throw new SkillError("BAD_KEYSTORE", "The keystore pbkdf2 parameters are incomplete.");
|
|
32591
|
+
}
|
|
32592
|
+
derived = crypto2.pbkdf2Sync(pass, Buffer.from(salt, "hex"), iterations, dklen, "sha256");
|
|
32593
|
+
} else {
|
|
32594
|
+
throw new SkillError("BAD_KEYSTORE", `Unsupported keystore KDF "${c.kdf}".`);
|
|
32595
|
+
}
|
|
32596
|
+
const ciphertext = Buffer.from(c.ciphertext, "hex");
|
|
32597
|
+
const mac = keccak256(Buffer.concat([derived.subarray(16, 32), ciphertext])).slice(2);
|
|
32598
|
+
if (!timingSafeEqualHex(mac, String(c.mac || ""))) {
|
|
32599
|
+
throw new SkillError(
|
|
32600
|
+
"KEYSTORE_BAD_PASSPHRASE",
|
|
32601
|
+
"Wrong passphrase for that keystore (the MAC did not verify)."
|
|
32602
|
+
);
|
|
32603
|
+
}
|
|
32604
|
+
if (c.cipher !== "aes-128-ctr") {
|
|
32605
|
+
throw new SkillError("BAD_KEYSTORE", `Unsupported keystore cipher "${c.cipher}".`);
|
|
32606
|
+
}
|
|
32607
|
+
const decipher = crypto2.createDecipheriv(
|
|
32608
|
+
"aes-128-ctr",
|
|
32609
|
+
derived.subarray(0, 16),
|
|
32610
|
+
Buffer.from(c.cipherparams.iv, "hex")
|
|
32611
|
+
);
|
|
32612
|
+
const secret = Buffer.concat([decipher.update(ciphertext), decipher.final()]);
|
|
32613
|
+
if (secret.length !== 32) {
|
|
32614
|
+
throw new SkillError("BAD_KEYSTORE", "The decrypted key is not 32 bytes.");
|
|
32615
|
+
}
|
|
32616
|
+
return `0x${secret.toString("hex")}`;
|
|
32617
|
+
}
|
|
32618
|
+
function safeParseJson(text) {
|
|
32619
|
+
try {
|
|
32620
|
+
return JSON.parse(text);
|
|
32621
|
+
} catch {
|
|
32622
|
+
throw new SkillError("BAD_KEYSTORE", "That keystore file is not valid JSON.");
|
|
32623
|
+
}
|
|
32624
|
+
}
|
|
32625
|
+
function timingSafeEqualHex(a, b) {
|
|
32626
|
+
const ab = Buffer.from(String(a).toLowerCase(), "hex");
|
|
32627
|
+
const bb = Buffer.from(String(b).toLowerCase(), "hex");
|
|
32628
|
+
if (ab.length === 0 || ab.length !== bb.length) return false;
|
|
32629
|
+
return crypto2.timingSafeEqual(ab, bb);
|
|
32630
|
+
}
|
|
32631
|
+
function looksLikeKeystore(text) {
|
|
32632
|
+
const t = String(text).trimStart();
|
|
32633
|
+
if (!t.startsWith("{")) return false;
|
|
32634
|
+
try {
|
|
32635
|
+
const o = JSON.parse(t);
|
|
32636
|
+
return Boolean(o && typeof o === "object" && o.crypto);
|
|
32637
|
+
} catch {
|
|
32638
|
+
return false;
|
|
32639
|
+
}
|
|
32640
|
+
}
|
|
32641
|
+
function planKeySource({ family, keyfile, env = process.env }) {
|
|
32642
|
+
if (keyfile) {
|
|
32643
|
+
const resolved = expandHome(keyfile);
|
|
32644
|
+
let text;
|
|
32645
|
+
try {
|
|
32646
|
+
text = fs2.readFileSync(resolved, "utf8");
|
|
32647
|
+
} catch (err) {
|
|
32648
|
+
throw new SkillError(
|
|
32649
|
+
"KEYFILE_UNREADABLE",
|
|
32650
|
+
`Cannot read ${displayPath(resolved)} (${err.code || "unknown error"}).`
|
|
32651
|
+
);
|
|
32652
|
+
}
|
|
32653
|
+
const kind = looksLikeKeystore(text) ? "keystore" : "keypair-file";
|
|
32654
|
+
if (kind === "keypair-file" && family === "evm") {
|
|
32655
|
+
throw new SkillError(
|
|
32656
|
+
"BAD_KEYSTORE",
|
|
32657
|
+
"That file is not a V3 keystore. For EVM, --keyfile expects an encrypted JSON keystore."
|
|
32658
|
+
);
|
|
32659
|
+
}
|
|
32660
|
+
if (kind === "keystore" && family === "solana") {
|
|
32661
|
+
throw new SkillError(
|
|
32662
|
+
"BAD_KEYPAIR_FILE",
|
|
32663
|
+
"That looks like an EVM keystore. For Solana, --keyfile expects a solana-keygen keypair file (a JSON array of bytes)."
|
|
32664
|
+
);
|
|
32665
|
+
}
|
|
32666
|
+
return { kind, path: resolved, label: displayPath(resolved) };
|
|
32667
|
+
}
|
|
32668
|
+
if (family === "solana") {
|
|
32669
|
+
const standard = defaultSolanaKeypairPath();
|
|
32670
|
+
if (fs2.existsSync(standard)) {
|
|
32671
|
+
return { kind: "keypair-file", path: standard, label: displayPath(standard) };
|
|
32672
|
+
}
|
|
32673
|
+
if (env[SOL_KEY_ENV]) return { kind: "env", label: SOL_KEY_ENV };
|
|
32674
|
+
throw new SkillError(
|
|
32675
|
+
"NO_KEY_SOURCE",
|
|
32676
|
+
`No signing key found. Either create one with solana-keygen (writes ${displayPath(standard)}), pass --keyfile <path>, or set ${SOL_KEY_ENV}.`
|
|
32677
|
+
);
|
|
32678
|
+
}
|
|
32679
|
+
if (family === "evm") {
|
|
32680
|
+
const fromEnv = env[EVM_KEYSTORE_ENV];
|
|
32681
|
+
if (fromEnv) {
|
|
32682
|
+
const resolved = expandHome(fromEnv);
|
|
32683
|
+
return { kind: "keystore", path: resolved, label: displayPath(resolved) };
|
|
32684
|
+
}
|
|
32685
|
+
if (env[EVM_KEY_ENV]) return { kind: "env", label: EVM_KEY_ENV };
|
|
32686
|
+
throw new SkillError(
|
|
32687
|
+
"NO_KEY_SOURCE",
|
|
32688
|
+
`No signing key found. Either point ${EVM_KEYSTORE_ENV} at an encrypted JSON keystore, pass --keyfile <path>, or set ${EVM_KEY_ENV}.`
|
|
32689
|
+
);
|
|
32690
|
+
}
|
|
32691
|
+
throw new SkillError("NO_KEY_SOURCE", `No key source for family "${family}".`);
|
|
32692
|
+
}
|
|
32693
|
+
async function loadKeySource(plan, { family, env = process.env, askPassphrase } = {}) {
|
|
32694
|
+
if (plan.kind === "env") {
|
|
32695
|
+
const name = family === "evm" ? EVM_KEY_ENV : SOL_KEY_ENV;
|
|
32696
|
+
const raw = env[name];
|
|
32697
|
+
if (!raw || !String(raw).trim()) {
|
|
32698
|
+
throw new SkillError("MISSING_KEY", `${name} is not set.`);
|
|
32699
|
+
}
|
|
32700
|
+
if (family === "evm") {
|
|
32701
|
+
return { privateKey: normalizeEvmPrivateKey(raw), label: plan.label, kind: plan.kind };
|
|
32702
|
+
}
|
|
32703
|
+
return { secretKey: decodeSolanaEnvKey(raw), label: plan.label, kind: plan.kind };
|
|
32704
|
+
}
|
|
32705
|
+
assertKeyfileSafe(plan.path);
|
|
32706
|
+
const text = fs2.readFileSync(plan.path, "utf8");
|
|
32707
|
+
if (plan.kind === "keypair-file") {
|
|
32708
|
+
return { secretKey: parseSolanaKeypairJson(text), label: plan.label, kind: plan.kind };
|
|
32709
|
+
}
|
|
32710
|
+
let passphrase = env[KEYSTORE_PASSPHRASE_ENV];
|
|
32711
|
+
if (passphrase === void 0 || passphrase === "") {
|
|
32712
|
+
if (!askPassphrase) {
|
|
32713
|
+
throw new SkillError(
|
|
32714
|
+
"KEYSTORE_PASSPHRASE_REQUIRED",
|
|
32715
|
+
`That keystore needs a passphrase. Run this on a terminal to be prompted, or set ${KEYSTORE_PASSPHRASE_ENV} for unattended use.`
|
|
32716
|
+
);
|
|
32717
|
+
}
|
|
32718
|
+
passphrase = await askPassphrase();
|
|
32719
|
+
}
|
|
32720
|
+
const privateKey = decryptKeystoreV3(text, passphrase);
|
|
32721
|
+
return { privateKey, label: plan.label, kind: plan.kind };
|
|
32722
|
+
}
|
|
32723
|
+
function expandHome(p) {
|
|
32724
|
+
const s = String(p);
|
|
32725
|
+
if (s === "~") return os.homedir();
|
|
32726
|
+
if (s.startsWith("~/")) return path2.join(os.homedir(), s.slice(2));
|
|
32727
|
+
return s;
|
|
32728
|
+
}
|
|
32729
|
+
function displayPath(p) {
|
|
32730
|
+
const home = os.homedir();
|
|
32731
|
+
const s = String(p);
|
|
32732
|
+
return s.startsWith(home + path2.sep) ? `~${s.slice(home.length)}` : s;
|
|
32733
|
+
}
|
|
32734
|
+
|
|
32735
|
+
// scripts/src/lib/dotenv.mjs
|
|
32736
|
+
import fs3 from "node:fs";
|
|
32737
|
+
import path3 from "node:path";
|
|
32738
|
+
var ALLOWED_KEYS = [
|
|
32739
|
+
"ROZO_CHECKOUT_EVM_KEY",
|
|
32740
|
+
"ROZO_CHECKOUT_SOL_KEY",
|
|
32741
|
+
"ROZO_CHECKOUT_EVM_KEYSTORE",
|
|
32742
|
+
"ROZO_CHECKOUT_KEYSTORE_PASSPHRASE"
|
|
32743
|
+
];
|
|
32744
|
+
var ALLOWED_PATTERN = /^ROZO_CHECKOUT_RPC_[A-Za-z0-9_]+$/;
|
|
32745
|
+
function isAllowedKey(key) {
|
|
32746
|
+
return ALLOWED_KEYS.includes(key) || ALLOWED_PATTERN.test(key);
|
|
32747
|
+
}
|
|
32748
|
+
function parseDotenv(text) {
|
|
32749
|
+
const vars = {};
|
|
32750
|
+
const lines = String(text).split(/\r?\n/);
|
|
32751
|
+
lines.forEach((rawLine, i) => {
|
|
32752
|
+
const lineNo = i + 1;
|
|
32753
|
+
const line = rawLine.trim();
|
|
32754
|
+
if (!line || line.startsWith("#")) return;
|
|
32755
|
+
const withoutExport = line.startsWith("export ") ? line.slice(7).trim() : line;
|
|
32756
|
+
const eq = withoutExport.indexOf("=");
|
|
32757
|
+
if (eq === -1) {
|
|
32758
|
+
throw new SkillError(
|
|
32759
|
+
"BAD_ENV_FILE",
|
|
32760
|
+
`Malformed .env: line ${lineNo} is not KEY=VALUE. (Content withheld \u2014 it may be a secret.)`
|
|
32761
|
+
);
|
|
32762
|
+
}
|
|
32763
|
+
const key = withoutExport.slice(0, eq).trim();
|
|
32764
|
+
if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(key)) {
|
|
32765
|
+
throw new SkillError(
|
|
32766
|
+
"BAD_ENV_FILE",
|
|
32767
|
+
`Malformed .env: line ${lineNo} has an invalid key name. (Content withheld.)`
|
|
32768
|
+
);
|
|
32769
|
+
}
|
|
32770
|
+
let value = withoutExport.slice(eq + 1).trim();
|
|
32771
|
+
if (value.length >= 2 && (value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'"))) {
|
|
32772
|
+
value = value.slice(1, -1);
|
|
32773
|
+
}
|
|
32774
|
+
vars[key] = value;
|
|
32775
|
+
});
|
|
32776
|
+
return vars;
|
|
32777
|
+
}
|
|
32778
|
+
function filterAllowed(vars) {
|
|
32779
|
+
const out = {};
|
|
32780
|
+
for (const [k, v] of Object.entries(vars)) if (isAllowedKey(k)) out[k] = v;
|
|
32781
|
+
return out;
|
|
32782
|
+
}
|
|
32783
|
+
function resolveEnvFile({ file, cwd = process.cwd() } = {}) {
|
|
32784
|
+
if (file) {
|
|
32785
|
+
const p = path3.resolve(file);
|
|
32786
|
+
if (!fs3.existsSync(p)) {
|
|
32787
|
+
throw new SkillError("ENV_FILE_MISSING", `No such env file: ${file}`);
|
|
32788
|
+
}
|
|
32789
|
+
return p;
|
|
32790
|
+
}
|
|
32791
|
+
const fallback = path3.join(cwd, ".env");
|
|
32792
|
+
return fs3.existsSync(fallback) ? fallback : null;
|
|
32793
|
+
}
|
|
32794
|
+
function applyDotenv({ file, cwd = process.cwd(), env = process.env } = {}) {
|
|
32795
|
+
const target = resolveEnvFile({ file, cwd });
|
|
32796
|
+
if (!target) return null;
|
|
32797
|
+
let stat;
|
|
32798
|
+
try {
|
|
32799
|
+
stat = fs3.statSync(target);
|
|
32800
|
+
} catch (err) {
|
|
32801
|
+
throw new SkillError("ENV_FILE_MISSING", `Cannot read env file (${err.code || "error"}).`);
|
|
32802
|
+
}
|
|
32803
|
+
if (process.platform !== "win32" && stat.mode & 63) {
|
|
32804
|
+
const mode = (stat.mode & 511).toString(8).padStart(3, "0");
|
|
32805
|
+
throw new SkillError(
|
|
32806
|
+
"ENV_FILE_PERMISSIONS",
|
|
32807
|
+
`That .env is readable by other users (mode ${mode}). Run: chmod 600 ${target}`
|
|
32808
|
+
);
|
|
32809
|
+
}
|
|
32810
|
+
assertNotTrackedByGit(target);
|
|
32811
|
+
const parsed = parseDotenv(fs3.readFileSync(target, "utf8"));
|
|
32812
|
+
const allowed = filterAllowed(parsed);
|
|
32813
|
+
const applied = [];
|
|
32814
|
+
for (const [k, v] of Object.entries(allowed)) {
|
|
32815
|
+
const existing = env[k];
|
|
32816
|
+
if (existing !== void 0 && String(existing).trim() !== "") continue;
|
|
32817
|
+
env[k] = v;
|
|
32818
|
+
applied.push(k);
|
|
32819
|
+
}
|
|
32820
|
+
return {
|
|
32821
|
+
path: target,
|
|
32822
|
+
applied,
|
|
32823
|
+
ignored: Object.keys(parsed).length - Object.keys(allowed).length
|
|
32824
|
+
};
|
|
32825
|
+
}
|
|
32826
|
+
|
|
32827
|
+
// scripts/src/lib/passphrase.mjs
|
|
32828
|
+
import readline from "node:readline";
|
|
32829
|
+
function promptPassphrase(prompt = " Keystore passphrase: ") {
|
|
32830
|
+
if (!process.stdin.isTTY) {
|
|
32831
|
+
throw new SkillError(
|
|
32832
|
+
"KEYSTORE_PASSPHRASE_REQUIRED",
|
|
32833
|
+
"A keystore passphrase is needed but this is not a terminal. Set ROZO_CHECKOUT_KEYSTORE_PASSPHRASE for unattended use."
|
|
32834
|
+
);
|
|
32835
|
+
}
|
|
32836
|
+
return new Promise((resolve, reject) => {
|
|
32837
|
+
const rl = readline.createInterface({
|
|
32838
|
+
input: process.stdin,
|
|
32839
|
+
output: process.stdout,
|
|
32840
|
+
terminal: true
|
|
32841
|
+
});
|
|
32842
|
+
let muted = false;
|
|
32843
|
+
const originalWrite = rl._writeToOutput?.bind(rl);
|
|
32844
|
+
rl._writeToOutput = (chunk) => {
|
|
32845
|
+
if (!muted) {
|
|
32846
|
+
if (originalWrite) originalWrite(chunk);
|
|
32847
|
+
else process.stdout.write(chunk);
|
|
32848
|
+
return;
|
|
32849
|
+
}
|
|
32850
|
+
if (chunk.includes(prompt)) process.stdout.write(prompt);
|
|
32851
|
+
};
|
|
32852
|
+
rl.question(prompt, (answer) => {
|
|
32853
|
+
rl._writeToOutput = originalWrite;
|
|
32854
|
+
rl.close();
|
|
32855
|
+
process.stdout.write("\n");
|
|
32856
|
+
const value = String(answer ?? "");
|
|
32857
|
+
if (!value) {
|
|
32858
|
+
reject(new SkillError("KEYSTORE_PASSPHRASE_REQUIRED", "No passphrase entered."));
|
|
32859
|
+
return;
|
|
32860
|
+
}
|
|
32861
|
+
resolve(value);
|
|
32862
|
+
});
|
|
32863
|
+
muted = true;
|
|
32864
|
+
rl.on("SIGINT", () => {
|
|
32865
|
+
rl._writeToOutput = originalWrite;
|
|
32866
|
+
rl.close();
|
|
32867
|
+
process.stdout.write("\n");
|
|
32868
|
+
reject(new SkillError("CANCELLED", "Cancelled."));
|
|
32869
|
+
});
|
|
32870
|
+
});
|
|
32871
|
+
}
|
|
32872
|
+
|
|
31743
32873
|
// scripts/src/lib/http.mjs
|
|
31744
32874
|
var DEFAULT_TIMEOUT_MS = 2e4;
|
|
31745
32875
|
var USER_AGENT = "rozo-checkout-skill/1.0";
|
|
@@ -32132,9 +33262,9 @@ function checkExpiry({
|
|
|
32132
33262
|
}
|
|
32133
33263
|
|
|
32134
33264
|
// scripts/src/lib/blacklist.mjs
|
|
32135
|
-
import
|
|
32136
|
-
import
|
|
32137
|
-
import
|
|
33265
|
+
import fs4 from "node:fs";
|
|
33266
|
+
import path4 from "node:path";
|
|
33267
|
+
import crypto3 from "node:crypto";
|
|
32138
33268
|
import { fileURLToPath } from "node:url";
|
|
32139
33269
|
var BlacklistError = class extends Error {
|
|
32140
33270
|
constructor(code, message) {
|
|
@@ -32169,7 +33299,7 @@ function parseBlacklist(doc) {
|
|
|
32169
33299
|
}
|
|
32170
33300
|
addresses.push(e.address);
|
|
32171
33301
|
}
|
|
32172
|
-
const digest =
|
|
33302
|
+
const digest = crypto3.createHash("sha256").update(JSON.stringify(addresses), "utf8").digest("hex");
|
|
32173
33303
|
if (typeof provenance.addressesSha256 !== "string" || !provenance.addressesSha256) {
|
|
32174
33304
|
throw new BlacklistError("BLACKLIST_UNAVAILABLE", "Blacklist provenance digest is missing.");
|
|
32175
33305
|
}
|
|
@@ -32192,11 +33322,11 @@ function parseBlacklist(doc) {
|
|
|
32192
33322
|
return { entries, index, provenance, digest };
|
|
32193
33323
|
}
|
|
32194
33324
|
function candidatePaths(moduleUrl) {
|
|
32195
|
-
const here =
|
|
33325
|
+
const here = path4.dirname(fileURLToPath(moduleUrl));
|
|
32196
33326
|
return [
|
|
32197
|
-
|
|
32198
|
-
|
|
32199
|
-
|
|
33327
|
+
path4.join(here, "blacklist.json"),
|
|
33328
|
+
path4.join(here, "..", "src", "lib", "blacklist.json"),
|
|
33329
|
+
path4.join(here, "..", "..", "src", "lib", "blacklist.json")
|
|
32200
33330
|
];
|
|
32201
33331
|
}
|
|
32202
33332
|
var cached = null;
|
|
@@ -32207,7 +33337,7 @@ function loadBlacklist(explicitPath) {
|
|
|
32207
33337
|
for (const p of paths) {
|
|
32208
33338
|
let raw;
|
|
32209
33339
|
try {
|
|
32210
|
-
raw =
|
|
33340
|
+
raw = fs4.readFileSync(p, "utf8");
|
|
32211
33341
|
} catch (err) {
|
|
32212
33342
|
lastErr = err;
|
|
32213
33343
|
continue;
|
|
@@ -32255,24 +33385,24 @@ function assertNotBlacklisted(targets, blacklist) {
|
|
|
32255
33385
|
}
|
|
32256
33386
|
|
|
32257
33387
|
// scripts/src/lib/state.mjs
|
|
32258
|
-
import
|
|
32259
|
-
import
|
|
32260
|
-
import
|
|
32261
|
-
import
|
|
33388
|
+
import fs5 from "node:fs";
|
|
33389
|
+
import path5 from "node:path";
|
|
33390
|
+
import os2 from "node:os";
|
|
33391
|
+
import crypto4 from "node:crypto";
|
|
32262
33392
|
var LOCK_STALE_MS = 6e4;
|
|
32263
33393
|
var LOCK_WAIT_MS = 1e4;
|
|
32264
33394
|
var LOCK_POLL_MS = 25;
|
|
32265
33395
|
function lockPath() {
|
|
32266
|
-
return
|
|
33396
|
+
return path5.join(stateRoot(), ".send.lock");
|
|
32267
33397
|
}
|
|
32268
33398
|
function sleepSync(ms) {
|
|
32269
33399
|
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
|
|
32270
33400
|
}
|
|
32271
33401
|
function tryAcquire(file) {
|
|
32272
33402
|
try {
|
|
32273
|
-
const fd =
|
|
32274
|
-
|
|
32275
|
-
|
|
33403
|
+
const fd = fs5.openSync(file, "wx", 384);
|
|
33404
|
+
fs5.writeFileSync(fd, JSON.stringify({ pid: process.pid, at: (/* @__PURE__ */ new Date()).toISOString() }));
|
|
33405
|
+
fs5.closeSync(fd);
|
|
32276
33406
|
return true;
|
|
32277
33407
|
} catch (err) {
|
|
32278
33408
|
if (err.code !== "EEXIST") throw err;
|
|
@@ -32281,17 +33411,17 @@ function tryAcquire(file) {
|
|
|
32281
33411
|
}
|
|
32282
33412
|
function withLock(fn) {
|
|
32283
33413
|
const file = lockPath();
|
|
32284
|
-
|
|
33414
|
+
fs5.mkdirSync(path5.dirname(file), { recursive: true, mode: 448 });
|
|
32285
33415
|
const deadline = Date.now() + LOCK_WAIT_MS;
|
|
32286
33416
|
for (; ; ) {
|
|
32287
33417
|
if (tryAcquire(file)) break;
|
|
32288
33418
|
try {
|
|
32289
|
-
const age = Date.now() -
|
|
33419
|
+
const age = Date.now() - fs5.statSync(file).mtimeMs;
|
|
32290
33420
|
if (age > LOCK_STALE_MS) {
|
|
32291
|
-
const stolen = `${file}.stale.${
|
|
33421
|
+
const stolen = `${file}.stale.${crypto4.randomBytes(4).toString("hex")}`;
|
|
32292
33422
|
try {
|
|
32293
|
-
|
|
32294
|
-
|
|
33423
|
+
fs5.renameSync(file, stolen);
|
|
33424
|
+
fs5.unlinkSync(stolen);
|
|
32295
33425
|
} catch {
|
|
32296
33426
|
}
|
|
32297
33427
|
continue;
|
|
@@ -32312,38 +33442,38 @@ function withLock(fn) {
|
|
|
32312
33442
|
return fn();
|
|
32313
33443
|
} finally {
|
|
32314
33444
|
try {
|
|
32315
|
-
|
|
33445
|
+
fs5.unlinkSync(file);
|
|
32316
33446
|
} catch {
|
|
32317
33447
|
}
|
|
32318
33448
|
}
|
|
32319
33449
|
}
|
|
32320
33450
|
function stateRoot() {
|
|
32321
|
-
return process.env.ROZO_CHECKOUT_STATE_DIR ||
|
|
33451
|
+
return process.env.ROZO_CHECKOUT_STATE_DIR || path5.join(os2.homedir(), ".rozo-checkout", "state");
|
|
32322
33452
|
}
|
|
32323
33453
|
function statePath(rozoPaymentId) {
|
|
32324
33454
|
if (!/^[A-Za-z0-9-]{8,64}$/.test(String(rozoPaymentId || ""))) {
|
|
32325
33455
|
throw new SkillError("BAD_ROZO_PAYMENT_ID", "Refusing to build a state path from that id.");
|
|
32326
33456
|
}
|
|
32327
|
-
return
|
|
33457
|
+
return path5.join(stateRoot(), `${rozoPaymentId}.json`);
|
|
32328
33458
|
}
|
|
32329
33459
|
function writeAtomic(file, data) {
|
|
32330
|
-
const dir =
|
|
32331
|
-
|
|
32332
|
-
const tmp =
|
|
32333
|
-
const fd =
|
|
33460
|
+
const dir = path5.dirname(file);
|
|
33461
|
+
fs5.mkdirSync(dir, { recursive: true, mode: 448 });
|
|
33462
|
+
const tmp = path5.join(dir, `.${path5.basename(file)}.${crypto4.randomBytes(6).toString("hex")}.tmp`);
|
|
33463
|
+
const fd = fs5.openSync(tmp, "wx", 384);
|
|
32334
33464
|
try {
|
|
32335
|
-
|
|
32336
|
-
|
|
33465
|
+
fs5.writeFileSync(fd, JSON.stringify(data, null, 2) + "\n", "utf8");
|
|
33466
|
+
fs5.fsyncSync(fd);
|
|
32337
33467
|
} finally {
|
|
32338
|
-
|
|
33468
|
+
fs5.closeSync(fd);
|
|
32339
33469
|
}
|
|
32340
|
-
|
|
33470
|
+
fs5.renameSync(tmp, file);
|
|
32341
33471
|
}
|
|
32342
33472
|
function readState(rozoPaymentId) {
|
|
32343
33473
|
const file = statePath(rozoPaymentId);
|
|
32344
33474
|
let raw;
|
|
32345
33475
|
try {
|
|
32346
|
-
raw =
|
|
33476
|
+
raw = fs5.readFileSync(file, "utf8");
|
|
32347
33477
|
} catch (err) {
|
|
32348
33478
|
if (err.code === "ENOENT") return null;
|
|
32349
33479
|
throw new SkillError("STATE_UNREADABLE", `Cannot read local state: ${err.code}`);
|
|
@@ -32368,9 +33498,9 @@ function depositDigest(source) {
|
|
|
32368
33498
|
amountUnit: source?.amountUnit ?? null,
|
|
32369
33499
|
lnInvoice: source?.lnInvoice ?? null
|
|
32370
33500
|
});
|
|
32371
|
-
return
|
|
33501
|
+
return crypto4.createHash("sha256").update(canonical, "utf8").digest("hex");
|
|
32372
33502
|
}
|
|
32373
|
-
function claimSend(rozoPaymentId, intent, {
|
|
33503
|
+
function claimSend(rozoPaymentId, intent, { skipCaps = false } = {}) {
|
|
32374
33504
|
return withLock(() => {
|
|
32375
33505
|
const state = readState(rozoPaymentId);
|
|
32376
33506
|
if (!state) {
|
|
@@ -32386,7 +33516,7 @@ function claimSend(rozoPaymentId, intent, { allowLarge = false, skipCaps = false
|
|
|
32386
33516
|
{ send: state.send }
|
|
32387
33517
|
);
|
|
32388
33518
|
}
|
|
32389
|
-
const caps = skipCaps ? null :
|
|
33519
|
+
const caps = skipCaps ? null : assertPaymentLimit(state.invoiceAmount);
|
|
32390
33520
|
const next = {
|
|
32391
33521
|
...state,
|
|
32392
33522
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -32429,50 +33559,22 @@ function recordSendResult(rozoPaymentId, { status, txHash = null, note = null })
|
|
|
32429
33559
|
return next;
|
|
32430
33560
|
});
|
|
32431
33561
|
}
|
|
32432
|
-
|
|
32433
|
-
|
|
32434
|
-
|
|
32435
|
-
|
|
32436
|
-
files = fs3.readdirSync(dir).filter((f) => f.endsWith(".json"));
|
|
32437
|
-
} catch {
|
|
32438
|
-
return 0;
|
|
32439
|
-
}
|
|
32440
|
-
let total = 0;
|
|
32441
|
-
for (const f of files) {
|
|
32442
|
-
if (excludeId && f === `${excludeId}.json`) continue;
|
|
32443
|
-
try {
|
|
32444
|
-
const s = JSON.parse(fs3.readFileSync(path2.join(dir, f), "utf8"));
|
|
32445
|
-
if (s?.send && ["claimed", "submitted", "confirmed", "ambiguous"].includes(s.send.status)) {
|
|
32446
|
-
const usd = Number(s.invoiceAmount);
|
|
32447
|
-
total += Number.isFinite(usd) ? usd : MAX_TX_USD;
|
|
32448
|
-
}
|
|
32449
|
-
} catch {
|
|
32450
|
-
total += MAX_TX_USD;
|
|
32451
|
-
}
|
|
33562
|
+
var MAX_PAYMENT_USD = 1100;
|
|
33563
|
+
function assertPaymentLimit(invoiceUsd) {
|
|
33564
|
+
if (invoiceUsd === null || invoiceUsd === void 0 || String(invoiceUsd).trim() === "") {
|
|
33565
|
+
throw new SkillError("BAD_INVOICE_AMOUNT", "Cannot evaluate the payment limit without a USD amount.");
|
|
32452
33566
|
}
|
|
32453
|
-
return total;
|
|
32454
|
-
}
|
|
32455
|
-
var MAX_TX_USD = 100;
|
|
32456
|
-
var MAX_SESSION_USD = 200;
|
|
32457
|
-
function assertSpendCapsUnlocked(invoiceUsd, { allowLarge = false, excludeId = null } = {}) {
|
|
32458
33567
|
const usd = Number(invoiceUsd);
|
|
32459
33568
|
if (!Number.isFinite(usd) || usd < 0) {
|
|
32460
|
-
throw new SkillError("BAD_INVOICE_AMOUNT", "Cannot evaluate
|
|
33569
|
+
throw new SkillError("BAD_INVOICE_AMOUNT", "Cannot evaluate the payment limit without a USD amount.");
|
|
32461
33570
|
}
|
|
32462
|
-
if (usd >
|
|
33571
|
+
if (usd > MAX_PAYMENT_USD) {
|
|
32463
33572
|
throw new SkillError(
|
|
32464
33573
|
"CAP_PER_TX",
|
|
32465
|
-
`$${usd}
|
|
32466
|
-
);
|
|
32467
|
-
}
|
|
32468
|
-
const prior = sessionSpendUsd({ excludeId });
|
|
32469
|
-
if (prior + usd > MAX_SESSION_USD) {
|
|
32470
|
-
throw new SkillError(
|
|
32471
|
-
"CAP_SESSION",
|
|
32472
|
-
`This send would bring cumulative spend to $${(prior + usd).toFixed(2)}, past the $${MAX_SESSION_USD} session cap. Clear or archive the state directory to start a new session.`
|
|
33574
|
+
`$${usd} is above the $${MAX_PAYMENT_USD} per-payment limit for automated sending. This limit has no override. Pay this invoice from a wallet you control instead \u2014 that path needs no key and has no limit.`
|
|
32473
33575
|
);
|
|
32474
33576
|
}
|
|
32475
|
-
return {
|
|
33577
|
+
return { usd, limitUsd: MAX_PAYMENT_USD };
|
|
32476
33578
|
}
|
|
32477
33579
|
|
|
32478
33580
|
// scripts/src/lib/presend.mjs
|
|
@@ -34359,59 +35461,18 @@ async function getAssociatedTokenAddress(mint, owner, allowOwnerOffCurve = false
|
|
|
34359
35461
|
// scripts/src/send-sol.mjs
|
|
34360
35462
|
var MEMO_PROGRAM_ID = new import_web36.PublicKey("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr");
|
|
34361
35463
|
var MAINNET_GENESIS = "5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d";
|
|
34362
|
-
function decodeSecretKey(raw) {
|
|
34363
|
-
const s = raw.trim();
|
|
34364
|
-
if (s.startsWith("[")) {
|
|
34365
|
-
let arr;
|
|
34366
|
-
try {
|
|
34367
|
-
arr = JSON.parse(s);
|
|
34368
|
-
} catch {
|
|
34369
|
-
throw new SkillError("BAD_KEY_FORMAT", `${SOL_KEY_ENV} looks like a JSON array but is malformed.`);
|
|
34370
|
-
}
|
|
34371
|
-
if (!Array.isArray(arr) || arr.length !== 64 && arr.length !== 32) {
|
|
34372
|
-
throw new SkillError("BAD_KEY_FORMAT", `${SOL_KEY_ENV} array must be 32 or 64 bytes.`);
|
|
34373
|
-
}
|
|
34374
|
-
return Uint8Array.from(arr);
|
|
34375
|
-
}
|
|
34376
|
-
try {
|
|
34377
|
-
const bytes = base58Decode(s);
|
|
34378
|
-
if (bytes.length !== 64 && bytes.length !== 32) {
|
|
34379
|
-
throw new Error("unexpected length");
|
|
34380
|
-
}
|
|
34381
|
-
return bytes;
|
|
34382
|
-
} catch {
|
|
34383
|
-
throw new SkillError(
|
|
34384
|
-
"BAD_KEY_FORMAT",
|
|
34385
|
-
`${SOL_KEY_ENV} must be a base58 secret key or a JSON byte array.`
|
|
34386
|
-
);
|
|
34387
|
-
}
|
|
34388
|
-
}
|
|
34389
35464
|
var B58_ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
34390
|
-
function base58Decode(str) {
|
|
34391
|
-
let num = 0n;
|
|
34392
|
-
for (const ch of str) {
|
|
34393
|
-
const idx = B58_ALPHABET.indexOf(ch);
|
|
34394
|
-
if (idx < 0) throw new Error("bad base58");
|
|
34395
|
-
num = num * 58n + BigInt(idx);
|
|
34396
|
-
}
|
|
34397
|
-
const bytes = [];
|
|
34398
|
-
while (num > 0n) {
|
|
34399
|
-
bytes.unshift(Number(num % 256n));
|
|
34400
|
-
num /= 256n;
|
|
34401
|
-
}
|
|
34402
|
-
for (const ch of str) {
|
|
34403
|
-
if (ch === "1") bytes.unshift(0);
|
|
34404
|
-
else break;
|
|
34405
|
-
}
|
|
34406
|
-
return Uint8Array.from(bytes);
|
|
34407
|
-
}
|
|
34408
35465
|
async function main(argv) {
|
|
34409
35466
|
const args = parseArgs(argv);
|
|
34410
35467
|
const rozoPaymentId = assertRozoPaymentId(args["rozo-payment-id"] || args._[0]);
|
|
34411
35468
|
assertNoTrackedDotEnv();
|
|
34412
|
-
const
|
|
35469
|
+
const dotenv = applyDotenv({ file: args["env-file"] });
|
|
35470
|
+
const plan = planKeySource({ family: "solana", keyfile: args.keyfile });
|
|
35471
|
+
const loaded = await loadKeySource(plan, { family: "solana", askPassphrase: promptPassphrase });
|
|
35472
|
+
const secret = loaded.secretKey;
|
|
34413
35473
|
const keypair = secret.length === 64 ? import_web36.Keypair.fromSecretKey(secret) : import_web36.Keypair.fromSeed(secret);
|
|
34414
35474
|
const sender = keypair.publicKey.toBase58();
|
|
35475
|
+
const keySource = loaded.label;
|
|
34415
35476
|
const dryRun = Boolean(args["dry-run"]);
|
|
34416
35477
|
const { source, state, expiry, amountAtomic, payment } = await preflight({
|
|
34417
35478
|
rozoPaymentId,
|
|
@@ -34511,6 +35572,9 @@ async function main(argv) {
|
|
|
34511
35572
|
withMemo: Boolean(source.receiverMemo)
|
|
34512
35573
|
},
|
|
34513
35574
|
confirmedAt: state.confirmation?.confirmedAt ?? null,
|
|
35575
|
+
keySource,
|
|
35576
|
+
// Key NAMES only — a value from a .env is never echoed.
|
|
35577
|
+
envFile: dotenv ? { path: dotenv.path, applied: dotenv.applied } : null,
|
|
34514
35578
|
minutesOfSlack: Math.floor(expiry.msOfSlack / 6e4),
|
|
34515
35579
|
note: "Nothing was signed or broadcast. Add --send (without --dry-run) to execute."
|
|
34516
35580
|
});
|
|
@@ -34557,8 +35621,7 @@ async function main(argv) {
|
|
|
34557
35621
|
amountAtomic: amountAtomic.toString(),
|
|
34558
35622
|
memo: source.receiverMemo ?? null,
|
|
34559
35623
|
expectedTxHash: signature
|
|
34560
|
-
}
|
|
34561
|
-
{ allowLarge: Boolean(args["yes-large"]) }
|
|
35624
|
+
}
|
|
34562
35625
|
);
|
|
34563
35626
|
let sent = null;
|
|
34564
35627
|
try {
|
|
@@ -34667,7 +35730,8 @@ async function main(argv) {
|
|
|
34667
35730
|
amount: source.amount,
|
|
34668
35731
|
toMasked: maskAddress(source.receiverAddress),
|
|
34669
35732
|
fromMasked: maskAddress(sender),
|
|
34670
|
-
withMemo: Boolean(source.receiverMemo)
|
|
35733
|
+
withMemo: Boolean(source.receiverMemo),
|
|
35734
|
+
keySource
|
|
34671
35735
|
},
|
|
34672
35736
|
nextStep: `status.js --rozo-payment-id ${rozoPaymentId} --watch`,
|
|
34673
35737
|
guidance: "On-chain confirmation is not settlement. Poll status.js until the state is `settled`."
|