@tinycloud/cli 0.7.7-beta.4 → 0.7.7-beta.5
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 +929 -675
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -36486,6 +36486,7 @@ var CAPABILITIES2 = deriveServiceConstants("capabilities");
|
|
|
36486
36486
|
var HOOKS = deriveServiceConstants("hooks");
|
|
36487
36487
|
var ENCRYPTION = deriveServiceConstants("encryption");
|
|
36488
36488
|
var SPACE = deriveServiceConstants("space");
|
|
36489
|
+
var CAPABILITY_REGISTRY = CAPABILITIES;
|
|
36489
36490
|
|
|
36490
36491
|
// ../bootstrap/dist/index.js
|
|
36491
36492
|
var DEFAULT_MANIFEST_SPACE = "applications";
|
|
@@ -42361,7 +42362,8 @@ var SERVICE_SHORT_TO_LONG = Object.freeze({
|
|
|
42361
42362
|
duckdb: "tinycloud.duckdb",
|
|
42362
42363
|
capabilities: "tinycloud.capabilities",
|
|
42363
42364
|
hooks: "tinycloud.hooks",
|
|
42364
|
-
encryption: "tinycloud.encryption"
|
|
42365
|
+
encryption: "tinycloud.encryption",
|
|
42366
|
+
delegation: "tinycloud.delegation"
|
|
42365
42367
|
});
|
|
42366
42368
|
var ENCRYPTION_PERMISSION_SERVICE2 = "tinycloud.encryption";
|
|
42367
42369
|
var ENCRYPTION_MANIFEST_SPACE2 = "encryption";
|
|
@@ -47438,228 +47440,24 @@ ${rowCount} row${rowCount === 1 ? "" : "s"} returned`) + "\n");
|
|
|
47438
47440
|
|
|
47439
47441
|
// ../sdk-core/dist/index.js
|
|
47440
47442
|
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
47443
|
|
|
47654
|
-
// ../../node_modules/multiformats/dist/src/bases/
|
|
47655
|
-
var
|
|
47656
|
-
__export(
|
|
47657
|
-
|
|
47444
|
+
// ../../node_modules/multiformats/dist/src/bases/base32.js
|
|
47445
|
+
var base32_exports = {};
|
|
47446
|
+
__export(base32_exports, {
|
|
47447
|
+
base32: () => base32,
|
|
47448
|
+
base32hex: () => base32hex,
|
|
47449
|
+
base32hexpad: () => base32hexpad,
|
|
47450
|
+
base32hexpadupper: () => base32hexpadupper,
|
|
47451
|
+
base32hexupper: () => base32hexupper,
|
|
47452
|
+
base32pad: () => base32pad,
|
|
47453
|
+
base32padupper: () => base32padupper,
|
|
47454
|
+
base32upper: () => base32upper,
|
|
47455
|
+
base32z: () => base32z
|
|
47658
47456
|
});
|
|
47659
47457
|
|
|
47660
47458
|
// ../../node_modules/multiformats/dist/src/bytes.js
|
|
47661
47459
|
var empty = new Uint8Array(0);
|
|
47662
|
-
function
|
|
47460
|
+
function equals(aa, bb) {
|
|
47663
47461
|
if (aa === bb) {
|
|
47664
47462
|
return true;
|
|
47665
47463
|
}
|
|
@@ -47933,7 +47731,7 @@ function baseX({ name: name2, prefix, alphabet: alphabet2 }) {
|
|
|
47933
47731
|
decode: (text) => coerce2(decode9(text))
|
|
47934
47732
|
});
|
|
47935
47733
|
}
|
|
47936
|
-
function
|
|
47734
|
+
function decode3(string2, alphabetIdx, bitsPerChar, name2) {
|
|
47937
47735
|
let end = string2.length;
|
|
47938
47736
|
while (string2[end - 1] === "=") {
|
|
47939
47737
|
--end;
|
|
@@ -47999,149 +47797,53 @@ function rfc4648({ name: name2, prefix, bitsPerChar, alphabet: alphabet2 }) {
|
|
|
47999
47797
|
return encode4(input, alphabet2, bitsPerChar);
|
|
48000
47798
|
},
|
|
48001
47799
|
decode(input) {
|
|
48002
|
-
return
|
|
47800
|
+
return decode3(input, alphabetIdx, bitsPerChar, name2);
|
|
48003
47801
|
}
|
|
48004
47802
|
});
|
|
48005
47803
|
}
|
|
48006
47804
|
|
|
48007
|
-
// ../../node_modules/multiformats/dist/src/bases/
|
|
48008
|
-
var
|
|
48009
|
-
prefix: "
|
|
48010
|
-
name: "
|
|
48011
|
-
alphabet: "
|
|
47805
|
+
// ../../node_modules/multiformats/dist/src/bases/base32.js
|
|
47806
|
+
var base32 = rfc4648({
|
|
47807
|
+
prefix: "b",
|
|
47808
|
+
name: "base32",
|
|
47809
|
+
alphabet: "abcdefghijklmnopqrstuvwxyz234567",
|
|
47810
|
+
bitsPerChar: 5
|
|
48012
47811
|
});
|
|
48013
|
-
|
|
48014
|
-
|
|
48015
|
-
|
|
48016
|
-
|
|
48017
|
-
|
|
48018
|
-
base16upper: () => base16upper
|
|
47812
|
+
var base32upper = rfc4648({
|
|
47813
|
+
prefix: "B",
|
|
47814
|
+
name: "base32upper",
|
|
47815
|
+
alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",
|
|
47816
|
+
bitsPerChar: 5
|
|
48019
47817
|
});
|
|
48020
|
-
var
|
|
48021
|
-
prefix: "
|
|
48022
|
-
name: "
|
|
48023
|
-
alphabet: "
|
|
48024
|
-
bitsPerChar:
|
|
47818
|
+
var base32pad = rfc4648({
|
|
47819
|
+
prefix: "c",
|
|
47820
|
+
name: "base32pad",
|
|
47821
|
+
alphabet: "abcdefghijklmnopqrstuvwxyz234567=",
|
|
47822
|
+
bitsPerChar: 5
|
|
48025
47823
|
});
|
|
48026
|
-
var
|
|
48027
|
-
prefix: "
|
|
48028
|
-
name: "
|
|
48029
|
-
alphabet: "
|
|
48030
|
-
bitsPerChar:
|
|
47824
|
+
var base32padupper = rfc4648({
|
|
47825
|
+
prefix: "C",
|
|
47826
|
+
name: "base32padupper",
|
|
47827
|
+
alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",
|
|
47828
|
+
bitsPerChar: 5
|
|
48031
47829
|
});
|
|
48032
|
-
|
|
48033
|
-
|
|
48034
|
-
|
|
48035
|
-
|
|
48036
|
-
|
|
47830
|
+
var base32hex = rfc4648({
|
|
47831
|
+
prefix: "v",
|
|
47832
|
+
name: "base32hex",
|
|
47833
|
+
alphabet: "0123456789abcdefghijklmnopqrstuv",
|
|
47834
|
+
bitsPerChar: 5
|
|
48037
47835
|
});
|
|
48038
|
-
var
|
|
48039
|
-
prefix: "
|
|
48040
|
-
name: "
|
|
48041
|
-
alphabet: "
|
|
48042
|
-
bitsPerChar:
|
|
47836
|
+
var base32hexupper = rfc4648({
|
|
47837
|
+
prefix: "V",
|
|
47838
|
+
name: "base32hexupper",
|
|
47839
|
+
alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUV",
|
|
47840
|
+
bitsPerChar: 5
|
|
48043
47841
|
});
|
|
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
|
|
47842
|
+
var base32hexpad = rfc4648({
|
|
47843
|
+
prefix: "t",
|
|
47844
|
+
name: "base32hexpad",
|
|
47845
|
+
alphabet: "0123456789abcdefghijklmnopqrstuv=",
|
|
47846
|
+
bitsPerChar: 5
|
|
48145
47847
|
});
|
|
48146
47848
|
var base32hexpadupper = rfc4648({
|
|
48147
47849
|
prefix: "T",
|
|
@@ -48190,96 +47892,29 @@ var base58flickr = baseX({
|
|
|
48190
47892
|
alphabet: "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"
|
|
48191
47893
|
});
|
|
48192
47894
|
|
|
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
47895
|
// ../../node_modules/multiformats/dist/src/vendor/varint.js
|
|
48261
|
-
var encode_1 =
|
|
48262
|
-
var
|
|
48263
|
-
var
|
|
48264
|
-
var MSBALL = ~
|
|
47896
|
+
var encode_1 = encode5;
|
|
47897
|
+
var MSB = 128;
|
|
47898
|
+
var REST = 127;
|
|
47899
|
+
var MSBALL = ~REST;
|
|
48265
47900
|
var INT = Math.pow(2, 31);
|
|
48266
|
-
function
|
|
47901
|
+
function encode5(num, out, offset) {
|
|
48267
47902
|
out = out || [];
|
|
48268
47903
|
offset = offset || 0;
|
|
48269
47904
|
var oldOffset = offset;
|
|
48270
47905
|
while (num >= INT) {
|
|
48271
|
-
out[offset++] = num & 255 |
|
|
47906
|
+
out[offset++] = num & 255 | MSB;
|
|
48272
47907
|
num /= 128;
|
|
48273
47908
|
}
|
|
48274
47909
|
while (num & MSBALL) {
|
|
48275
|
-
out[offset++] = num & 255 |
|
|
47910
|
+
out[offset++] = num & 255 | MSB;
|
|
48276
47911
|
num >>>= 7;
|
|
48277
47912
|
}
|
|
48278
47913
|
out[offset] = num | 0;
|
|
48279
|
-
|
|
47914
|
+
encode5.bytes = offset - oldOffset + 1;
|
|
48280
47915
|
return out;
|
|
48281
47916
|
}
|
|
48282
|
-
var
|
|
47917
|
+
var decode4 = read;
|
|
48283
47918
|
var MSB$1 = 128;
|
|
48284
47919
|
var REST$1 = 127;
|
|
48285
47920
|
function read(buf, offset) {
|
|
@@ -48296,28 +47931,28 @@ function read(buf, offset) {
|
|
|
48296
47931
|
read.bytes = counter - offset;
|
|
48297
47932
|
return res;
|
|
48298
47933
|
}
|
|
48299
|
-
var
|
|
48300
|
-
var
|
|
48301
|
-
var
|
|
48302
|
-
var
|
|
48303
|
-
var
|
|
48304
|
-
var
|
|
48305
|
-
var
|
|
47934
|
+
var N1 = Math.pow(2, 7);
|
|
47935
|
+
var N2 = Math.pow(2, 14);
|
|
47936
|
+
var N3 = Math.pow(2, 21);
|
|
47937
|
+
var N4 = Math.pow(2, 28);
|
|
47938
|
+
var N5 = Math.pow(2, 35);
|
|
47939
|
+
var N6 = Math.pow(2, 42);
|
|
47940
|
+
var N7 = Math.pow(2, 49);
|
|
48306
47941
|
var N8 = Math.pow(2, 56);
|
|
48307
47942
|
var N9 = Math.pow(2, 63);
|
|
48308
47943
|
var length = function(value) {
|
|
48309
|
-
return value <
|
|
47944
|
+
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
47945
|
};
|
|
48311
47946
|
var varint = {
|
|
48312
47947
|
encode: encode_1,
|
|
48313
|
-
decode:
|
|
47948
|
+
decode: decode4,
|
|
48314
47949
|
encodingLength: length
|
|
48315
47950
|
};
|
|
48316
47951
|
var _brrp_varint = varint;
|
|
48317
47952
|
var varint_default = _brrp_varint;
|
|
48318
47953
|
|
|
48319
47954
|
// ../../node_modules/multiformats/dist/src/varint.js
|
|
48320
|
-
function
|
|
47955
|
+
function decode5(data, offset = 0) {
|
|
48321
47956
|
const code2 = varint_default.decode(data, offset);
|
|
48322
47957
|
return [code2, varint_default.decode.bytes];
|
|
48323
47958
|
}
|
|
@@ -48325,37 +47960,37 @@ function encodeTo(int, target, offset = 0) {
|
|
|
48325
47960
|
varint_default.encode(int, target, offset);
|
|
48326
47961
|
return target;
|
|
48327
47962
|
}
|
|
48328
|
-
function
|
|
47963
|
+
function encodingLength(int) {
|
|
48329
47964
|
return varint_default.encodingLength(int);
|
|
48330
47965
|
}
|
|
48331
47966
|
|
|
48332
47967
|
// ../../node_modules/multiformats/dist/src/hashes/digest.js
|
|
48333
47968
|
function create(code2, digest2) {
|
|
48334
47969
|
const size = digest2.byteLength;
|
|
48335
|
-
const sizeOffset =
|
|
48336
|
-
const digestOffset = sizeOffset +
|
|
47970
|
+
const sizeOffset = encodingLength(code2);
|
|
47971
|
+
const digestOffset = sizeOffset + encodingLength(size);
|
|
48337
47972
|
const bytes = new Uint8Array(digestOffset + size);
|
|
48338
47973
|
encodeTo(code2, bytes, 0);
|
|
48339
47974
|
encodeTo(size, bytes, sizeOffset);
|
|
48340
47975
|
bytes.set(digest2, digestOffset);
|
|
48341
47976
|
return new Digest(code2, size, digest2, bytes);
|
|
48342
47977
|
}
|
|
48343
|
-
function
|
|
47978
|
+
function decode6(multihash) {
|
|
48344
47979
|
const bytes = coerce2(multihash);
|
|
48345
|
-
const [code2, sizeOffset] =
|
|
48346
|
-
const [size, digestOffset] =
|
|
47980
|
+
const [code2, sizeOffset] = decode5(bytes);
|
|
47981
|
+
const [size, digestOffset] = decode5(bytes.subarray(sizeOffset));
|
|
48347
47982
|
const digest2 = bytes.subarray(sizeOffset + digestOffset);
|
|
48348
47983
|
if (digest2.byteLength !== size) {
|
|
48349
47984
|
throw new Error("Incorrect length");
|
|
48350
47985
|
}
|
|
48351
47986
|
return new Digest(code2, size, digest2, bytes);
|
|
48352
47987
|
}
|
|
48353
|
-
function
|
|
47988
|
+
function equals2(a, b) {
|
|
48354
47989
|
if (a === b) {
|
|
48355
47990
|
return true;
|
|
48356
47991
|
} else {
|
|
48357
47992
|
const data = b;
|
|
48358
|
-
return a.code === data.code && a.size === data.size && data.bytes instanceof Uint8Array &&
|
|
47993
|
+
return a.code === data.code && a.size === data.size && data.bytes instanceof Uint8Array && equals(a.bytes, data.bytes);
|
|
48359
47994
|
}
|
|
48360
47995
|
}
|
|
48361
47996
|
var Digest = class {
|
|
@@ -48374,89 +48009,6 @@ var Digest = class {
|
|
|
48374
48009
|
}
|
|
48375
48010
|
};
|
|
48376
48011
|
|
|
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
48012
|
// ../../node_modules/multiformats/dist/src/cid.js
|
|
48461
48013
|
function format(link, base3) {
|
|
48462
48014
|
const { bytes, version: version28 } = link;
|
|
@@ -48552,7 +48104,7 @@ var CID = class _CID {
|
|
|
48552
48104
|
}
|
|
48553
48105
|
static equals(self2, other) {
|
|
48554
48106
|
const unknown = other;
|
|
48555
|
-
return unknown != null && self2.code === unknown.code && self2.version === unknown.version &&
|
|
48107
|
+
return unknown != null && self2.code === unknown.code && self2.version === unknown.version && equals2(self2.multihash, unknown.multihash);
|
|
48556
48108
|
}
|
|
48557
48109
|
toString(base3) {
|
|
48558
48110
|
return format(this, base3);
|
|
@@ -48590,7 +48142,7 @@ var CID = class _CID {
|
|
|
48590
48142
|
return new _CID(version28, code2, multihash, bytes ?? encodeCID(version28, code2, multihash.bytes));
|
|
48591
48143
|
} else if (value[cidSymbol] === true) {
|
|
48592
48144
|
const { version: version28, multihash, code: code2 } = value;
|
|
48593
|
-
const digest2 =
|
|
48145
|
+
const digest2 = decode6(multihash);
|
|
48594
48146
|
return _CID.create(version28, code2, digest2);
|
|
48595
48147
|
} else {
|
|
48596
48148
|
return null;
|
|
@@ -48640,162 +48192,612 @@ var CID = class _CID {
|
|
|
48640
48192
|
static createV1(code2, digest2) {
|
|
48641
48193
|
return _CID.create(1, code2, digest2);
|
|
48642
48194
|
}
|
|
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;
|
|
48195
|
+
/**
|
|
48196
|
+
* Decoded a CID from its binary representation. The byte array must contain
|
|
48197
|
+
* only the CID with no additional bytes.
|
|
48198
|
+
*
|
|
48199
|
+
* An error will be thrown if the bytes provided do not contain a valid
|
|
48200
|
+
* binary representation of a CID.
|
|
48201
|
+
*/
|
|
48202
|
+
static decode(bytes) {
|
|
48203
|
+
const [cid, remainder] = _CID.decodeFirst(bytes);
|
|
48204
|
+
if (remainder.length !== 0) {
|
|
48205
|
+
throw new Error("Incorrect length");
|
|
48206
|
+
}
|
|
48207
|
+
return cid;
|
|
48208
|
+
}
|
|
48209
|
+
/**
|
|
48210
|
+
* Decoded a CID from its binary representation at the beginning of a byte
|
|
48211
|
+
* array.
|
|
48212
|
+
*
|
|
48213
|
+
* Returns an array with the first element containing the CID and the second
|
|
48214
|
+
* element containing the remainder of the original byte array. The remainder
|
|
48215
|
+
* will be a zero-length byte array if the provided bytes only contained a
|
|
48216
|
+
* binary CID representation.
|
|
48217
|
+
*/
|
|
48218
|
+
static decodeFirst(bytes) {
|
|
48219
|
+
const specs = _CID.inspectBytes(bytes);
|
|
48220
|
+
const prefixSize = specs.size - specs.multihashSize;
|
|
48221
|
+
const multihashBytes = coerce2(bytes.subarray(prefixSize, prefixSize + specs.multihashSize));
|
|
48222
|
+
if (multihashBytes.byteLength !== specs.multihashSize) {
|
|
48223
|
+
throw new Error("Incorrect length");
|
|
48224
|
+
}
|
|
48225
|
+
const digestBytes = multihashBytes.subarray(specs.multihashSize - specs.digestSize);
|
|
48226
|
+
const digest2 = new Digest(specs.multihashCode, specs.digestSize, digestBytes, multihashBytes);
|
|
48227
|
+
const cid = specs.version === 0 ? _CID.createV0(digest2) : _CID.createV1(specs.codec, digest2);
|
|
48228
|
+
return [cid, bytes.subarray(specs.size)];
|
|
48229
|
+
}
|
|
48230
|
+
/**
|
|
48231
|
+
* Inspect the initial bytes of a CID to determine its properties.
|
|
48232
|
+
*
|
|
48233
|
+
* Involves decoding up to 4 varints. Typically this will require only 4 to 6
|
|
48234
|
+
* bytes but for larger multicodec code values and larger multihash digest
|
|
48235
|
+
* lengths these varints can be quite large. It is recommended that at least
|
|
48236
|
+
* 10 bytes be made available in the `initialBytes` argument for a complete
|
|
48237
|
+
* inspection.
|
|
48238
|
+
*/
|
|
48239
|
+
static inspectBytes(initialBytes) {
|
|
48240
|
+
let offset = 0;
|
|
48241
|
+
const next = () => {
|
|
48242
|
+
const [i, length2] = decode5(initialBytes.subarray(offset));
|
|
48243
|
+
offset += length2;
|
|
48244
|
+
return i;
|
|
48245
|
+
};
|
|
48246
|
+
let version28 = next();
|
|
48247
|
+
let codec = DAG_PB_CODE;
|
|
48248
|
+
if (version28 === 18) {
|
|
48249
|
+
version28 = 0;
|
|
48250
|
+
offset = 0;
|
|
48251
|
+
} else {
|
|
48252
|
+
codec = next();
|
|
48253
|
+
}
|
|
48254
|
+
if (version28 !== 0 && version28 !== 1) {
|
|
48255
|
+
throw new RangeError(`Invalid CID version ${version28}`);
|
|
48256
|
+
}
|
|
48257
|
+
const prefixSize = offset;
|
|
48258
|
+
const multihashCode = next();
|
|
48259
|
+
const digestSize = next();
|
|
48260
|
+
const size = offset + digestSize;
|
|
48261
|
+
const multihashSize = size - prefixSize;
|
|
48262
|
+
return { version: version28, codec, multihashCode, digestSize, multihashSize, size };
|
|
48263
|
+
}
|
|
48264
|
+
/**
|
|
48265
|
+
* Takes cid in a string representation and creates an instance. If `base`
|
|
48266
|
+
* decoder is not provided will use a default from the configuration. It will
|
|
48267
|
+
* throw an error if encoding of the CID is not compatible with supplied (or
|
|
48268
|
+
* a default decoder).
|
|
48269
|
+
*/
|
|
48270
|
+
static parse(source, base3) {
|
|
48271
|
+
const [prefix, bytes] = parseCIDtoBytes(source, base3);
|
|
48272
|
+
const cid = _CID.decode(bytes);
|
|
48273
|
+
if (cid.version === 0 && source[0] !== "Q") {
|
|
48274
|
+
throw Error("Version 0 CID string must not include multibase prefix");
|
|
48275
|
+
}
|
|
48276
|
+
baseCache(cid).set(prefix, source);
|
|
48277
|
+
return cid;
|
|
48278
|
+
}
|
|
48279
|
+
};
|
|
48280
|
+
function parseCIDtoBytes(source, base3) {
|
|
48281
|
+
switch (source[0]) {
|
|
48282
|
+
// CIDv0 is parsed differently
|
|
48283
|
+
case "Q": {
|
|
48284
|
+
const decoder = base3 ?? base58btc;
|
|
48285
|
+
return [
|
|
48286
|
+
base58btc.prefix,
|
|
48287
|
+
decoder.decode(`${base58btc.prefix}${source}`)
|
|
48288
|
+
];
|
|
48289
|
+
}
|
|
48290
|
+
case base58btc.prefix: {
|
|
48291
|
+
const decoder = base3 ?? base58btc;
|
|
48292
|
+
return [base58btc.prefix, decoder.decode(source)];
|
|
48293
|
+
}
|
|
48294
|
+
case base32.prefix: {
|
|
48295
|
+
const decoder = base3 ?? base32;
|
|
48296
|
+
return [base32.prefix, decoder.decode(source)];
|
|
48297
|
+
}
|
|
48298
|
+
case base36.prefix: {
|
|
48299
|
+
const decoder = base3 ?? base36;
|
|
48300
|
+
return [base36.prefix, decoder.decode(source)];
|
|
48301
|
+
}
|
|
48302
|
+
default: {
|
|
48303
|
+
if (base3 == null) {
|
|
48304
|
+
throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");
|
|
48305
|
+
}
|
|
48306
|
+
return [source[0], base3.decode(source)];
|
|
48307
|
+
}
|
|
48308
|
+
}
|
|
48309
|
+
}
|
|
48310
|
+
function toStringV0(bytes, cache2, base3) {
|
|
48311
|
+
const { prefix } = base3;
|
|
48312
|
+
if (prefix !== base58btc.prefix) {
|
|
48313
|
+
throw Error(`Cannot string encode V0 in ${base3.name} encoding`);
|
|
48314
|
+
}
|
|
48315
|
+
const cid = cache2.get(prefix);
|
|
48316
|
+
if (cid == null) {
|
|
48317
|
+
const cid2 = base3.encode(bytes).slice(1);
|
|
48318
|
+
cache2.set(prefix, cid2);
|
|
48319
|
+
return cid2;
|
|
48320
|
+
} else {
|
|
48321
|
+
return cid;
|
|
48322
|
+
}
|
|
48323
|
+
}
|
|
48324
|
+
function toStringV1(bytes, cache2, base3) {
|
|
48325
|
+
const { prefix } = base3;
|
|
48326
|
+
const cid = cache2.get(prefix);
|
|
48327
|
+
if (cid == null) {
|
|
48328
|
+
const cid2 = base3.encode(bytes);
|
|
48329
|
+
cache2.set(prefix, cid2);
|
|
48330
|
+
return cid2;
|
|
48331
|
+
} else {
|
|
48332
|
+
return cid;
|
|
48333
|
+
}
|
|
48334
|
+
}
|
|
48335
|
+
var DAG_PB_CODE = 112;
|
|
48336
|
+
var SHA_256_CODE = 18;
|
|
48337
|
+
function encodeCID(version28, code2, multihash) {
|
|
48338
|
+
const codeOffset = encodingLength(version28);
|
|
48339
|
+
const hashOffset = codeOffset + encodingLength(code2);
|
|
48340
|
+
const bytes = new Uint8Array(hashOffset + multihash.byteLength);
|
|
48341
|
+
encodeTo(version28, bytes, 0);
|
|
48342
|
+
encodeTo(code2, bytes, codeOffset);
|
|
48343
|
+
bytes.set(multihash, hashOffset);
|
|
48344
|
+
return bytes;
|
|
48345
|
+
}
|
|
48346
|
+
var cidSymbol = /* @__PURE__ */ Symbol.for("@ipld/js-cid/CID");
|
|
48347
|
+
|
|
48348
|
+
// ../../node_modules/multiformats/dist/src/bases/base10.js
|
|
48349
|
+
var base10_exports = {};
|
|
48350
|
+
__export(base10_exports, {
|
|
48351
|
+
base10: () => base10
|
|
48352
|
+
});
|
|
48353
|
+
var base10 = baseX({
|
|
48354
|
+
prefix: "9",
|
|
48355
|
+
name: "base10",
|
|
48356
|
+
alphabet: "0123456789"
|
|
48357
|
+
});
|
|
48358
|
+
|
|
48359
|
+
// ../../node_modules/multiformats/dist/src/bases/base16.js
|
|
48360
|
+
var base16_exports = {};
|
|
48361
|
+
__export(base16_exports, {
|
|
48362
|
+
base16: () => base16,
|
|
48363
|
+
base16upper: () => base16upper
|
|
48364
|
+
});
|
|
48365
|
+
var base16 = rfc4648({
|
|
48366
|
+
prefix: "f",
|
|
48367
|
+
name: "base16",
|
|
48368
|
+
alphabet: "0123456789abcdef",
|
|
48369
|
+
bitsPerChar: 4
|
|
48370
|
+
});
|
|
48371
|
+
var base16upper = rfc4648({
|
|
48372
|
+
prefix: "F",
|
|
48373
|
+
name: "base16upper",
|
|
48374
|
+
alphabet: "0123456789ABCDEF",
|
|
48375
|
+
bitsPerChar: 4
|
|
48376
|
+
});
|
|
48377
|
+
|
|
48378
|
+
// ../../node_modules/multiformats/dist/src/bases/base2.js
|
|
48379
|
+
var base2_exports = {};
|
|
48380
|
+
__export(base2_exports, {
|
|
48381
|
+
base2: () => base22
|
|
48382
|
+
});
|
|
48383
|
+
var base22 = rfc4648({
|
|
48384
|
+
prefix: "0",
|
|
48385
|
+
name: "base2",
|
|
48386
|
+
alphabet: "01",
|
|
48387
|
+
bitsPerChar: 1
|
|
48388
|
+
});
|
|
48389
|
+
|
|
48390
|
+
// ../../node_modules/multiformats/dist/src/bases/base256emoji.js
|
|
48391
|
+
var base256emoji_exports = {};
|
|
48392
|
+
__export(base256emoji_exports, {
|
|
48393
|
+
base256emoji: () => base256emoji
|
|
48394
|
+
});
|
|
48395
|
+
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}");
|
|
48396
|
+
var alphabetBytesToChars = alphabet.reduce((p, c, i) => {
|
|
48397
|
+
p[i] = c;
|
|
48398
|
+
return p;
|
|
48399
|
+
}, []);
|
|
48400
|
+
var alphabetCharsToBytes = alphabet.reduce((p, c, i) => {
|
|
48401
|
+
const codePoint = c.codePointAt(0);
|
|
48402
|
+
if (codePoint == null) {
|
|
48403
|
+
throw new Error(`Invalid character: ${c}`);
|
|
48404
|
+
}
|
|
48405
|
+
p[codePoint] = i;
|
|
48406
|
+
return p;
|
|
48407
|
+
}, []);
|
|
48408
|
+
function encode6(data) {
|
|
48409
|
+
return data.reduce((p, c) => {
|
|
48410
|
+
p += alphabetBytesToChars[c];
|
|
48411
|
+
return p;
|
|
48412
|
+
}, "");
|
|
48413
|
+
}
|
|
48414
|
+
function decode7(str) {
|
|
48415
|
+
const byts = [];
|
|
48416
|
+
for (const char of str) {
|
|
48417
|
+
const codePoint = char.codePointAt(0);
|
|
48418
|
+
if (codePoint == null) {
|
|
48419
|
+
throw new Error(`Invalid character: ${char}`);
|
|
48420
|
+
}
|
|
48421
|
+
const byt = alphabetCharsToBytes[codePoint];
|
|
48422
|
+
if (byt == null) {
|
|
48423
|
+
throw new Error(`Non-base256emoji character: ${char}`);
|
|
48424
|
+
}
|
|
48425
|
+
byts.push(byt);
|
|
48426
|
+
}
|
|
48427
|
+
return new Uint8Array(byts);
|
|
48428
|
+
}
|
|
48429
|
+
var base256emoji = from({
|
|
48430
|
+
prefix: "\u{1F680}",
|
|
48431
|
+
name: "base256emoji",
|
|
48432
|
+
encode: encode6,
|
|
48433
|
+
decode: decode7
|
|
48434
|
+
});
|
|
48435
|
+
|
|
48436
|
+
// ../../node_modules/multiformats/dist/src/bases/base64.js
|
|
48437
|
+
var base64_exports = {};
|
|
48438
|
+
__export(base64_exports, {
|
|
48439
|
+
base64: () => base64,
|
|
48440
|
+
base64pad: () => base64pad,
|
|
48441
|
+
base64url: () => base64url,
|
|
48442
|
+
base64urlpad: () => base64urlpad
|
|
48443
|
+
});
|
|
48444
|
+
var base64 = rfc4648({
|
|
48445
|
+
prefix: "m",
|
|
48446
|
+
name: "base64",
|
|
48447
|
+
alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
|
|
48448
|
+
bitsPerChar: 6
|
|
48449
|
+
});
|
|
48450
|
+
var base64pad = rfc4648({
|
|
48451
|
+
prefix: "M",
|
|
48452
|
+
name: "base64pad",
|
|
48453
|
+
alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
|
|
48454
|
+
bitsPerChar: 6
|
|
48455
|
+
});
|
|
48456
|
+
var base64url = rfc4648({
|
|
48457
|
+
prefix: "u",
|
|
48458
|
+
name: "base64url",
|
|
48459
|
+
alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",
|
|
48460
|
+
bitsPerChar: 6
|
|
48461
|
+
});
|
|
48462
|
+
var base64urlpad = rfc4648({
|
|
48463
|
+
prefix: "U",
|
|
48464
|
+
name: "base64urlpad",
|
|
48465
|
+
alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",
|
|
48466
|
+
bitsPerChar: 6
|
|
48467
|
+
});
|
|
48468
|
+
|
|
48469
|
+
// ../../node_modules/multiformats/dist/src/bases/base8.js
|
|
48470
|
+
var base8_exports = {};
|
|
48471
|
+
__export(base8_exports, {
|
|
48472
|
+
base8: () => base8
|
|
48473
|
+
});
|
|
48474
|
+
var base8 = rfc4648({
|
|
48475
|
+
prefix: "7",
|
|
48476
|
+
name: "base8",
|
|
48477
|
+
alphabet: "01234567",
|
|
48478
|
+
bitsPerChar: 3
|
|
48479
|
+
});
|
|
48480
|
+
|
|
48481
|
+
// ../../node_modules/multiformats/dist/src/bases/identity.js
|
|
48482
|
+
var identity_exports = {};
|
|
48483
|
+
__export(identity_exports, {
|
|
48484
|
+
identity: () => identity
|
|
48485
|
+
});
|
|
48486
|
+
var identity = from({
|
|
48487
|
+
prefix: "\0",
|
|
48488
|
+
name: "identity",
|
|
48489
|
+
encode: (buf) => toString(buf),
|
|
48490
|
+
decode: (str) => fromString(str)
|
|
48491
|
+
});
|
|
48492
|
+
|
|
48493
|
+
// ../../node_modules/multiformats/dist/src/codecs/json.js
|
|
48494
|
+
var textEncoder = new TextEncoder();
|
|
48495
|
+
var textDecoder = new TextDecoder();
|
|
48496
|
+
|
|
48497
|
+
// ../../node_modules/multiformats/dist/src/hashes/identity.js
|
|
48498
|
+
var identity_exports2 = {};
|
|
48499
|
+
__export(identity_exports2, {
|
|
48500
|
+
identity: () => identity2
|
|
48501
|
+
});
|
|
48502
|
+
var code = 0;
|
|
48503
|
+
var name = "identity";
|
|
48504
|
+
var encode7 = coerce2;
|
|
48505
|
+
function digest(input, options) {
|
|
48506
|
+
if (options?.truncate != null && options.truncate !== input.byteLength) {
|
|
48507
|
+
if (options.truncate < 0 || options.truncate > input.byteLength) {
|
|
48508
|
+
throw new Error(`Invalid truncate option, must be less than or equal to ${input.byteLength}`);
|
|
48509
|
+
}
|
|
48510
|
+
input = input.subarray(0, options.truncate);
|
|
48511
|
+
}
|
|
48512
|
+
return create(code, encode7(input));
|
|
48513
|
+
}
|
|
48514
|
+
var identity2 = { code, name, encode: encode7, digest };
|
|
48515
|
+
|
|
48516
|
+
// ../../node_modules/multiformats/dist/src/hashes/sha2.js
|
|
48517
|
+
var sha2_exports = {};
|
|
48518
|
+
__export(sha2_exports, {
|
|
48519
|
+
sha256: () => sha2563,
|
|
48520
|
+
sha512: () => sha5122
|
|
48521
|
+
});
|
|
48522
|
+
import crypto3 from "crypto";
|
|
48523
|
+
|
|
48524
|
+
// ../../node_modules/multiformats/dist/src/hashes/hasher.js
|
|
48525
|
+
var DEFAULT_MIN_DIGEST_LENGTH = 20;
|
|
48526
|
+
function from2({ name: name2, code: code2, encode: encode8, minDigestLength, maxDigestLength }) {
|
|
48527
|
+
return new Hasher(name2, code2, encode8, minDigestLength, maxDigestLength);
|
|
48528
|
+
}
|
|
48529
|
+
var Hasher = class {
|
|
48530
|
+
name;
|
|
48531
|
+
code;
|
|
48532
|
+
encode;
|
|
48533
|
+
minDigestLength;
|
|
48534
|
+
maxDigestLength;
|
|
48535
|
+
constructor(name2, code2, encode8, minDigestLength, maxDigestLength) {
|
|
48536
|
+
this.name = name2;
|
|
48537
|
+
this.code = code2;
|
|
48538
|
+
this.encode = encode8;
|
|
48539
|
+
this.minDigestLength = minDigestLength ?? DEFAULT_MIN_DIGEST_LENGTH;
|
|
48540
|
+
this.maxDigestLength = maxDigestLength;
|
|
48541
|
+
}
|
|
48542
|
+
digest(input, options) {
|
|
48543
|
+
if (options?.truncate != null) {
|
|
48544
|
+
if (options.truncate < this.minDigestLength) {
|
|
48545
|
+
throw new Error(`Invalid truncate option, must be greater than or equal to ${this.minDigestLength}`);
|
|
48546
|
+
}
|
|
48547
|
+
if (this.maxDigestLength != null && options.truncate > this.maxDigestLength) {
|
|
48548
|
+
throw new Error(`Invalid truncate option, must be less than or equal to ${this.maxDigestLength}`);
|
|
48549
|
+
}
|
|
48550
|
+
}
|
|
48551
|
+
if (input instanceof Uint8Array) {
|
|
48552
|
+
const result = this.encode(input);
|
|
48553
|
+
if (result instanceof Uint8Array) {
|
|
48554
|
+
return createDigest(result, this.code, options?.truncate);
|
|
48555
|
+
}
|
|
48556
|
+
return result.then((digest2) => createDigest(digest2, this.code, options?.truncate));
|
|
48557
|
+
} else {
|
|
48558
|
+
throw Error("Unknown type, must be binary type");
|
|
48559
|
+
}
|
|
48560
|
+
}
|
|
48561
|
+
};
|
|
48562
|
+
function createDigest(digest2, code2, truncate) {
|
|
48563
|
+
if (truncate != null && truncate !== digest2.byteLength) {
|
|
48564
|
+
if (truncate > digest2.byteLength) {
|
|
48565
|
+
throw new Error(`Invalid truncate option, must be less than or equal to ${digest2.byteLength}`);
|
|
48566
|
+
}
|
|
48567
|
+
digest2 = digest2.subarray(0, truncate);
|
|
48568
|
+
}
|
|
48569
|
+
return create(code2, digest2);
|
|
48570
|
+
}
|
|
48571
|
+
|
|
48572
|
+
// ../../node_modules/multiformats/dist/src/hashes/sha2.js
|
|
48573
|
+
var sha2563 = from2({
|
|
48574
|
+
name: "sha2-256",
|
|
48575
|
+
code: 18,
|
|
48576
|
+
encode: (input) => coerce2(crypto3.createHash("sha256").update(input).digest())
|
|
48577
|
+
});
|
|
48578
|
+
var sha5122 = from2({
|
|
48579
|
+
name: "sha2-512",
|
|
48580
|
+
code: 19,
|
|
48581
|
+
encode: (input) => coerce2(crypto3.createHash("sha512").update(input).digest())
|
|
48582
|
+
});
|
|
48583
|
+
|
|
48584
|
+
// ../../node_modules/multiformats/dist/src/basics.js
|
|
48585
|
+
var bases = { ...identity_exports, ...base2_exports, ...base8_exports, ...base10_exports, ...base16_exports, ...base32_exports, ...base36_exports, ...base58_exports, ...base64_exports, ...base256emoji_exports };
|
|
48586
|
+
var hashes = { ...sha2_exports, ...identity_exports2 };
|
|
48587
|
+
|
|
48588
|
+
// ../sdk-core/dist/index.js
|
|
48589
|
+
var import_ms2 = __toESM(require_ms(), 1);
|
|
48590
|
+
|
|
48591
|
+
// ../../node_modules/uint8arrays/dist/src/equals.js
|
|
48592
|
+
function equals3(a, b) {
|
|
48593
|
+
if (a === b) {
|
|
48594
|
+
return true;
|
|
48595
|
+
}
|
|
48596
|
+
if (a.byteLength !== b.byteLength) {
|
|
48597
|
+
return false;
|
|
48598
|
+
}
|
|
48599
|
+
for (let i = 0; i < a.byteLength; i++) {
|
|
48600
|
+
if (a[i] !== b[i]) {
|
|
48601
|
+
return false;
|
|
48602
|
+
}
|
|
48603
|
+
}
|
|
48604
|
+
return true;
|
|
48605
|
+
}
|
|
48606
|
+
|
|
48607
|
+
// ../../node_modules/uint8arrays/dist/src/alloc.node.js
|
|
48608
|
+
import { Buffer as Buffer2 } from "buffer";
|
|
48609
|
+
|
|
48610
|
+
// ../../node_modules/uint8arrays/dist/src/util/as-uint8array.node.js
|
|
48611
|
+
function asUint8Array(buf) {
|
|
48612
|
+
return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);
|
|
48613
|
+
}
|
|
48614
|
+
|
|
48615
|
+
// ../../node_modules/uint8arrays/dist/src/alloc.node.js
|
|
48616
|
+
function allocUnsafe(size = 0) {
|
|
48617
|
+
return asUint8Array(Buffer2.allocUnsafe(size));
|
|
48618
|
+
}
|
|
48619
|
+
|
|
48620
|
+
// ../../node_modules/uint8-varint/dist/src/index.js
|
|
48621
|
+
var N12 = Math.pow(2, 7);
|
|
48622
|
+
var N22 = Math.pow(2, 14);
|
|
48623
|
+
var N32 = Math.pow(2, 21);
|
|
48624
|
+
var N42 = Math.pow(2, 28);
|
|
48625
|
+
var N52 = Math.pow(2, 35);
|
|
48626
|
+
var N62 = Math.pow(2, 42);
|
|
48627
|
+
var N72 = Math.pow(2, 49);
|
|
48628
|
+
var MSB2 = 128;
|
|
48629
|
+
var REST2 = 127;
|
|
48630
|
+
function encodingLength2(value) {
|
|
48631
|
+
if (value < N12) {
|
|
48632
|
+
return 1;
|
|
48633
|
+
}
|
|
48634
|
+
if (value < N22) {
|
|
48635
|
+
return 2;
|
|
48636
|
+
}
|
|
48637
|
+
if (value < N32) {
|
|
48638
|
+
return 3;
|
|
48639
|
+
}
|
|
48640
|
+
if (value < N42) {
|
|
48641
|
+
return 4;
|
|
48642
|
+
}
|
|
48643
|
+
if (value < N52) {
|
|
48644
|
+
return 5;
|
|
48656
48645
|
}
|
|
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)];
|
|
48646
|
+
if (value < N62) {
|
|
48647
|
+
return 6;
|
|
48677
48648
|
}
|
|
48678
|
-
|
|
48679
|
-
|
|
48680
|
-
|
|
48681
|
-
|
|
48682
|
-
|
|
48683
|
-
|
|
48684
|
-
|
|
48685
|
-
|
|
48686
|
-
|
|
48687
|
-
|
|
48688
|
-
|
|
48689
|
-
|
|
48690
|
-
|
|
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();
|
|
48649
|
+
if (value < N72) {
|
|
48650
|
+
return 7;
|
|
48651
|
+
}
|
|
48652
|
+
if (Number.MAX_SAFE_INTEGER != null && value > Number.MAX_SAFE_INTEGER) {
|
|
48653
|
+
throw new RangeError("Could not encode varint");
|
|
48654
|
+
}
|
|
48655
|
+
return 8;
|
|
48656
|
+
}
|
|
48657
|
+
function encodeUint8Array(value, buf, offset = 0) {
|
|
48658
|
+
switch (encodingLength2(value)) {
|
|
48659
|
+
case 8: {
|
|
48660
|
+
buf[offset++] = value & 255 | MSB2;
|
|
48661
|
+
value /= 128;
|
|
48701
48662
|
}
|
|
48702
|
-
|
|
48703
|
-
|
|
48663
|
+
case 7: {
|
|
48664
|
+
buf[offset++] = value & 255 | MSB2;
|
|
48665
|
+
value /= 128;
|
|
48704
48666
|
}
|
|
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");
|
|
48667
|
+
case 6: {
|
|
48668
|
+
buf[offset++] = value & 255 | MSB2;
|
|
48669
|
+
value /= 128;
|
|
48723
48670
|
}
|
|
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
|
-
];
|
|
48671
|
+
case 5: {
|
|
48672
|
+
buf[offset++] = value & 255 | MSB2;
|
|
48673
|
+
value /= 128;
|
|
48737
48674
|
}
|
|
48738
|
-
case
|
|
48739
|
-
|
|
48740
|
-
|
|
48675
|
+
case 4: {
|
|
48676
|
+
buf[offset++] = value & 255 | MSB2;
|
|
48677
|
+
value >>>= 7;
|
|
48741
48678
|
}
|
|
48742
|
-
case
|
|
48743
|
-
|
|
48744
|
-
|
|
48679
|
+
case 3: {
|
|
48680
|
+
buf[offset++] = value & 255 | MSB2;
|
|
48681
|
+
value >>>= 7;
|
|
48745
48682
|
}
|
|
48746
|
-
case
|
|
48747
|
-
|
|
48748
|
-
|
|
48683
|
+
case 2: {
|
|
48684
|
+
buf[offset++] = value & 255 | MSB2;
|
|
48685
|
+
value >>>= 7;
|
|
48749
48686
|
}
|
|
48750
|
-
|
|
48751
|
-
|
|
48752
|
-
|
|
48753
|
-
|
|
48754
|
-
return [source[0], base3.decode(source)];
|
|
48687
|
+
case 1: {
|
|
48688
|
+
buf[offset++] = value & 255;
|
|
48689
|
+
value >>>= 7;
|
|
48690
|
+
break;
|
|
48755
48691
|
}
|
|
48692
|
+
default:
|
|
48693
|
+
throw new Error("unreachable");
|
|
48756
48694
|
}
|
|
48695
|
+
return buf;
|
|
48757
48696
|
}
|
|
48758
|
-
function
|
|
48759
|
-
|
|
48760
|
-
|
|
48761
|
-
|
|
48697
|
+
function decodeUint8Array(buf, offset) {
|
|
48698
|
+
let b = buf[offset];
|
|
48699
|
+
let res = 0;
|
|
48700
|
+
res += b & REST2;
|
|
48701
|
+
if (b < MSB2) {
|
|
48702
|
+
return res;
|
|
48762
48703
|
}
|
|
48763
|
-
|
|
48764
|
-
|
|
48765
|
-
|
|
48766
|
-
|
|
48767
|
-
|
|
48768
|
-
|
|
48769
|
-
|
|
48704
|
+
b = buf[offset + 1];
|
|
48705
|
+
res += (b & REST2) << 7;
|
|
48706
|
+
if (b < MSB2) {
|
|
48707
|
+
return res;
|
|
48708
|
+
}
|
|
48709
|
+
b = buf[offset + 2];
|
|
48710
|
+
res += (b & REST2) << 14;
|
|
48711
|
+
if (b < MSB2) {
|
|
48712
|
+
return res;
|
|
48713
|
+
}
|
|
48714
|
+
b = buf[offset + 3];
|
|
48715
|
+
res += (b & REST2) << 21;
|
|
48716
|
+
if (b < MSB2) {
|
|
48717
|
+
return res;
|
|
48718
|
+
}
|
|
48719
|
+
b = buf[offset + 4];
|
|
48720
|
+
res += (b & REST2) * N42;
|
|
48721
|
+
if (b < MSB2) {
|
|
48722
|
+
return res;
|
|
48723
|
+
}
|
|
48724
|
+
b = buf[offset + 5];
|
|
48725
|
+
res += (b & REST2) * N52;
|
|
48726
|
+
if (b < MSB2) {
|
|
48727
|
+
return res;
|
|
48728
|
+
}
|
|
48729
|
+
b = buf[offset + 6];
|
|
48730
|
+
res += (b & REST2) * N62;
|
|
48731
|
+
if (b < MSB2) {
|
|
48732
|
+
return res;
|
|
48733
|
+
}
|
|
48734
|
+
b = buf[offset + 7];
|
|
48735
|
+
res += (b & REST2) * N72;
|
|
48736
|
+
if (b < MSB2) {
|
|
48737
|
+
return res;
|
|
48770
48738
|
}
|
|
48739
|
+
throw new RangeError("Could not decode varint");
|
|
48771
48740
|
}
|
|
48772
|
-
function
|
|
48773
|
-
|
|
48774
|
-
|
|
48775
|
-
|
|
48776
|
-
|
|
48777
|
-
|
|
48778
|
-
|
|
48741
|
+
function decodeUint8ArrayList(buf, offset) {
|
|
48742
|
+
let b = buf.get(offset);
|
|
48743
|
+
let res = 0;
|
|
48744
|
+
res += b & REST2;
|
|
48745
|
+
if (b < MSB2) {
|
|
48746
|
+
return res;
|
|
48747
|
+
}
|
|
48748
|
+
b = buf.get(offset + 1);
|
|
48749
|
+
res += (b & REST2) << 7;
|
|
48750
|
+
if (b < MSB2) {
|
|
48751
|
+
return res;
|
|
48752
|
+
}
|
|
48753
|
+
b = buf.get(offset + 2);
|
|
48754
|
+
res += (b & REST2) << 14;
|
|
48755
|
+
if (b < MSB2) {
|
|
48756
|
+
return res;
|
|
48757
|
+
}
|
|
48758
|
+
b = buf.get(offset + 3);
|
|
48759
|
+
res += (b & REST2) << 21;
|
|
48760
|
+
if (b < MSB2) {
|
|
48761
|
+
return res;
|
|
48762
|
+
}
|
|
48763
|
+
b = buf.get(offset + 4);
|
|
48764
|
+
res += (b & REST2) * N42;
|
|
48765
|
+
if (b < MSB2) {
|
|
48766
|
+
return res;
|
|
48767
|
+
}
|
|
48768
|
+
b = buf.get(offset + 5);
|
|
48769
|
+
res += (b & REST2) * N52;
|
|
48770
|
+
if (b < MSB2) {
|
|
48771
|
+
return res;
|
|
48772
|
+
}
|
|
48773
|
+
b = buf.get(offset + 6);
|
|
48774
|
+
res += (b & REST2) * N62;
|
|
48775
|
+
if (b < MSB2) {
|
|
48776
|
+
return res;
|
|
48777
|
+
}
|
|
48778
|
+
b = buf.get(offset + 7);
|
|
48779
|
+
res += (b & REST2) * N72;
|
|
48780
|
+
if (b < MSB2) {
|
|
48781
|
+
return res;
|
|
48782
|
+
}
|
|
48783
|
+
throw new RangeError("Could not decode varint");
|
|
48784
|
+
}
|
|
48785
|
+
function decode8(buf, offset = 0) {
|
|
48786
|
+
if (buf instanceof Uint8Array) {
|
|
48787
|
+
return decodeUint8Array(buf, offset);
|
|
48779
48788
|
} else {
|
|
48780
|
-
return
|
|
48789
|
+
return decodeUint8ArrayList(buf, offset);
|
|
48781
48790
|
}
|
|
48782
48791
|
}
|
|
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;
|
|
48792
|
+
|
|
48793
|
+
// ../../node_modules/uint8arrays/dist/src/concat.node.js
|
|
48794
|
+
import { Buffer as Buffer3 } from "buffer";
|
|
48795
|
+
function concat2(arrays, length2) {
|
|
48796
|
+
return asUint8Array(Buffer3.concat(arrays, length2));
|
|
48793
48797
|
}
|
|
48794
|
-
var cidSymbol = /* @__PURE__ */ Symbol.for("@ipld/js-cid/CID");
|
|
48795
48798
|
|
|
48796
|
-
// ../../node_modules/
|
|
48797
|
-
|
|
48798
|
-
var hashes = { ...sha2_exports, ...identity_exports2 };
|
|
48799
|
+
// ../../node_modules/uint8arrays/dist/src/from-string.node.js
|
|
48800
|
+
import { Buffer as Buffer4 } from "buffer";
|
|
48799
48801
|
|
|
48800
48802
|
// ../../node_modules/uint8arrays/dist/src/util/bases.js
|
|
48801
48803
|
function createCodec(name2, prefix, encode8, decode9) {
|
|
@@ -49367,13 +49369,13 @@ function bytesToComponents(bytes) {
|
|
|
49367
49369
|
const components = [];
|
|
49368
49370
|
let i = 0;
|
|
49369
49371
|
while (i < bytes.length) {
|
|
49370
|
-
const code2 =
|
|
49372
|
+
const code2 = decode8(bytes, i);
|
|
49371
49373
|
const codec = registry.getProtocol(code2);
|
|
49372
|
-
const codeLength =
|
|
49374
|
+
const codeLength = encodingLength2(code2);
|
|
49373
49375
|
const size = sizeForAddr(codec, bytes, i + codeLength);
|
|
49374
49376
|
let sizeLength = 0;
|
|
49375
49377
|
if (size > 0 && codec.size === V) {
|
|
49376
|
-
sizeLength =
|
|
49378
|
+
sizeLength = encodingLength2(size);
|
|
49377
49379
|
}
|
|
49378
49380
|
const componentLength = codeLength + sizeLength + size;
|
|
49379
49381
|
const component = {
|
|
@@ -49397,7 +49399,7 @@ function componentsToBytes(components) {
|
|
|
49397
49399
|
for (const component of components) {
|
|
49398
49400
|
if (component.bytes == null) {
|
|
49399
49401
|
const codec = registry.getProtocol(component.code);
|
|
49400
|
-
const codecLength =
|
|
49402
|
+
const codecLength = encodingLength2(component.code);
|
|
49401
49403
|
let valueBytes;
|
|
49402
49404
|
let valueLength = 0;
|
|
49403
49405
|
let valueLengthLength = 0;
|
|
@@ -49405,7 +49407,7 @@ function componentsToBytes(components) {
|
|
|
49405
49407
|
valueBytes = codec.valueToBytes?.(component.value) ?? fromString2(component.value);
|
|
49406
49408
|
valueLength = valueBytes.byteLength;
|
|
49407
49409
|
if (codec.size === V) {
|
|
49408
|
-
valueLengthLength =
|
|
49410
|
+
valueLengthLength = encodingLength2(valueLength);
|
|
49409
49411
|
}
|
|
49410
49412
|
}
|
|
49411
49413
|
const bytes3 = new Uint8Array(codecLength + valueLengthLength + valueLength);
|
|
@@ -49505,7 +49507,7 @@ function sizeForAddr(codec, bytes, offset) {
|
|
|
49505
49507
|
if (codec.size > 0) {
|
|
49506
49508
|
return codec.size / 8;
|
|
49507
49509
|
}
|
|
49508
|
-
return
|
|
49510
|
+
return decode8(bytes, offset);
|
|
49509
49511
|
}
|
|
49510
49512
|
|
|
49511
49513
|
// ../../node_modules/@multiformats/multiaddr/dist/src/multiaddr.js
|
|
@@ -49599,7 +49601,7 @@ var Multiaddr = class _Multiaddr {
|
|
|
49599
49601
|
});
|
|
49600
49602
|
}
|
|
49601
49603
|
equals(addr) {
|
|
49602
|
-
return
|
|
49604
|
+
return equals3(this.bytes, addr.bytes);
|
|
49603
49605
|
}
|
|
49604
49606
|
/**
|
|
49605
49607
|
* Returns Multiaddr as a human-readable string
|
|
@@ -49687,6 +49689,232 @@ var ClientSessionSchema = external_exports.object({
|
|
|
49687
49689
|
signature: external_exports.string(),
|
|
49688
49690
|
ens: EnsDataSchema.optional()
|
|
49689
49691
|
});
|
|
49692
|
+
var objectHasOwn = Object.hasOwn ?? Object.prototype.hasOwnProperty.call.bind(
|
|
49693
|
+
Object.prototype.hasOwnProperty
|
|
49694
|
+
);
|
|
49695
|
+
var textEncoder2 = new TextEncoder();
|
|
49696
|
+
var objectHasOwn2 = Object.hasOwn ?? Object.prototype.hasOwnProperty.call.bind(
|
|
49697
|
+
Object.prototype.hasOwnProperty
|
|
49698
|
+
);
|
|
49699
|
+
var CEILING_SERVICES = /* @__PURE__ */ new Set(["tinycloud.kv", "tinycloud.sql", "tinycloud.vfs"]);
|
|
49700
|
+
var GRANTABLE_ACTIONS = /* @__PURE__ */ new Map();
|
|
49701
|
+
for (const entry of CAPABILITY_REGISTRY) {
|
|
49702
|
+
if (!CEILING_SERVICES.has(entry.service)) {
|
|
49703
|
+
continue;
|
|
49704
|
+
}
|
|
49705
|
+
if (entry.aliasOf !== void 0 || entry.implies !== void 0 || entry.urn.endsWith("/*")) {
|
|
49706
|
+
continue;
|
|
49707
|
+
}
|
|
49708
|
+
const existing = GRANTABLE_ACTIONS.get(entry.service);
|
|
49709
|
+
if (existing === void 0) {
|
|
49710
|
+
GRANTABLE_ACTIONS.set(entry.service, /* @__PURE__ */ new Set([entry.urn]));
|
|
49711
|
+
continue;
|
|
49712
|
+
}
|
|
49713
|
+
existing.add(entry.urn);
|
|
49714
|
+
}
|
|
49715
|
+
var textEncoder22 = new TextEncoder();
|
|
49716
|
+
var objectHasOwn3 = Object.hasOwn ?? Object.prototype.hasOwnProperty.call.bind(
|
|
49717
|
+
Object.prototype.hasOwnProperty
|
|
49718
|
+
);
|
|
49719
|
+
var TRANSCRIPT_SHARE_BOOTSTRAP_SCHEMA = "xyz.tinycloud.exchange/transcript-bootstrap/v0";
|
|
49720
|
+
var OWNER_NODE_ENDPOINT_SCHEMA = "xyz.tinycloud.exchange/owner-node-endpoint/v1";
|
|
49721
|
+
var W3C_VC_CREDENTIAL_VERIFIER = "w3c.vc/credential/v1";
|
|
49722
|
+
var objectHasOwn4 = Object.hasOwn ?? Object.prototype.hasOwnProperty.call.bind(
|
|
49723
|
+
Object.prototype.hasOwnProperty
|
|
49724
|
+
);
|
|
49725
|
+
var POLICY_ENGINE_CHALLENGE_RESPONSE_SCHEMA = "xyz.tinycloud.policy/challenge/v0";
|
|
49726
|
+
var POLICY_ENGINE_DENIAL_SCHEMA = "xyz.tinycloud.policy-engine/denial/v0";
|
|
49727
|
+
var POLICY_ENGINE_GRANT_PRESENTATION_DENIAL_CODES = [
|
|
49728
|
+
"schema-invalid",
|
|
49729
|
+
"challenge-not-found",
|
|
49730
|
+
"challenge-expired",
|
|
49731
|
+
"challenge-nonce-consumed",
|
|
49732
|
+
"presentation-expired",
|
|
49733
|
+
"presentation-audience-mismatch",
|
|
49734
|
+
"presentation-evidence-missing",
|
|
49735
|
+
"digest-mismatch",
|
|
49736
|
+
"evidence-requirement-unknown",
|
|
49737
|
+
"evidence-requirement-duplicate",
|
|
49738
|
+
"holder-signature-invalid",
|
|
49739
|
+
"holder-signature-signer-mismatch",
|
|
49740
|
+
"id-mismatch",
|
|
49741
|
+
"requested-capabilities-exceeded",
|
|
49742
|
+
"requested-capabilities-hash-mismatch",
|
|
49743
|
+
"evidence-authority-missing",
|
|
49744
|
+
"evidence-credential-invalid",
|
|
49745
|
+
"evidence-domain-invalid",
|
|
49746
|
+
"evidence-domain-missing",
|
|
49747
|
+
"evidence-freshness-expired",
|
|
49748
|
+
"evidence-freshness-unestablishable",
|
|
49749
|
+
"evidence-issuer-missing",
|
|
49750
|
+
"evidence-issuer-untrusted",
|
|
49751
|
+
"evidence-presentation-invalid",
|
|
49752
|
+
"evidence-requirements-invalid",
|
|
49753
|
+
"evidence-verifier-unsupported",
|
|
49754
|
+
"enrollment-binding-mismatch",
|
|
49755
|
+
"enrollment-expired",
|
|
49756
|
+
"enrollment-not-yet-valid",
|
|
49757
|
+
"enrollment-out-of-scope",
|
|
49758
|
+
"enrollment-revoked",
|
|
49759
|
+
"enrollment-revoked-irreversible",
|
|
49760
|
+
"enrollment-status-rollback",
|
|
49761
|
+
"signature-invalid",
|
|
49762
|
+
"signer-not-authorized",
|
|
49763
|
+
"audience-mismatch",
|
|
49764
|
+
"capability-not-contained",
|
|
49765
|
+
"evidence-invalid",
|
|
49766
|
+
"evidence-missing",
|
|
49767
|
+
"evidence-stale",
|
|
49768
|
+
"evidence-subject-mismatch",
|
|
49769
|
+
"evidence-untrusted",
|
|
49770
|
+
"grant-ttl-exceeds-policy",
|
|
49771
|
+
"holder-did-mismatch",
|
|
49772
|
+
"holder-key-not-permitted",
|
|
49773
|
+
"holder-signature-invalid",
|
|
49774
|
+
"owner-mismatch",
|
|
49775
|
+
"policy-expired",
|
|
49776
|
+
"policy-inactive",
|
|
49777
|
+
"policy-not-found",
|
|
49778
|
+
"policy-not-satisfied",
|
|
49779
|
+
"policy-revoked",
|
|
49780
|
+
"policy-status-rollback",
|
|
49781
|
+
"rate-limited"
|
|
49782
|
+
];
|
|
49783
|
+
var JsonValueSchema = external_exports.lazy(
|
|
49784
|
+
() => external_exports.union([
|
|
49785
|
+
external_exports.string(),
|
|
49786
|
+
external_exports.number().finite(),
|
|
49787
|
+
external_exports.boolean(),
|
|
49788
|
+
external_exports.null(),
|
|
49789
|
+
external_exports.array(JsonValueSchema),
|
|
49790
|
+
external_exports.record(JsonValueSchema)
|
|
49791
|
+
])
|
|
49792
|
+
);
|
|
49793
|
+
var Rfc3339Schema = external_exports.string().refine((value) => parseStrictRfc33392(value) !== void 0, {
|
|
49794
|
+
message: "must be strict RFC 3339 date-time with timezone"
|
|
49795
|
+
});
|
|
49796
|
+
var SignedRecordSchema = external_exports.object({
|
|
49797
|
+
schema: external_exports.string(),
|
|
49798
|
+
engineRecordId: external_exports.string(),
|
|
49799
|
+
ownerDid: external_exports.string(),
|
|
49800
|
+
endpoint: external_exports.string(),
|
|
49801
|
+
audience: external_exports.string(),
|
|
49802
|
+
supportedPolicyVersions: external_exports.array(external_exports.string()),
|
|
49803
|
+
supportedEvidenceVerifiers: external_exports.array(external_exports.string()),
|
|
49804
|
+
grantIssuerDid: external_exports.string(),
|
|
49805
|
+
expiresAt: Rfc3339Schema,
|
|
49806
|
+
signature: external_exports.object({
|
|
49807
|
+
suite: external_exports.string(),
|
|
49808
|
+
signerDid: external_exports.string(),
|
|
49809
|
+
value: external_exports.string()
|
|
49810
|
+
}).strict()
|
|
49811
|
+
}).strict();
|
|
49812
|
+
var PolicyEngineSchema = external_exports.object({
|
|
49813
|
+
endpoint: external_exports.string().url(),
|
|
49814
|
+
audience: external_exports.string(),
|
|
49815
|
+
supportedEvidenceVerifiers: external_exports.tuple([
|
|
49816
|
+
external_exports.literal(W3C_VC_CREDENTIAL_VERIFIER)
|
|
49817
|
+
]),
|
|
49818
|
+
signedRecord: SignedRecordSchema
|
|
49819
|
+
}).strict();
|
|
49820
|
+
var OwnerNodeSchema = external_exports.object({
|
|
49821
|
+
schema: external_exports.literal(OWNER_NODE_ENDPOINT_SCHEMA),
|
|
49822
|
+
endpoint: external_exports.string().url(),
|
|
49823
|
+
spaceId: external_exports.string().min(1)
|
|
49824
|
+
}).strict();
|
|
49825
|
+
var ResourceHintSchema = external_exports.object({
|
|
49826
|
+
resourceType: external_exports.string(),
|
|
49827
|
+
resourceId: external_exports.string(),
|
|
49828
|
+
requestedCapabilities: external_exports.array(JsonValueSchema).min(1)
|
|
49829
|
+
}).strict();
|
|
49830
|
+
var BootstrapSchema = external_exports.object({
|
|
49831
|
+
schema: external_exports.literal(TRANSCRIPT_SHARE_BOOTSTRAP_SCHEMA),
|
|
49832
|
+
policyId: external_exports.string(),
|
|
49833
|
+
policyEngine: PolicyEngineSchema,
|
|
49834
|
+
ownerNode: OwnerNodeSchema,
|
|
49835
|
+
resourceHint: ResourceHintSchema
|
|
49836
|
+
}).strict();
|
|
49837
|
+
var SignatureSchema = external_exports.object({
|
|
49838
|
+
suite: external_exports.string(),
|
|
49839
|
+
signerDid: external_exports.string(),
|
|
49840
|
+
value: external_exports.string()
|
|
49841
|
+
}).strict();
|
|
49842
|
+
var ChallengeSchema = external_exports.object({
|
|
49843
|
+
schema: external_exports.literal(POLICY_ENGINE_CHALLENGE_RESPONSE_SCHEMA),
|
|
49844
|
+
challengeId: external_exports.string(),
|
|
49845
|
+
policyId: external_exports.string(),
|
|
49846
|
+
audience: external_exports.string(),
|
|
49847
|
+
nonce: external_exports.string().min(16),
|
|
49848
|
+
challengeExpiresAt: Rfc3339Schema,
|
|
49849
|
+
acceptedSuites: external_exports.array(external_exports.string()).min(1),
|
|
49850
|
+
requestedCapabilitiesTemplate: external_exports.array(JsonValueSchema).optional(),
|
|
49851
|
+
signature: SignatureSchema
|
|
49852
|
+
}).strict();
|
|
49853
|
+
var ChallengeResponseSchema = external_exports.object({ challenge: ChallengeSchema }).strict();
|
|
49854
|
+
var DenialSchema = external_exports.object({
|
|
49855
|
+
schema: external_exports.literal(POLICY_ENGINE_DENIAL_SCHEMA),
|
|
49856
|
+
code: external_exports.enum(POLICY_ENGINE_GRANT_PRESENTATION_DENIAL_CODES),
|
|
49857
|
+
message: external_exports.string().optional()
|
|
49858
|
+
}).strict();
|
|
49859
|
+
var ErrorEnvelopeDenialSchema = external_exports.object({
|
|
49860
|
+
error: external_exports.object({
|
|
49861
|
+
code: external_exports.enum(POLICY_ENGINE_GRANT_PRESENTATION_DENIAL_CODES),
|
|
49862
|
+
message: external_exports.string().optional()
|
|
49863
|
+
}).strict()
|
|
49864
|
+
}).strict();
|
|
49865
|
+
var WireDelegationSchema = external_exports.object({
|
|
49866
|
+
delegationId: external_exports.string(),
|
|
49867
|
+
issuanceId: external_exports.string().min(1),
|
|
49868
|
+
issuerDid: external_exports.string(),
|
|
49869
|
+
holderDid: external_exports.string(),
|
|
49870
|
+
policyId: external_exports.string(),
|
|
49871
|
+
capabilityHashHex: external_exports.string().regex(/^[0-9a-f]{64}$/),
|
|
49872
|
+
revocationMode: external_exports.literal("refresh_only"),
|
|
49873
|
+
issuedAt: Rfc3339Schema,
|
|
49874
|
+
expiresAt: Rfc3339Schema,
|
|
49875
|
+
terminal: external_exports.boolean(),
|
|
49876
|
+
encoded: external_exports.string()
|
|
49877
|
+
}).strict();
|
|
49878
|
+
var ResolveResponseSchema = external_exports.object({ delegation: WireDelegationSchema }).strict();
|
|
49879
|
+
var DelegateReceiptSchema = external_exports.object({
|
|
49880
|
+
cid: external_exports.string().min(1),
|
|
49881
|
+
activated: external_exports.array(external_exports.string()),
|
|
49882
|
+
skipped: external_exports.array(external_exports.string())
|
|
49883
|
+
}).strict();
|
|
49884
|
+
var SqlReadResponseSchema = external_exports.object({ rows: external_exports.array(JsonValueSchema) }).strict();
|
|
49885
|
+
var KvReadResponseSchema = external_exports.object({ value: JsonValueSchema }).strict();
|
|
49886
|
+
var LISTEN_SQL_STATEMENT_CATALOG = [
|
|
49887
|
+
{
|
|
49888
|
+
name: "listen.getConversation",
|
|
49889
|
+
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 = ?",
|
|
49890
|
+
fixedParams: [{ index: 0, value: "{conversationId}" }]
|
|
49891
|
+
},
|
|
49892
|
+
{
|
|
49893
|
+
name: "listen.listParticipants",
|
|
49894
|
+
sql: "SELECT id, name, email, speaker_label FROM participant WHERE conversation_id = ? ORDER BY COALESCE(speaker_label, name), id",
|
|
49895
|
+
fixedParams: [{ index: 0, value: "{conversationId}" }]
|
|
49896
|
+
}
|
|
49897
|
+
];
|
|
49898
|
+
var LISTEN_SQL_STATEMENT_BY_NAME = new Map(
|
|
49899
|
+
LISTEN_SQL_STATEMENT_CATALOG.map((statement) => [
|
|
49900
|
+
statement.name,
|
|
49901
|
+
statement
|
|
49902
|
+
])
|
|
49903
|
+
);
|
|
49904
|
+
function parseStrictRfc33392(value) {
|
|
49905
|
+
if (!/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(\.\d+)?(Z|[+-]\d{2}:\d{2})$/.test(
|
|
49906
|
+
value
|
|
49907
|
+
)) {
|
|
49908
|
+
return void 0;
|
|
49909
|
+
}
|
|
49910
|
+
const parsed = Date.parse(value);
|
|
49911
|
+
if (Number.isNaN(parsed)) {
|
|
49912
|
+
return void 0;
|
|
49913
|
+
}
|
|
49914
|
+
const canonical = new Date(parsed).toISOString().replace(".000Z", "Z");
|
|
49915
|
+
const reparsed = Date.parse(value);
|
|
49916
|
+
return Date.parse(canonical) === reparsed ? parsed : void 0;
|
|
49917
|
+
}
|
|
49690
49918
|
var ethereumAddressPattern = /^0x[a-fA-F0-9]{40}$/;
|
|
49691
49919
|
var EnsDataSchema2 = external_exports.object({
|
|
49692
49920
|
/** ENS name/domain. */
|
|
@@ -49839,6 +50067,22 @@ var DelegationSchema = external_exports.object({
|
|
|
49839
50067
|
/** Authorization header (UCAN bearer token) */
|
|
49840
50068
|
authHeader: external_exports.string().optional()
|
|
49841
50069
|
});
|
|
50070
|
+
var DelegationStatusSchema = external_exports.object({
|
|
50071
|
+
cid: external_exports.string().min(1),
|
|
50072
|
+
status: external_exports.enum(["active", "revoked", "expired", "unavailable", "not_found"]),
|
|
50073
|
+
exists: external_exports.boolean(),
|
|
50074
|
+
active: external_exports.boolean(),
|
|
50075
|
+
revoked: external_exports.boolean(),
|
|
50076
|
+
expired: external_exports.boolean()
|
|
50077
|
+
}).strict().superRefine((value, context) => {
|
|
50078
|
+
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;
|
|
50079
|
+
if (!valid) {
|
|
50080
|
+
context.addIssue({
|
|
50081
|
+
code: external_exports.ZodIssueCode.custom,
|
|
50082
|
+
message: "delegation status flags do not match status"
|
|
50083
|
+
});
|
|
50084
|
+
}
|
|
50085
|
+
});
|
|
49842
50086
|
var CapabilityEntrySchema = external_exports.object({
|
|
49843
50087
|
/** Resource URI this capability applies to */
|
|
49844
50088
|
resource: external_exports.string(),
|
|
@@ -50003,6 +50247,11 @@ var DelegationManagerConfigSchema = external_exports.object({
|
|
|
50003
50247
|
(val) => typeof val === "function",
|
|
50004
50248
|
{ message: "Expected an invoke function" }
|
|
50005
50249
|
),
|
|
50250
|
+
/** Platform-specific invoke function for raw resource URIs */
|
|
50251
|
+
invokeAny: external_exports.unknown().refine(
|
|
50252
|
+
(val) => val === void 0 || typeof val === "function",
|
|
50253
|
+
{ message: "Expected an invokeAny function or undefined" }
|
|
50254
|
+
).optional(),
|
|
50006
50255
|
/** Optional custom fetch implementation */
|
|
50007
50256
|
fetch: external_exports.unknown().refine(
|
|
50008
50257
|
(val) => val === void 0 || typeof val === "function",
|
|
@@ -50227,7 +50476,8 @@ var SERVICE_SHORT_TO_LONG2 = Object.freeze({
|
|
|
50227
50476
|
duckdb: "tinycloud.duckdb",
|
|
50228
50477
|
capabilities: "tinycloud.capabilities",
|
|
50229
50478
|
hooks: "tinycloud.hooks",
|
|
50230
|
-
encryption: "tinycloud.encryption"
|
|
50479
|
+
encryption: "tinycloud.encryption",
|
|
50480
|
+
delegation: "tinycloud.delegation"
|
|
50231
50481
|
});
|
|
50232
50482
|
var SERVICE_LONG_TO_SHORT2 = Object.freeze(
|
|
50233
50483
|
Object.fromEntries(
|
|
@@ -50342,6 +50592,10 @@ var SharingServiceConfigSchema = external_exports.object({
|
|
|
50342
50592
|
createDelegationWasm: external_exports.unknown().refine((val) => val === void 0 || typeof val === "function", {
|
|
50343
50593
|
message: "Expected a createDelegationWasm function or undefined"
|
|
50344
50594
|
}).optional(),
|
|
50595
|
+
/** CID computation used to verify transportable child delegations. */
|
|
50596
|
+
computeCid: external_exports.unknown().refine((val) => val === void 0 || typeof val === "function", {
|
|
50597
|
+
message: "Expected a computeCid function or undefined"
|
|
50598
|
+
}).optional(),
|
|
50345
50599
|
/**
|
|
50346
50600
|
* Path prefix for KV operations.
|
|
50347
50601
|
*/
|