@wovin/connect-nftstorage 0.0.1-RC21 → 0.0.1-RC22
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/{chunk-JPD6PCG6.js → chunk-7HXBFNXR.js} +491 -186
- package/dist/chunk-7HXBFNXR.js.map +1 -0
- package/dist/chunk-R6GDUZUI.js +1520 -0
- package/dist/chunk-R6GDUZUI.js.map +1 -0
- package/dist/chunk-UEOOYEN2.js +19054 -0
- package/dist/chunk-UEOOYEN2.js.map +1 -0
- package/dist/index.d.ts +3 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.html +7 -0
- package/dist/index.js +3 -8
- package/dist/index.js.map +1 -1
- package/dist/retrieve.js +2 -3
- package/dist/store.d.ts +2 -3
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +2 -4
- package/dist/utils.d.ts +0 -2
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +0 -20
- package/dist/utils.js.map +1 -1
- package/package.json +2 -3
- package/dist/chunk-4FG7WPTV.js +0 -104673
- package/dist/chunk-4FG7WPTV.js.map +0 -1
- package/dist/chunk-JN4DQDNQ.js +0 -385
- package/dist/chunk-JN4DQDNQ.js.map +0 -1
- package/dist/chunk-JPD6PCG6.js.map +0 -1
- package/dist/chunk-JS6FK6O4.js +0 -102284
- package/dist/chunk-JS6FK6O4.js.map +0 -1
- package/dist/chunk-RXHOK4WI.js +0 -16396
- package/dist/chunk-RXHOK4WI.js.map +0 -1
|
@@ -1,31 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Logger
|
|
3
|
-
} from "./chunk-JN4DQDNQ.js";
|
|
4
|
-
import {
|
|
5
|
-
concat,
|
|
6
|
-
crypto_exports,
|
|
7
|
-
equals,
|
|
8
|
-
fromString,
|
|
9
|
-
init_crypto,
|
|
10
|
-
toString,
|
|
11
|
-
ucan_exports,
|
|
12
|
-
webcrypto
|
|
13
|
-
} from "./chunk-4FG7WPTV.js";
|
|
14
1
|
import {
|
|
15
2
|
CID,
|
|
3
|
+
Logger,
|
|
16
4
|
__commonJS,
|
|
17
5
|
__export,
|
|
18
6
|
__require,
|
|
19
|
-
__toCommonJS,
|
|
20
7
|
__toESM,
|
|
21
|
-
|
|
22
|
-
|
|
8
|
+
base32_exports,
|
|
9
|
+
base58_exports,
|
|
10
|
+
baseX,
|
|
11
|
+
coerce,
|
|
12
|
+
create,
|
|
13
|
+
from,
|
|
14
|
+
fromString,
|
|
15
|
+
rfc4648,
|
|
16
|
+
toString
|
|
17
|
+
} from "./chunk-R6GDUZUI.js";
|
|
23
18
|
|
|
24
19
|
// ../../../node_modules/.pnpm/@stablelib+random@1.0.2/node_modules/@stablelib/random/lib/source/browser.js
|
|
25
20
|
var require_browser = __commonJS({
|
|
26
21
|
"../../../node_modules/.pnpm/@stablelib+random@1.0.2/node_modules/@stablelib/random/lib/source/browser.js"(exports) {
|
|
27
22
|
"use strict";
|
|
28
|
-
init_dirname();
|
|
29
23
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
24
|
exports.BrowserRandomSource = void 0;
|
|
31
25
|
var QUOTA = 65536;
|
|
@@ -59,7 +53,6 @@ var require_browser = __commonJS({
|
|
|
59
53
|
var require_wipe = __commonJS({
|
|
60
54
|
"../../../node_modules/.pnpm/@stablelib+wipe@1.0.1/node_modules/@stablelib/wipe/lib/wipe.js"(exports) {
|
|
61
55
|
"use strict";
|
|
62
|
-
init_dirname();
|
|
63
56
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
64
57
|
function wipe(array) {
|
|
65
58
|
for (var i = 0; i < array.length; i++) {
|
|
@@ -71,11 +64,17 @@ var require_wipe = __commonJS({
|
|
|
71
64
|
}
|
|
72
65
|
});
|
|
73
66
|
|
|
67
|
+
// (disabled):crypto
|
|
68
|
+
var require_crypto = __commonJS({
|
|
69
|
+
"(disabled):crypto"() {
|
|
70
|
+
"use strict";
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
|
|
74
74
|
// ../../../node_modules/.pnpm/@stablelib+random@1.0.2/node_modules/@stablelib/random/lib/source/node.js
|
|
75
75
|
var require_node = __commonJS({
|
|
76
76
|
"../../../node_modules/.pnpm/@stablelib+random@1.0.2/node_modules/@stablelib/random/lib/source/node.js"(exports) {
|
|
77
77
|
"use strict";
|
|
78
|
-
init_dirname();
|
|
79
78
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
80
79
|
exports.NodeRandomSource = void 0;
|
|
81
80
|
var wipe_1 = require_wipe();
|
|
@@ -84,7 +83,7 @@ var require_node = __commonJS({
|
|
|
84
83
|
this.isAvailable = false;
|
|
85
84
|
this.isInstantiated = false;
|
|
86
85
|
if (typeof __require !== "undefined") {
|
|
87
|
-
const nodeCrypto = (
|
|
86
|
+
const nodeCrypto = require_crypto();
|
|
88
87
|
if (nodeCrypto && nodeCrypto.randomBytes) {
|
|
89
88
|
this._crypto = nodeCrypto;
|
|
90
89
|
this.isAvailable = true;
|
|
@@ -116,7 +115,6 @@ var require_node = __commonJS({
|
|
|
116
115
|
var require_system = __commonJS({
|
|
117
116
|
"../../../node_modules/.pnpm/@stablelib+random@1.0.2/node_modules/@stablelib/random/lib/source/system.js"(exports) {
|
|
118
117
|
"use strict";
|
|
119
|
-
init_dirname();
|
|
120
118
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
121
119
|
exports.SystemRandomSource = void 0;
|
|
122
120
|
var browser_1 = require_browser();
|
|
@@ -153,7 +151,6 @@ var require_system = __commonJS({
|
|
|
153
151
|
var require_int = __commonJS({
|
|
154
152
|
"../../../node_modules/.pnpm/@stablelib+int@1.0.1/node_modules/@stablelib/int/lib/int.js"(exports) {
|
|
155
153
|
"use strict";
|
|
156
|
-
init_dirname();
|
|
157
154
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
158
155
|
function imulShim(a, b) {
|
|
159
156
|
var ah = a >>> 16 & 65535, al = a & 65535;
|
|
@@ -192,7 +189,6 @@ var require_int = __commonJS({
|
|
|
192
189
|
var require_binary = __commonJS({
|
|
193
190
|
"../../../node_modules/.pnpm/@stablelib+binary@1.0.1/node_modules/@stablelib/binary/lib/binary.js"(exports) {
|
|
194
191
|
"use strict";
|
|
195
|
-
init_dirname();
|
|
196
192
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
197
193
|
var int_1 = require_int();
|
|
198
194
|
function readInt16BE(array, offset) {
|
|
@@ -536,7 +532,6 @@ var require_binary = __commonJS({
|
|
|
536
532
|
var require_random = __commonJS({
|
|
537
533
|
"../../../node_modules/.pnpm/@stablelib+random@1.0.2/node_modules/@stablelib/random/lib/random.js"(exports) {
|
|
538
534
|
"use strict";
|
|
539
|
-
init_dirname();
|
|
540
535
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
541
536
|
exports.randomStringForEntropy = exports.randomString = exports.randomUint32 = exports.randomBytes = exports.defaultRandomSource = void 0;
|
|
542
537
|
var system_1 = require_system();
|
|
@@ -591,7 +586,6 @@ var require_random = __commonJS({
|
|
|
591
586
|
var require_sha512 = __commonJS({
|
|
592
587
|
"../../../node_modules/.pnpm/@stablelib+sha512@1.0.1/node_modules/@stablelib/sha512/lib/sha512.js"(exports) {
|
|
593
588
|
"use strict";
|
|
594
|
-
init_dirname();
|
|
595
589
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
596
590
|
var binary_1 = require_binary();
|
|
597
591
|
var wipe_1 = require_wipe();
|
|
@@ -1199,9 +1193,9 @@ var require_sha512 = __commonJS({
|
|
|
1199
1193
|
function hash(data) {
|
|
1200
1194
|
var h = new SHA512();
|
|
1201
1195
|
h.update(data);
|
|
1202
|
-
var
|
|
1196
|
+
var digest2 = h.digest();
|
|
1203
1197
|
h.clean();
|
|
1204
|
-
return
|
|
1198
|
+
return digest2;
|
|
1205
1199
|
}
|
|
1206
1200
|
exports.hash = hash;
|
|
1207
1201
|
}
|
|
@@ -1211,7 +1205,6 @@ var require_sha512 = __commonJS({
|
|
|
1211
1205
|
var require_ed25519 = __commonJS({
|
|
1212
1206
|
"../../../node_modules/.pnpm/@stablelib+ed25519@1.0.3/node_modules/@stablelib/ed25519/lib/ed25519.js"(exports) {
|
|
1213
1207
|
"use strict";
|
|
1214
|
-
init_dirname();
|
|
1215
1208
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1216
1209
|
exports.convertSecretKeyToX25519 = exports.convertPublicKeyToX25519 = exports.verify = exports.sign = exports.extractPublicKeyFromSecretKey = exports.generateKeyPair = exports.generateKeyPairFromSeed = exports.SEED_LENGTH = exports.SECRET_KEY_LENGTH = exports.PUBLIC_KEY_LENGTH = exports.SIGNATURE_LENGTH = void 0;
|
|
1217
1210
|
var random_1 = require_random();
|
|
@@ -2139,16 +2132,15 @@ var require_ed25519 = __commonJS({
|
|
|
2139
2132
|
var require_BigInteger = __commonJS({
|
|
2140
2133
|
"../../../node_modules/.pnpm/big-integer@1.6.51/node_modules/big-integer/BigInteger.js"(exports, module) {
|
|
2141
2134
|
"use strict";
|
|
2142
|
-
init_dirname();
|
|
2143
2135
|
var bigInt2 = function(undefined2) {
|
|
2144
2136
|
"use strict";
|
|
2145
2137
|
var BASE = 1e7, LOG_BASE = 7, MAX_INT = 9007199254740992, MAX_INT_ARR = smallToArray(MAX_INT), DEFAULT_ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyz";
|
|
2146
2138
|
var supportsNativeBigInt = typeof BigInt === "function";
|
|
2147
|
-
function Integer(v, radix,
|
|
2139
|
+
function Integer(v, radix, alphabet2, caseSensitive) {
|
|
2148
2140
|
if (typeof v === "undefined")
|
|
2149
2141
|
return Integer[0];
|
|
2150
2142
|
if (typeof radix !== "undefined")
|
|
2151
|
-
return +radix === 10 && !
|
|
2143
|
+
return +radix === 10 && !alphabet2 ? parseValue(v) : parseBase(v, radix, alphabet2, caseSensitive);
|
|
2152
2144
|
return parseValue(v);
|
|
2153
2145
|
}
|
|
2154
2146
|
function BigInteger(value, sign6) {
|
|
@@ -3227,19 +3219,19 @@ var require_BigInteger = __commonJS({
|
|
|
3227
3219
|
}
|
|
3228
3220
|
return low.add(Integer.fromArray(result, BASE, false));
|
|
3229
3221
|
}
|
|
3230
|
-
var parseBase = function(text, base,
|
|
3231
|
-
|
|
3222
|
+
var parseBase = function(text, base, alphabet2, caseSensitive) {
|
|
3223
|
+
alphabet2 = alphabet2 || DEFAULT_ALPHABET;
|
|
3232
3224
|
text = String(text);
|
|
3233
3225
|
if (!caseSensitive) {
|
|
3234
3226
|
text = text.toLowerCase();
|
|
3235
|
-
|
|
3227
|
+
alphabet2 = alphabet2.toLowerCase();
|
|
3236
3228
|
}
|
|
3237
3229
|
var length = text.length;
|
|
3238
3230
|
var i2;
|
|
3239
3231
|
var absBase = Math.abs(base);
|
|
3240
3232
|
var alphabetValues = {};
|
|
3241
|
-
for (i2 = 0; i2 <
|
|
3242
|
-
alphabetValues[
|
|
3233
|
+
for (i2 = 0; i2 < alphabet2.length; i2++) {
|
|
3234
|
+
alphabetValues[alphabet2[i2]] = i2;
|
|
3243
3235
|
}
|
|
3244
3236
|
for (i2 = 0; i2 < length; i2++) {
|
|
3245
3237
|
var c = text[i2];
|
|
@@ -3279,10 +3271,10 @@ var require_BigInteger = __commonJS({
|
|
|
3279
3271
|
}
|
|
3280
3272
|
return isNegative ? val.negate() : val;
|
|
3281
3273
|
}
|
|
3282
|
-
function stringify(digit,
|
|
3283
|
-
|
|
3284
|
-
if (digit <
|
|
3285
|
-
return
|
|
3274
|
+
function stringify(digit, alphabet2) {
|
|
3275
|
+
alphabet2 = alphabet2 || DEFAULT_ALPHABET;
|
|
3276
|
+
if (digit < alphabet2.length) {
|
|
3277
|
+
return alphabet2[digit];
|
|
3286
3278
|
}
|
|
3287
3279
|
return "<" + digit + ">";
|
|
3288
3280
|
}
|
|
@@ -3339,10 +3331,10 @@ var require_BigInteger = __commonJS({
|
|
|
3339
3331
|
out.push(left.toJSNumber());
|
|
3340
3332
|
return { value: out.reverse(), isNegative: neg };
|
|
3341
3333
|
}
|
|
3342
|
-
function toBaseString(n, base,
|
|
3334
|
+
function toBaseString(n, base, alphabet2) {
|
|
3343
3335
|
var arr = toBase(n, base);
|
|
3344
3336
|
return (arr.isNegative ? "-" : "") + arr.value.map(function(x) {
|
|
3345
|
-
return stringify(x,
|
|
3337
|
+
return stringify(x, alphabet2);
|
|
3346
3338
|
}).join("");
|
|
3347
3339
|
}
|
|
3348
3340
|
BigInteger.prototype.toArray = function(radix) {
|
|
@@ -3354,11 +3346,11 @@ var require_BigInteger = __commonJS({
|
|
|
3354
3346
|
NativeBigInt.prototype.toArray = function(radix) {
|
|
3355
3347
|
return toBase(this, radix);
|
|
3356
3348
|
};
|
|
3357
|
-
BigInteger.prototype.toString = function(radix,
|
|
3349
|
+
BigInteger.prototype.toString = function(radix, alphabet2) {
|
|
3358
3350
|
if (radix === undefined2)
|
|
3359
3351
|
radix = 10;
|
|
3360
3352
|
if (radix !== 10)
|
|
3361
|
-
return toBaseString(this, radix,
|
|
3353
|
+
return toBaseString(this, radix, alphabet2);
|
|
3362
3354
|
var v = this.value, l = v.length, str = String(v[--l]), zeros = "0000000", digit;
|
|
3363
3355
|
while (--l >= 0) {
|
|
3364
3356
|
digit = String(v[l]);
|
|
@@ -3367,11 +3359,11 @@ var require_BigInteger = __commonJS({
|
|
|
3367
3359
|
var sign6 = this.sign ? "-" : "";
|
|
3368
3360
|
return sign6 + str;
|
|
3369
3361
|
};
|
|
3370
|
-
SmallInteger.prototype.toString = function(radix,
|
|
3362
|
+
SmallInteger.prototype.toString = function(radix, alphabet2) {
|
|
3371
3363
|
if (radix === undefined2)
|
|
3372
3364
|
radix = 10;
|
|
3373
3365
|
if (radix != 10)
|
|
3374
|
-
return toBaseString(this, radix,
|
|
3366
|
+
return toBaseString(this, radix, alphabet2);
|
|
3375
3367
|
return String(this.value);
|
|
3376
3368
|
};
|
|
3377
3369
|
NativeBigInt.prototype.toString = SmallInteger.prototype.toString;
|
|
@@ -3492,24 +3484,376 @@ var require_BigInteger = __commonJS({
|
|
|
3492
3484
|
}
|
|
3493
3485
|
});
|
|
3494
3486
|
|
|
3495
|
-
// src/
|
|
3496
|
-
|
|
3487
|
+
// ../../../node_modules/.pnpm/uint8arrays@5.0.0/node_modules/uint8arrays/dist/src/util/as-uint8array.js
|
|
3488
|
+
function asUint8Array(buf) {
|
|
3489
|
+
if (globalThis.Buffer != null) {
|
|
3490
|
+
return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);
|
|
3491
|
+
}
|
|
3492
|
+
return buf;
|
|
3493
|
+
}
|
|
3497
3494
|
|
|
3498
|
-
// ../../../node_modules/.pnpm
|
|
3499
|
-
|
|
3495
|
+
// ../../../node_modules/.pnpm/uint8arrays@5.0.0/node_modules/uint8arrays/dist/src/alloc.js
|
|
3496
|
+
function allocUnsafe(size = 0) {
|
|
3497
|
+
if (globalThis.Buffer?.allocUnsafe != null) {
|
|
3498
|
+
return asUint8Array(globalThis.Buffer.allocUnsafe(size));
|
|
3499
|
+
}
|
|
3500
|
+
return new Uint8Array(size);
|
|
3501
|
+
}
|
|
3500
3502
|
|
|
3501
|
-
// ../../../node_modules/.pnpm
|
|
3502
|
-
|
|
3503
|
+
// ../../../node_modules/.pnpm/uint8arrays@5.0.0/node_modules/uint8arrays/dist/src/concat.js
|
|
3504
|
+
function concat(arrays, length) {
|
|
3505
|
+
if (globalThis.Buffer != null) {
|
|
3506
|
+
return asUint8Array(globalThis.Buffer.concat(arrays, length));
|
|
3507
|
+
}
|
|
3508
|
+
if (length == null) {
|
|
3509
|
+
length = arrays.reduce((acc, curr) => acc + curr.length, 0);
|
|
3510
|
+
}
|
|
3511
|
+
const output = allocUnsafe(length);
|
|
3512
|
+
let offset = 0;
|
|
3513
|
+
for (const arr of arrays) {
|
|
3514
|
+
output.set(arr, offset);
|
|
3515
|
+
offset += arr.length;
|
|
3516
|
+
}
|
|
3517
|
+
return asUint8Array(output);
|
|
3518
|
+
}
|
|
3519
|
+
|
|
3520
|
+
// ../../../node_modules/.pnpm/uint8arrays@5.0.0/node_modules/uint8arrays/dist/src/equals.js
|
|
3521
|
+
function equals(a, b) {
|
|
3522
|
+
if (a === b) {
|
|
3523
|
+
return true;
|
|
3524
|
+
}
|
|
3525
|
+
if (a.byteLength !== b.byteLength) {
|
|
3526
|
+
return false;
|
|
3527
|
+
}
|
|
3528
|
+
for (let i = 0; i < a.byteLength; i++) {
|
|
3529
|
+
if (a[i] !== b[i]) {
|
|
3530
|
+
return false;
|
|
3531
|
+
}
|
|
3532
|
+
}
|
|
3533
|
+
return true;
|
|
3534
|
+
}
|
|
3535
|
+
|
|
3536
|
+
// ../../../node_modules/.pnpm/multiformats@12.1.3/node_modules/multiformats/src/bases/base10.js
|
|
3537
|
+
var base10_exports = {};
|
|
3538
|
+
__export(base10_exports, {
|
|
3539
|
+
base10: () => base10
|
|
3540
|
+
});
|
|
3541
|
+
var base10 = baseX({
|
|
3542
|
+
prefix: "9",
|
|
3543
|
+
name: "base10",
|
|
3544
|
+
alphabet: "0123456789"
|
|
3545
|
+
});
|
|
3546
|
+
|
|
3547
|
+
// ../../../node_modules/.pnpm/multiformats@12.1.3/node_modules/multiformats/src/bases/base16.js
|
|
3548
|
+
var base16_exports = {};
|
|
3549
|
+
__export(base16_exports, {
|
|
3550
|
+
base16: () => base16,
|
|
3551
|
+
base16upper: () => base16upper
|
|
3552
|
+
});
|
|
3553
|
+
var base16 = rfc4648({
|
|
3554
|
+
prefix: "f",
|
|
3555
|
+
name: "base16",
|
|
3556
|
+
alphabet: "0123456789abcdef",
|
|
3557
|
+
bitsPerChar: 4
|
|
3558
|
+
});
|
|
3559
|
+
var base16upper = rfc4648({
|
|
3560
|
+
prefix: "F",
|
|
3561
|
+
name: "base16upper",
|
|
3562
|
+
alphabet: "0123456789ABCDEF",
|
|
3563
|
+
bitsPerChar: 4
|
|
3564
|
+
});
|
|
3565
|
+
|
|
3566
|
+
// ../../../node_modules/.pnpm/multiformats@12.1.3/node_modules/multiformats/src/bases/base2.js
|
|
3567
|
+
var base2_exports = {};
|
|
3568
|
+
__export(base2_exports, {
|
|
3569
|
+
base2: () => base2
|
|
3570
|
+
});
|
|
3571
|
+
var base2 = rfc4648({
|
|
3572
|
+
prefix: "0",
|
|
3573
|
+
name: "base2",
|
|
3574
|
+
alphabet: "01",
|
|
3575
|
+
bitsPerChar: 1
|
|
3576
|
+
});
|
|
3577
|
+
|
|
3578
|
+
// ../../../node_modules/.pnpm/multiformats@12.1.3/node_modules/multiformats/src/bases/base256emoji.js
|
|
3579
|
+
var base256emoji_exports = {};
|
|
3580
|
+
__export(base256emoji_exports, {
|
|
3581
|
+
base256emoji: () => base256emoji
|
|
3582
|
+
});
|
|
3583
|
+
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}");
|
|
3584
|
+
var alphabetBytesToChars = (
|
|
3585
|
+
/** @type {string[]} */
|
|
3586
|
+
alphabet.reduce(
|
|
3587
|
+
(p, c, i) => {
|
|
3588
|
+
p[i] = c;
|
|
3589
|
+
return p;
|
|
3590
|
+
},
|
|
3591
|
+
/** @type {string[]} */
|
|
3592
|
+
[]
|
|
3593
|
+
)
|
|
3594
|
+
);
|
|
3595
|
+
var alphabetCharsToBytes = (
|
|
3596
|
+
/** @type {number[]} */
|
|
3597
|
+
alphabet.reduce(
|
|
3598
|
+
(p, c, i) => {
|
|
3599
|
+
p[
|
|
3600
|
+
/** @type {number} */
|
|
3601
|
+
c.codePointAt(0)
|
|
3602
|
+
] = i;
|
|
3603
|
+
return p;
|
|
3604
|
+
},
|
|
3605
|
+
/** @type {number[]} */
|
|
3606
|
+
[]
|
|
3607
|
+
)
|
|
3608
|
+
);
|
|
3609
|
+
function encode(data) {
|
|
3610
|
+
return data.reduce((p, c) => {
|
|
3611
|
+
p += alphabetBytesToChars[c];
|
|
3612
|
+
return p;
|
|
3613
|
+
}, "");
|
|
3614
|
+
}
|
|
3615
|
+
function decode(str) {
|
|
3616
|
+
const byts = [];
|
|
3617
|
+
for (const char of str) {
|
|
3618
|
+
const byt = alphabetCharsToBytes[
|
|
3619
|
+
/** @type {number} */
|
|
3620
|
+
char.codePointAt(0)
|
|
3621
|
+
];
|
|
3622
|
+
if (byt === void 0) {
|
|
3623
|
+
throw new Error(`Non-base256emoji character: ${char}`);
|
|
3624
|
+
}
|
|
3625
|
+
byts.push(byt);
|
|
3626
|
+
}
|
|
3627
|
+
return new Uint8Array(byts);
|
|
3628
|
+
}
|
|
3629
|
+
var base256emoji = from({
|
|
3630
|
+
prefix: "\u{1F680}",
|
|
3631
|
+
name: "base256emoji",
|
|
3632
|
+
encode,
|
|
3633
|
+
decode
|
|
3634
|
+
});
|
|
3635
|
+
|
|
3636
|
+
// ../../../node_modules/.pnpm/multiformats@12.1.3/node_modules/multiformats/src/bases/base36.js
|
|
3637
|
+
var base36_exports = {};
|
|
3638
|
+
__export(base36_exports, {
|
|
3639
|
+
base36: () => base36,
|
|
3640
|
+
base36upper: () => base36upper
|
|
3641
|
+
});
|
|
3642
|
+
var base36 = baseX({
|
|
3643
|
+
prefix: "k",
|
|
3644
|
+
name: "base36",
|
|
3645
|
+
alphabet: "0123456789abcdefghijklmnopqrstuvwxyz"
|
|
3646
|
+
});
|
|
3647
|
+
var base36upper = baseX({
|
|
3648
|
+
prefix: "K",
|
|
3649
|
+
name: "base36upper",
|
|
3650
|
+
alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
|
3651
|
+
});
|
|
3652
|
+
|
|
3653
|
+
// ../../../node_modules/.pnpm/multiformats@12.1.3/node_modules/multiformats/src/bases/base64.js
|
|
3654
|
+
var base64_exports = {};
|
|
3655
|
+
__export(base64_exports, {
|
|
3656
|
+
base64: () => base64,
|
|
3657
|
+
base64pad: () => base64pad,
|
|
3658
|
+
base64url: () => base64url,
|
|
3659
|
+
base64urlpad: () => base64urlpad
|
|
3660
|
+
});
|
|
3661
|
+
var base64 = rfc4648({
|
|
3662
|
+
prefix: "m",
|
|
3663
|
+
name: "base64",
|
|
3664
|
+
alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
|
|
3665
|
+
bitsPerChar: 6
|
|
3666
|
+
});
|
|
3667
|
+
var base64pad = rfc4648({
|
|
3668
|
+
prefix: "M",
|
|
3669
|
+
name: "base64pad",
|
|
3670
|
+
alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
|
|
3671
|
+
bitsPerChar: 6
|
|
3672
|
+
});
|
|
3673
|
+
var base64url = rfc4648({
|
|
3674
|
+
prefix: "u",
|
|
3675
|
+
name: "base64url",
|
|
3676
|
+
alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",
|
|
3677
|
+
bitsPerChar: 6
|
|
3678
|
+
});
|
|
3679
|
+
var base64urlpad = rfc4648({
|
|
3680
|
+
prefix: "U",
|
|
3681
|
+
name: "base64urlpad",
|
|
3682
|
+
alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",
|
|
3683
|
+
bitsPerChar: 6
|
|
3684
|
+
});
|
|
3685
|
+
|
|
3686
|
+
// ../../../node_modules/.pnpm/multiformats@12.1.3/node_modules/multiformats/src/bases/base8.js
|
|
3687
|
+
var base8_exports = {};
|
|
3688
|
+
__export(base8_exports, {
|
|
3689
|
+
base8: () => base8
|
|
3690
|
+
});
|
|
3691
|
+
var base8 = rfc4648({
|
|
3692
|
+
prefix: "7",
|
|
3693
|
+
name: "base8",
|
|
3694
|
+
alphabet: "01234567",
|
|
3695
|
+
bitsPerChar: 3
|
|
3696
|
+
});
|
|
3697
|
+
|
|
3698
|
+
// ../../../node_modules/.pnpm/multiformats@12.1.3/node_modules/multiformats/src/bases/identity.js
|
|
3699
|
+
var identity_exports = {};
|
|
3700
|
+
__export(identity_exports, {
|
|
3701
|
+
identity: () => identity
|
|
3702
|
+
});
|
|
3703
|
+
var identity = from({
|
|
3704
|
+
prefix: "\0",
|
|
3705
|
+
name: "identity",
|
|
3706
|
+
encode: (buf) => toString(buf),
|
|
3707
|
+
decode: (str) => fromString(str)
|
|
3708
|
+
});
|
|
3709
|
+
|
|
3710
|
+
// ../../../node_modules/.pnpm/multiformats@12.1.3/node_modules/multiformats/src/codecs/json.js
|
|
3711
|
+
var textEncoder = new TextEncoder();
|
|
3712
|
+
var textDecoder = new TextDecoder();
|
|
3713
|
+
|
|
3714
|
+
// ../../../node_modules/.pnpm/multiformats@12.1.3/node_modules/multiformats/src/hashes/identity.js
|
|
3715
|
+
var identity_exports2 = {};
|
|
3716
|
+
__export(identity_exports2, {
|
|
3717
|
+
identity: () => identity2
|
|
3718
|
+
});
|
|
3719
|
+
var code = 0;
|
|
3720
|
+
var name = "identity";
|
|
3721
|
+
var encode2 = coerce;
|
|
3722
|
+
var digest = (input) => create(code, encode2(input));
|
|
3723
|
+
var identity2 = { code, name, encode: encode2, digest };
|
|
3724
|
+
|
|
3725
|
+
// ../../../node_modules/.pnpm/multiformats@12.1.3/node_modules/multiformats/src/hashes/sha2-browser.js
|
|
3726
|
+
var sha2_browser_exports = {};
|
|
3727
|
+
__export(sha2_browser_exports, {
|
|
3728
|
+
sha256: () => sha256,
|
|
3729
|
+
sha512: () => sha512
|
|
3730
|
+
});
|
|
3731
|
+
|
|
3732
|
+
// ../../../node_modules/.pnpm/multiformats@12.1.3/node_modules/multiformats/src/hashes/hasher.js
|
|
3733
|
+
var from2 = ({ name: name2, code: code2, encode: encode7 }) => new Hasher(name2, code2, encode7);
|
|
3734
|
+
var Hasher = class {
|
|
3735
|
+
/**
|
|
3736
|
+
*
|
|
3737
|
+
* @param {Name} name
|
|
3738
|
+
* @param {Code} code
|
|
3739
|
+
* @param {(input: Uint8Array) => Await<Uint8Array>} encode
|
|
3740
|
+
*/
|
|
3741
|
+
constructor(name2, code2, encode7) {
|
|
3742
|
+
this.name = name2;
|
|
3743
|
+
this.code = code2;
|
|
3744
|
+
this.encode = encode7;
|
|
3745
|
+
}
|
|
3746
|
+
/**
|
|
3747
|
+
* @param {Uint8Array} input
|
|
3748
|
+
* @returns {Await<Digest.Digest<Code, number>>}
|
|
3749
|
+
*/
|
|
3750
|
+
digest(input) {
|
|
3751
|
+
if (input instanceof Uint8Array) {
|
|
3752
|
+
const result = this.encode(input);
|
|
3753
|
+
return result instanceof Uint8Array ? create(this.code, result) : result.then((digest2) => create(this.code, digest2));
|
|
3754
|
+
} else {
|
|
3755
|
+
throw Error("Unknown type, must be binary type");
|
|
3756
|
+
}
|
|
3757
|
+
}
|
|
3758
|
+
};
|
|
3759
|
+
|
|
3760
|
+
// ../../../node_modules/.pnpm/multiformats@12.1.3/node_modules/multiformats/src/hashes/sha2-browser.js
|
|
3761
|
+
var sha = (name2) => (
|
|
3762
|
+
/**
|
|
3763
|
+
* @param {Uint8Array} data
|
|
3764
|
+
*/
|
|
3765
|
+
async (data) => new Uint8Array(await crypto.subtle.digest(name2, data))
|
|
3766
|
+
);
|
|
3767
|
+
var sha256 = from2({
|
|
3768
|
+
name: "sha2-256",
|
|
3769
|
+
code: 18,
|
|
3770
|
+
encode: sha("SHA-256")
|
|
3771
|
+
});
|
|
3772
|
+
var sha512 = from2({
|
|
3773
|
+
name: "sha2-512",
|
|
3774
|
+
code: 19,
|
|
3775
|
+
encode: sha("SHA-512")
|
|
3776
|
+
});
|
|
3777
|
+
|
|
3778
|
+
// ../../../node_modules/.pnpm/multiformats@12.1.3/node_modules/multiformats/src/basics.js
|
|
3779
|
+
var bases = { ...identity_exports, ...base2_exports, ...base8_exports, ...base10_exports, ...base16_exports, ...base32_exports, ...base36_exports, ...base58_exports, ...base64_exports, ...base256emoji_exports };
|
|
3780
|
+
var hashes = { ...sha2_browser_exports, ...identity_exports2 };
|
|
3781
|
+
|
|
3782
|
+
// ../../../node_modules/.pnpm/uint8arrays@5.0.0/node_modules/uint8arrays/dist/src/util/bases.js
|
|
3783
|
+
function createCodec(name2, prefix, encode7, decode2) {
|
|
3784
|
+
return {
|
|
3785
|
+
name: name2,
|
|
3786
|
+
prefix,
|
|
3787
|
+
encoder: {
|
|
3788
|
+
name: name2,
|
|
3789
|
+
prefix,
|
|
3790
|
+
encode: encode7
|
|
3791
|
+
},
|
|
3792
|
+
decoder: {
|
|
3793
|
+
decode: decode2
|
|
3794
|
+
}
|
|
3795
|
+
};
|
|
3796
|
+
}
|
|
3797
|
+
var string = createCodec("utf8", "u", (buf) => {
|
|
3798
|
+
const decoder = new TextDecoder("utf8");
|
|
3799
|
+
return "u" + decoder.decode(buf);
|
|
3800
|
+
}, (str) => {
|
|
3801
|
+
const encoder = new TextEncoder();
|
|
3802
|
+
return encoder.encode(str.substring(1));
|
|
3803
|
+
});
|
|
3804
|
+
var ascii = createCodec("ascii", "a", (buf) => {
|
|
3805
|
+
let string2 = "a";
|
|
3806
|
+
for (let i = 0; i < buf.length; i++) {
|
|
3807
|
+
string2 += String.fromCharCode(buf[i]);
|
|
3808
|
+
}
|
|
3809
|
+
return string2;
|
|
3810
|
+
}, (str) => {
|
|
3811
|
+
str = str.substring(1);
|
|
3812
|
+
const buf = allocUnsafe(str.length);
|
|
3813
|
+
for (let i = 0; i < str.length; i++) {
|
|
3814
|
+
buf[i] = str.charCodeAt(i);
|
|
3815
|
+
}
|
|
3816
|
+
return buf;
|
|
3817
|
+
});
|
|
3818
|
+
var BASES = {
|
|
3819
|
+
utf8: string,
|
|
3820
|
+
"utf-8": string,
|
|
3821
|
+
hex: bases.base16,
|
|
3822
|
+
latin1: ascii,
|
|
3823
|
+
ascii,
|
|
3824
|
+
binary: ascii,
|
|
3825
|
+
...bases
|
|
3826
|
+
};
|
|
3827
|
+
var bases_default = BASES;
|
|
3828
|
+
|
|
3829
|
+
// ../../../node_modules/.pnpm/uint8arrays@5.0.0/node_modules/uint8arrays/dist/src/from-string.js
|
|
3830
|
+
function fromString2(string2, encoding = "utf8") {
|
|
3831
|
+
const base = bases_default[encoding];
|
|
3832
|
+
if (base == null) {
|
|
3833
|
+
throw new Error(`Unsupported encoding "${encoding}"`);
|
|
3834
|
+
}
|
|
3835
|
+
if ((encoding === "utf8" || encoding === "utf-8") && globalThis.Buffer != null && globalThis.Buffer.from != null) {
|
|
3836
|
+
return asUint8Array(globalThis.Buffer.from(string2, "utf-8"));
|
|
3837
|
+
}
|
|
3838
|
+
return base.decoder.decode(`${base.prefix}${string2}`);
|
|
3839
|
+
}
|
|
3840
|
+
|
|
3841
|
+
// ../../../node_modules/.pnpm/uint8arrays@5.0.0/node_modules/uint8arrays/dist/src/to-string.js
|
|
3842
|
+
function toString2(array, encoding = "utf8") {
|
|
3843
|
+
const base = bases_default[encoding];
|
|
3844
|
+
if (base == null) {
|
|
3845
|
+
throw new Error(`Unsupported encoding "${encoding}"`);
|
|
3846
|
+
}
|
|
3847
|
+
if ((encoding === "utf8" || encoding === "utf-8") && globalThis.Buffer != null && globalThis.Buffer.from != null) {
|
|
3848
|
+
return globalThis.Buffer.from(array.buffer, array.byteOffset, array.byteLength).toString("utf8");
|
|
3849
|
+
}
|
|
3850
|
+
return base.encoder.encode(array).substring(1);
|
|
3851
|
+
}
|
|
3503
3852
|
|
|
3504
3853
|
// ../../../node_modules/.pnpm/@ucans+default-plugins@0.12.0/node_modules/@ucans/default-plugins/dist/esm/ed25519/keypair.js
|
|
3505
|
-
init_dirname();
|
|
3506
3854
|
var ed25519 = __toESM(require_ed25519(), 1);
|
|
3507
3855
|
|
|
3508
|
-
// ../../../node_modules/.pnpm/@ucans+default-plugins@0.12.0/node_modules/@ucans/default-plugins/dist/esm/ed25519/crypto.js
|
|
3509
|
-
init_dirname();
|
|
3510
|
-
|
|
3511
3856
|
// ../../../node_modules/.pnpm/@ucans+default-plugins@0.12.0/node_modules/@ucans/default-plugins/dist/esm/prefixes.js
|
|
3512
|
-
init_dirname();
|
|
3513
3857
|
var EDWARDS_DID_PREFIX = new Uint8Array([237, 1]);
|
|
3514
3858
|
var BLS_DID_PREFIX = new Uint8Array([234, 1]);
|
|
3515
3859
|
var P256_DID_PREFIX = new Uint8Array([128, 36]);
|
|
@@ -3520,13 +3864,12 @@ var RSA_DID_PREFIX_OLD = new Uint8Array([0, 245, 2]);
|
|
|
3520
3864
|
var BASE58_DID_PREFIX = "did:key:z";
|
|
3521
3865
|
|
|
3522
3866
|
// ../../../node_modules/.pnpm/@ucans+default-plugins@0.12.0/node_modules/@ucans/default-plugins/dist/esm/util.js
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
if (!did2.startsWith(BASE58_DID_PREFIX)) {
|
|
3867
|
+
function keyBytesFromDid(did, expectedPrefix) {
|
|
3868
|
+
if (!did.startsWith(BASE58_DID_PREFIX)) {
|
|
3526
3869
|
throw new Error("Please use a base58-encoded DID formatted `did:key:z...`");
|
|
3527
3870
|
}
|
|
3528
|
-
const didWithoutPrefix =
|
|
3529
|
-
const bytes =
|
|
3871
|
+
const didWithoutPrefix = did.slice(BASE58_DID_PREFIX.length);
|
|
3872
|
+
const bytes = fromString2(didWithoutPrefix, "base58btc");
|
|
3530
3873
|
if (!hasPrefix(bytes, expectedPrefix)) {
|
|
3531
3874
|
throw new Error(`Expected prefix: ${expectedPrefix}`);
|
|
3532
3875
|
}
|
|
@@ -3534,7 +3877,7 @@ function keyBytesFromDid(did2, expectedPrefix) {
|
|
|
3534
3877
|
}
|
|
3535
3878
|
function didFromKeyBytes(publicKeyBytes, prefix) {
|
|
3536
3879
|
const bytes = concat([prefix, publicKeyBytes]);
|
|
3537
|
-
const base58Key =
|
|
3880
|
+
const base58Key = toString2(bytes, "base58btc");
|
|
3538
3881
|
return BASE58_DID_PREFIX + base58Key;
|
|
3539
3882
|
}
|
|
3540
3883
|
var hasPrefix = (prefixedKey, prefix) => {
|
|
@@ -3542,8 +3885,8 @@ var hasPrefix = (prefixedKey, prefix) => {
|
|
|
3542
3885
|
};
|
|
3543
3886
|
|
|
3544
3887
|
// ../../../node_modules/.pnpm/@ucans+default-plugins@0.12.0/node_modules/@ucans/default-plugins/dist/esm/ed25519/crypto.js
|
|
3545
|
-
var didToPublicKey = (
|
|
3546
|
-
return keyBytesFromDid(
|
|
3888
|
+
var didToPublicKey = (did) => {
|
|
3889
|
+
return keyBytesFromDid(did, EDWARDS_DID_PREFIX);
|
|
3547
3890
|
};
|
|
3548
3891
|
var publicKeyToDid = (pubkey) => {
|
|
3549
3892
|
return didFromKeyBytes(pubkey, EDWARDS_DID_PREFIX);
|
|
@@ -3593,7 +3936,7 @@ var EdKeypair = class _EdKeypair {
|
|
|
3593
3936
|
}
|
|
3594
3937
|
static fromSecretKey(key, params) {
|
|
3595
3938
|
const { format: format2 = "base64pad", exportable = false } = params || {};
|
|
3596
|
-
const secretKey =
|
|
3939
|
+
const secretKey = fromString2(key, format2);
|
|
3597
3940
|
const publicKey = ed25519.extractPublicKeyFromSecretKey(secretKey);
|
|
3598
3941
|
return new _EdKeypair(secretKey, publicKey, exportable);
|
|
3599
3942
|
}
|
|
@@ -3610,16 +3953,16 @@ var EdKeypair = class _EdKeypair {
|
|
|
3610
3953
|
if (!this.exportable) {
|
|
3611
3954
|
throw new Error("Key is not exportable");
|
|
3612
3955
|
}
|
|
3613
|
-
return
|
|
3956
|
+
return toString2(this.secretKey, format2);
|
|
3614
3957
|
});
|
|
3615
3958
|
}
|
|
3616
3959
|
};
|
|
3617
3960
|
|
|
3618
|
-
// ../../../node_modules/.pnpm
|
|
3619
|
-
|
|
3961
|
+
// ../../../node_modules/.pnpm/one-webcrypto@1.0.3/node_modules/one-webcrypto/browser.mjs
|
|
3962
|
+
var _globalReference = globalThis || window || self;
|
|
3963
|
+
var webcrypto = _globalReference.crypto;
|
|
3620
3964
|
|
|
3621
3965
|
// ../../../node_modules/.pnpm/@ucans+default-plugins@0.12.0/node_modules/@ucans/default-plugins/dist/esm/rsa/crypto.js
|
|
3622
|
-
init_dirname();
|
|
3623
3966
|
var __awaiter2 = function(thisArg, _arguments, P, generator) {
|
|
3624
3967
|
function adopt(value) {
|
|
3625
3968
|
return value instanceof P ? value : new P(function(resolve) {
|
|
@@ -3656,12 +3999,12 @@ var importKey = (key) => __awaiter2(void 0, void 0, void 0, function* () {
|
|
|
3656
3999
|
var verify = (pubKey, msg, sig) => __awaiter2(void 0, void 0, void 0, function* () {
|
|
3657
4000
|
return yield webcrypto.subtle.verify({ name: RSA_ALG, saltLength: SALT_LEGNTH }, yield importKey(pubKey), sig, msg);
|
|
3658
4001
|
});
|
|
3659
|
-
var didToPublicKey2 = (
|
|
3660
|
-
const keyBytes = keyBytesFromDid(
|
|
4002
|
+
var didToPublicKey2 = (did) => {
|
|
4003
|
+
const keyBytes = keyBytesFromDid(did, RSA_DID_PREFIX);
|
|
3661
4004
|
return convertRSAPublicKeyToSubjectPublicKeyInfo(keyBytes);
|
|
3662
4005
|
};
|
|
3663
|
-
var oldDidToPublicKey = (
|
|
3664
|
-
return keyBytesFromDid(
|
|
4006
|
+
var oldDidToPublicKey = (did) => {
|
|
4007
|
+
return keyBytesFromDid(did, RSA_DID_PREFIX_OLD);
|
|
3665
4008
|
};
|
|
3666
4009
|
var SPKI_PARAMS_ENCODED = new Uint8Array([48, 13, 6, 9, 42, 134, 72, 134, 247, 13, 1, 1, 1, 5, 0]);
|
|
3667
4010
|
var ASN_SEQUENCE_TAG = new Uint8Array([48]);
|
|
@@ -3696,14 +4039,7 @@ function asn1DERLengthEncode(length) {
|
|
|
3696
4039
|
return new Uint8Array([128 | octets.length & 255, ...octets]);
|
|
3697
4040
|
}
|
|
3698
4041
|
|
|
3699
|
-
// ../../../node_modules/.pnpm/@ucans+default-plugins@0.12.0/node_modules/@ucans/default-plugins/dist/esm/types.js
|
|
3700
|
-
init_dirname();
|
|
3701
|
-
|
|
3702
|
-
// ../../../node_modules/.pnpm/@ucans+default-plugins@0.12.0/node_modules/@ucans/default-plugins/dist/esm/p256/keypair.js
|
|
3703
|
-
init_dirname();
|
|
3704
|
-
|
|
3705
4042
|
// ../../../node_modules/.pnpm/@ucans+default-plugins@0.12.0/node_modules/@ucans/default-plugins/dist/esm/p256/crypto.js
|
|
3706
|
-
init_dirname();
|
|
3707
4043
|
var import_big_integer = __toESM(require_BigInteger(), 1);
|
|
3708
4044
|
var __awaiter3 = function(thisArg, _arguments, P, generator) {
|
|
3709
4045
|
function adopt(value) {
|
|
@@ -3741,8 +4077,8 @@ var importKey2 = (key) => __awaiter3(void 0, void 0, void 0, function* () {
|
|
|
3741
4077
|
var verify2 = (pubKey, msg, sig) => __awaiter3(void 0, void 0, void 0, function* () {
|
|
3742
4078
|
return yield webcrypto.subtle.verify({ name: ALG, hash: { name: DEFAULT_HASH_ALG2 } }, yield importKey2(pubKey), sig, msg);
|
|
3743
4079
|
});
|
|
3744
|
-
var didToPublicKey3 = (
|
|
3745
|
-
const keyBytes = keyBytesFromDid(
|
|
4080
|
+
var didToPublicKey3 = (did) => {
|
|
4081
|
+
const keyBytes = keyBytesFromDid(did, P256_DID_PREFIX);
|
|
3746
4082
|
return decompressP256Pubkey(keyBytes);
|
|
3747
4083
|
};
|
|
3748
4084
|
var decompressP256Pubkey = (compressed) => {
|
|
@@ -3757,7 +4093,7 @@ var decompressP256Pubkey = (compressed) => {
|
|
|
3757
4093
|
const pIdent = prime.add(1).divide(4);
|
|
3758
4094
|
const signY = (0, import_big_integer.default)(compressed[0] - 2);
|
|
3759
4095
|
const x = compressed.slice(1);
|
|
3760
|
-
const xBig = (0, import_big_integer.default)(
|
|
4096
|
+
const xBig = (0, import_big_integer.default)(toString2(x, "base10"));
|
|
3761
4097
|
const maybeY = xBig.pow(3).subtract(xBig.multiply(3)).add(b).modPow(pIdent, prime);
|
|
3762
4098
|
let yBig;
|
|
3763
4099
|
if (maybeY.mod(2).equals(signY)) {
|
|
@@ -3765,7 +4101,7 @@ var decompressP256Pubkey = (compressed) => {
|
|
|
3765
4101
|
} else {
|
|
3766
4102
|
yBig = prime.subtract(maybeY);
|
|
3767
4103
|
}
|
|
3768
|
-
const y =
|
|
4104
|
+
const y = fromString2(yBig.toString(10), "base10");
|
|
3769
4105
|
const offset = 32 - y.length;
|
|
3770
4106
|
const yPadded = new Uint8Array(32);
|
|
3771
4107
|
yPadded.set(y, offset);
|
|
@@ -3774,7 +4110,6 @@ var decompressP256Pubkey = (compressed) => {
|
|
|
3774
4110
|
};
|
|
3775
4111
|
|
|
3776
4112
|
// ../../../node_modules/.pnpm/@ucans+default-plugins@0.12.0/node_modules/@ucans/default-plugins/dist/esm/ed25519/plugin.js
|
|
3777
|
-
init_dirname();
|
|
3778
4113
|
var ed255192 = __toESM(require_ed25519(), 1);
|
|
3779
4114
|
var __awaiter4 = function(thisArg, _arguments, P, generator) {
|
|
3780
4115
|
function adopt(value) {
|
|
@@ -3806,14 +4141,13 @@ var __awaiter4 = function(thisArg, _arguments, P, generator) {
|
|
|
3806
4141
|
var ed25519Plugin = {
|
|
3807
4142
|
prefix: EDWARDS_DID_PREFIX,
|
|
3808
4143
|
jwtAlg: "EdDSA",
|
|
3809
|
-
verifySignature: (
|
|
3810
|
-
const publicKey = didToPublicKey(
|
|
4144
|
+
verifySignature: (did, data, sig) => __awaiter4(void 0, void 0, void 0, function* () {
|
|
4145
|
+
const publicKey = didToPublicKey(did);
|
|
3811
4146
|
return ed255192.verify(publicKey, data, sig);
|
|
3812
4147
|
})
|
|
3813
4148
|
};
|
|
3814
4149
|
|
|
3815
4150
|
// ../../../node_modules/.pnpm/@ucans+default-plugins@0.12.0/node_modules/@ucans/default-plugins/dist/esm/rsa/plugin.js
|
|
3816
|
-
init_dirname();
|
|
3817
4151
|
var __awaiter5 = function(thisArg, _arguments, P, generator) {
|
|
3818
4152
|
function adopt(value) {
|
|
3819
4153
|
return value instanceof P ? value : new P(function(resolve) {
|
|
@@ -3844,22 +4178,21 @@ var __awaiter5 = function(thisArg, _arguments, P, generator) {
|
|
|
3844
4178
|
var rsaPlugin = {
|
|
3845
4179
|
prefix: RSA_DID_PREFIX,
|
|
3846
4180
|
jwtAlg: "RS256",
|
|
3847
|
-
verifySignature: (
|
|
3848
|
-
const publicKey = didToPublicKey2(
|
|
4181
|
+
verifySignature: (did, data, sig) => __awaiter5(void 0, void 0, void 0, function* () {
|
|
4182
|
+
const publicKey = didToPublicKey2(did);
|
|
3849
4183
|
return verify(publicKey, data, sig);
|
|
3850
4184
|
})
|
|
3851
4185
|
};
|
|
3852
4186
|
var rsaOldPlugin = {
|
|
3853
4187
|
prefix: RSA_DID_PREFIX_OLD,
|
|
3854
4188
|
jwtAlg: "RS256",
|
|
3855
|
-
verifySignature: (
|
|
3856
|
-
const publicKey = oldDidToPublicKey(
|
|
4189
|
+
verifySignature: (did, data, sig) => __awaiter5(void 0, void 0, void 0, function* () {
|
|
4190
|
+
const publicKey = oldDidToPublicKey(did);
|
|
3857
4191
|
return verify(publicKey, data, sig);
|
|
3858
4192
|
})
|
|
3859
4193
|
};
|
|
3860
4194
|
|
|
3861
4195
|
// ../../../node_modules/.pnpm/@ucans+default-plugins@0.12.0/node_modules/@ucans/default-plugins/dist/esm/p256/plugin.js
|
|
3862
|
-
init_dirname();
|
|
3863
4196
|
var __awaiter6 = function(thisArg, _arguments, P, generator) {
|
|
3864
4197
|
function adopt(value) {
|
|
3865
4198
|
return value instanceof P ? value : new P(function(resolve) {
|
|
@@ -3890,26 +4223,13 @@ var __awaiter6 = function(thisArg, _arguments, P, generator) {
|
|
|
3890
4223
|
var p256Plugin = {
|
|
3891
4224
|
prefix: P256_DID_PREFIX,
|
|
3892
4225
|
jwtAlg: "ES256",
|
|
3893
|
-
verifySignature: (
|
|
3894
|
-
const publicKey = didToPublicKey3(
|
|
4226
|
+
verifySignature: (did, data, sig) => __awaiter6(void 0, void 0, void 0, function* () {
|
|
4227
|
+
const publicKey = didToPublicKey3(did);
|
|
3895
4228
|
return verify2(publicKey, data, sig);
|
|
3896
4229
|
})
|
|
3897
4230
|
};
|
|
3898
4231
|
|
|
3899
|
-
// ../../../node_modules/.pnpm/@ucans+default-plugins@0.12.0/node_modules/@ucans/default-plugins/dist/esm/default-plugins.js
|
|
3900
|
-
init_dirname();
|
|
3901
|
-
|
|
3902
|
-
// ../../../node_modules/.pnpm/@ucans+core@0.12.0/node_modules/@ucans/core/dist/esm/index.js
|
|
3903
|
-
init_dirname();
|
|
3904
|
-
|
|
3905
|
-
// ../../../node_modules/.pnpm/@ucans+core@0.12.0/node_modules/@ucans/core/dist/esm/token.js
|
|
3906
|
-
init_dirname();
|
|
3907
|
-
|
|
3908
|
-
// ../../../node_modules/.pnpm/@ucans+core@0.12.0/node_modules/@ucans/core/dist/esm/semver.js
|
|
3909
|
-
init_dirname();
|
|
3910
|
-
|
|
3911
4232
|
// ../../../node_modules/.pnpm/@ucans+core@0.12.0/node_modules/@ucans/core/dist/esm/util.js
|
|
3912
|
-
init_dirname();
|
|
3913
4233
|
var __awaiter7 = function(thisArg, _arguments, P, generator) {
|
|
3914
4234
|
function adopt(value) {
|
|
3915
4235
|
return value instanceof P ? value : new P(function(resolve) {
|
|
@@ -4062,13 +4382,13 @@ function comparePart(left, right) {
|
|
|
4062
4382
|
return LT;
|
|
4063
4383
|
return EQ;
|
|
4064
4384
|
}
|
|
4065
|
-
function
|
|
4385
|
+
function compare2(left, right) {
|
|
4066
4386
|
const l = typeof left === "string" ? parse(left) : left;
|
|
4067
4387
|
const r = typeof right === "string" ? parse(right) : right;
|
|
4068
4388
|
return comparePart(l === null || l === void 0 ? void 0 : l.major, r === null || r === void 0 ? void 0 : r.major) || comparePart(l === null || l === void 0 ? void 0 : l.minor, r === null || r === void 0 ? void 0 : r.minor) || comparePart(l === null || l === void 0 ? void 0 : l.patch, r === null || r === void 0 ? void 0 : r.patch);
|
|
4069
4389
|
}
|
|
4070
4390
|
function lt(left, right) {
|
|
4071
|
-
return
|
|
4391
|
+
return compare2(left, right) === LT;
|
|
4072
4392
|
}
|
|
4073
4393
|
function gte(left, right) {
|
|
4074
4394
|
return !lt(left, right);
|
|
@@ -4079,7 +4399,7 @@ var capability_exports = {};
|
|
|
4079
4399
|
__export(capability_exports, {
|
|
4080
4400
|
ability: () => ability_exports,
|
|
4081
4401
|
as: () => as2,
|
|
4082
|
-
encode: () =>
|
|
4402
|
+
encode: () => encode5,
|
|
4083
4403
|
isAbility: () => isAbility,
|
|
4084
4404
|
isCapability: () => isCapability,
|
|
4085
4405
|
isEncodedCapability: () => isEncodedCapability,
|
|
@@ -4089,7 +4409,6 @@ __export(capability_exports, {
|
|
|
4089
4409
|
prf: () => prf2,
|
|
4090
4410
|
resourcePointer: () => resource_pointer_exports
|
|
4091
4411
|
});
|
|
4092
|
-
init_dirname();
|
|
4093
4412
|
|
|
4094
4413
|
// ../../../node_modules/.pnpm/@ucans+core@0.12.0/node_modules/@ucans/core/dist/esm/capability/ability.js
|
|
4095
4414
|
var ability_exports = {};
|
|
@@ -4097,16 +4416,14 @@ __export(ability_exports, {
|
|
|
4097
4416
|
REDELEGATE: () => REDELEGATE,
|
|
4098
4417
|
SEPARATOR: () => SEPARATOR,
|
|
4099
4418
|
SUPERUSER: () => SUPERUSER,
|
|
4100
|
-
encode: () =>
|
|
4419
|
+
encode: () => encode3,
|
|
4101
4420
|
isAbility: () => isAbility,
|
|
4102
4421
|
isEqual: () => isEqual,
|
|
4103
4422
|
joinSegments: () => joinSegments,
|
|
4104
4423
|
parse: () => parse2
|
|
4105
4424
|
});
|
|
4106
|
-
init_dirname();
|
|
4107
4425
|
|
|
4108
4426
|
// ../../../node_modules/.pnpm/@ucans+core@0.12.0/node_modules/@ucans/core/dist/esm/capability/super-user.js
|
|
4109
|
-
init_dirname();
|
|
4110
4427
|
var SUPERUSER = "*";
|
|
4111
4428
|
|
|
4112
4429
|
// ../../../node_modules/.pnpm/@ucans+core@0.12.0/node_modules/@ucans/core/dist/esm/capability/ability.js
|
|
@@ -4125,7 +4442,7 @@ function isEqual(a, b) {
|
|
|
4125
4442
|
function joinSegments(segments) {
|
|
4126
4443
|
return segments.join(SEPARATOR);
|
|
4127
4444
|
}
|
|
4128
|
-
function
|
|
4445
|
+
function encode3(ability) {
|
|
4129
4446
|
switch (ability) {
|
|
4130
4447
|
case SUPERUSER:
|
|
4131
4448
|
return ability;
|
|
@@ -4138,8 +4455,8 @@ function parse2(ability) {
|
|
|
4138
4455
|
case SUPERUSER:
|
|
4139
4456
|
return SUPERUSER;
|
|
4140
4457
|
default: {
|
|
4141
|
-
const [
|
|
4142
|
-
return { namespace
|
|
4458
|
+
const [namespace, ...segments] = ability.split(SEPARATOR);
|
|
4459
|
+
return { namespace, segments };
|
|
4143
4460
|
}
|
|
4144
4461
|
}
|
|
4145
4462
|
}
|
|
@@ -4149,22 +4466,21 @@ var resource_pointer_exports = {};
|
|
|
4149
4466
|
__export(resource_pointer_exports, {
|
|
4150
4467
|
SEPARATOR: () => SEPARATOR2,
|
|
4151
4468
|
as: () => as,
|
|
4152
|
-
encode: () =>
|
|
4469
|
+
encode: () => encode4,
|
|
4153
4470
|
isEqual: () => isEqual2,
|
|
4154
4471
|
isResourcePointer: () => isResourcePointer,
|
|
4155
4472
|
my: () => my,
|
|
4156
4473
|
parse: () => parse3,
|
|
4157
4474
|
prf: () => prf
|
|
4158
4475
|
});
|
|
4159
|
-
init_dirname();
|
|
4160
4476
|
var SEPARATOR2 = ":";
|
|
4161
4477
|
function isResourcePointer(obj) {
|
|
4162
4478
|
return isRecord(obj) && hasProp(obj, "scheme") && typeof obj.scheme === "string" && hasProp(obj, "hierPart") && (obj.hierPart === SUPERUSER || typeof obj.hierPart === "string");
|
|
4163
4479
|
}
|
|
4164
|
-
function as(
|
|
4480
|
+
function as(did, resource) {
|
|
4165
4481
|
return {
|
|
4166
4482
|
scheme: "as",
|
|
4167
|
-
hierPart: `${
|
|
4483
|
+
hierPart: `${did}:${resource}`
|
|
4168
4484
|
};
|
|
4169
4485
|
}
|
|
4170
4486
|
function my(resource) {
|
|
@@ -4182,7 +4498,7 @@ function prf(selector) {
|
|
|
4182
4498
|
function isEqual2(a, b) {
|
|
4183
4499
|
return a.scheme.toLowerCase() === a.scheme.toLowerCase() && a.hierPart === b.hierPart;
|
|
4184
4500
|
}
|
|
4185
|
-
function
|
|
4501
|
+
function encode4(pointer) {
|
|
4186
4502
|
return `${pointer.scheme}${SEPARATOR2}${pointer.hierPart}`;
|
|
4187
4503
|
}
|
|
4188
4504
|
function parse3(pointer) {
|
|
@@ -4197,9 +4513,9 @@ function isCapability(obj) {
|
|
|
4197
4513
|
function isEncodedCapability(obj) {
|
|
4198
4514
|
return isRecord(obj) && hasProp(obj, "with") && typeof obj.with === "string" && hasProp(obj, "can") && typeof obj.can === "string";
|
|
4199
4515
|
}
|
|
4200
|
-
function as2(
|
|
4516
|
+
function as2(did, resource) {
|
|
4201
4517
|
return {
|
|
4202
|
-
with: as(
|
|
4518
|
+
with: as(did, resource),
|
|
4203
4519
|
can: SUPERUSER
|
|
4204
4520
|
};
|
|
4205
4521
|
}
|
|
@@ -4218,10 +4534,10 @@ function prf2(selector, ability) {
|
|
|
4218
4534
|
function isEqual3(a, b) {
|
|
4219
4535
|
return isEqual2(a.with, b.with) && isEqual(a.can, b.can);
|
|
4220
4536
|
}
|
|
4221
|
-
function
|
|
4537
|
+
function encode5(cap) {
|
|
4222
4538
|
return {
|
|
4223
|
-
with:
|
|
4224
|
-
can:
|
|
4539
|
+
with: encode4(cap.with),
|
|
4540
|
+
can: encode3(cap.can)
|
|
4225
4541
|
};
|
|
4226
4542
|
}
|
|
4227
4543
|
function parse4(cap) {
|
|
@@ -4231,11 +4547,7 @@ function parse4(cap) {
|
|
|
4231
4547
|
};
|
|
4232
4548
|
}
|
|
4233
4549
|
|
|
4234
|
-
// ../../../node_modules/.pnpm/@ucans+core@0.12.0/node_modules/@ucans/core/dist/esm/compatibility.js
|
|
4235
|
-
init_dirname();
|
|
4236
|
-
|
|
4237
4550
|
// ../../../node_modules/.pnpm/@ucans+core@0.12.0/node_modules/@ucans/core/dist/esm/types.js
|
|
4238
|
-
init_dirname();
|
|
4239
4551
|
function isKeypair(obj) {
|
|
4240
4552
|
return isRecord(obj) && hasProp(obj, "jwtAlg") && typeof obj.jwtAlg === "string" && hasProp(obj, "sign") && typeof obj.sign === "function";
|
|
4241
4553
|
}
|
|
@@ -4421,28 +4733,28 @@ var sign4 = (plugins) => (payload, jwtAlg, signFn) => __awaiter8(void 0, void 0,
|
|
|
4421
4733
|
const encodedHeader = encodeHeader(header);
|
|
4422
4734
|
const encodedPayload = encodePayload(payload);
|
|
4423
4735
|
const signedData = `${encodedHeader}.${encodedPayload}`;
|
|
4424
|
-
const toSign =
|
|
4736
|
+
const toSign = fromString2(signedData, "utf8");
|
|
4425
4737
|
const sig = yield signFn(toSign);
|
|
4426
4738
|
return Object.freeze({
|
|
4427
4739
|
header,
|
|
4428
4740
|
payload,
|
|
4429
4741
|
signedData,
|
|
4430
|
-
signature:
|
|
4742
|
+
signature: toString2(sig, "base64url")
|
|
4431
4743
|
});
|
|
4432
4744
|
});
|
|
4433
4745
|
var signWithKeypair = (plugins) => (payload, keypair) => {
|
|
4434
4746
|
return sign4(plugins)(payload, keypair.jwtAlg, (data) => keypair.sign(data));
|
|
4435
4747
|
};
|
|
4436
|
-
function
|
|
4748
|
+
function encode6(ucan) {
|
|
4437
4749
|
return `${ucan.signedData}.${ucan.signature}`;
|
|
4438
4750
|
}
|
|
4439
4751
|
function encodeHeader(header) {
|
|
4440
4752
|
const headerFormatted = Object.assign(Object.assign({}, header), { ucv: format(header.ucv) });
|
|
4441
|
-
return
|
|
4753
|
+
return toString2(fromString2(JSON.stringify(headerFormatted), "utf8"), "base64url");
|
|
4442
4754
|
}
|
|
4443
4755
|
function encodePayload(payload) {
|
|
4444
|
-
const payloadWithEncodedCaps = Object.assign(Object.assign({}, payload), { att: payload.att.map(
|
|
4445
|
-
return
|
|
4756
|
+
const payloadWithEncodedCaps = Object.assign(Object.assign({}, payload), { att: payload.att.map(encode5) });
|
|
4757
|
+
return toString2(fromString2(JSON.stringify(payloadWithEncodedCaps), "utf8"), "base64url");
|
|
4446
4758
|
}
|
|
4447
4759
|
function parse5(encodedUcan) {
|
|
4448
4760
|
const [encodedHeader, encodedPayload, signature] = encodedUcan.split(".");
|
|
@@ -4452,7 +4764,7 @@ function parse5(encodedUcan) {
|
|
|
4452
4764
|
let headerJson;
|
|
4453
4765
|
let headerObject;
|
|
4454
4766
|
try {
|
|
4455
|
-
headerJson =
|
|
4767
|
+
headerJson = toString2(fromString2(encodedHeader, "base64url"), "utf8");
|
|
4456
4768
|
} catch (_a) {
|
|
4457
4769
|
throw new Error(`Can't parse UCAN header: ${encodedHeader}: Can't parse as base64url.`);
|
|
4458
4770
|
}
|
|
@@ -4464,7 +4776,7 @@ function parse5(encodedUcan) {
|
|
|
4464
4776
|
let payloadJson;
|
|
4465
4777
|
let payloadObject;
|
|
4466
4778
|
try {
|
|
4467
|
-
payloadJson =
|
|
4779
|
+
payloadJson = toString2(fromString2(encodedPayload, "base64url"), "utf8");
|
|
4468
4780
|
} catch (_c) {
|
|
4469
4781
|
throw new Error(`Can't parse UCAN payload: ${encodedPayload}: Can't parse as base64url.`);
|
|
4470
4782
|
}
|
|
@@ -4493,8 +4805,8 @@ var validate = (plugins) => (encodedUcan, opts) => __awaiter8(void 0, void 0, vo
|
|
|
4493
4805
|
}
|
|
4494
4806
|
}
|
|
4495
4807
|
if (checkSignature) {
|
|
4496
|
-
const sigBytes =
|
|
4497
|
-
const data =
|
|
4808
|
+
const sigBytes = fromString2(signature, "base64url");
|
|
4809
|
+
const data = fromString2(`${encodedHeader}.${encodedPayload}`, "utf8");
|
|
4498
4810
|
const validSig = yield plugins.verifySignature(payload.iss, data, sigBytes);
|
|
4499
4811
|
if (!validSig) {
|
|
4500
4812
|
throw new Error(`Invalid UCAN: ${encodedUcan}: Signature invalid.`);
|
|
@@ -4548,11 +4860,7 @@ var isTooEarly = (ucan) => {
|
|
|
4548
4860
|
return ucan.payload.nbf > Math.floor(Date.now() / 1e3);
|
|
4549
4861
|
};
|
|
4550
4862
|
|
|
4551
|
-
// ../../../node_modules/.pnpm/@ucans+core@0.12.0/node_modules/@ucans/core/dist/esm/verify.js
|
|
4552
|
-
init_dirname();
|
|
4553
|
-
|
|
4554
4863
|
// ../../../node_modules/.pnpm/@ucans+core@0.12.0/node_modules/@ucans/core/dist/esm/attenuation.js
|
|
4555
|
-
init_dirname();
|
|
4556
4864
|
var __awaiter9 = function(thisArg, _arguments, P, generator) {
|
|
4557
4865
|
function adopt(value) {
|
|
4558
4866
|
return value instanceof P ? value : new P(function(resolve) {
|
|
@@ -4657,7 +4965,7 @@ var delegationChains = (plugins) => function(semantics, ucan, isRevoked = () =>
|
|
|
4657
4965
|
})) {
|
|
4658
4966
|
return __asyncGenerator2(this, arguments, function* () {
|
|
4659
4967
|
if (yield __await2(isRevoked(ucan))) {
|
|
4660
|
-
yield yield __await2(new Error(`UCAN Revoked: ${
|
|
4968
|
+
yield yield __await2(new Error(`UCAN Revoked: ${encode6(ucan)}`));
|
|
4661
4969
|
return yield __await2(void 0);
|
|
4662
4970
|
}
|
|
4663
4971
|
yield __await2(yield* __asyncDelegator(__asyncValues2(capabilitiesFromParenthood(ucan))));
|
|
@@ -4703,8 +5011,8 @@ function capabilityCanBeDelegated(semantics, capability, fromDelegationChain) {
|
|
|
4703
5011
|
}
|
|
4704
5012
|
return ownershipScope.scheme == capability.with.scheme && semantics.canDelegateAbility(ownershipScope.ability, capability.can);
|
|
4705
5013
|
}
|
|
4706
|
-
function ownershipCanBeDelegated(semantics,
|
|
4707
|
-
if (
|
|
5014
|
+
function ownershipCanBeDelegated(semantics, did, scope, fromDelegationChain) {
|
|
5015
|
+
if (did !== fromDelegationChain.ownershipDID) {
|
|
4708
5016
|
return false;
|
|
4709
5017
|
}
|
|
4710
5018
|
const parentScope = fromDelegationChain.scope;
|
|
@@ -5027,7 +5335,6 @@ var verify4 = (plugins) => (ucan, options) => __awaiter10(void 0, void 0, void 0
|
|
|
5027
5335
|
});
|
|
5028
5336
|
|
|
5029
5337
|
// ../../../node_modules/.pnpm/@ucans+core@0.12.0/node_modules/@ucans/core/dist/esm/builder.js
|
|
5030
|
-
init_dirname();
|
|
5031
5338
|
var __awaiter11 = function(thisArg, _arguments, P, generator) {
|
|
5032
5339
|
function adopt(value) {
|
|
5033
5340
|
return value instanceof P ? value : new P(function(resolve) {
|
|
@@ -5177,15 +5484,15 @@ var mkBuilderClass = (plugins) => {
|
|
|
5177
5484
|
if (!capabilityCanBeDelegated(semantics, requiredCapability, proof)) {
|
|
5178
5485
|
throw new Error(`Can't add capability to UCAN: Given proof doesn't give required rights to delegate.`);
|
|
5179
5486
|
}
|
|
5180
|
-
return new Builder2(this.state, Object.assign(Object.assign({}, this.defaultable), { capabilities: [...this.defaultable.capabilities, requiredCapability], proofs: this.defaultable.proofs.find((p) =>
|
|
5487
|
+
return new Builder2(this.state, Object.assign(Object.assign({}, this.defaultable), { capabilities: [...this.defaultable.capabilities, requiredCapability], proofs: this.defaultable.proofs.find((p) => encode6(p) === encode6(ucan)) == null ? [...this.defaultable.proofs, ucan] : this.defaultable.proofs }));
|
|
5181
5488
|
} else {
|
|
5182
5489
|
const store = storeOrProof;
|
|
5183
5490
|
const issuer = this.state.issuer.did();
|
|
5184
5491
|
const result = first(store.findWithCapability(issuer, requiredCapability, issuer));
|
|
5185
5492
|
if (result != null) {
|
|
5186
5493
|
const ucan = result.ucan;
|
|
5187
|
-
const ucanEncoded =
|
|
5188
|
-
return new Builder2(this.state, Object.assign(Object.assign({}, this.defaultable), { capabilities: [...this.defaultable.capabilities, requiredCapability], proofs: this.defaultable.proofs.find((proof) =>
|
|
5494
|
+
const ucanEncoded = encode6(ucan);
|
|
5495
|
+
return new Builder2(this.state, Object.assign(Object.assign({}, this.defaultable), { capabilities: [...this.defaultable.capabilities, requiredCapability], proofs: this.defaultable.proofs.find((proof) => encode6(proof) === ucanEncoded) == null ? [...this.defaultable.proofs, ucan] : this.defaultable.proofs }));
|
|
5189
5496
|
} else {
|
|
5190
5497
|
throw new Error(`Couldn't add capability to UCAN. Couldn't find anything providing this capability in given store.`);
|
|
5191
5498
|
}
|
|
@@ -5203,7 +5510,7 @@ var mkBuilderClass = (plugins) => {
|
|
|
5203
5510
|
addNonce: this.defaultable.addNonce,
|
|
5204
5511
|
capabilities: this.defaultable.capabilities,
|
|
5205
5512
|
facts: this.defaultable.facts,
|
|
5206
|
-
proofs: this.defaultable.proofs.map((proof) =>
|
|
5513
|
+
proofs: this.defaultable.proofs.map((proof) => encode6(proof))
|
|
5207
5514
|
});
|
|
5208
5515
|
}
|
|
5209
5516
|
build() {
|
|
@@ -5220,7 +5527,6 @@ var mkBuilderClass = (plugins) => {
|
|
|
5220
5527
|
var builder_default = mkBuilderClass;
|
|
5221
5528
|
|
|
5222
5529
|
// ../../../node_modules/.pnpm/@ucans+core@0.12.0/node_modules/@ucans/core/dist/esm/store.js
|
|
5223
|
-
init_dirname();
|
|
5224
5530
|
var __awaiter12 = function(thisArg, _arguments, P, generator) {
|
|
5225
5531
|
function adopt(value) {
|
|
5226
5532
|
return value instanceof P ? value : new P(function(resolve) {
|
|
@@ -5308,8 +5614,8 @@ var mkStoreClass = (plugins) => {
|
|
|
5308
5614
|
return __awaiter12(this, void 0, void 0, function* () {
|
|
5309
5615
|
const audience = ucan.payload.aud;
|
|
5310
5616
|
const byAudience = (_b = this.index[audience]) !== null && _b !== void 0 ? _b : [];
|
|
5311
|
-
const encoded =
|
|
5312
|
-
if (byAudience.find((stored) =>
|
|
5617
|
+
const encoded = encode6(ucan);
|
|
5618
|
+
if (byAudience.find((stored) => encode6(stored.processedUcan) === encoded) != null) {
|
|
5313
5619
|
return;
|
|
5314
5620
|
}
|
|
5315
5621
|
const chains = [];
|
|
@@ -5333,7 +5639,7 @@ var mkStoreClass = (plugins) => {
|
|
|
5333
5639
|
throw e_2.error;
|
|
5334
5640
|
}
|
|
5335
5641
|
}
|
|
5336
|
-
if (byAudience.find((stored) =>
|
|
5642
|
+
if (byAudience.find((stored) => encode6(stored.processedUcan) === encoded) != null) {
|
|
5337
5643
|
return;
|
|
5338
5644
|
}
|
|
5339
5645
|
byAudience.push({
|
|
@@ -5369,7 +5675,6 @@ var mkStoreClass = (plugins) => {
|
|
|
5369
5675
|
var store_default = mkStoreClass;
|
|
5370
5676
|
|
|
5371
5677
|
// ../../../node_modules/.pnpm/@ucans+core@0.12.0/node_modules/@ucans/core/dist/esm/plugins.js
|
|
5372
|
-
init_dirname();
|
|
5373
5678
|
var __awaiter13 = function(thisArg, _arguments, P, generator) {
|
|
5374
5679
|
function adopt(value) {
|
|
5375
5680
|
return value instanceof P ? value : new P(function(resolve) {
|
|
@@ -5402,10 +5707,10 @@ var Plugins = class {
|
|
|
5402
5707
|
this.keys = keys;
|
|
5403
5708
|
this.methods = methods;
|
|
5404
5709
|
}
|
|
5405
|
-
verifyIssuerAlg(
|
|
5406
|
-
const didMethod = parseDidMethod(
|
|
5710
|
+
verifyIssuerAlg(did, jwtAlg) {
|
|
5711
|
+
const didMethod = parseDidMethod(did);
|
|
5407
5712
|
if (didMethod === "key") {
|
|
5408
|
-
const bytes = parsePrefixedBytes(
|
|
5713
|
+
const bytes = parsePrefixedBytes(did);
|
|
5409
5714
|
for (const keyPlugin of this.keys) {
|
|
5410
5715
|
if (hasPrefix2(bytes, keyPlugin.prefix)) {
|
|
5411
5716
|
return jwtAlg === keyPlugin.jwtAlg;
|
|
@@ -5414,28 +5719,28 @@ var Plugins = class {
|
|
|
5414
5719
|
} else {
|
|
5415
5720
|
const maybePlugin = this.methods[didMethod];
|
|
5416
5721
|
if (maybePlugin) {
|
|
5417
|
-
return maybePlugin.checkJwtAlg(
|
|
5722
|
+
return maybePlugin.checkJwtAlg(did, jwtAlg);
|
|
5418
5723
|
}
|
|
5419
5724
|
}
|
|
5420
|
-
throw new Error(`DID method not supported by plugins: ${
|
|
5725
|
+
throw new Error(`DID method not supported by plugins: ${did}`);
|
|
5421
5726
|
}
|
|
5422
|
-
verifySignature(
|
|
5727
|
+
verifySignature(did, data, sig) {
|
|
5423
5728
|
return __awaiter13(this, void 0, void 0, function* () {
|
|
5424
|
-
const didMethod = parseDidMethod(
|
|
5729
|
+
const didMethod = parseDidMethod(did);
|
|
5425
5730
|
if (didMethod === "key") {
|
|
5426
|
-
const bytes = parsePrefixedBytes(
|
|
5731
|
+
const bytes = parsePrefixedBytes(did);
|
|
5427
5732
|
for (const keyPlugin of this.keys) {
|
|
5428
5733
|
if (hasPrefix2(bytes, keyPlugin.prefix)) {
|
|
5429
|
-
return keyPlugin.verifySignature(
|
|
5734
|
+
return keyPlugin.verifySignature(did, data, sig);
|
|
5430
5735
|
}
|
|
5431
5736
|
}
|
|
5432
5737
|
} else {
|
|
5433
5738
|
const maybePlugin = this.methods[didMethod];
|
|
5434
5739
|
if (maybePlugin) {
|
|
5435
|
-
return maybePlugin.verifySignature(
|
|
5740
|
+
return maybePlugin.verifySignature(did, data, sig);
|
|
5436
5741
|
}
|
|
5437
5742
|
}
|
|
5438
|
-
throw new Error(`DID method not supported by plugins: ${
|
|
5743
|
+
throw new Error(`DID method not supported by plugins: ${did}`);
|
|
5439
5744
|
});
|
|
5440
5745
|
}
|
|
5441
5746
|
};
|
|
@@ -5443,19 +5748,19 @@ var hasPrefix2 = (prefixedKey, prefix) => {
|
|
|
5443
5748
|
return equals(prefix, prefixedKey.subarray(0, prefix.byteLength));
|
|
5444
5749
|
};
|
|
5445
5750
|
var BASE58_DID_PREFIX2 = "did:key:z";
|
|
5446
|
-
var parsePrefixedBytes = (
|
|
5447
|
-
if (!
|
|
5448
|
-
throw new Error(`Not a valid base58 formatted did:key: ${
|
|
5751
|
+
var parsePrefixedBytes = (did) => {
|
|
5752
|
+
if (!did.startsWith(BASE58_DID_PREFIX2)) {
|
|
5753
|
+
throw new Error(`Not a valid base58 formatted did:key: ${did}`);
|
|
5449
5754
|
}
|
|
5450
|
-
return
|
|
5755
|
+
return fromString2(did.slice(BASE58_DID_PREFIX2.length), "base58btc");
|
|
5451
5756
|
};
|
|
5452
|
-
var parseDidMethod = (
|
|
5453
|
-
const parts =
|
|
5757
|
+
var parseDidMethod = (did) => {
|
|
5758
|
+
const parts = did.split(":");
|
|
5454
5759
|
if (parts[0] !== "did") {
|
|
5455
|
-
throw new Error(`Not a DID: ${
|
|
5760
|
+
throw new Error(`Not a DID: ${did}`);
|
|
5456
5761
|
}
|
|
5457
5762
|
if (parts[1].length < 1) {
|
|
5458
|
-
throw new Error(`No DID method included: ${
|
|
5763
|
+
throw new Error(`No DID method included: ${did}`);
|
|
5459
5764
|
}
|
|
5460
5765
|
return parts[1];
|
|
5461
5766
|
};
|
|
@@ -5524,18 +5829,18 @@ async function createRequestToken(keypair, serviceDID, ucanToken) {
|
|
|
5524
5829
|
issuer: keypair,
|
|
5525
5830
|
audience: serviceDID,
|
|
5526
5831
|
capabilities: payload.att.map((att) => capability_exports.parse(att)),
|
|
5527
|
-
proofs: [
|
|
5832
|
+
proofs: [encode6(ucanToken)]
|
|
5528
5833
|
});
|
|
5529
5834
|
}
|
|
5530
|
-
async function registerDid(apiKey,
|
|
5531
|
-
DEBUG(`Registering`, { did
|
|
5835
|
+
async function registerDid(apiKey, did) {
|
|
5836
|
+
DEBUG(`Registering`, { did });
|
|
5532
5837
|
const result = await (await fetch("https://api.nft.storage/user/did", {
|
|
5533
5838
|
method: "POST",
|
|
5534
5839
|
headers: {
|
|
5535
5840
|
"Authorization": `Bearer ${apiKey}`
|
|
5536
5841
|
},
|
|
5537
5842
|
body: JSON.stringify({
|
|
5538
|
-
did
|
|
5843
|
+
did
|
|
5539
5844
|
})
|
|
5540
5845
|
})).json();
|
|
5541
5846
|
DEBUG(`Register DID result`, result);
|
|
@@ -5553,15 +5858,15 @@ async function getRootUcan(apiKey) {
|
|
|
5553
5858
|
DEBUG(`Get root UCAN result`, result);
|
|
5554
5859
|
if (!result.ok)
|
|
5555
5860
|
throw new Error(`Failed get root UCAN ` + result.error);
|
|
5556
|
-
return
|
|
5861
|
+
return validate2(result.value);
|
|
5557
5862
|
}
|
|
5558
5863
|
|
|
5559
5864
|
export {
|
|
5560
5865
|
EdKeypair,
|
|
5561
|
-
|
|
5866
|
+
encode6 as encode,
|
|
5562
5867
|
storeCar,
|
|
5563
5868
|
createRequestToken,
|
|
5564
5869
|
registerDid,
|
|
5565
5870
|
getRootUcan
|
|
5566
5871
|
};
|
|
5567
|
-
//# sourceMappingURL=chunk-
|
|
5872
|
+
//# sourceMappingURL=chunk-7HXBFNXR.js.map
|