@tinycloud/cli 0.7.7-beta.4 → 0.7.7-beta.6
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/index.js +970 -675
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -36434,6 +36434,8 @@ var CAPABILITIES = [
|
|
|
36434
36434
|
{ urn: "tinycloud.duckdb/select", service: "tinycloud.duckdb", status: "deprecated-alias", aliasOf: "tinycloud.duckdb/read" },
|
|
36435
36435
|
{ urn: "tinycloud.duckdb/*", service: "tinycloud.duckdb", status: "active", implies: ["tinycloud.duckdb/read", "tinycloud.duckdb/write", "tinycloud.duckdb/admin", "tinycloud.duckdb/import", "tinycloud.duckdb/export"] },
|
|
36436
36436
|
{ urn: "tinycloud.capabilities/read", service: "tinycloud.capabilities", status: "active" },
|
|
36437
|
+
{ urn: "tinycloud.delegation/status", service: "tinycloud.delegation", status: "active" },
|
|
36438
|
+
{ urn: "tinycloud.delegation/list", service: "tinycloud.delegation", status: "active" },
|
|
36437
36439
|
{ urn: "tinycloud.hooks/subscribe", service: "tinycloud.hooks", status: "active" },
|
|
36438
36440
|
{ urn: "tinycloud.hooks/register", service: "tinycloud.hooks", status: "active" },
|
|
36439
36441
|
{ urn: "tinycloud.hooks/list", service: "tinycloud.hooks", status: "active" },
|
|
@@ -36486,6 +36488,7 @@ var CAPABILITIES2 = deriveServiceConstants("capabilities");
|
|
|
36486
36488
|
var HOOKS = deriveServiceConstants("hooks");
|
|
36487
36489
|
var ENCRYPTION = deriveServiceConstants("encryption");
|
|
36488
36490
|
var SPACE = deriveServiceConstants("space");
|
|
36491
|
+
var CAPABILITY_REGISTRY = CAPABILITIES;
|
|
36489
36492
|
|
|
36490
36493
|
// ../bootstrap/dist/index.js
|
|
36491
36494
|
var DEFAULT_MANIFEST_SPACE = "applications";
|
|
@@ -42361,7 +42364,8 @@ var SERVICE_SHORT_TO_LONG = Object.freeze({
|
|
|
42361
42364
|
duckdb: "tinycloud.duckdb",
|
|
42362
42365
|
capabilities: "tinycloud.capabilities",
|
|
42363
42366
|
hooks: "tinycloud.hooks",
|
|
42364
|
-
encryption: "tinycloud.encryption"
|
|
42367
|
+
encryption: "tinycloud.encryption",
|
|
42368
|
+
delegation: "tinycloud.delegation"
|
|
42365
42369
|
});
|
|
42366
42370
|
var ENCRYPTION_PERMISSION_SERVICE2 = "tinycloud.encryption";
|
|
42367
42371
|
var ENCRYPTION_MANIFEST_SPACE2 = "encryption";
|
|
@@ -47438,228 +47442,24 @@ ${rowCount} row${rowCount === 1 ? "" : "s"} returned`) + "\n");
|
|
|
47438
47442
|
|
|
47439
47443
|
// ../sdk-core/dist/index.js
|
|
47440
47444
|
var import_siwe = __toESM(require_siwe(), 1);
|
|
47441
|
-
var import_ms2 = __toESM(require_ms(), 1);
|
|
47442
|
-
|
|
47443
|
-
// ../../node_modules/uint8arrays/dist/src/equals.js
|
|
47444
|
-
function equals(a, b) {
|
|
47445
|
-
if (a === b) {
|
|
47446
|
-
return true;
|
|
47447
|
-
}
|
|
47448
|
-
if (a.byteLength !== b.byteLength) {
|
|
47449
|
-
return false;
|
|
47450
|
-
}
|
|
47451
|
-
for (let i = 0; i < a.byteLength; i++) {
|
|
47452
|
-
if (a[i] !== b[i]) {
|
|
47453
|
-
return false;
|
|
47454
|
-
}
|
|
47455
|
-
}
|
|
47456
|
-
return true;
|
|
47457
|
-
}
|
|
47458
|
-
|
|
47459
|
-
// ../../node_modules/uint8arrays/dist/src/alloc.node.js
|
|
47460
|
-
import { Buffer as Buffer2 } from "buffer";
|
|
47461
|
-
|
|
47462
|
-
// ../../node_modules/uint8arrays/dist/src/util/as-uint8array.node.js
|
|
47463
|
-
function asUint8Array(buf) {
|
|
47464
|
-
return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);
|
|
47465
|
-
}
|
|
47466
|
-
|
|
47467
|
-
// ../../node_modules/uint8arrays/dist/src/alloc.node.js
|
|
47468
|
-
function allocUnsafe(size = 0) {
|
|
47469
|
-
return asUint8Array(Buffer2.allocUnsafe(size));
|
|
47470
|
-
}
|
|
47471
|
-
|
|
47472
|
-
// ../../node_modules/uint8-varint/dist/src/index.js
|
|
47473
|
-
var N1 = Math.pow(2, 7);
|
|
47474
|
-
var N2 = Math.pow(2, 14);
|
|
47475
|
-
var N3 = Math.pow(2, 21);
|
|
47476
|
-
var N4 = Math.pow(2, 28);
|
|
47477
|
-
var N5 = Math.pow(2, 35);
|
|
47478
|
-
var N6 = Math.pow(2, 42);
|
|
47479
|
-
var N7 = Math.pow(2, 49);
|
|
47480
|
-
var MSB = 128;
|
|
47481
|
-
var REST = 127;
|
|
47482
|
-
function encodingLength(value) {
|
|
47483
|
-
if (value < N1) {
|
|
47484
|
-
return 1;
|
|
47485
|
-
}
|
|
47486
|
-
if (value < N2) {
|
|
47487
|
-
return 2;
|
|
47488
|
-
}
|
|
47489
|
-
if (value < N3) {
|
|
47490
|
-
return 3;
|
|
47491
|
-
}
|
|
47492
|
-
if (value < N4) {
|
|
47493
|
-
return 4;
|
|
47494
|
-
}
|
|
47495
|
-
if (value < N5) {
|
|
47496
|
-
return 5;
|
|
47497
|
-
}
|
|
47498
|
-
if (value < N6) {
|
|
47499
|
-
return 6;
|
|
47500
|
-
}
|
|
47501
|
-
if (value < N7) {
|
|
47502
|
-
return 7;
|
|
47503
|
-
}
|
|
47504
|
-
if (Number.MAX_SAFE_INTEGER != null && value > Number.MAX_SAFE_INTEGER) {
|
|
47505
|
-
throw new RangeError("Could not encode varint");
|
|
47506
|
-
}
|
|
47507
|
-
return 8;
|
|
47508
|
-
}
|
|
47509
|
-
function encodeUint8Array(value, buf, offset = 0) {
|
|
47510
|
-
switch (encodingLength(value)) {
|
|
47511
|
-
case 8: {
|
|
47512
|
-
buf[offset++] = value & 255 | MSB;
|
|
47513
|
-
value /= 128;
|
|
47514
|
-
}
|
|
47515
|
-
case 7: {
|
|
47516
|
-
buf[offset++] = value & 255 | MSB;
|
|
47517
|
-
value /= 128;
|
|
47518
|
-
}
|
|
47519
|
-
case 6: {
|
|
47520
|
-
buf[offset++] = value & 255 | MSB;
|
|
47521
|
-
value /= 128;
|
|
47522
|
-
}
|
|
47523
|
-
case 5: {
|
|
47524
|
-
buf[offset++] = value & 255 | MSB;
|
|
47525
|
-
value /= 128;
|
|
47526
|
-
}
|
|
47527
|
-
case 4: {
|
|
47528
|
-
buf[offset++] = value & 255 | MSB;
|
|
47529
|
-
value >>>= 7;
|
|
47530
|
-
}
|
|
47531
|
-
case 3: {
|
|
47532
|
-
buf[offset++] = value & 255 | MSB;
|
|
47533
|
-
value >>>= 7;
|
|
47534
|
-
}
|
|
47535
|
-
case 2: {
|
|
47536
|
-
buf[offset++] = value & 255 | MSB;
|
|
47537
|
-
value >>>= 7;
|
|
47538
|
-
}
|
|
47539
|
-
case 1: {
|
|
47540
|
-
buf[offset++] = value & 255;
|
|
47541
|
-
value >>>= 7;
|
|
47542
|
-
break;
|
|
47543
|
-
}
|
|
47544
|
-
default:
|
|
47545
|
-
throw new Error("unreachable");
|
|
47546
|
-
}
|
|
47547
|
-
return buf;
|
|
47548
|
-
}
|
|
47549
|
-
function decodeUint8Array(buf, offset) {
|
|
47550
|
-
let b = buf[offset];
|
|
47551
|
-
let res = 0;
|
|
47552
|
-
res += b & REST;
|
|
47553
|
-
if (b < MSB) {
|
|
47554
|
-
return res;
|
|
47555
|
-
}
|
|
47556
|
-
b = buf[offset + 1];
|
|
47557
|
-
res += (b & REST) << 7;
|
|
47558
|
-
if (b < MSB) {
|
|
47559
|
-
return res;
|
|
47560
|
-
}
|
|
47561
|
-
b = buf[offset + 2];
|
|
47562
|
-
res += (b & REST) << 14;
|
|
47563
|
-
if (b < MSB) {
|
|
47564
|
-
return res;
|
|
47565
|
-
}
|
|
47566
|
-
b = buf[offset + 3];
|
|
47567
|
-
res += (b & REST) << 21;
|
|
47568
|
-
if (b < MSB) {
|
|
47569
|
-
return res;
|
|
47570
|
-
}
|
|
47571
|
-
b = buf[offset + 4];
|
|
47572
|
-
res += (b & REST) * N4;
|
|
47573
|
-
if (b < MSB) {
|
|
47574
|
-
return res;
|
|
47575
|
-
}
|
|
47576
|
-
b = buf[offset + 5];
|
|
47577
|
-
res += (b & REST) * N5;
|
|
47578
|
-
if (b < MSB) {
|
|
47579
|
-
return res;
|
|
47580
|
-
}
|
|
47581
|
-
b = buf[offset + 6];
|
|
47582
|
-
res += (b & REST) * N6;
|
|
47583
|
-
if (b < MSB) {
|
|
47584
|
-
return res;
|
|
47585
|
-
}
|
|
47586
|
-
b = buf[offset + 7];
|
|
47587
|
-
res += (b & REST) * N7;
|
|
47588
|
-
if (b < MSB) {
|
|
47589
|
-
return res;
|
|
47590
|
-
}
|
|
47591
|
-
throw new RangeError("Could not decode varint");
|
|
47592
|
-
}
|
|
47593
|
-
function decodeUint8ArrayList(buf, offset) {
|
|
47594
|
-
let b = buf.get(offset);
|
|
47595
|
-
let res = 0;
|
|
47596
|
-
res += b & REST;
|
|
47597
|
-
if (b < MSB) {
|
|
47598
|
-
return res;
|
|
47599
|
-
}
|
|
47600
|
-
b = buf.get(offset + 1);
|
|
47601
|
-
res += (b & REST) << 7;
|
|
47602
|
-
if (b < MSB) {
|
|
47603
|
-
return res;
|
|
47604
|
-
}
|
|
47605
|
-
b = buf.get(offset + 2);
|
|
47606
|
-
res += (b & REST) << 14;
|
|
47607
|
-
if (b < MSB) {
|
|
47608
|
-
return res;
|
|
47609
|
-
}
|
|
47610
|
-
b = buf.get(offset + 3);
|
|
47611
|
-
res += (b & REST) << 21;
|
|
47612
|
-
if (b < MSB) {
|
|
47613
|
-
return res;
|
|
47614
|
-
}
|
|
47615
|
-
b = buf.get(offset + 4);
|
|
47616
|
-
res += (b & REST) * N4;
|
|
47617
|
-
if (b < MSB) {
|
|
47618
|
-
return res;
|
|
47619
|
-
}
|
|
47620
|
-
b = buf.get(offset + 5);
|
|
47621
|
-
res += (b & REST) * N5;
|
|
47622
|
-
if (b < MSB) {
|
|
47623
|
-
return res;
|
|
47624
|
-
}
|
|
47625
|
-
b = buf.get(offset + 6);
|
|
47626
|
-
res += (b & REST) * N6;
|
|
47627
|
-
if (b < MSB) {
|
|
47628
|
-
return res;
|
|
47629
|
-
}
|
|
47630
|
-
b = buf.get(offset + 7);
|
|
47631
|
-
res += (b & REST) * N7;
|
|
47632
|
-
if (b < MSB) {
|
|
47633
|
-
return res;
|
|
47634
|
-
}
|
|
47635
|
-
throw new RangeError("Could not decode varint");
|
|
47636
|
-
}
|
|
47637
|
-
function decode3(buf, offset = 0) {
|
|
47638
|
-
if (buf instanceof Uint8Array) {
|
|
47639
|
-
return decodeUint8Array(buf, offset);
|
|
47640
|
-
} else {
|
|
47641
|
-
return decodeUint8ArrayList(buf, offset);
|
|
47642
|
-
}
|
|
47643
|
-
}
|
|
47644
|
-
|
|
47645
|
-
// ../../node_modules/uint8arrays/dist/src/concat.node.js
|
|
47646
|
-
import { Buffer as Buffer3 } from "buffer";
|
|
47647
|
-
function concat2(arrays, length2) {
|
|
47648
|
-
return asUint8Array(Buffer3.concat(arrays, length2));
|
|
47649
|
-
}
|
|
47650
|
-
|
|
47651
|
-
// ../../node_modules/uint8arrays/dist/src/from-string.node.js
|
|
47652
|
-
import { Buffer as Buffer4 } from "buffer";
|
|
47653
47445
|
|
|
47654
|
-
// ../../node_modules/multiformats/dist/src/bases/
|
|
47655
|
-
var
|
|
47656
|
-
__export(
|
|
47657
|
-
|
|
47446
|
+
// ../../node_modules/multiformats/dist/src/bases/base32.js
|
|
47447
|
+
var base32_exports = {};
|
|
47448
|
+
__export(base32_exports, {
|
|
47449
|
+
base32: () => base32,
|
|
47450
|
+
base32hex: () => base32hex,
|
|
47451
|
+
base32hexpad: () => base32hexpad,
|
|
47452
|
+
base32hexpadupper: () => base32hexpadupper,
|
|
47453
|
+
base32hexupper: () => base32hexupper,
|
|
47454
|
+
base32pad: () => base32pad,
|
|
47455
|
+
base32padupper: () => base32padupper,
|
|
47456
|
+
base32upper: () => base32upper,
|
|
47457
|
+
base32z: () => base32z
|
|
47658
47458
|
});
|
|
47659
47459
|
|
|
47660
47460
|
// ../../node_modules/multiformats/dist/src/bytes.js
|
|
47661
47461
|
var empty = new Uint8Array(0);
|
|
47662
|
-
function
|
|
47462
|
+
function equals(aa, bb) {
|
|
47663
47463
|
if (aa === bb) {
|
|
47664
47464
|
return true;
|
|
47665
47465
|
}
|
|
@@ -47933,7 +47733,7 @@ function baseX({ name: name2, prefix, alphabet: alphabet2 }) {
|
|
|
47933
47733
|
decode: (text) => coerce2(decode9(text))
|
|
47934
47734
|
});
|
|
47935
47735
|
}
|
|
47936
|
-
function
|
|
47736
|
+
function decode3(string2, alphabetIdx, bitsPerChar, name2) {
|
|
47937
47737
|
let end = string2.length;
|
|
47938
47738
|
while (string2[end - 1] === "=") {
|
|
47939
47739
|
--end;
|
|
@@ -47999,149 +47799,53 @@ function rfc4648({ name: name2, prefix, bitsPerChar, alphabet: alphabet2 }) {
|
|
|
47999
47799
|
return encode4(input, alphabet2, bitsPerChar);
|
|
48000
47800
|
},
|
|
48001
47801
|
decode(input) {
|
|
48002
|
-
return
|
|
47802
|
+
return decode3(input, alphabetIdx, bitsPerChar, name2);
|
|
48003
47803
|
}
|
|
48004
47804
|
});
|
|
48005
47805
|
}
|
|
48006
47806
|
|
|
48007
|
-
// ../../node_modules/multiformats/dist/src/bases/
|
|
48008
|
-
var
|
|
48009
|
-
prefix: "
|
|
48010
|
-
name: "
|
|
48011
|
-
alphabet: "
|
|
47807
|
+
// ../../node_modules/multiformats/dist/src/bases/base32.js
|
|
47808
|
+
var base32 = rfc4648({
|
|
47809
|
+
prefix: "b",
|
|
47810
|
+
name: "base32",
|
|
47811
|
+
alphabet: "abcdefghijklmnopqrstuvwxyz234567",
|
|
47812
|
+
bitsPerChar: 5
|
|
48012
47813
|
});
|
|
48013
|
-
|
|
48014
|
-
|
|
48015
|
-
|
|
48016
|
-
|
|
48017
|
-
|
|
48018
|
-
base16upper: () => base16upper
|
|
47814
|
+
var base32upper = rfc4648({
|
|
47815
|
+
prefix: "B",
|
|
47816
|
+
name: "base32upper",
|
|
47817
|
+
alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",
|
|
47818
|
+
bitsPerChar: 5
|
|
48019
47819
|
});
|
|
48020
|
-
var
|
|
48021
|
-
prefix: "
|
|
48022
|
-
name: "
|
|
48023
|
-
alphabet: "
|
|
48024
|
-
bitsPerChar:
|
|
47820
|
+
var base32pad = rfc4648({
|
|
47821
|
+
prefix: "c",
|
|
47822
|
+
name: "base32pad",
|
|
47823
|
+
alphabet: "abcdefghijklmnopqrstuvwxyz234567=",
|
|
47824
|
+
bitsPerChar: 5
|
|
48025
47825
|
});
|
|
48026
|
-
var
|
|
48027
|
-
prefix: "
|
|
48028
|
-
name: "
|
|
48029
|
-
alphabet: "
|
|
48030
|
-
bitsPerChar:
|
|
47826
|
+
var base32padupper = rfc4648({
|
|
47827
|
+
prefix: "C",
|
|
47828
|
+
name: "base32padupper",
|
|
47829
|
+
alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",
|
|
47830
|
+
bitsPerChar: 5
|
|
48031
47831
|
});
|
|
48032
|
-
|
|
48033
|
-
|
|
48034
|
-
|
|
48035
|
-
|
|
48036
|
-
|
|
47832
|
+
var base32hex = rfc4648({
|
|
47833
|
+
prefix: "v",
|
|
47834
|
+
name: "base32hex",
|
|
47835
|
+
alphabet: "0123456789abcdefghijklmnopqrstuv",
|
|
47836
|
+
bitsPerChar: 5
|
|
48037
47837
|
});
|
|
48038
|
-
var
|
|
48039
|
-
prefix: "
|
|
48040
|
-
name: "
|
|
48041
|
-
alphabet: "
|
|
48042
|
-
bitsPerChar:
|
|
47838
|
+
var base32hexupper = rfc4648({
|
|
47839
|
+
prefix: "V",
|
|
47840
|
+
name: "base32hexupper",
|
|
47841
|
+
alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUV",
|
|
47842
|
+
bitsPerChar: 5
|
|
48043
47843
|
});
|
|
48044
|
-
|
|
48045
|
-
|
|
48046
|
-
|
|
48047
|
-
|
|
48048
|
-
|
|
48049
|
-
});
|
|
48050
|
-
var alphabet = Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}");
|
|
48051
|
-
var alphabetBytesToChars = alphabet.reduce((p, c, i) => {
|
|
48052
|
-
p[i] = c;
|
|
48053
|
-
return p;
|
|
48054
|
-
}, []);
|
|
48055
|
-
var alphabetCharsToBytes = alphabet.reduce((p, c, i) => {
|
|
48056
|
-
const codePoint = c.codePointAt(0);
|
|
48057
|
-
if (codePoint == null) {
|
|
48058
|
-
throw new Error(`Invalid character: ${c}`);
|
|
48059
|
-
}
|
|
48060
|
-
p[codePoint] = i;
|
|
48061
|
-
return p;
|
|
48062
|
-
}, []);
|
|
48063
|
-
function encode5(data) {
|
|
48064
|
-
return data.reduce((p, c) => {
|
|
48065
|
-
p += alphabetBytesToChars[c];
|
|
48066
|
-
return p;
|
|
48067
|
-
}, "");
|
|
48068
|
-
}
|
|
48069
|
-
function decode5(str) {
|
|
48070
|
-
const byts = [];
|
|
48071
|
-
for (const char of str) {
|
|
48072
|
-
const codePoint = char.codePointAt(0);
|
|
48073
|
-
if (codePoint == null) {
|
|
48074
|
-
throw new Error(`Invalid character: ${char}`);
|
|
48075
|
-
}
|
|
48076
|
-
const byt = alphabetCharsToBytes[codePoint];
|
|
48077
|
-
if (byt == null) {
|
|
48078
|
-
throw new Error(`Non-base256emoji character: ${char}`);
|
|
48079
|
-
}
|
|
48080
|
-
byts.push(byt);
|
|
48081
|
-
}
|
|
48082
|
-
return new Uint8Array(byts);
|
|
48083
|
-
}
|
|
48084
|
-
var base256emoji = from({
|
|
48085
|
-
prefix: "\u{1F680}",
|
|
48086
|
-
name: "base256emoji",
|
|
48087
|
-
encode: encode5,
|
|
48088
|
-
decode: decode5
|
|
48089
|
-
});
|
|
48090
|
-
|
|
48091
|
-
// ../../node_modules/multiformats/dist/src/bases/base32.js
|
|
48092
|
-
var base32_exports = {};
|
|
48093
|
-
__export(base32_exports, {
|
|
48094
|
-
base32: () => base32,
|
|
48095
|
-
base32hex: () => base32hex,
|
|
48096
|
-
base32hexpad: () => base32hexpad,
|
|
48097
|
-
base32hexpadupper: () => base32hexpadupper,
|
|
48098
|
-
base32hexupper: () => base32hexupper,
|
|
48099
|
-
base32pad: () => base32pad,
|
|
48100
|
-
base32padupper: () => base32padupper,
|
|
48101
|
-
base32upper: () => base32upper,
|
|
48102
|
-
base32z: () => base32z
|
|
48103
|
-
});
|
|
48104
|
-
var base32 = rfc4648({
|
|
48105
|
-
prefix: "b",
|
|
48106
|
-
name: "base32",
|
|
48107
|
-
alphabet: "abcdefghijklmnopqrstuvwxyz234567",
|
|
48108
|
-
bitsPerChar: 5
|
|
48109
|
-
});
|
|
48110
|
-
var base32upper = rfc4648({
|
|
48111
|
-
prefix: "B",
|
|
48112
|
-
name: "base32upper",
|
|
48113
|
-
alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",
|
|
48114
|
-
bitsPerChar: 5
|
|
48115
|
-
});
|
|
48116
|
-
var base32pad = rfc4648({
|
|
48117
|
-
prefix: "c",
|
|
48118
|
-
name: "base32pad",
|
|
48119
|
-
alphabet: "abcdefghijklmnopqrstuvwxyz234567=",
|
|
48120
|
-
bitsPerChar: 5
|
|
48121
|
-
});
|
|
48122
|
-
var base32padupper = rfc4648({
|
|
48123
|
-
prefix: "C",
|
|
48124
|
-
name: "base32padupper",
|
|
48125
|
-
alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",
|
|
48126
|
-
bitsPerChar: 5
|
|
48127
|
-
});
|
|
48128
|
-
var base32hex = rfc4648({
|
|
48129
|
-
prefix: "v",
|
|
48130
|
-
name: "base32hex",
|
|
48131
|
-
alphabet: "0123456789abcdefghijklmnopqrstuv",
|
|
48132
|
-
bitsPerChar: 5
|
|
48133
|
-
});
|
|
48134
|
-
var base32hexupper = rfc4648({
|
|
48135
|
-
prefix: "V",
|
|
48136
|
-
name: "base32hexupper",
|
|
48137
|
-
alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUV",
|
|
48138
|
-
bitsPerChar: 5
|
|
48139
|
-
});
|
|
48140
|
-
var base32hexpad = rfc4648({
|
|
48141
|
-
prefix: "t",
|
|
48142
|
-
name: "base32hexpad",
|
|
48143
|
-
alphabet: "0123456789abcdefghijklmnopqrstuv=",
|
|
48144
|
-
bitsPerChar: 5
|
|
47844
|
+
var base32hexpad = rfc4648({
|
|
47845
|
+
prefix: "t",
|
|
47846
|
+
name: "base32hexpad",
|
|
47847
|
+
alphabet: "0123456789abcdefghijklmnopqrstuv=",
|
|
47848
|
+
bitsPerChar: 5
|
|
48145
47849
|
});
|
|
48146
47850
|
var base32hexpadupper = rfc4648({
|
|
48147
47851
|
prefix: "T",
|
|
@@ -48190,96 +47894,29 @@ var base58flickr = baseX({
|
|
|
48190
47894
|
alphabet: "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"
|
|
48191
47895
|
});
|
|
48192
47896
|
|
|
48193
|
-
// ../../node_modules/multiformats/dist/src/bases/base64.js
|
|
48194
|
-
var base64_exports = {};
|
|
48195
|
-
__export(base64_exports, {
|
|
48196
|
-
base64: () => base64,
|
|
48197
|
-
base64pad: () => base64pad,
|
|
48198
|
-
base64url: () => base64url,
|
|
48199
|
-
base64urlpad: () => base64urlpad
|
|
48200
|
-
});
|
|
48201
|
-
var base64 = rfc4648({
|
|
48202
|
-
prefix: "m",
|
|
48203
|
-
name: "base64",
|
|
48204
|
-
alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
|
|
48205
|
-
bitsPerChar: 6
|
|
48206
|
-
});
|
|
48207
|
-
var base64pad = rfc4648({
|
|
48208
|
-
prefix: "M",
|
|
48209
|
-
name: "base64pad",
|
|
48210
|
-
alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
|
|
48211
|
-
bitsPerChar: 6
|
|
48212
|
-
});
|
|
48213
|
-
var base64url = rfc4648({
|
|
48214
|
-
prefix: "u",
|
|
48215
|
-
name: "base64url",
|
|
48216
|
-
alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",
|
|
48217
|
-
bitsPerChar: 6
|
|
48218
|
-
});
|
|
48219
|
-
var base64urlpad = rfc4648({
|
|
48220
|
-
prefix: "U",
|
|
48221
|
-
name: "base64urlpad",
|
|
48222
|
-
alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",
|
|
48223
|
-
bitsPerChar: 6
|
|
48224
|
-
});
|
|
48225
|
-
|
|
48226
|
-
// ../../node_modules/multiformats/dist/src/bases/base8.js
|
|
48227
|
-
var base8_exports = {};
|
|
48228
|
-
__export(base8_exports, {
|
|
48229
|
-
base8: () => base8
|
|
48230
|
-
});
|
|
48231
|
-
var base8 = rfc4648({
|
|
48232
|
-
prefix: "7",
|
|
48233
|
-
name: "base8",
|
|
48234
|
-
alphabet: "01234567",
|
|
48235
|
-
bitsPerChar: 3
|
|
48236
|
-
});
|
|
48237
|
-
|
|
48238
|
-
// ../../node_modules/multiformats/dist/src/bases/identity.js
|
|
48239
|
-
var identity_exports = {};
|
|
48240
|
-
__export(identity_exports, {
|
|
48241
|
-
identity: () => identity
|
|
48242
|
-
});
|
|
48243
|
-
var identity = from({
|
|
48244
|
-
prefix: "\0",
|
|
48245
|
-
name: "identity",
|
|
48246
|
-
encode: (buf) => toString(buf),
|
|
48247
|
-
decode: (str) => fromString(str)
|
|
48248
|
-
});
|
|
48249
|
-
|
|
48250
|
-
// ../../node_modules/multiformats/dist/src/codecs/json.js
|
|
48251
|
-
var textEncoder = new TextEncoder();
|
|
48252
|
-
var textDecoder = new TextDecoder();
|
|
48253
|
-
|
|
48254
|
-
// ../../node_modules/multiformats/dist/src/hashes/identity.js
|
|
48255
|
-
var identity_exports2 = {};
|
|
48256
|
-
__export(identity_exports2, {
|
|
48257
|
-
identity: () => identity2
|
|
48258
|
-
});
|
|
48259
|
-
|
|
48260
47897
|
// ../../node_modules/multiformats/dist/src/vendor/varint.js
|
|
48261
|
-
var encode_1 =
|
|
48262
|
-
var
|
|
48263
|
-
var
|
|
48264
|
-
var MSBALL = ~
|
|
47898
|
+
var encode_1 = encode5;
|
|
47899
|
+
var MSB = 128;
|
|
47900
|
+
var REST = 127;
|
|
47901
|
+
var MSBALL = ~REST;
|
|
48265
47902
|
var INT = Math.pow(2, 31);
|
|
48266
|
-
function
|
|
47903
|
+
function encode5(num, out, offset) {
|
|
48267
47904
|
out = out || [];
|
|
48268
47905
|
offset = offset || 0;
|
|
48269
47906
|
var oldOffset = offset;
|
|
48270
47907
|
while (num >= INT) {
|
|
48271
|
-
out[offset++] = num & 255 |
|
|
47908
|
+
out[offset++] = num & 255 | MSB;
|
|
48272
47909
|
num /= 128;
|
|
48273
47910
|
}
|
|
48274
47911
|
while (num & MSBALL) {
|
|
48275
|
-
out[offset++] = num & 255 |
|
|
47912
|
+
out[offset++] = num & 255 | MSB;
|
|
48276
47913
|
num >>>= 7;
|
|
48277
47914
|
}
|
|
48278
47915
|
out[offset] = num | 0;
|
|
48279
|
-
|
|
47916
|
+
encode5.bytes = offset - oldOffset + 1;
|
|
48280
47917
|
return out;
|
|
48281
47918
|
}
|
|
48282
|
-
var
|
|
47919
|
+
var decode4 = read;
|
|
48283
47920
|
var MSB$1 = 128;
|
|
48284
47921
|
var REST$1 = 127;
|
|
48285
47922
|
function read(buf, offset) {
|
|
@@ -48296,28 +47933,28 @@ function read(buf, offset) {
|
|
|
48296
47933
|
read.bytes = counter - offset;
|
|
48297
47934
|
return res;
|
|
48298
47935
|
}
|
|
48299
|
-
var
|
|
48300
|
-
var
|
|
48301
|
-
var
|
|
48302
|
-
var
|
|
48303
|
-
var
|
|
48304
|
-
var
|
|
48305
|
-
var
|
|
47936
|
+
var N1 = Math.pow(2, 7);
|
|
47937
|
+
var N2 = Math.pow(2, 14);
|
|
47938
|
+
var N3 = Math.pow(2, 21);
|
|
47939
|
+
var N4 = Math.pow(2, 28);
|
|
47940
|
+
var N5 = Math.pow(2, 35);
|
|
47941
|
+
var N6 = Math.pow(2, 42);
|
|
47942
|
+
var N7 = Math.pow(2, 49);
|
|
48306
47943
|
var N8 = Math.pow(2, 56);
|
|
48307
47944
|
var N9 = Math.pow(2, 63);
|
|
48308
47945
|
var length = function(value) {
|
|
48309
|
-
return value <
|
|
47946
|
+
return value < N1 ? 1 : value < N2 ? 2 : value < N3 ? 3 : value < N4 ? 4 : value < N5 ? 5 : value < N6 ? 6 : value < N7 ? 7 : value < N8 ? 8 : value < N9 ? 9 : 10;
|
|
48310
47947
|
};
|
|
48311
47948
|
var varint = {
|
|
48312
47949
|
encode: encode_1,
|
|
48313
|
-
decode:
|
|
47950
|
+
decode: decode4,
|
|
48314
47951
|
encodingLength: length
|
|
48315
47952
|
};
|
|
48316
47953
|
var _brrp_varint = varint;
|
|
48317
47954
|
var varint_default = _brrp_varint;
|
|
48318
47955
|
|
|
48319
47956
|
// ../../node_modules/multiformats/dist/src/varint.js
|
|
48320
|
-
function
|
|
47957
|
+
function decode5(data, offset = 0) {
|
|
48321
47958
|
const code2 = varint_default.decode(data, offset);
|
|
48322
47959
|
return [code2, varint_default.decode.bytes];
|
|
48323
47960
|
}
|
|
@@ -48325,37 +47962,37 @@ function encodeTo(int, target, offset = 0) {
|
|
|
48325
47962
|
varint_default.encode(int, target, offset);
|
|
48326
47963
|
return target;
|
|
48327
47964
|
}
|
|
48328
|
-
function
|
|
47965
|
+
function encodingLength(int) {
|
|
48329
47966
|
return varint_default.encodingLength(int);
|
|
48330
47967
|
}
|
|
48331
47968
|
|
|
48332
47969
|
// ../../node_modules/multiformats/dist/src/hashes/digest.js
|
|
48333
47970
|
function create(code2, digest2) {
|
|
48334
47971
|
const size = digest2.byteLength;
|
|
48335
|
-
const sizeOffset =
|
|
48336
|
-
const digestOffset = sizeOffset +
|
|
47972
|
+
const sizeOffset = encodingLength(code2);
|
|
47973
|
+
const digestOffset = sizeOffset + encodingLength(size);
|
|
48337
47974
|
const bytes = new Uint8Array(digestOffset + size);
|
|
48338
47975
|
encodeTo(code2, bytes, 0);
|
|
48339
47976
|
encodeTo(size, bytes, sizeOffset);
|
|
48340
47977
|
bytes.set(digest2, digestOffset);
|
|
48341
47978
|
return new Digest(code2, size, digest2, bytes);
|
|
48342
47979
|
}
|
|
48343
|
-
function
|
|
47980
|
+
function decode6(multihash) {
|
|
48344
47981
|
const bytes = coerce2(multihash);
|
|
48345
|
-
const [code2, sizeOffset] =
|
|
48346
|
-
const [size, digestOffset] =
|
|
47982
|
+
const [code2, sizeOffset] = decode5(bytes);
|
|
47983
|
+
const [size, digestOffset] = decode5(bytes.subarray(sizeOffset));
|
|
48347
47984
|
const digest2 = bytes.subarray(sizeOffset + digestOffset);
|
|
48348
47985
|
if (digest2.byteLength !== size) {
|
|
48349
47986
|
throw new Error("Incorrect length");
|
|
48350
47987
|
}
|
|
48351
47988
|
return new Digest(code2, size, digest2, bytes);
|
|
48352
47989
|
}
|
|
48353
|
-
function
|
|
47990
|
+
function equals2(a, b) {
|
|
48354
47991
|
if (a === b) {
|
|
48355
47992
|
return true;
|
|
48356
47993
|
} else {
|
|
48357
47994
|
const data = b;
|
|
48358
|
-
return a.code === data.code && a.size === data.size && data.bytes instanceof Uint8Array &&
|
|
47995
|
+
return a.code === data.code && a.size === data.size && data.bytes instanceof Uint8Array && equals(a.bytes, data.bytes);
|
|
48359
47996
|
}
|
|
48360
47997
|
}
|
|
48361
47998
|
var Digest = class {
|
|
@@ -48374,89 +48011,6 @@ var Digest = class {
|
|
|
48374
48011
|
}
|
|
48375
48012
|
};
|
|
48376
48013
|
|
|
48377
|
-
// ../../node_modules/multiformats/dist/src/hashes/identity.js
|
|
48378
|
-
var code = 0;
|
|
48379
|
-
var name = "identity";
|
|
48380
|
-
var encode7 = coerce2;
|
|
48381
|
-
function digest(input, options) {
|
|
48382
|
-
if (options?.truncate != null && options.truncate !== input.byteLength) {
|
|
48383
|
-
if (options.truncate < 0 || options.truncate > input.byteLength) {
|
|
48384
|
-
throw new Error(`Invalid truncate option, must be less than or equal to ${input.byteLength}`);
|
|
48385
|
-
}
|
|
48386
|
-
input = input.subarray(0, options.truncate);
|
|
48387
|
-
}
|
|
48388
|
-
return create(code, encode7(input));
|
|
48389
|
-
}
|
|
48390
|
-
var identity2 = { code, name, encode: encode7, digest };
|
|
48391
|
-
|
|
48392
|
-
// ../../node_modules/multiformats/dist/src/hashes/sha2.js
|
|
48393
|
-
var sha2_exports = {};
|
|
48394
|
-
__export(sha2_exports, {
|
|
48395
|
-
sha256: () => sha2563,
|
|
48396
|
-
sha512: () => sha5122
|
|
48397
|
-
});
|
|
48398
|
-
import crypto3 from "crypto";
|
|
48399
|
-
|
|
48400
|
-
// ../../node_modules/multiformats/dist/src/hashes/hasher.js
|
|
48401
|
-
var DEFAULT_MIN_DIGEST_LENGTH = 20;
|
|
48402
|
-
function from2({ name: name2, code: code2, encode: encode8, minDigestLength, maxDigestLength }) {
|
|
48403
|
-
return new Hasher(name2, code2, encode8, minDigestLength, maxDigestLength);
|
|
48404
|
-
}
|
|
48405
|
-
var Hasher = class {
|
|
48406
|
-
name;
|
|
48407
|
-
code;
|
|
48408
|
-
encode;
|
|
48409
|
-
minDigestLength;
|
|
48410
|
-
maxDigestLength;
|
|
48411
|
-
constructor(name2, code2, encode8, minDigestLength, maxDigestLength) {
|
|
48412
|
-
this.name = name2;
|
|
48413
|
-
this.code = code2;
|
|
48414
|
-
this.encode = encode8;
|
|
48415
|
-
this.minDigestLength = minDigestLength ?? DEFAULT_MIN_DIGEST_LENGTH;
|
|
48416
|
-
this.maxDigestLength = maxDigestLength;
|
|
48417
|
-
}
|
|
48418
|
-
digest(input, options) {
|
|
48419
|
-
if (options?.truncate != null) {
|
|
48420
|
-
if (options.truncate < this.minDigestLength) {
|
|
48421
|
-
throw new Error(`Invalid truncate option, must be greater than or equal to ${this.minDigestLength}`);
|
|
48422
|
-
}
|
|
48423
|
-
if (this.maxDigestLength != null && options.truncate > this.maxDigestLength) {
|
|
48424
|
-
throw new Error(`Invalid truncate option, must be less than or equal to ${this.maxDigestLength}`);
|
|
48425
|
-
}
|
|
48426
|
-
}
|
|
48427
|
-
if (input instanceof Uint8Array) {
|
|
48428
|
-
const result = this.encode(input);
|
|
48429
|
-
if (result instanceof Uint8Array) {
|
|
48430
|
-
return createDigest(result, this.code, options?.truncate);
|
|
48431
|
-
}
|
|
48432
|
-
return result.then((digest2) => createDigest(digest2, this.code, options?.truncate));
|
|
48433
|
-
} else {
|
|
48434
|
-
throw Error("Unknown type, must be binary type");
|
|
48435
|
-
}
|
|
48436
|
-
}
|
|
48437
|
-
};
|
|
48438
|
-
function createDigest(digest2, code2, truncate) {
|
|
48439
|
-
if (truncate != null && truncate !== digest2.byteLength) {
|
|
48440
|
-
if (truncate > digest2.byteLength) {
|
|
48441
|
-
throw new Error(`Invalid truncate option, must be less than or equal to ${digest2.byteLength}`);
|
|
48442
|
-
}
|
|
48443
|
-
digest2 = digest2.subarray(0, truncate);
|
|
48444
|
-
}
|
|
48445
|
-
return create(code2, digest2);
|
|
48446
|
-
}
|
|
48447
|
-
|
|
48448
|
-
// ../../node_modules/multiformats/dist/src/hashes/sha2.js
|
|
48449
|
-
var sha2563 = from2({
|
|
48450
|
-
name: "sha2-256",
|
|
48451
|
-
code: 18,
|
|
48452
|
-
encode: (input) => coerce2(crypto3.createHash("sha256").update(input).digest())
|
|
48453
|
-
});
|
|
48454
|
-
var sha5122 = from2({
|
|
48455
|
-
name: "sha2-512",
|
|
48456
|
-
code: 19,
|
|
48457
|
-
encode: (input) => coerce2(crypto3.createHash("sha512").update(input).digest())
|
|
48458
|
-
});
|
|
48459
|
-
|
|
48460
48014
|
// ../../node_modules/multiformats/dist/src/cid.js
|
|
48461
48015
|
function format(link, base3) {
|
|
48462
48016
|
const { bytes, version: version28 } = link;
|
|
@@ -48552,7 +48106,7 @@ var CID = class _CID {
|
|
|
48552
48106
|
}
|
|
48553
48107
|
static equals(self2, other) {
|
|
48554
48108
|
const unknown = other;
|
|
48555
|
-
return unknown != null && self2.code === unknown.code && self2.version === unknown.version &&
|
|
48109
|
+
return unknown != null && self2.code === unknown.code && self2.version === unknown.version && equals2(self2.multihash, unknown.multihash);
|
|
48556
48110
|
}
|
|
48557
48111
|
toString(base3) {
|
|
48558
48112
|
return format(this, base3);
|
|
@@ -48590,7 +48144,7 @@ var CID = class _CID {
|
|
|
48590
48144
|
return new _CID(version28, code2, multihash, bytes ?? encodeCID(version28, code2, multihash.bytes));
|
|
48591
48145
|
} else if (value[cidSymbol] === true) {
|
|
48592
48146
|
const { version: version28, multihash, code: code2 } = value;
|
|
48593
|
-
const digest2 =
|
|
48147
|
+
const digest2 = decode6(multihash);
|
|
48594
48148
|
return _CID.create(version28, code2, digest2);
|
|
48595
48149
|
} else {
|
|
48596
48150
|
return null;
|
|
@@ -48640,162 +48194,612 @@ var CID = class _CID {
|
|
|
48640
48194
|
static createV1(code2, digest2) {
|
|
48641
48195
|
return _CID.create(1, code2, digest2);
|
|
48642
48196
|
}
|
|
48643
|
-
/**
|
|
48644
|
-
* Decoded a CID from its binary representation. The byte array must contain
|
|
48645
|
-
* only the CID with no additional bytes.
|
|
48646
|
-
*
|
|
48647
|
-
* An error will be thrown if the bytes provided do not contain a valid
|
|
48648
|
-
* binary representation of a CID.
|
|
48649
|
-
*/
|
|
48650
|
-
static decode(bytes) {
|
|
48651
|
-
const [cid, remainder] = _CID.decodeFirst(bytes);
|
|
48652
|
-
if (remainder.length !== 0) {
|
|
48653
|
-
throw new Error("Incorrect length");
|
|
48654
|
-
}
|
|
48655
|
-
return cid;
|
|
48197
|
+
/**
|
|
48198
|
+
* Decoded a CID from its binary representation. The byte array must contain
|
|
48199
|
+
* only the CID with no additional bytes.
|
|
48200
|
+
*
|
|
48201
|
+
* An error will be thrown if the bytes provided do not contain a valid
|
|
48202
|
+
* binary representation of a CID.
|
|
48203
|
+
*/
|
|
48204
|
+
static decode(bytes) {
|
|
48205
|
+
const [cid, remainder] = _CID.decodeFirst(bytes);
|
|
48206
|
+
if (remainder.length !== 0) {
|
|
48207
|
+
throw new Error("Incorrect length");
|
|
48208
|
+
}
|
|
48209
|
+
return cid;
|
|
48210
|
+
}
|
|
48211
|
+
/**
|
|
48212
|
+
* Decoded a CID from its binary representation at the beginning of a byte
|
|
48213
|
+
* array.
|
|
48214
|
+
*
|
|
48215
|
+
* Returns an array with the first element containing the CID and the second
|
|
48216
|
+
* element containing the remainder of the original byte array. The remainder
|
|
48217
|
+
* will be a zero-length byte array if the provided bytes only contained a
|
|
48218
|
+
* binary CID representation.
|
|
48219
|
+
*/
|
|
48220
|
+
static decodeFirst(bytes) {
|
|
48221
|
+
const specs = _CID.inspectBytes(bytes);
|
|
48222
|
+
const prefixSize = specs.size - specs.multihashSize;
|
|
48223
|
+
const multihashBytes = coerce2(bytes.subarray(prefixSize, prefixSize + specs.multihashSize));
|
|
48224
|
+
if (multihashBytes.byteLength !== specs.multihashSize) {
|
|
48225
|
+
throw new Error("Incorrect length");
|
|
48226
|
+
}
|
|
48227
|
+
const digestBytes = multihashBytes.subarray(specs.multihashSize - specs.digestSize);
|
|
48228
|
+
const digest2 = new Digest(specs.multihashCode, specs.digestSize, digestBytes, multihashBytes);
|
|
48229
|
+
const cid = specs.version === 0 ? _CID.createV0(digest2) : _CID.createV1(specs.codec, digest2);
|
|
48230
|
+
return [cid, bytes.subarray(specs.size)];
|
|
48231
|
+
}
|
|
48232
|
+
/**
|
|
48233
|
+
* Inspect the initial bytes of a CID to determine its properties.
|
|
48234
|
+
*
|
|
48235
|
+
* Involves decoding up to 4 varints. Typically this will require only 4 to 6
|
|
48236
|
+
* bytes but for larger multicodec code values and larger multihash digest
|
|
48237
|
+
* lengths these varints can be quite large. It is recommended that at least
|
|
48238
|
+
* 10 bytes be made available in the `initialBytes` argument for a complete
|
|
48239
|
+
* inspection.
|
|
48240
|
+
*/
|
|
48241
|
+
static inspectBytes(initialBytes) {
|
|
48242
|
+
let offset = 0;
|
|
48243
|
+
const next = () => {
|
|
48244
|
+
const [i, length2] = decode5(initialBytes.subarray(offset));
|
|
48245
|
+
offset += length2;
|
|
48246
|
+
return i;
|
|
48247
|
+
};
|
|
48248
|
+
let version28 = next();
|
|
48249
|
+
let codec = DAG_PB_CODE;
|
|
48250
|
+
if (version28 === 18) {
|
|
48251
|
+
version28 = 0;
|
|
48252
|
+
offset = 0;
|
|
48253
|
+
} else {
|
|
48254
|
+
codec = next();
|
|
48255
|
+
}
|
|
48256
|
+
if (version28 !== 0 && version28 !== 1) {
|
|
48257
|
+
throw new RangeError(`Invalid CID version ${version28}`);
|
|
48258
|
+
}
|
|
48259
|
+
const prefixSize = offset;
|
|
48260
|
+
const multihashCode = next();
|
|
48261
|
+
const digestSize = next();
|
|
48262
|
+
const size = offset + digestSize;
|
|
48263
|
+
const multihashSize = size - prefixSize;
|
|
48264
|
+
return { version: version28, codec, multihashCode, digestSize, multihashSize, size };
|
|
48265
|
+
}
|
|
48266
|
+
/**
|
|
48267
|
+
* Takes cid in a string representation and creates an instance. If `base`
|
|
48268
|
+
* decoder is not provided will use a default from the configuration. It will
|
|
48269
|
+
* throw an error if encoding of the CID is not compatible with supplied (or
|
|
48270
|
+
* a default decoder).
|
|
48271
|
+
*/
|
|
48272
|
+
static parse(source, base3) {
|
|
48273
|
+
const [prefix, bytes] = parseCIDtoBytes(source, base3);
|
|
48274
|
+
const cid = _CID.decode(bytes);
|
|
48275
|
+
if (cid.version === 0 && source[0] !== "Q") {
|
|
48276
|
+
throw Error("Version 0 CID string must not include multibase prefix");
|
|
48277
|
+
}
|
|
48278
|
+
baseCache(cid).set(prefix, source);
|
|
48279
|
+
return cid;
|
|
48280
|
+
}
|
|
48281
|
+
};
|
|
48282
|
+
function parseCIDtoBytes(source, base3) {
|
|
48283
|
+
switch (source[0]) {
|
|
48284
|
+
// CIDv0 is parsed differently
|
|
48285
|
+
case "Q": {
|
|
48286
|
+
const decoder = base3 ?? base58btc;
|
|
48287
|
+
return [
|
|
48288
|
+
base58btc.prefix,
|
|
48289
|
+
decoder.decode(`${base58btc.prefix}${source}`)
|
|
48290
|
+
];
|
|
48291
|
+
}
|
|
48292
|
+
case base58btc.prefix: {
|
|
48293
|
+
const decoder = base3 ?? base58btc;
|
|
48294
|
+
return [base58btc.prefix, decoder.decode(source)];
|
|
48295
|
+
}
|
|
48296
|
+
case base32.prefix: {
|
|
48297
|
+
const decoder = base3 ?? base32;
|
|
48298
|
+
return [base32.prefix, decoder.decode(source)];
|
|
48299
|
+
}
|
|
48300
|
+
case base36.prefix: {
|
|
48301
|
+
const decoder = base3 ?? base36;
|
|
48302
|
+
return [base36.prefix, decoder.decode(source)];
|
|
48303
|
+
}
|
|
48304
|
+
default: {
|
|
48305
|
+
if (base3 == null) {
|
|
48306
|
+
throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");
|
|
48307
|
+
}
|
|
48308
|
+
return [source[0], base3.decode(source)];
|
|
48309
|
+
}
|
|
48310
|
+
}
|
|
48311
|
+
}
|
|
48312
|
+
function toStringV0(bytes, cache2, base3) {
|
|
48313
|
+
const { prefix } = base3;
|
|
48314
|
+
if (prefix !== base58btc.prefix) {
|
|
48315
|
+
throw Error(`Cannot string encode V0 in ${base3.name} encoding`);
|
|
48316
|
+
}
|
|
48317
|
+
const cid = cache2.get(prefix);
|
|
48318
|
+
if (cid == null) {
|
|
48319
|
+
const cid2 = base3.encode(bytes).slice(1);
|
|
48320
|
+
cache2.set(prefix, cid2);
|
|
48321
|
+
return cid2;
|
|
48322
|
+
} else {
|
|
48323
|
+
return cid;
|
|
48324
|
+
}
|
|
48325
|
+
}
|
|
48326
|
+
function toStringV1(bytes, cache2, base3) {
|
|
48327
|
+
const { prefix } = base3;
|
|
48328
|
+
const cid = cache2.get(prefix);
|
|
48329
|
+
if (cid == null) {
|
|
48330
|
+
const cid2 = base3.encode(bytes);
|
|
48331
|
+
cache2.set(prefix, cid2);
|
|
48332
|
+
return cid2;
|
|
48333
|
+
} else {
|
|
48334
|
+
return cid;
|
|
48335
|
+
}
|
|
48336
|
+
}
|
|
48337
|
+
var DAG_PB_CODE = 112;
|
|
48338
|
+
var SHA_256_CODE = 18;
|
|
48339
|
+
function encodeCID(version28, code2, multihash) {
|
|
48340
|
+
const codeOffset = encodingLength(version28);
|
|
48341
|
+
const hashOffset = codeOffset + encodingLength(code2);
|
|
48342
|
+
const bytes = new Uint8Array(hashOffset + multihash.byteLength);
|
|
48343
|
+
encodeTo(version28, bytes, 0);
|
|
48344
|
+
encodeTo(code2, bytes, codeOffset);
|
|
48345
|
+
bytes.set(multihash, hashOffset);
|
|
48346
|
+
return bytes;
|
|
48347
|
+
}
|
|
48348
|
+
var cidSymbol = /* @__PURE__ */ Symbol.for("@ipld/js-cid/CID");
|
|
48349
|
+
|
|
48350
|
+
// ../../node_modules/multiformats/dist/src/bases/base10.js
|
|
48351
|
+
var base10_exports = {};
|
|
48352
|
+
__export(base10_exports, {
|
|
48353
|
+
base10: () => base10
|
|
48354
|
+
});
|
|
48355
|
+
var base10 = baseX({
|
|
48356
|
+
prefix: "9",
|
|
48357
|
+
name: "base10",
|
|
48358
|
+
alphabet: "0123456789"
|
|
48359
|
+
});
|
|
48360
|
+
|
|
48361
|
+
// ../../node_modules/multiformats/dist/src/bases/base16.js
|
|
48362
|
+
var base16_exports = {};
|
|
48363
|
+
__export(base16_exports, {
|
|
48364
|
+
base16: () => base16,
|
|
48365
|
+
base16upper: () => base16upper
|
|
48366
|
+
});
|
|
48367
|
+
var base16 = rfc4648({
|
|
48368
|
+
prefix: "f",
|
|
48369
|
+
name: "base16",
|
|
48370
|
+
alphabet: "0123456789abcdef",
|
|
48371
|
+
bitsPerChar: 4
|
|
48372
|
+
});
|
|
48373
|
+
var base16upper = rfc4648({
|
|
48374
|
+
prefix: "F",
|
|
48375
|
+
name: "base16upper",
|
|
48376
|
+
alphabet: "0123456789ABCDEF",
|
|
48377
|
+
bitsPerChar: 4
|
|
48378
|
+
});
|
|
48379
|
+
|
|
48380
|
+
// ../../node_modules/multiformats/dist/src/bases/base2.js
|
|
48381
|
+
var base2_exports = {};
|
|
48382
|
+
__export(base2_exports, {
|
|
48383
|
+
base2: () => base22
|
|
48384
|
+
});
|
|
48385
|
+
var base22 = rfc4648({
|
|
48386
|
+
prefix: "0",
|
|
48387
|
+
name: "base2",
|
|
48388
|
+
alphabet: "01",
|
|
48389
|
+
bitsPerChar: 1
|
|
48390
|
+
});
|
|
48391
|
+
|
|
48392
|
+
// ../../node_modules/multiformats/dist/src/bases/base256emoji.js
|
|
48393
|
+
var base256emoji_exports = {};
|
|
48394
|
+
__export(base256emoji_exports, {
|
|
48395
|
+
base256emoji: () => base256emoji
|
|
48396
|
+
});
|
|
48397
|
+
var alphabet = Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}");
|
|
48398
|
+
var alphabetBytesToChars = alphabet.reduce((p, c, i) => {
|
|
48399
|
+
p[i] = c;
|
|
48400
|
+
return p;
|
|
48401
|
+
}, []);
|
|
48402
|
+
var alphabetCharsToBytes = alphabet.reduce((p, c, i) => {
|
|
48403
|
+
const codePoint = c.codePointAt(0);
|
|
48404
|
+
if (codePoint == null) {
|
|
48405
|
+
throw new Error(`Invalid character: ${c}`);
|
|
48406
|
+
}
|
|
48407
|
+
p[codePoint] = i;
|
|
48408
|
+
return p;
|
|
48409
|
+
}, []);
|
|
48410
|
+
function encode6(data) {
|
|
48411
|
+
return data.reduce((p, c) => {
|
|
48412
|
+
p += alphabetBytesToChars[c];
|
|
48413
|
+
return p;
|
|
48414
|
+
}, "");
|
|
48415
|
+
}
|
|
48416
|
+
function decode7(str) {
|
|
48417
|
+
const byts = [];
|
|
48418
|
+
for (const char of str) {
|
|
48419
|
+
const codePoint = char.codePointAt(0);
|
|
48420
|
+
if (codePoint == null) {
|
|
48421
|
+
throw new Error(`Invalid character: ${char}`);
|
|
48422
|
+
}
|
|
48423
|
+
const byt = alphabetCharsToBytes[codePoint];
|
|
48424
|
+
if (byt == null) {
|
|
48425
|
+
throw new Error(`Non-base256emoji character: ${char}`);
|
|
48426
|
+
}
|
|
48427
|
+
byts.push(byt);
|
|
48428
|
+
}
|
|
48429
|
+
return new Uint8Array(byts);
|
|
48430
|
+
}
|
|
48431
|
+
var base256emoji = from({
|
|
48432
|
+
prefix: "\u{1F680}",
|
|
48433
|
+
name: "base256emoji",
|
|
48434
|
+
encode: encode6,
|
|
48435
|
+
decode: decode7
|
|
48436
|
+
});
|
|
48437
|
+
|
|
48438
|
+
// ../../node_modules/multiformats/dist/src/bases/base64.js
|
|
48439
|
+
var base64_exports = {};
|
|
48440
|
+
__export(base64_exports, {
|
|
48441
|
+
base64: () => base64,
|
|
48442
|
+
base64pad: () => base64pad,
|
|
48443
|
+
base64url: () => base64url,
|
|
48444
|
+
base64urlpad: () => base64urlpad
|
|
48445
|
+
});
|
|
48446
|
+
var base64 = rfc4648({
|
|
48447
|
+
prefix: "m",
|
|
48448
|
+
name: "base64",
|
|
48449
|
+
alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
|
|
48450
|
+
bitsPerChar: 6
|
|
48451
|
+
});
|
|
48452
|
+
var base64pad = rfc4648({
|
|
48453
|
+
prefix: "M",
|
|
48454
|
+
name: "base64pad",
|
|
48455
|
+
alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
|
|
48456
|
+
bitsPerChar: 6
|
|
48457
|
+
});
|
|
48458
|
+
var base64url = rfc4648({
|
|
48459
|
+
prefix: "u",
|
|
48460
|
+
name: "base64url",
|
|
48461
|
+
alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",
|
|
48462
|
+
bitsPerChar: 6
|
|
48463
|
+
});
|
|
48464
|
+
var base64urlpad = rfc4648({
|
|
48465
|
+
prefix: "U",
|
|
48466
|
+
name: "base64urlpad",
|
|
48467
|
+
alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",
|
|
48468
|
+
bitsPerChar: 6
|
|
48469
|
+
});
|
|
48470
|
+
|
|
48471
|
+
// ../../node_modules/multiformats/dist/src/bases/base8.js
|
|
48472
|
+
var base8_exports = {};
|
|
48473
|
+
__export(base8_exports, {
|
|
48474
|
+
base8: () => base8
|
|
48475
|
+
});
|
|
48476
|
+
var base8 = rfc4648({
|
|
48477
|
+
prefix: "7",
|
|
48478
|
+
name: "base8",
|
|
48479
|
+
alphabet: "01234567",
|
|
48480
|
+
bitsPerChar: 3
|
|
48481
|
+
});
|
|
48482
|
+
|
|
48483
|
+
// ../../node_modules/multiformats/dist/src/bases/identity.js
|
|
48484
|
+
var identity_exports = {};
|
|
48485
|
+
__export(identity_exports, {
|
|
48486
|
+
identity: () => identity
|
|
48487
|
+
});
|
|
48488
|
+
var identity = from({
|
|
48489
|
+
prefix: "\0",
|
|
48490
|
+
name: "identity",
|
|
48491
|
+
encode: (buf) => toString(buf),
|
|
48492
|
+
decode: (str) => fromString(str)
|
|
48493
|
+
});
|
|
48494
|
+
|
|
48495
|
+
// ../../node_modules/multiformats/dist/src/codecs/json.js
|
|
48496
|
+
var textEncoder = new TextEncoder();
|
|
48497
|
+
var textDecoder = new TextDecoder();
|
|
48498
|
+
|
|
48499
|
+
// ../../node_modules/multiformats/dist/src/hashes/identity.js
|
|
48500
|
+
var identity_exports2 = {};
|
|
48501
|
+
__export(identity_exports2, {
|
|
48502
|
+
identity: () => identity2
|
|
48503
|
+
});
|
|
48504
|
+
var code = 0;
|
|
48505
|
+
var name = "identity";
|
|
48506
|
+
var encode7 = coerce2;
|
|
48507
|
+
function digest(input, options) {
|
|
48508
|
+
if (options?.truncate != null && options.truncate !== input.byteLength) {
|
|
48509
|
+
if (options.truncate < 0 || options.truncate > input.byteLength) {
|
|
48510
|
+
throw new Error(`Invalid truncate option, must be less than or equal to ${input.byteLength}`);
|
|
48511
|
+
}
|
|
48512
|
+
input = input.subarray(0, options.truncate);
|
|
48513
|
+
}
|
|
48514
|
+
return create(code, encode7(input));
|
|
48515
|
+
}
|
|
48516
|
+
var identity2 = { code, name, encode: encode7, digest };
|
|
48517
|
+
|
|
48518
|
+
// ../../node_modules/multiformats/dist/src/hashes/sha2.js
|
|
48519
|
+
var sha2_exports = {};
|
|
48520
|
+
__export(sha2_exports, {
|
|
48521
|
+
sha256: () => sha2563,
|
|
48522
|
+
sha512: () => sha5122
|
|
48523
|
+
});
|
|
48524
|
+
import crypto3 from "crypto";
|
|
48525
|
+
|
|
48526
|
+
// ../../node_modules/multiformats/dist/src/hashes/hasher.js
|
|
48527
|
+
var DEFAULT_MIN_DIGEST_LENGTH = 20;
|
|
48528
|
+
function from2({ name: name2, code: code2, encode: encode8, minDigestLength, maxDigestLength }) {
|
|
48529
|
+
return new Hasher(name2, code2, encode8, minDigestLength, maxDigestLength);
|
|
48530
|
+
}
|
|
48531
|
+
var Hasher = class {
|
|
48532
|
+
name;
|
|
48533
|
+
code;
|
|
48534
|
+
encode;
|
|
48535
|
+
minDigestLength;
|
|
48536
|
+
maxDigestLength;
|
|
48537
|
+
constructor(name2, code2, encode8, minDigestLength, maxDigestLength) {
|
|
48538
|
+
this.name = name2;
|
|
48539
|
+
this.code = code2;
|
|
48540
|
+
this.encode = encode8;
|
|
48541
|
+
this.minDigestLength = minDigestLength ?? DEFAULT_MIN_DIGEST_LENGTH;
|
|
48542
|
+
this.maxDigestLength = maxDigestLength;
|
|
48543
|
+
}
|
|
48544
|
+
digest(input, options) {
|
|
48545
|
+
if (options?.truncate != null) {
|
|
48546
|
+
if (options.truncate < this.minDigestLength) {
|
|
48547
|
+
throw new Error(`Invalid truncate option, must be greater than or equal to ${this.minDigestLength}`);
|
|
48548
|
+
}
|
|
48549
|
+
if (this.maxDigestLength != null && options.truncate > this.maxDigestLength) {
|
|
48550
|
+
throw new Error(`Invalid truncate option, must be less than or equal to ${this.maxDigestLength}`);
|
|
48551
|
+
}
|
|
48552
|
+
}
|
|
48553
|
+
if (input instanceof Uint8Array) {
|
|
48554
|
+
const result = this.encode(input);
|
|
48555
|
+
if (result instanceof Uint8Array) {
|
|
48556
|
+
return createDigest(result, this.code, options?.truncate);
|
|
48557
|
+
}
|
|
48558
|
+
return result.then((digest2) => createDigest(digest2, this.code, options?.truncate));
|
|
48559
|
+
} else {
|
|
48560
|
+
throw Error("Unknown type, must be binary type");
|
|
48561
|
+
}
|
|
48562
|
+
}
|
|
48563
|
+
};
|
|
48564
|
+
function createDigest(digest2, code2, truncate) {
|
|
48565
|
+
if (truncate != null && truncate !== digest2.byteLength) {
|
|
48566
|
+
if (truncate > digest2.byteLength) {
|
|
48567
|
+
throw new Error(`Invalid truncate option, must be less than or equal to ${digest2.byteLength}`);
|
|
48568
|
+
}
|
|
48569
|
+
digest2 = digest2.subarray(0, truncate);
|
|
48570
|
+
}
|
|
48571
|
+
return create(code2, digest2);
|
|
48572
|
+
}
|
|
48573
|
+
|
|
48574
|
+
// ../../node_modules/multiformats/dist/src/hashes/sha2.js
|
|
48575
|
+
var sha2563 = from2({
|
|
48576
|
+
name: "sha2-256",
|
|
48577
|
+
code: 18,
|
|
48578
|
+
encode: (input) => coerce2(crypto3.createHash("sha256").update(input).digest())
|
|
48579
|
+
});
|
|
48580
|
+
var sha5122 = from2({
|
|
48581
|
+
name: "sha2-512",
|
|
48582
|
+
code: 19,
|
|
48583
|
+
encode: (input) => coerce2(crypto3.createHash("sha512").update(input).digest())
|
|
48584
|
+
});
|
|
48585
|
+
|
|
48586
|
+
// ../../node_modules/multiformats/dist/src/basics.js
|
|
48587
|
+
var bases = { ...identity_exports, ...base2_exports, ...base8_exports, ...base10_exports, ...base16_exports, ...base32_exports, ...base36_exports, ...base58_exports, ...base64_exports, ...base256emoji_exports };
|
|
48588
|
+
var hashes = { ...sha2_exports, ...identity_exports2 };
|
|
48589
|
+
|
|
48590
|
+
// ../sdk-core/dist/index.js
|
|
48591
|
+
var import_ms2 = __toESM(require_ms(), 1);
|
|
48592
|
+
|
|
48593
|
+
// ../../node_modules/uint8arrays/dist/src/equals.js
|
|
48594
|
+
function equals3(a, b) {
|
|
48595
|
+
if (a === b) {
|
|
48596
|
+
return true;
|
|
48597
|
+
}
|
|
48598
|
+
if (a.byteLength !== b.byteLength) {
|
|
48599
|
+
return false;
|
|
48600
|
+
}
|
|
48601
|
+
for (let i = 0; i < a.byteLength; i++) {
|
|
48602
|
+
if (a[i] !== b[i]) {
|
|
48603
|
+
return false;
|
|
48604
|
+
}
|
|
48605
|
+
}
|
|
48606
|
+
return true;
|
|
48607
|
+
}
|
|
48608
|
+
|
|
48609
|
+
// ../../node_modules/uint8arrays/dist/src/alloc.node.js
|
|
48610
|
+
import { Buffer as Buffer2 } from "buffer";
|
|
48611
|
+
|
|
48612
|
+
// ../../node_modules/uint8arrays/dist/src/util/as-uint8array.node.js
|
|
48613
|
+
function asUint8Array(buf) {
|
|
48614
|
+
return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);
|
|
48615
|
+
}
|
|
48616
|
+
|
|
48617
|
+
// ../../node_modules/uint8arrays/dist/src/alloc.node.js
|
|
48618
|
+
function allocUnsafe(size = 0) {
|
|
48619
|
+
return asUint8Array(Buffer2.allocUnsafe(size));
|
|
48620
|
+
}
|
|
48621
|
+
|
|
48622
|
+
// ../../node_modules/uint8-varint/dist/src/index.js
|
|
48623
|
+
var N12 = Math.pow(2, 7);
|
|
48624
|
+
var N22 = Math.pow(2, 14);
|
|
48625
|
+
var N32 = Math.pow(2, 21);
|
|
48626
|
+
var N42 = Math.pow(2, 28);
|
|
48627
|
+
var N52 = Math.pow(2, 35);
|
|
48628
|
+
var N62 = Math.pow(2, 42);
|
|
48629
|
+
var N72 = Math.pow(2, 49);
|
|
48630
|
+
var MSB2 = 128;
|
|
48631
|
+
var REST2 = 127;
|
|
48632
|
+
function encodingLength2(value) {
|
|
48633
|
+
if (value < N12) {
|
|
48634
|
+
return 1;
|
|
48635
|
+
}
|
|
48636
|
+
if (value < N22) {
|
|
48637
|
+
return 2;
|
|
48638
|
+
}
|
|
48639
|
+
if (value < N32) {
|
|
48640
|
+
return 3;
|
|
48641
|
+
}
|
|
48642
|
+
if (value < N42) {
|
|
48643
|
+
return 4;
|
|
48644
|
+
}
|
|
48645
|
+
if (value < N52) {
|
|
48646
|
+
return 5;
|
|
48647
|
+
}
|
|
48648
|
+
if (value < N62) {
|
|
48649
|
+
return 6;
|
|
48656
48650
|
}
|
|
48657
|
-
|
|
48658
|
-
|
|
48659
|
-
* array.
|
|
48660
|
-
*
|
|
48661
|
-
* Returns an array with the first element containing the CID and the second
|
|
48662
|
-
* element containing the remainder of the original byte array. The remainder
|
|
48663
|
-
* will be a zero-length byte array if the provided bytes only contained a
|
|
48664
|
-
* binary CID representation.
|
|
48665
|
-
*/
|
|
48666
|
-
static decodeFirst(bytes) {
|
|
48667
|
-
const specs = _CID.inspectBytes(bytes);
|
|
48668
|
-
const prefixSize = specs.size - specs.multihashSize;
|
|
48669
|
-
const multihashBytes = coerce2(bytes.subarray(prefixSize, prefixSize + specs.multihashSize));
|
|
48670
|
-
if (multihashBytes.byteLength !== specs.multihashSize) {
|
|
48671
|
-
throw new Error("Incorrect length");
|
|
48672
|
-
}
|
|
48673
|
-
const digestBytes = multihashBytes.subarray(specs.multihashSize - specs.digestSize);
|
|
48674
|
-
const digest2 = new Digest(specs.multihashCode, specs.digestSize, digestBytes, multihashBytes);
|
|
48675
|
-
const cid = specs.version === 0 ? _CID.createV0(digest2) : _CID.createV1(specs.codec, digest2);
|
|
48676
|
-
return [cid, bytes.subarray(specs.size)];
|
|
48651
|
+
if (value < N72) {
|
|
48652
|
+
return 7;
|
|
48677
48653
|
}
|
|
48678
|
-
|
|
48679
|
-
|
|
48680
|
-
|
|
48681
|
-
|
|
48682
|
-
|
|
48683
|
-
|
|
48684
|
-
|
|
48685
|
-
|
|
48686
|
-
|
|
48687
|
-
|
|
48688
|
-
let offset = 0;
|
|
48689
|
-
const next = () => {
|
|
48690
|
-
const [i, length2] = decode7(initialBytes.subarray(offset));
|
|
48691
|
-
offset += length2;
|
|
48692
|
-
return i;
|
|
48693
|
-
};
|
|
48694
|
-
let version28 = next();
|
|
48695
|
-
let codec = DAG_PB_CODE;
|
|
48696
|
-
if (version28 === 18) {
|
|
48697
|
-
version28 = 0;
|
|
48698
|
-
offset = 0;
|
|
48699
|
-
} else {
|
|
48700
|
-
codec = next();
|
|
48654
|
+
if (Number.MAX_SAFE_INTEGER != null && value > Number.MAX_SAFE_INTEGER) {
|
|
48655
|
+
throw new RangeError("Could not encode varint");
|
|
48656
|
+
}
|
|
48657
|
+
return 8;
|
|
48658
|
+
}
|
|
48659
|
+
function encodeUint8Array(value, buf, offset = 0) {
|
|
48660
|
+
switch (encodingLength2(value)) {
|
|
48661
|
+
case 8: {
|
|
48662
|
+
buf[offset++] = value & 255 | MSB2;
|
|
48663
|
+
value /= 128;
|
|
48701
48664
|
}
|
|
48702
|
-
|
|
48703
|
-
|
|
48665
|
+
case 7: {
|
|
48666
|
+
buf[offset++] = value & 255 | MSB2;
|
|
48667
|
+
value /= 128;
|
|
48704
48668
|
}
|
|
48705
|
-
|
|
48706
|
-
|
|
48707
|
-
|
|
48708
|
-
const size = offset + digestSize;
|
|
48709
|
-
const multihashSize = size - prefixSize;
|
|
48710
|
-
return { version: version28, codec, multihashCode, digestSize, multihashSize, size };
|
|
48711
|
-
}
|
|
48712
|
-
/**
|
|
48713
|
-
* Takes cid in a string representation and creates an instance. If `base`
|
|
48714
|
-
* decoder is not provided will use a default from the configuration. It will
|
|
48715
|
-
* throw an error if encoding of the CID is not compatible with supplied (or
|
|
48716
|
-
* a default decoder).
|
|
48717
|
-
*/
|
|
48718
|
-
static parse(source, base3) {
|
|
48719
|
-
const [prefix, bytes] = parseCIDtoBytes(source, base3);
|
|
48720
|
-
const cid = _CID.decode(bytes);
|
|
48721
|
-
if (cid.version === 0 && source[0] !== "Q") {
|
|
48722
|
-
throw Error("Version 0 CID string must not include multibase prefix");
|
|
48669
|
+
case 6: {
|
|
48670
|
+
buf[offset++] = value & 255 | MSB2;
|
|
48671
|
+
value /= 128;
|
|
48723
48672
|
}
|
|
48724
|
-
|
|
48725
|
-
|
|
48726
|
-
|
|
48727
|
-
};
|
|
48728
|
-
function parseCIDtoBytes(source, base3) {
|
|
48729
|
-
switch (source[0]) {
|
|
48730
|
-
// CIDv0 is parsed differently
|
|
48731
|
-
case "Q": {
|
|
48732
|
-
const decoder = base3 ?? base58btc;
|
|
48733
|
-
return [
|
|
48734
|
-
base58btc.prefix,
|
|
48735
|
-
decoder.decode(`${base58btc.prefix}${source}`)
|
|
48736
|
-
];
|
|
48673
|
+
case 5: {
|
|
48674
|
+
buf[offset++] = value & 255 | MSB2;
|
|
48675
|
+
value /= 128;
|
|
48737
48676
|
}
|
|
48738
|
-
case
|
|
48739
|
-
|
|
48740
|
-
|
|
48677
|
+
case 4: {
|
|
48678
|
+
buf[offset++] = value & 255 | MSB2;
|
|
48679
|
+
value >>>= 7;
|
|
48741
48680
|
}
|
|
48742
|
-
case
|
|
48743
|
-
|
|
48744
|
-
|
|
48681
|
+
case 3: {
|
|
48682
|
+
buf[offset++] = value & 255 | MSB2;
|
|
48683
|
+
value >>>= 7;
|
|
48745
48684
|
}
|
|
48746
|
-
case
|
|
48747
|
-
|
|
48748
|
-
|
|
48685
|
+
case 2: {
|
|
48686
|
+
buf[offset++] = value & 255 | MSB2;
|
|
48687
|
+
value >>>= 7;
|
|
48749
48688
|
}
|
|
48750
|
-
|
|
48751
|
-
|
|
48752
|
-
|
|
48753
|
-
|
|
48754
|
-
return [source[0], base3.decode(source)];
|
|
48689
|
+
case 1: {
|
|
48690
|
+
buf[offset++] = value & 255;
|
|
48691
|
+
value >>>= 7;
|
|
48692
|
+
break;
|
|
48755
48693
|
}
|
|
48694
|
+
default:
|
|
48695
|
+
throw new Error("unreachable");
|
|
48756
48696
|
}
|
|
48697
|
+
return buf;
|
|
48757
48698
|
}
|
|
48758
|
-
function
|
|
48759
|
-
|
|
48760
|
-
|
|
48761
|
-
|
|
48699
|
+
function decodeUint8Array(buf, offset) {
|
|
48700
|
+
let b = buf[offset];
|
|
48701
|
+
let res = 0;
|
|
48702
|
+
res += b & REST2;
|
|
48703
|
+
if (b < MSB2) {
|
|
48704
|
+
return res;
|
|
48762
48705
|
}
|
|
48763
|
-
|
|
48764
|
-
|
|
48765
|
-
|
|
48766
|
-
|
|
48767
|
-
|
|
48768
|
-
|
|
48769
|
-
|
|
48706
|
+
b = buf[offset + 1];
|
|
48707
|
+
res += (b & REST2) << 7;
|
|
48708
|
+
if (b < MSB2) {
|
|
48709
|
+
return res;
|
|
48710
|
+
}
|
|
48711
|
+
b = buf[offset + 2];
|
|
48712
|
+
res += (b & REST2) << 14;
|
|
48713
|
+
if (b < MSB2) {
|
|
48714
|
+
return res;
|
|
48715
|
+
}
|
|
48716
|
+
b = buf[offset + 3];
|
|
48717
|
+
res += (b & REST2) << 21;
|
|
48718
|
+
if (b < MSB2) {
|
|
48719
|
+
return res;
|
|
48720
|
+
}
|
|
48721
|
+
b = buf[offset + 4];
|
|
48722
|
+
res += (b & REST2) * N42;
|
|
48723
|
+
if (b < MSB2) {
|
|
48724
|
+
return res;
|
|
48725
|
+
}
|
|
48726
|
+
b = buf[offset + 5];
|
|
48727
|
+
res += (b & REST2) * N52;
|
|
48728
|
+
if (b < MSB2) {
|
|
48729
|
+
return res;
|
|
48730
|
+
}
|
|
48731
|
+
b = buf[offset + 6];
|
|
48732
|
+
res += (b & REST2) * N62;
|
|
48733
|
+
if (b < MSB2) {
|
|
48734
|
+
return res;
|
|
48770
48735
|
}
|
|
48736
|
+
b = buf[offset + 7];
|
|
48737
|
+
res += (b & REST2) * N72;
|
|
48738
|
+
if (b < MSB2) {
|
|
48739
|
+
return res;
|
|
48740
|
+
}
|
|
48741
|
+
throw new RangeError("Could not decode varint");
|
|
48771
48742
|
}
|
|
48772
|
-
function
|
|
48773
|
-
|
|
48774
|
-
|
|
48775
|
-
|
|
48776
|
-
|
|
48777
|
-
|
|
48778
|
-
|
|
48743
|
+
function decodeUint8ArrayList(buf, offset) {
|
|
48744
|
+
let b = buf.get(offset);
|
|
48745
|
+
let res = 0;
|
|
48746
|
+
res += b & REST2;
|
|
48747
|
+
if (b < MSB2) {
|
|
48748
|
+
return res;
|
|
48749
|
+
}
|
|
48750
|
+
b = buf.get(offset + 1);
|
|
48751
|
+
res += (b & REST2) << 7;
|
|
48752
|
+
if (b < MSB2) {
|
|
48753
|
+
return res;
|
|
48754
|
+
}
|
|
48755
|
+
b = buf.get(offset + 2);
|
|
48756
|
+
res += (b & REST2) << 14;
|
|
48757
|
+
if (b < MSB2) {
|
|
48758
|
+
return res;
|
|
48759
|
+
}
|
|
48760
|
+
b = buf.get(offset + 3);
|
|
48761
|
+
res += (b & REST2) << 21;
|
|
48762
|
+
if (b < MSB2) {
|
|
48763
|
+
return res;
|
|
48764
|
+
}
|
|
48765
|
+
b = buf.get(offset + 4);
|
|
48766
|
+
res += (b & REST2) * N42;
|
|
48767
|
+
if (b < MSB2) {
|
|
48768
|
+
return res;
|
|
48769
|
+
}
|
|
48770
|
+
b = buf.get(offset + 5);
|
|
48771
|
+
res += (b & REST2) * N52;
|
|
48772
|
+
if (b < MSB2) {
|
|
48773
|
+
return res;
|
|
48774
|
+
}
|
|
48775
|
+
b = buf.get(offset + 6);
|
|
48776
|
+
res += (b & REST2) * N62;
|
|
48777
|
+
if (b < MSB2) {
|
|
48778
|
+
return res;
|
|
48779
|
+
}
|
|
48780
|
+
b = buf.get(offset + 7);
|
|
48781
|
+
res += (b & REST2) * N72;
|
|
48782
|
+
if (b < MSB2) {
|
|
48783
|
+
return res;
|
|
48784
|
+
}
|
|
48785
|
+
throw new RangeError("Could not decode varint");
|
|
48786
|
+
}
|
|
48787
|
+
function decode8(buf, offset = 0) {
|
|
48788
|
+
if (buf instanceof Uint8Array) {
|
|
48789
|
+
return decodeUint8Array(buf, offset);
|
|
48779
48790
|
} else {
|
|
48780
|
-
return
|
|
48791
|
+
return decodeUint8ArrayList(buf, offset);
|
|
48781
48792
|
}
|
|
48782
48793
|
}
|
|
48783
|
-
|
|
48784
|
-
|
|
48785
|
-
|
|
48786
|
-
|
|
48787
|
-
|
|
48788
|
-
const bytes = new Uint8Array(hashOffset + multihash.byteLength);
|
|
48789
|
-
encodeTo(version28, bytes, 0);
|
|
48790
|
-
encodeTo(code2, bytes, codeOffset);
|
|
48791
|
-
bytes.set(multihash, hashOffset);
|
|
48792
|
-
return bytes;
|
|
48794
|
+
|
|
48795
|
+
// ../../node_modules/uint8arrays/dist/src/concat.node.js
|
|
48796
|
+
import { Buffer as Buffer3 } from "buffer";
|
|
48797
|
+
function concat2(arrays, length2) {
|
|
48798
|
+
return asUint8Array(Buffer3.concat(arrays, length2));
|
|
48793
48799
|
}
|
|
48794
|
-
var cidSymbol = /* @__PURE__ */ Symbol.for("@ipld/js-cid/CID");
|
|
48795
48800
|
|
|
48796
|
-
// ../../node_modules/
|
|
48797
|
-
|
|
48798
|
-
var hashes = { ...sha2_exports, ...identity_exports2 };
|
|
48801
|
+
// ../../node_modules/uint8arrays/dist/src/from-string.node.js
|
|
48802
|
+
import { Buffer as Buffer4 } from "buffer";
|
|
48799
48803
|
|
|
48800
48804
|
// ../../node_modules/uint8arrays/dist/src/util/bases.js
|
|
48801
48805
|
function createCodec(name2, prefix, encode8, decode9) {
|
|
@@ -49367,13 +49371,13 @@ function bytesToComponents(bytes) {
|
|
|
49367
49371
|
const components = [];
|
|
49368
49372
|
let i = 0;
|
|
49369
49373
|
while (i < bytes.length) {
|
|
49370
|
-
const code2 =
|
|
49374
|
+
const code2 = decode8(bytes, i);
|
|
49371
49375
|
const codec = registry.getProtocol(code2);
|
|
49372
|
-
const codeLength =
|
|
49376
|
+
const codeLength = encodingLength2(code2);
|
|
49373
49377
|
const size = sizeForAddr(codec, bytes, i + codeLength);
|
|
49374
49378
|
let sizeLength = 0;
|
|
49375
49379
|
if (size > 0 && codec.size === V) {
|
|
49376
|
-
sizeLength =
|
|
49380
|
+
sizeLength = encodingLength2(size);
|
|
49377
49381
|
}
|
|
49378
49382
|
const componentLength = codeLength + sizeLength + size;
|
|
49379
49383
|
const component = {
|
|
@@ -49397,7 +49401,7 @@ function componentsToBytes(components) {
|
|
|
49397
49401
|
for (const component of components) {
|
|
49398
49402
|
if (component.bytes == null) {
|
|
49399
49403
|
const codec = registry.getProtocol(component.code);
|
|
49400
|
-
const codecLength =
|
|
49404
|
+
const codecLength = encodingLength2(component.code);
|
|
49401
49405
|
let valueBytes;
|
|
49402
49406
|
let valueLength = 0;
|
|
49403
49407
|
let valueLengthLength = 0;
|
|
@@ -49405,7 +49409,7 @@ function componentsToBytes(components) {
|
|
|
49405
49409
|
valueBytes = codec.valueToBytes?.(component.value) ?? fromString2(component.value);
|
|
49406
49410
|
valueLength = valueBytes.byteLength;
|
|
49407
49411
|
if (codec.size === V) {
|
|
49408
|
-
valueLengthLength =
|
|
49412
|
+
valueLengthLength = encodingLength2(valueLength);
|
|
49409
49413
|
}
|
|
49410
49414
|
}
|
|
49411
49415
|
const bytes3 = new Uint8Array(codecLength + valueLengthLength + valueLength);
|
|
@@ -49505,7 +49509,7 @@ function sizeForAddr(codec, bytes, offset) {
|
|
|
49505
49509
|
if (codec.size > 0) {
|
|
49506
49510
|
return codec.size / 8;
|
|
49507
49511
|
}
|
|
49508
|
-
return
|
|
49512
|
+
return decode8(bytes, offset);
|
|
49509
49513
|
}
|
|
49510
49514
|
|
|
49511
49515
|
// ../../node_modules/@multiformats/multiaddr/dist/src/multiaddr.js
|
|
@@ -49599,7 +49603,7 @@ var Multiaddr = class _Multiaddr {
|
|
|
49599
49603
|
});
|
|
49600
49604
|
}
|
|
49601
49605
|
equals(addr) {
|
|
49602
|
-
return
|
|
49606
|
+
return equals3(this.bytes, addr.bytes);
|
|
49603
49607
|
}
|
|
49604
49608
|
/**
|
|
49605
49609
|
* Returns Multiaddr as a human-readable string
|
|
@@ -49687,6 +49691,232 @@ var ClientSessionSchema = external_exports.object({
|
|
|
49687
49691
|
signature: external_exports.string(),
|
|
49688
49692
|
ens: EnsDataSchema.optional()
|
|
49689
49693
|
});
|
|
49694
|
+
var objectHasOwn = Object.hasOwn ?? Object.prototype.hasOwnProperty.call.bind(
|
|
49695
|
+
Object.prototype.hasOwnProperty
|
|
49696
|
+
);
|
|
49697
|
+
var textEncoder2 = new TextEncoder();
|
|
49698
|
+
var objectHasOwn2 = Object.hasOwn ?? Object.prototype.hasOwnProperty.call.bind(
|
|
49699
|
+
Object.prototype.hasOwnProperty
|
|
49700
|
+
);
|
|
49701
|
+
var CEILING_SERVICES = /* @__PURE__ */ new Set(["tinycloud.kv", "tinycloud.sql", "tinycloud.vfs"]);
|
|
49702
|
+
var GRANTABLE_ACTIONS = /* @__PURE__ */ new Map();
|
|
49703
|
+
for (const entry of CAPABILITY_REGISTRY) {
|
|
49704
|
+
if (!CEILING_SERVICES.has(entry.service)) {
|
|
49705
|
+
continue;
|
|
49706
|
+
}
|
|
49707
|
+
if (entry.aliasOf !== void 0 || entry.implies !== void 0 || entry.urn.endsWith("/*")) {
|
|
49708
|
+
continue;
|
|
49709
|
+
}
|
|
49710
|
+
const existing = GRANTABLE_ACTIONS.get(entry.service);
|
|
49711
|
+
if (existing === void 0) {
|
|
49712
|
+
GRANTABLE_ACTIONS.set(entry.service, /* @__PURE__ */ new Set([entry.urn]));
|
|
49713
|
+
continue;
|
|
49714
|
+
}
|
|
49715
|
+
existing.add(entry.urn);
|
|
49716
|
+
}
|
|
49717
|
+
var textEncoder22 = new TextEncoder();
|
|
49718
|
+
var objectHasOwn3 = Object.hasOwn ?? Object.prototype.hasOwnProperty.call.bind(
|
|
49719
|
+
Object.prototype.hasOwnProperty
|
|
49720
|
+
);
|
|
49721
|
+
var TRANSCRIPT_SHARE_BOOTSTRAP_SCHEMA = "xyz.tinycloud.exchange/transcript-bootstrap/v0";
|
|
49722
|
+
var OWNER_NODE_ENDPOINT_SCHEMA = "xyz.tinycloud.exchange/owner-node-endpoint/v1";
|
|
49723
|
+
var W3C_VC_CREDENTIAL_VERIFIER = "w3c.vc/credential/v1";
|
|
49724
|
+
var objectHasOwn4 = Object.hasOwn ?? Object.prototype.hasOwnProperty.call.bind(
|
|
49725
|
+
Object.prototype.hasOwnProperty
|
|
49726
|
+
);
|
|
49727
|
+
var POLICY_ENGINE_CHALLENGE_RESPONSE_SCHEMA = "xyz.tinycloud.policy/challenge/v0";
|
|
49728
|
+
var POLICY_ENGINE_DENIAL_SCHEMA = "xyz.tinycloud.policy-engine/denial/v0";
|
|
49729
|
+
var POLICY_ENGINE_GRANT_PRESENTATION_DENIAL_CODES = [
|
|
49730
|
+
"schema-invalid",
|
|
49731
|
+
"challenge-not-found",
|
|
49732
|
+
"challenge-expired",
|
|
49733
|
+
"challenge-nonce-consumed",
|
|
49734
|
+
"presentation-expired",
|
|
49735
|
+
"presentation-audience-mismatch",
|
|
49736
|
+
"presentation-evidence-missing",
|
|
49737
|
+
"digest-mismatch",
|
|
49738
|
+
"evidence-requirement-unknown",
|
|
49739
|
+
"evidence-requirement-duplicate",
|
|
49740
|
+
"holder-signature-invalid",
|
|
49741
|
+
"holder-signature-signer-mismatch",
|
|
49742
|
+
"id-mismatch",
|
|
49743
|
+
"requested-capabilities-exceeded",
|
|
49744
|
+
"requested-capabilities-hash-mismatch",
|
|
49745
|
+
"evidence-authority-missing",
|
|
49746
|
+
"evidence-credential-invalid",
|
|
49747
|
+
"evidence-domain-invalid",
|
|
49748
|
+
"evidence-domain-missing",
|
|
49749
|
+
"evidence-freshness-expired",
|
|
49750
|
+
"evidence-freshness-unestablishable",
|
|
49751
|
+
"evidence-issuer-missing",
|
|
49752
|
+
"evidence-issuer-untrusted",
|
|
49753
|
+
"evidence-presentation-invalid",
|
|
49754
|
+
"evidence-requirements-invalid",
|
|
49755
|
+
"evidence-verifier-unsupported",
|
|
49756
|
+
"enrollment-binding-mismatch",
|
|
49757
|
+
"enrollment-expired",
|
|
49758
|
+
"enrollment-not-yet-valid",
|
|
49759
|
+
"enrollment-out-of-scope",
|
|
49760
|
+
"enrollment-revoked",
|
|
49761
|
+
"enrollment-revoked-irreversible",
|
|
49762
|
+
"enrollment-status-rollback",
|
|
49763
|
+
"signature-invalid",
|
|
49764
|
+
"signer-not-authorized",
|
|
49765
|
+
"audience-mismatch",
|
|
49766
|
+
"capability-not-contained",
|
|
49767
|
+
"evidence-invalid",
|
|
49768
|
+
"evidence-missing",
|
|
49769
|
+
"evidence-stale",
|
|
49770
|
+
"evidence-subject-mismatch",
|
|
49771
|
+
"evidence-untrusted",
|
|
49772
|
+
"grant-ttl-exceeds-policy",
|
|
49773
|
+
"holder-did-mismatch",
|
|
49774
|
+
"holder-key-not-permitted",
|
|
49775
|
+
"holder-signature-invalid",
|
|
49776
|
+
"owner-mismatch",
|
|
49777
|
+
"policy-expired",
|
|
49778
|
+
"policy-inactive",
|
|
49779
|
+
"policy-not-found",
|
|
49780
|
+
"policy-not-satisfied",
|
|
49781
|
+
"policy-revoked",
|
|
49782
|
+
"policy-status-rollback",
|
|
49783
|
+
"rate-limited"
|
|
49784
|
+
];
|
|
49785
|
+
var JsonValueSchema = external_exports.lazy(
|
|
49786
|
+
() => external_exports.union([
|
|
49787
|
+
external_exports.string(),
|
|
49788
|
+
external_exports.number().finite(),
|
|
49789
|
+
external_exports.boolean(),
|
|
49790
|
+
external_exports.null(),
|
|
49791
|
+
external_exports.array(JsonValueSchema),
|
|
49792
|
+
external_exports.record(JsonValueSchema)
|
|
49793
|
+
])
|
|
49794
|
+
);
|
|
49795
|
+
var Rfc3339Schema = external_exports.string().refine((value) => parseStrictRfc33392(value) !== void 0, {
|
|
49796
|
+
message: "must be strict RFC 3339 date-time with timezone"
|
|
49797
|
+
});
|
|
49798
|
+
var SignedRecordSchema = external_exports.object({
|
|
49799
|
+
schema: external_exports.string(),
|
|
49800
|
+
engineRecordId: external_exports.string(),
|
|
49801
|
+
ownerDid: external_exports.string(),
|
|
49802
|
+
endpoint: external_exports.string(),
|
|
49803
|
+
audience: external_exports.string(),
|
|
49804
|
+
supportedPolicyVersions: external_exports.array(external_exports.string()),
|
|
49805
|
+
supportedEvidenceVerifiers: external_exports.array(external_exports.string()),
|
|
49806
|
+
grantIssuerDid: external_exports.string(),
|
|
49807
|
+
expiresAt: Rfc3339Schema,
|
|
49808
|
+
signature: external_exports.object({
|
|
49809
|
+
suite: external_exports.string(),
|
|
49810
|
+
signerDid: external_exports.string(),
|
|
49811
|
+
value: external_exports.string()
|
|
49812
|
+
}).strict()
|
|
49813
|
+
}).strict();
|
|
49814
|
+
var PolicyEngineSchema = external_exports.object({
|
|
49815
|
+
endpoint: external_exports.string().url(),
|
|
49816
|
+
audience: external_exports.string(),
|
|
49817
|
+
supportedEvidenceVerifiers: external_exports.tuple([
|
|
49818
|
+
external_exports.literal(W3C_VC_CREDENTIAL_VERIFIER)
|
|
49819
|
+
]),
|
|
49820
|
+
signedRecord: SignedRecordSchema
|
|
49821
|
+
}).strict();
|
|
49822
|
+
var OwnerNodeSchema = external_exports.object({
|
|
49823
|
+
schema: external_exports.literal(OWNER_NODE_ENDPOINT_SCHEMA),
|
|
49824
|
+
endpoint: external_exports.string().url(),
|
|
49825
|
+
spaceId: external_exports.string().min(1)
|
|
49826
|
+
}).strict();
|
|
49827
|
+
var ResourceHintSchema = external_exports.object({
|
|
49828
|
+
resourceType: external_exports.string(),
|
|
49829
|
+
resourceId: external_exports.string(),
|
|
49830
|
+
requestedCapabilities: external_exports.array(JsonValueSchema).min(1)
|
|
49831
|
+
}).strict();
|
|
49832
|
+
var BootstrapSchema = external_exports.object({
|
|
49833
|
+
schema: external_exports.literal(TRANSCRIPT_SHARE_BOOTSTRAP_SCHEMA),
|
|
49834
|
+
policyId: external_exports.string(),
|
|
49835
|
+
policyEngine: PolicyEngineSchema,
|
|
49836
|
+
ownerNode: OwnerNodeSchema,
|
|
49837
|
+
resourceHint: ResourceHintSchema
|
|
49838
|
+
}).strict();
|
|
49839
|
+
var SignatureSchema = external_exports.object({
|
|
49840
|
+
suite: external_exports.string(),
|
|
49841
|
+
signerDid: external_exports.string(),
|
|
49842
|
+
value: external_exports.string()
|
|
49843
|
+
}).strict();
|
|
49844
|
+
var ChallengeSchema = external_exports.object({
|
|
49845
|
+
schema: external_exports.literal(POLICY_ENGINE_CHALLENGE_RESPONSE_SCHEMA),
|
|
49846
|
+
challengeId: external_exports.string(),
|
|
49847
|
+
policyId: external_exports.string(),
|
|
49848
|
+
audience: external_exports.string(),
|
|
49849
|
+
nonce: external_exports.string().min(16),
|
|
49850
|
+
challengeExpiresAt: Rfc3339Schema,
|
|
49851
|
+
acceptedSuites: external_exports.array(external_exports.string()).min(1),
|
|
49852
|
+
requestedCapabilitiesTemplate: external_exports.array(JsonValueSchema).optional(),
|
|
49853
|
+
signature: SignatureSchema
|
|
49854
|
+
}).strict();
|
|
49855
|
+
var ChallengeResponseSchema = external_exports.object({ challenge: ChallengeSchema }).strict();
|
|
49856
|
+
var DenialSchema = external_exports.object({
|
|
49857
|
+
schema: external_exports.literal(POLICY_ENGINE_DENIAL_SCHEMA),
|
|
49858
|
+
code: external_exports.enum(POLICY_ENGINE_GRANT_PRESENTATION_DENIAL_CODES),
|
|
49859
|
+
message: external_exports.string().optional()
|
|
49860
|
+
}).strict();
|
|
49861
|
+
var ErrorEnvelopeDenialSchema = external_exports.object({
|
|
49862
|
+
error: external_exports.object({
|
|
49863
|
+
code: external_exports.enum(POLICY_ENGINE_GRANT_PRESENTATION_DENIAL_CODES),
|
|
49864
|
+
message: external_exports.string().optional()
|
|
49865
|
+
}).strict()
|
|
49866
|
+
}).strict();
|
|
49867
|
+
var WireDelegationSchema = external_exports.object({
|
|
49868
|
+
delegationId: external_exports.string(),
|
|
49869
|
+
issuanceId: external_exports.string().min(1),
|
|
49870
|
+
issuerDid: external_exports.string(),
|
|
49871
|
+
holderDid: external_exports.string(),
|
|
49872
|
+
policyId: external_exports.string(),
|
|
49873
|
+
capabilityHashHex: external_exports.string().regex(/^[0-9a-f]{64}$/),
|
|
49874
|
+
revocationMode: external_exports.literal("refresh_only"),
|
|
49875
|
+
issuedAt: Rfc3339Schema,
|
|
49876
|
+
expiresAt: Rfc3339Schema,
|
|
49877
|
+
terminal: external_exports.boolean(),
|
|
49878
|
+
encoded: external_exports.string()
|
|
49879
|
+
}).strict();
|
|
49880
|
+
var ResolveResponseSchema = external_exports.object({ delegation: WireDelegationSchema }).strict();
|
|
49881
|
+
var DelegateReceiptSchema = external_exports.object({
|
|
49882
|
+
cid: external_exports.string().min(1),
|
|
49883
|
+
activated: external_exports.array(external_exports.string()),
|
|
49884
|
+
skipped: external_exports.array(external_exports.string())
|
|
49885
|
+
}).strict();
|
|
49886
|
+
var SqlReadResponseSchema = external_exports.object({ rows: external_exports.array(JsonValueSchema) }).strict();
|
|
49887
|
+
var KvReadResponseSchema = external_exports.object({ value: JsonValueSchema }).strict();
|
|
49888
|
+
var LISTEN_SQL_STATEMENT_CATALOG = [
|
|
49889
|
+
{
|
|
49890
|
+
name: "listen.getConversation",
|
|
49891
|
+
sql: "SELECT id, title, source, source_id, source_url, started_at, ended_at, duration_secs, summary, metadata, transcript_json, transcript_text, created_at, updated_at FROM conversation WHERE id = ?",
|
|
49892
|
+
fixedParams: [{ index: 0, value: "{conversationId}" }]
|
|
49893
|
+
},
|
|
49894
|
+
{
|
|
49895
|
+
name: "listen.listParticipants",
|
|
49896
|
+
sql: "SELECT id, name, email, speaker_label FROM participant WHERE conversation_id = ? ORDER BY COALESCE(speaker_label, name), id",
|
|
49897
|
+
fixedParams: [{ index: 0, value: "{conversationId}" }]
|
|
49898
|
+
}
|
|
49899
|
+
];
|
|
49900
|
+
var LISTEN_SQL_STATEMENT_BY_NAME = new Map(
|
|
49901
|
+
LISTEN_SQL_STATEMENT_CATALOG.map((statement) => [
|
|
49902
|
+
statement.name,
|
|
49903
|
+
statement
|
|
49904
|
+
])
|
|
49905
|
+
);
|
|
49906
|
+
function parseStrictRfc33392(value) {
|
|
49907
|
+
if (!/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(\.\d+)?(Z|[+-]\d{2}:\d{2})$/.test(
|
|
49908
|
+
value
|
|
49909
|
+
)) {
|
|
49910
|
+
return void 0;
|
|
49911
|
+
}
|
|
49912
|
+
const parsed = Date.parse(value);
|
|
49913
|
+
if (Number.isNaN(parsed)) {
|
|
49914
|
+
return void 0;
|
|
49915
|
+
}
|
|
49916
|
+
const canonical = new Date(parsed).toISOString().replace(".000Z", "Z");
|
|
49917
|
+
const reparsed = Date.parse(value);
|
|
49918
|
+
return Date.parse(canonical) === reparsed ? parsed : void 0;
|
|
49919
|
+
}
|
|
49690
49920
|
var ethereumAddressPattern = /^0x[a-fA-F0-9]{40}$/;
|
|
49691
49921
|
var EnsDataSchema2 = external_exports.object({
|
|
49692
49922
|
/** ENS name/domain. */
|
|
@@ -49839,6 +50069,59 @@ var DelegationSchema = external_exports.object({
|
|
|
49839
50069
|
/** Authorization header (UCAN bearer token) */
|
|
49840
50070
|
authHeader: external_exports.string().optional()
|
|
49841
50071
|
});
|
|
50072
|
+
var DelegationStatusSchema = external_exports.object({
|
|
50073
|
+
cid: external_exports.string().min(1),
|
|
50074
|
+
status: external_exports.enum(["active", "revoked", "expired", "unavailable", "not_found"]),
|
|
50075
|
+
exists: external_exports.boolean(),
|
|
50076
|
+
active: external_exports.boolean(),
|
|
50077
|
+
revoked: external_exports.boolean(),
|
|
50078
|
+
expired: external_exports.boolean()
|
|
50079
|
+
}).strict().superRefine((value, context) => {
|
|
50080
|
+
const valid = value.status === "active" ? value.exists && value.active && !value.revoked && !value.expired : value.status === "revoked" ? value.exists && !value.active && value.revoked && !value.expired : value.status === "expired" ? value.exists && !value.active && !value.revoked && value.expired : value.status === "unavailable" ? value.exists && !value.active && !value.revoked && !value.expired : !value.exists && !value.active && !value.revoked && !value.expired;
|
|
50081
|
+
if (!valid) {
|
|
50082
|
+
context.addIssue({
|
|
50083
|
+
code: external_exports.ZodIssueCode.custom,
|
|
50084
|
+
message: "delegation status flags do not match status"
|
|
50085
|
+
});
|
|
50086
|
+
}
|
|
50087
|
+
});
|
|
50088
|
+
var DelegationRevocationReceiptSchema = external_exports.object({
|
|
50089
|
+
revoked: external_exports.literal(true),
|
|
50090
|
+
cid: external_exports.string().min(1)
|
|
50091
|
+
}).strict();
|
|
50092
|
+
var AccountDelegationResourceSchema = external_exports.object({
|
|
50093
|
+
resource: external_exports.string().min(1),
|
|
50094
|
+
actions: external_exports.array(external_exports.string()),
|
|
50095
|
+
caveats: external_exports.array(external_exports.record(external_exports.string(), external_exports.unknown()))
|
|
50096
|
+
}).strict();
|
|
50097
|
+
var AccountDelegationDateSchema = external_exports.string().datetime({ offset: true }).transform((value) => new Date(value));
|
|
50098
|
+
var AccountDelegationRecordSchema = external_exports.object({
|
|
50099
|
+
cid: external_exports.string().min(1),
|
|
50100
|
+
direction: external_exports.enum(["granted", "received"]),
|
|
50101
|
+
delegatorDid: external_exports.string().min(1),
|
|
50102
|
+
delegateDid: external_exports.string().min(1),
|
|
50103
|
+
resources: external_exports.array(AccountDelegationResourceSchema),
|
|
50104
|
+
parents: external_exports.array(external_exports.string()),
|
|
50105
|
+
issuedAt: AccountDelegationDateSchema.nullable(),
|
|
50106
|
+
notBefore: AccountDelegationDateSchema.nullable(),
|
|
50107
|
+
expiresAt: AccountDelegationDateSchema.nullable(),
|
|
50108
|
+
status: external_exports.enum(["active", "pending", "expired", "revoked", "ancestor_revoked"]),
|
|
50109
|
+
revokedAt: AccountDelegationDateSchema.nullable().optional(),
|
|
50110
|
+
revokedBy: external_exports.string().optional(),
|
|
50111
|
+
revokedAncestorCid: external_exports.string().optional()
|
|
50112
|
+
}).strict();
|
|
50113
|
+
var AccountDelegationPageSchema = external_exports.object({
|
|
50114
|
+
schemaVersion: external_exports.literal(2),
|
|
50115
|
+
items: external_exports.array(AccountDelegationRecordSchema),
|
|
50116
|
+
nextCursor: external_exports.string().optional()
|
|
50117
|
+
}).strict();
|
|
50118
|
+
var AccountDelegationQueryOptionsSchema = external_exports.object({
|
|
50119
|
+
direction: external_exports.enum(["granted", "received", "all"]).optional(),
|
|
50120
|
+
status: external_exports.enum(["active", "pending", "expired", "revoked", "ancestor_revoked"]).optional(),
|
|
50121
|
+
space: external_exports.string().trim().min(1).optional(),
|
|
50122
|
+
limit: external_exports.number().int().min(1).max(100).optional(),
|
|
50123
|
+
cursor: external_exports.string().min(1).optional()
|
|
50124
|
+
}).strict();
|
|
49842
50125
|
var CapabilityEntrySchema = external_exports.object({
|
|
49843
50126
|
/** Resource URI this capability applies to */
|
|
49844
50127
|
resource: external_exports.string(),
|
|
@@ -49993,6 +50276,8 @@ var GenerateShareParamsSchema = external_exports.object({
|
|
|
49993
50276
|
var DelegationManagerConfigSchema = external_exports.object({
|
|
49994
50277
|
/** TinyCloud host URLs */
|
|
49995
50278
|
hosts: external_exports.array(external_exports.string()),
|
|
50279
|
+
/** Account space used by account-wide delegation history queries */
|
|
50280
|
+
accountSpaceId: external_exports.string().min(1).optional(),
|
|
49996
50281
|
/** Active session for authentication */
|
|
49997
50282
|
session: external_exports.unknown().refine(
|
|
49998
50283
|
(val) => val !== null && typeof val === "object",
|
|
@@ -50003,6 +50288,11 @@ var DelegationManagerConfigSchema = external_exports.object({
|
|
|
50003
50288
|
(val) => typeof val === "function",
|
|
50004
50289
|
{ message: "Expected an invoke function" }
|
|
50005
50290
|
),
|
|
50291
|
+
/** Platform-specific invoke function for raw resource URIs */
|
|
50292
|
+
invokeAny: external_exports.unknown().refine(
|
|
50293
|
+
(val) => val === void 0 || typeof val === "function",
|
|
50294
|
+
{ message: "Expected an invokeAny function or undefined" }
|
|
50295
|
+
).optional(),
|
|
50006
50296
|
/** Optional custom fetch implementation */
|
|
50007
50297
|
fetch: external_exports.unknown().refine(
|
|
50008
50298
|
(val) => val === void 0 || typeof val === "function",
|
|
@@ -50227,7 +50517,8 @@ var SERVICE_SHORT_TO_LONG2 = Object.freeze({
|
|
|
50227
50517
|
duckdb: "tinycloud.duckdb",
|
|
50228
50518
|
capabilities: "tinycloud.capabilities",
|
|
50229
50519
|
hooks: "tinycloud.hooks",
|
|
50230
|
-
encryption: "tinycloud.encryption"
|
|
50520
|
+
encryption: "tinycloud.encryption",
|
|
50521
|
+
delegation: "tinycloud.delegation"
|
|
50231
50522
|
});
|
|
50232
50523
|
var SERVICE_LONG_TO_SHORT2 = Object.freeze(
|
|
50233
50524
|
Object.fromEntries(
|
|
@@ -50342,6 +50633,10 @@ var SharingServiceConfigSchema = external_exports.object({
|
|
|
50342
50633
|
createDelegationWasm: external_exports.unknown().refine((val) => val === void 0 || typeof val === "function", {
|
|
50343
50634
|
message: "Expected a createDelegationWasm function or undefined"
|
|
50344
50635
|
}).optional(),
|
|
50636
|
+
/** CID computation used to verify transportable child delegations. */
|
|
50637
|
+
computeCid: external_exports.unknown().refine((val) => val === void 0 || typeof val === "function", {
|
|
50638
|
+
message: "Expected a computeCid function or undefined"
|
|
50639
|
+
}).optional(),
|
|
50345
50640
|
/**
|
|
50346
50641
|
* Path prefix for KV operations.
|
|
50347
50642
|
*/
|