@query-farm/vgi 0.25.3 → 0.25.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/arrow/repr.test-d.d.ts +4 -4
- package/dist/index.js +72 -119
- package/dist/index.js.map +6 -6
- package/dist/serve-entry.js +72 -119
- package/dist/serve-entry.js.map +6 -6
- package/dist/worker-cf-entry.js +72 -119
- package/dist/worker-cf-entry.js.map +6 -6
- package/package.json +5 -5
package/dist/serve-entry.js
CHANGED
|
@@ -3546,45 +3546,48 @@ class NoCatalogError extends VgiError {
|
|
|
3546
3546
|
function isBytes(a) {
|
|
3547
3547
|
return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array" && "BYTES_PER_ELEMENT" in a && a.BYTES_PER_ELEMENT === 1;
|
|
3548
3548
|
}
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3549
|
+
var atitle = (title) => title ? `"${title}" ` : "";
|
|
3550
|
+
function abool(value, title = "") {
|
|
3551
|
+
if (typeof value !== "boolean")
|
|
3552
|
+
throw new TypeError(atitle(title) + "expected boolean, got type=" + typeof value);
|
|
3553
|
+
return value;
|
|
3552
3554
|
}
|
|
3553
|
-
function anumber(n) {
|
|
3555
|
+
function anumber(n, title = "") {
|
|
3554
3556
|
if (typeof n !== "number")
|
|
3555
|
-
throw new TypeError("number
|
|
3557
|
+
throw new TypeError(atitle(title) + "expected number, got " + typeof n);
|
|
3556
3558
|
if (!Number.isSafeInteger(n) || n < 0)
|
|
3557
|
-
throw new RangeError("
|
|
3559
|
+
throw new RangeError(atitle(title) + "expected integer >= 0, got " + n);
|
|
3560
|
+
return n;
|
|
3558
3561
|
}
|
|
3559
3562
|
function abytes(value, length, title = "") {
|
|
3563
|
+
if (isBytes(value) && (length === undefined || value.length === length))
|
|
3564
|
+
return value;
|
|
3565
|
+
if (length !== undefined)
|
|
3566
|
+
anumber(length, "length");
|
|
3560
3567
|
const bytes = isBytes(value);
|
|
3561
|
-
const
|
|
3562
|
-
const
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
throw new
|
|
3571
|
-
|
|
3572
|
-
return value;
|
|
3573
|
-
}
|
|
3568
|
+
const ofLen = length !== undefined ? ` of length ${length}` : "";
|
|
3569
|
+
const got = bytes ? `length=${value.length}` : `type=${typeof value}`;
|
|
3570
|
+
const message = atitle(title) + "expected Uint8Array" + ofLen + ", got " + got;
|
|
3571
|
+
if (!bytes)
|
|
3572
|
+
throw new TypeError(message);
|
|
3573
|
+
throw new RangeError(message);
|
|
3574
|
+
}
|
|
3575
|
+
var aobject = (value, label) => {
|
|
3576
|
+
if (value === null || typeof value !== "object" || Array.isArray(value))
|
|
3577
|
+
throw new TypeError(label === "object" ? "expected valid options object" : `"${label}" expected object, got type=${typeof value}`);
|
|
3578
|
+
};
|
|
3574
3579
|
function aexists(instance, checkFinished = true) {
|
|
3575
3580
|
if (instance.destroyed)
|
|
3576
|
-
throw new Error("
|
|
3581
|
+
throw new Error("hash was destroyed");
|
|
3577
3582
|
if (checkFinished && instance.finished)
|
|
3578
|
-
throw new Error("
|
|
3583
|
+
throw new Error("digest() was already called");
|
|
3579
3584
|
}
|
|
3580
|
-
function aoutput(out, instance
|
|
3585
|
+
function aoutput(out, instance) {
|
|
3581
3586
|
abytes(out, undefined, "output");
|
|
3582
3587
|
const min = instance.outputLen;
|
|
3583
|
-
if (out.length
|
|
3584
|
-
throw new RangeError("
|
|
3588
|
+
if (!(out.length >= min)) {
|
|
3589
|
+
throw new RangeError('"output" expected length >= ' + min);
|
|
3585
3590
|
}
|
|
3586
|
-
if (onlyAligned && !isAligned32(out))
|
|
3587
|
-
throw new Error("invalid output, must be aligned");
|
|
3588
3591
|
}
|
|
3589
3592
|
function u32(arr) {
|
|
3590
3593
|
return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
|
|
@@ -3598,21 +3601,25 @@ function createView(arr) {
|
|
|
3598
3601
|
return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
|
|
3599
3602
|
}
|
|
3600
3603
|
var isLE = /* @__PURE__ */ (() => new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68)();
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3604
|
+
function byteSwap(word) {
|
|
3605
|
+
return word << 24 & 4278190080 | word << 8 & 16711680 | word >>> 8 & 65280 | word >>> 24 & 255;
|
|
3606
|
+
}
|
|
3607
|
+
function byteSwap32(arr) {
|
|
3608
|
+
for (let i = 0;i < arr.length; i++) {
|
|
3605
3609
|
arr[i] = byteSwap(arr[i]);
|
|
3610
|
+
}
|
|
3606
3611
|
return arr;
|
|
3607
|
-
}
|
|
3612
|
+
}
|
|
3608
3613
|
var swap32IfBE = isLE ? (u) => u : byteSwap32;
|
|
3609
3614
|
function checkOpts(defaults, opts) {
|
|
3610
|
-
|
|
3611
|
-
|
|
3615
|
+
aobject(defaults, "defaults");
|
|
3616
|
+
aobject(opts, "opts");
|
|
3612
3617
|
const merged = Object.assign(defaults, opts);
|
|
3613
3618
|
return merged;
|
|
3614
3619
|
}
|
|
3615
3620
|
function equalBytes(a, b) {
|
|
3621
|
+
a = abytes(a);
|
|
3622
|
+
b = abytes(b);
|
|
3616
3623
|
if (a.length !== b.length)
|
|
3617
3624
|
return false;
|
|
3618
3625
|
let diff = 0;
|
|
@@ -3638,8 +3645,14 @@ var wrapCipher = (params, constructor) => {
|
|
|
3638
3645
|
abytes(nonce, params.varSizeNonce ? undefined : params.nonceLength, "nonce");
|
|
3639
3646
|
}
|
|
3640
3647
|
const tagl = params.tagLength;
|
|
3641
|
-
|
|
3642
|
-
|
|
3648
|
+
const aadStart = params.nonceLength !== undefined ? 1 : 0;
|
|
3649
|
+
if (!params.withAAD) {
|
|
3650
|
+
for (let i = aadStart;i < args.length; i++)
|
|
3651
|
+
if (isBytes(args[i]))
|
|
3652
|
+
throw new Error("AAD not supported");
|
|
3653
|
+
}
|
|
3654
|
+
if (params.withAAD && args[aadStart] !== undefined)
|
|
3655
|
+
abytes(args[aadStart], undefined, "AAD");
|
|
3643
3656
|
const cipher = constructor(key, ...args);
|
|
3644
3657
|
const checkOutput = (fnLength, output) => {
|
|
3645
3658
|
if (output !== undefined) {
|
|
@@ -3654,14 +3667,14 @@ var wrapCipher = (params, constructor) => {
|
|
|
3654
3667
|
if (called)
|
|
3655
3668
|
throw new Error("cannot encrypt() twice with same key + nonce");
|
|
3656
3669
|
called = true;
|
|
3657
|
-
abytes(data);
|
|
3670
|
+
abytes(data, undefined, "data");
|
|
3658
3671
|
checkOutput(cipher.encrypt.length, output);
|
|
3659
3672
|
return cipher.encrypt(data, output);
|
|
3660
3673
|
},
|
|
3661
3674
|
decrypt(data, output) {
|
|
3662
|
-
abytes(data);
|
|
3675
|
+
abytes(data, undefined, "data");
|
|
3663
3676
|
if (tagl && data.length < tagl)
|
|
3664
|
-
throw new Error('"ciphertext" expected length
|
|
3677
|
+
throw new Error('"ciphertext" expected length >= tagLength=' + tagl);
|
|
3665
3678
|
checkOutput(cipher.decrypt.length, output);
|
|
3666
3679
|
return cipher.decrypt(data, output);
|
|
3667
3680
|
}
|
|
@@ -3674,9 +3687,7 @@ var wrapCipher = (params, constructor) => {
|
|
|
3674
3687
|
function getOutput(expectedLength, out, onlyAligned = true) {
|
|
3675
3688
|
if (out === undefined)
|
|
3676
3689
|
return new Uint8Array(expectedLength);
|
|
3677
|
-
abytes(out,
|
|
3678
|
-
if (out.length !== expectedLength)
|
|
3679
|
-
throw new Error('"output" expected Uint8Array of length ' + expectedLength + ", got: " + out.length);
|
|
3690
|
+
abytes(out, expectedLength, "output");
|
|
3680
3691
|
if (onlyAligned && !isAligned32(out))
|
|
3681
3692
|
throw new Error("invalid output, must be aligned");
|
|
3682
3693
|
return out;
|
|
@@ -3793,7 +3804,7 @@ function createCipher(core, opts) {
|
|
|
3793
3804
|
let k32 = u32(k);
|
|
3794
3805
|
if (extendNonceFn) {
|
|
3795
3806
|
if (nonce.length !== 24)
|
|
3796
|
-
throw new Error(
|
|
3807
|
+
throw new Error("arx: extended nonce must be 24 bytes");
|
|
3797
3808
|
const n16 = nonce.subarray(0, 16);
|
|
3798
3809
|
if (isLE)
|
|
3799
3810
|
extendNonceFn(sigma, k32, u32(n16), k32);
|
|
@@ -3829,6 +3840,7 @@ function createCipher(core, opts) {
|
|
|
3829
3840
|
function u8to16(a, i) {
|
|
3830
3841
|
return a[i++] & 255 | (a[i++] & 255) << 8;
|
|
3831
3842
|
}
|
|
3843
|
+
|
|
3832
3844
|
class Poly1305 {
|
|
3833
3845
|
blockLen = 16;
|
|
3834
3846
|
outputLen = 16;
|
|
@@ -4163,83 +4175,24 @@ function chachaCore(s, k, n, out, cnt, rounds = 20) {
|
|
|
4163
4175
|
out[oi++] = y15 + x15 | 0;
|
|
4164
4176
|
}
|
|
4165
4177
|
function hchacha(s, k, i, out) {
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
x04 = rotl(x04 ^ x08, 12);
|
|
4172
|
-
x00 = x00 + x04 | 0;
|
|
4173
|
-
x12 = rotl(x12 ^ x00, 8);
|
|
4174
|
-
x08 = x08 + x12 | 0;
|
|
4175
|
-
x04 = rotl(x04 ^ x08, 7);
|
|
4176
|
-
x01 = x01 + x05 | 0;
|
|
4177
|
-
x13 = rotl(x13 ^ x01, 16);
|
|
4178
|
-
x09 = x09 + x13 | 0;
|
|
4179
|
-
x05 = rotl(x05 ^ x09, 12);
|
|
4180
|
-
x01 = x01 + x05 | 0;
|
|
4181
|
-
x13 = rotl(x13 ^ x01, 8);
|
|
4182
|
-
x09 = x09 + x13 | 0;
|
|
4183
|
-
x05 = rotl(x05 ^ x09, 7);
|
|
4184
|
-
x02 = x02 + x06 | 0;
|
|
4185
|
-
x14 = rotl(x14 ^ x02, 16);
|
|
4186
|
-
x10 = x10 + x14 | 0;
|
|
4187
|
-
x06 = rotl(x06 ^ x10, 12);
|
|
4188
|
-
x02 = x02 + x06 | 0;
|
|
4189
|
-
x14 = rotl(x14 ^ x02, 8);
|
|
4190
|
-
x10 = x10 + x14 | 0;
|
|
4191
|
-
x06 = rotl(x06 ^ x10, 7);
|
|
4192
|
-
x03 = x03 + x07 | 0;
|
|
4193
|
-
x15 = rotl(x15 ^ x03, 16);
|
|
4194
|
-
x11 = x11 + x15 | 0;
|
|
4195
|
-
x07 = rotl(x07 ^ x11, 12);
|
|
4196
|
-
x03 = x03 + x07 | 0;
|
|
4197
|
-
x15 = rotl(x15 ^ x03, 8);
|
|
4198
|
-
x11 = x11 + x15 | 0;
|
|
4199
|
-
x07 = rotl(x07 ^ x11, 7);
|
|
4200
|
-
x00 = x00 + x05 | 0;
|
|
4201
|
-
x15 = rotl(x15 ^ x00, 16);
|
|
4202
|
-
x10 = x10 + x15 | 0;
|
|
4203
|
-
x05 = rotl(x05 ^ x10, 12);
|
|
4204
|
-
x00 = x00 + x05 | 0;
|
|
4205
|
-
x15 = rotl(x15 ^ x00, 8);
|
|
4206
|
-
x10 = x10 + x15 | 0;
|
|
4207
|
-
x05 = rotl(x05 ^ x10, 7);
|
|
4208
|
-
x01 = x01 + x06 | 0;
|
|
4209
|
-
x12 = rotl(x12 ^ x01, 16);
|
|
4210
|
-
x11 = x11 + x12 | 0;
|
|
4211
|
-
x06 = rotl(x06 ^ x11, 12);
|
|
4212
|
-
x01 = x01 + x06 | 0;
|
|
4213
|
-
x12 = rotl(x12 ^ x01, 8);
|
|
4214
|
-
x11 = x11 + x12 | 0;
|
|
4215
|
-
x06 = rotl(x06 ^ x11, 7);
|
|
4216
|
-
x02 = x02 + x07 | 0;
|
|
4217
|
-
x13 = rotl(x13 ^ x02, 16);
|
|
4218
|
-
x08 = x08 + x13 | 0;
|
|
4219
|
-
x07 = rotl(x07 ^ x08, 12);
|
|
4220
|
-
x02 = x02 + x07 | 0;
|
|
4221
|
-
x13 = rotl(x13 ^ x02, 8);
|
|
4222
|
-
x08 = x08 + x13 | 0;
|
|
4223
|
-
x07 = rotl(x07 ^ x08, 7);
|
|
4224
|
-
x03 = x03 + x04 | 0;
|
|
4225
|
-
x14 = rotl(x14 ^ x03, 16);
|
|
4226
|
-
x09 = x09 + x14 | 0;
|
|
4227
|
-
x04 = rotl(x04 ^ x09, 12);
|
|
4228
|
-
x03 = x03 + x04 | 0;
|
|
4229
|
-
x14 = rotl(x14 ^ x03, 8);
|
|
4230
|
-
x09 = x09 + x14 | 0;
|
|
4231
|
-
x04 = rotl(x04 ^ x09, 7);
|
|
4232
|
-
}
|
|
4178
|
+
const s2 = isLE ? s : swap32IfBE(s.slice(0, 4));
|
|
4179
|
+
const k2 = isLE ? k : swap32IfBE(k.slice(0, 8));
|
|
4180
|
+
const i2 = isLE ? i : swap32IfBE(i.slice(0, 4));
|
|
4181
|
+
const t = new Uint32Array(16);
|
|
4182
|
+
chachaCore(s2, k2, i2.subarray(1), t, i2[0]);
|
|
4233
4183
|
let oi = 0;
|
|
4234
|
-
out[oi++] =
|
|
4235
|
-
out[oi++] =
|
|
4236
|
-
out[oi++] =
|
|
4237
|
-
out[oi++] =
|
|
4238
|
-
out[oi++] =
|
|
4239
|
-
out[oi++] =
|
|
4240
|
-
out[oi++] =
|
|
4241
|
-
out[oi++] =
|
|
4184
|
+
out[oi++] = t[0] - s2[0] | 0;
|
|
4185
|
+
out[oi++] = t[1] - s2[1] | 0;
|
|
4186
|
+
out[oi++] = t[2] - s2[2] | 0;
|
|
4187
|
+
out[oi++] = t[3] - s2[3] | 0;
|
|
4188
|
+
out[oi++] = t[12] - i2[0] | 0;
|
|
4189
|
+
out[oi++] = t[13] - i2[1] | 0;
|
|
4190
|
+
out[oi++] = t[14] - i2[2] | 0;
|
|
4191
|
+
out[oi++] = t[15] - i2[3] | 0;
|
|
4242
4192
|
swap32IfBE(out);
|
|
4193
|
+
if (!isLE)
|
|
4194
|
+
clean(s2, k2, i2);
|
|
4195
|
+
clean(t);
|
|
4243
4196
|
}
|
|
4244
4197
|
var xchacha20 = /* @__PURE__ */ createCipher(chachaCore, {
|
|
4245
4198
|
counterRight: false,
|
|
@@ -4299,7 +4252,7 @@ var _poly1305_aead = (xorStream) => (key, nonce, AAD) => {
|
|
|
4299
4252
|
}
|
|
4300
4253
|
};
|
|
4301
4254
|
};
|
|
4302
|
-
var xchacha20poly1305 = /* @__PURE__ */ wrapCipher({ blockSize: 64, nonceLength: 24, tagLength: 16 }, /* @__PURE__ */ _poly1305_aead(xchacha20));
|
|
4255
|
+
var xchacha20poly1305 = /* @__PURE__ */ wrapCipher({ blockSize: 64, nonceLength: 24, tagLength: 16, withAAD: true }, /* @__PURE__ */ _poly1305_aead(xchacha20));
|
|
4303
4256
|
|
|
4304
4257
|
// src/crypto.ts
|
|
4305
4258
|
var _UTF8 = new TextEncoder;
|
|
@@ -6033,4 +5986,4 @@ export {
|
|
|
6033
5986
|
DEFAULT_PORT
|
|
6034
5987
|
};
|
|
6035
5988
|
|
|
6036
|
-
//# debugId=
|
|
5989
|
+
//# debugId=9DA63DC5728C1F8B64756E2164756E21
|