@pod-os/elements 0.1.2-da0e5dd.0 → 0.2.0
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/cjs/elements.cjs.js +1 -1
- package/dist/cjs/ion-app_36.cjs.entry.js +284 -118
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/test-component.cjs.entry.js +13 -0
- package/dist/collection/collection-manifest.json +2 -1
- package/dist/collection/components/pos-image/BrokenImage.js +21 -0
- package/dist/collection/components/pos-image/pos-image.css +36 -1
- package/dist/collection/components/pos-image/pos-image.js +13 -3
- package/dist/collection/test/TestComponent.js +4 -0
- package/dist/collection/test/mockPodOS.js +1 -1
- package/dist/collection/test/renderFunctionalComponent.js +8 -0
- package/dist/custom-elements/index.d.ts +6 -0
- package/dist/custom-elements/index.js +292 -121
- package/dist/elements/elements.esm.js +1 -1
- package/dist/elements/p-41a752d5.entry.js +61 -0
- package/dist/elements/p-611d40b2.entry.js +1 -0
- package/dist/esm/elements.js +1 -1
- package/dist/esm/ion-app_36.entry.js +284 -118
- package/dist/esm/loader.js +1 -1
- package/dist/esm/test-component.entry.js +9 -0
- package/dist/types/components/pos-image/BrokenImage.d.ts +6 -0
- package/dist/types/components/pos-image/pos-image.d.ts +1 -0
- package/dist/types/components.d.ts +13 -0
- package/dist/types/test/TestComponent.d.ts +2 -0
- package/dist/types/test/mockPodOS.d.ts +1 -1
- package/dist/types/test/renderFunctionalComponent.d.ts +1 -0
- package/package.json +2 -2
- package/dist/elements/p-fe935eeb.entry.js +0 -61
|
@@ -2665,26 +2665,26 @@ var require_InruptError = __commonJS({
|
|
|
2665
2665
|
}
|
|
2666
2666
|
static lookupErrorIri(iri, messageParams) {
|
|
2667
2667
|
if (InruptError.determineIfVocabTerm(iri)) {
|
|
2668
|
-
const
|
|
2669
|
-
return
|
|
2668
|
+
const message2 = messageParams === void 0 ? iri.message : iri.messageParams(...messageParams);
|
|
2669
|
+
return message2 === void 0 ? `Looked up error message IRI [${iri.value}], but found no message value.` : message2;
|
|
2670
2670
|
}
|
|
2671
2671
|
return `Error message looked up at: [${iri.value}]${messageParams === void 0 ? "" : `, with params [${messageParams.toString()}]`}`;
|
|
2672
2672
|
}
|
|
2673
|
-
static appendHttpResponseDetails(
|
|
2673
|
+
static appendHttpResponseDetails(message2, response, append) {
|
|
2674
2674
|
if (append && typeof response !== "undefined") {
|
|
2675
|
-
return `${
|
|
2675
|
+
return `${message2} HTTP details: status code [${response.status}], status text [${response.statusText}].`;
|
|
2676
2676
|
}
|
|
2677
|
-
return
|
|
2677
|
+
return message2;
|
|
2678
2678
|
}
|
|
2679
|
-
static appendErrorIri(
|
|
2680
|
-
return append ? `${
|
|
2679
|
+
static appendErrorIri(message2, iri, append) {
|
|
2680
|
+
return append ? `${message2} Error IRI: [${iri.value}].` : message2;
|
|
2681
2681
|
}
|
|
2682
|
-
static substituteParams(
|
|
2683
|
-
let fullMessage =
|
|
2682
|
+
static substituteParams(message2, params) {
|
|
2683
|
+
let fullMessage = message2;
|
|
2684
2684
|
if (params !== void 0) {
|
|
2685
|
-
const paramsRequired =
|
|
2685
|
+
const paramsRequired = message2.split("{{").length - 1;
|
|
2686
2686
|
if (paramsRequired !== params.length) {
|
|
2687
|
-
throw new Error(`Setting parameters on message [${
|
|
2687
|
+
throw new Error(`Setting parameters on message [${message2}], but it requires [${paramsRequired}] params and we received [${params.length}].`);
|
|
2688
2688
|
}
|
|
2689
2689
|
for (let i = 0; i < params.length; i += 1) {
|
|
2690
2690
|
const marker = `{{${i}}}`;
|
|
@@ -3114,10 +3114,10 @@ var require_browser_ponyfill = __commonJS({
|
|
|
3114
3114
|
try {
|
|
3115
3115
|
new exports2.DOMException();
|
|
3116
3116
|
} catch (err) {
|
|
3117
|
-
exports2.DOMException = function(
|
|
3118
|
-
this.message =
|
|
3117
|
+
exports2.DOMException = function(message2, name) {
|
|
3118
|
+
this.message = message2;
|
|
3119
3119
|
this.name = name;
|
|
3120
|
-
var error2 = Error(
|
|
3120
|
+
var error2 = Error(message2);
|
|
3121
3121
|
this.stack = error2.stack;
|
|
3122
3122
|
};
|
|
3123
3123
|
exports2.DOMException.prototype = Object.create(Error.prototype);
|
|
@@ -3349,9 +3349,9 @@ var JOSEError, JWTClaimValidationFailed, JWTExpired, JOSEAlgNotAllowed, JOSENotS
|
|
|
3349
3349
|
var init_errors = __esm({
|
|
3350
3350
|
"../node_modules/jose/dist/browser/util/errors.js"() {
|
|
3351
3351
|
JOSEError = class extends Error {
|
|
3352
|
-
constructor(
|
|
3352
|
+
constructor(message2) {
|
|
3353
3353
|
var _a;
|
|
3354
|
-
super(
|
|
3354
|
+
super(message2);
|
|
3355
3355
|
this.code = "ERR_JOSE_GENERIC";
|
|
3356
3356
|
this.name = this.constructor.name;
|
|
3357
3357
|
(_a = Error.captureStackTrace) === null || _a === void 0 ? void 0 : _a.call(Error, this, this.constructor);
|
|
@@ -3361,8 +3361,8 @@ var init_errors = __esm({
|
|
|
3361
3361
|
}
|
|
3362
3362
|
};
|
|
3363
3363
|
JWTClaimValidationFailed = class extends JOSEError {
|
|
3364
|
-
constructor(
|
|
3365
|
-
super(
|
|
3364
|
+
constructor(message2, claim = "unspecified", reason = "unspecified") {
|
|
3365
|
+
super(message2);
|
|
3366
3366
|
this.code = "ERR_JWT_CLAIM_VALIDATION_FAILED";
|
|
3367
3367
|
this.claim = claim;
|
|
3368
3368
|
this.reason = reason;
|
|
@@ -3372,8 +3372,8 @@ var init_errors = __esm({
|
|
|
3372
3372
|
}
|
|
3373
3373
|
};
|
|
3374
3374
|
JWTExpired = class extends JOSEError {
|
|
3375
|
-
constructor(
|
|
3376
|
-
super(
|
|
3375
|
+
constructor(message2, claim = "unspecified", reason = "unspecified") {
|
|
3376
|
+
super(message2);
|
|
3377
3377
|
this.code = "ERR_JWT_EXPIRED";
|
|
3378
3378
|
this.claim = claim;
|
|
3379
3379
|
this.reason = reason;
|
|
@@ -3555,8 +3555,9 @@ var init_check_cek_length = __esm({
|
|
|
3555
3555
|
"../node_modules/jose/dist/browser/runtime/check_cek_length.js"() {
|
|
3556
3556
|
init_errors();
|
|
3557
3557
|
checkCekLength = (cek, expected) => {
|
|
3558
|
-
|
|
3559
|
-
|
|
3558
|
+
const actual = cek.byteLength << 3;
|
|
3559
|
+
if (actual !== expected) {
|
|
3560
|
+
throw new JWEInvalid(`Invalid Content Encryption Key length. Expected ${expected} bits, got ${actual} bits`);
|
|
3560
3561
|
}
|
|
3561
3562
|
};
|
|
3562
3563
|
check_cek_length_default = checkCekLength;
|
|
@@ -3591,7 +3592,7 @@ var init_timing_safe_equal = __esm({
|
|
|
3591
3592
|
|
|
3592
3593
|
// ../node_modules/jose/dist/browser/runtime/env.js
|
|
3593
3594
|
function isCloudflareWorkers() {
|
|
3594
|
-
return typeof WebSocketPair === "
|
|
3595
|
+
return typeof WebSocketPair !== "undefined" || typeof navigator !== "undefined" && navigator.userAgent === "Cloudflare-Workers" || typeof EdgeRuntime !== "undefined" && EdgeRuntime === "vercel";
|
|
3595
3596
|
}
|
|
3596
3597
|
var init_env = __esm({
|
|
3597
3598
|
"../node_modules/jose/dist/browser/runtime/env.js"() {
|
|
@@ -3674,6 +3675,12 @@ function checkSigCryptoKey(key, alg, ...usages) {
|
|
|
3674
3675
|
throw unusable("NODE-ED25519");
|
|
3675
3676
|
break;
|
|
3676
3677
|
}
|
|
3678
|
+
case "EdDSA": {
|
|
3679
|
+
if (key.algorithm.name !== "Ed25519" && key.algorithm.name !== "Ed448") {
|
|
3680
|
+
throw unusable("Ed25519 or Ed448");
|
|
3681
|
+
}
|
|
3682
|
+
break;
|
|
3683
|
+
}
|
|
3677
3684
|
case "ES256":
|
|
3678
3685
|
case "ES384":
|
|
3679
3686
|
case "ES512": {
|
|
@@ -3714,10 +3721,17 @@ function checkEncCryptoKey(key, alg, ...usages) {
|
|
|
3714
3721
|
throw unusable(expected, "algorithm.length");
|
|
3715
3722
|
break;
|
|
3716
3723
|
}
|
|
3717
|
-
case "ECDH":
|
|
3718
|
-
|
|
3719
|
-
|
|
3724
|
+
case "ECDH": {
|
|
3725
|
+
switch (key.algorithm.name) {
|
|
3726
|
+
case "ECDH":
|
|
3727
|
+
case "X25519":
|
|
3728
|
+
case "X448":
|
|
3729
|
+
break;
|
|
3730
|
+
default:
|
|
3731
|
+
throw unusable("ECDH, X25519, or X448");
|
|
3732
|
+
}
|
|
3720
3733
|
break;
|
|
3734
|
+
}
|
|
3721
3735
|
case "PBES2-HS256+A128KW":
|
|
3722
3736
|
case "PBES2-HS384+A192KW":
|
|
3723
3737
|
case "PBES2-HS512+A256KW":
|
|
@@ -3748,29 +3762,34 @@ var init_crypto_key = __esm({
|
|
|
3748
3762
|
});
|
|
3749
3763
|
|
|
3750
3764
|
// ../node_modules/jose/dist/browser/lib/invalid_key_input.js
|
|
3765
|
+
function message(msg2, actual, ...types2) {
|
|
3766
|
+
if (types2.length > 2) {
|
|
3767
|
+
const last = types2.pop();
|
|
3768
|
+
msg2 += `one of type ${types2.join(", ")}, or ${last}.`;
|
|
3769
|
+
} else if (types2.length === 2) {
|
|
3770
|
+
msg2 += `one of type ${types2[0]} or ${types2[1]}.`;
|
|
3771
|
+
} else {
|
|
3772
|
+
msg2 += `of type ${types2[0]}.`;
|
|
3773
|
+
}
|
|
3774
|
+
if (actual == null) {
|
|
3775
|
+
msg2 += ` Received ${actual}`;
|
|
3776
|
+
} else if (typeof actual === "function" && actual.name) {
|
|
3777
|
+
msg2 += ` Received function ${actual.name}`;
|
|
3778
|
+
} else if (typeof actual === "object" && actual != null) {
|
|
3779
|
+
if (actual.constructor && actual.constructor.name) {
|
|
3780
|
+
msg2 += ` Received an instance of ${actual.constructor.name}`;
|
|
3781
|
+
}
|
|
3782
|
+
}
|
|
3783
|
+
return msg2;
|
|
3784
|
+
}
|
|
3785
|
+
function withAlg(alg, actual, ...types2) {
|
|
3786
|
+
return message(`Key for the ${alg} algorithm must be `, actual, ...types2);
|
|
3787
|
+
}
|
|
3751
3788
|
var invalid_key_input_default;
|
|
3752
3789
|
var init_invalid_key_input = __esm({
|
|
3753
3790
|
"../node_modules/jose/dist/browser/lib/invalid_key_input.js"() {
|
|
3754
3791
|
invalid_key_input_default = (actual, ...types2) => {
|
|
3755
|
-
|
|
3756
|
-
if (types2.length > 2) {
|
|
3757
|
-
const last = types2.pop();
|
|
3758
|
-
msg2 += `one of type ${types2.join(", ")}, or ${last}.`;
|
|
3759
|
-
} else if (types2.length === 2) {
|
|
3760
|
-
msg2 += `one of type ${types2[0]} or ${types2[1]}.`;
|
|
3761
|
-
} else {
|
|
3762
|
-
msg2 += `of type ${types2[0]}.`;
|
|
3763
|
-
}
|
|
3764
|
-
if (actual == null) {
|
|
3765
|
-
msg2 += ` Received ${actual}`;
|
|
3766
|
-
} else if (typeof actual === "function" && actual.name) {
|
|
3767
|
-
msg2 += ` Received function ${actual.name}`;
|
|
3768
|
-
} else if (typeof actual === "object" && actual != null) {
|
|
3769
|
-
if (actual.constructor && actual.constructor.name) {
|
|
3770
|
-
msg2 += ` Received an instance of ${actual.constructor.name}`;
|
|
3771
|
-
}
|
|
3772
|
-
}
|
|
3773
|
-
return msg2;
|
|
3792
|
+
return message("Key must be ", actual, ...types2);
|
|
3774
3793
|
};
|
|
3775
3794
|
}
|
|
3776
3795
|
});
|
|
@@ -4003,10 +4022,18 @@ async function deriveKey(publicKey, privateKey, algorithm, keyLength, apu = new
|
|
|
4003
4022
|
}
|
|
4004
4023
|
checkEncCryptoKey(privateKey, "ECDH", "deriveBits");
|
|
4005
4024
|
const value = concat(lengthAndInput(encoder.encode(algorithm)), lengthAndInput(apu), lengthAndInput(apv), uint32be(keyLength));
|
|
4025
|
+
let length;
|
|
4026
|
+
if (publicKey.algorithm.name === "X25519") {
|
|
4027
|
+
length = 256;
|
|
4028
|
+
} else if (publicKey.algorithm.name === "X448") {
|
|
4029
|
+
length = 448;
|
|
4030
|
+
} else {
|
|
4031
|
+
length = Math.ceil(parseInt(publicKey.algorithm.namedCurve.substr(-3), 10) / 8) << 3;
|
|
4032
|
+
}
|
|
4006
4033
|
const sharedSecret = new Uint8Array(await webcrypto_default.subtle.deriveBits({
|
|
4007
|
-
name:
|
|
4034
|
+
name: publicKey.algorithm.name,
|
|
4008
4035
|
public: publicKey
|
|
4009
|
-
}, privateKey,
|
|
4036
|
+
}, privateKey, length));
|
|
4010
4037
|
return concatKdf(sharedSecret, keyLength, value);
|
|
4011
4038
|
}
|
|
4012
4039
|
async function generateEpk(key) {
|
|
@@ -4019,7 +4046,7 @@ function ecdhAllowed(key) {
|
|
|
4019
4046
|
if (!isCryptoKey(key)) {
|
|
4020
4047
|
throw new TypeError(invalid_key_input_default(key, ...types));
|
|
4021
4048
|
}
|
|
4022
|
-
return ["P-256", "P-384", "P-521"].includes(key.algorithm.namedCurve);
|
|
4049
|
+
return ["P-256", "P-384", "P-521"].includes(key.algorithm.namedCurve) || key.algorithm.name === "X25519" || key.algorithm.name === "X448";
|
|
4023
4050
|
}
|
|
4024
4051
|
var init_ecdhes = __esm({
|
|
4025
4052
|
"../node_modules/jose/dist/browser/runtime/ecdhes.js"() {
|
|
@@ -4268,8 +4295,14 @@ var init_asn1 = __esm({
|
|
|
4268
4295
|
return "P-384";
|
|
4269
4296
|
case findOid(keyData, [43, 129, 4, 0, 35]):
|
|
4270
4297
|
return "P-521";
|
|
4271
|
-
case
|
|
4298
|
+
case findOid(keyData, [43, 101, 110]):
|
|
4299
|
+
return "X25519";
|
|
4300
|
+
case findOid(keyData, [43, 101, 111]):
|
|
4301
|
+
return "X448";
|
|
4302
|
+
case findOid(keyData, [43, 101, 112]):
|
|
4272
4303
|
return "Ed25519";
|
|
4304
|
+
case findOid(keyData, [43, 101, 113]):
|
|
4305
|
+
return "Ed448";
|
|
4273
4306
|
default:
|
|
4274
4307
|
throw new JOSENotSupported("Invalid or unsupported EC Key Curve or OKP Key Sub Type");
|
|
4275
4308
|
}
|
|
@@ -4318,15 +4351,22 @@ var init_asn1 = __esm({
|
|
|
4318
4351
|
case "ECDH-ES":
|
|
4319
4352
|
case "ECDH-ES+A128KW":
|
|
4320
4353
|
case "ECDH-ES+A192KW":
|
|
4321
|
-
case "ECDH-ES+A256KW":
|
|
4322
|
-
|
|
4354
|
+
case "ECDH-ES+A256KW": {
|
|
4355
|
+
const namedCurve = getNamedCurve2(keyData);
|
|
4356
|
+
algorithm = namedCurve.startsWith("P-") ? { name: "ECDH", namedCurve } : { name: namedCurve };
|
|
4323
4357
|
keyUsages = isPublic ? [] : ["deriveBits"];
|
|
4324
4358
|
break;
|
|
4325
|
-
|
|
4359
|
+
}
|
|
4360
|
+
case (isCloudflareWorkers() && "EdDSA"): {
|
|
4326
4361
|
const namedCurve = getNamedCurve2(keyData).toUpperCase();
|
|
4327
4362
|
algorithm = { name: `NODE-${namedCurve}`, namedCurve: `NODE-${namedCurve}` };
|
|
4328
4363
|
keyUsages = isPublic ? ["verify"] : ["sign"];
|
|
4329
4364
|
break;
|
|
4365
|
+
}
|
|
4366
|
+
case "EdDSA":
|
|
4367
|
+
algorithm = { name: getNamedCurve2(keyData) };
|
|
4368
|
+
keyUsages = isPublic ? ["verify"] : ["sign"];
|
|
4369
|
+
break;
|
|
4330
4370
|
default:
|
|
4331
4371
|
throw new JOSENotSupported('Invalid or unsupported "alg" (Algorithm) value');
|
|
4332
4372
|
}
|
|
@@ -4449,9 +4489,27 @@ function subtleMapping(jwk) {
|
|
|
4449
4489
|
keyUsages = jwk.d ? ["sign"] : ["verify"];
|
|
4450
4490
|
break;
|
|
4451
4491
|
default:
|
|
4452
|
-
throw new JOSENotSupported('Invalid or unsupported JWK "
|
|
4492
|
+
throw new JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
|
|
4453
4493
|
}
|
|
4454
4494
|
break;
|
|
4495
|
+
case "OKP": {
|
|
4496
|
+
switch (jwk.alg) {
|
|
4497
|
+
case "EdDSA":
|
|
4498
|
+
algorithm = { name: jwk.crv };
|
|
4499
|
+
keyUsages = jwk.d ? ["sign"] : ["verify"];
|
|
4500
|
+
break;
|
|
4501
|
+
case "ECDH-ES":
|
|
4502
|
+
case "ECDH-ES+A128KW":
|
|
4503
|
+
case "ECDH-ES+A192KW":
|
|
4504
|
+
case "ECDH-ES+A256KW":
|
|
4505
|
+
algorithm = { name: jwk.crv };
|
|
4506
|
+
keyUsages = jwk.d ? ["deriveBits"] : [];
|
|
4507
|
+
break;
|
|
4508
|
+
default:
|
|
4509
|
+
throw new JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
|
|
4510
|
+
}
|
|
4511
|
+
break;
|
|
4512
|
+
}
|
|
4455
4513
|
default:
|
|
4456
4514
|
throw new JOSENotSupported('Invalid or unsupported JWK "kty" (Key Type) Parameter value');
|
|
4457
4515
|
}
|
|
@@ -4511,18 +4569,12 @@ function parseElement(bytes) {
|
|
|
4511
4569
|
if (bytes[position] < 128) {
|
|
4512
4570
|
length = bytes[position];
|
|
4513
4571
|
position++;
|
|
4514
|
-
} else {
|
|
4515
|
-
let numberOfDigits = bytes[position] & 127;
|
|
4516
|
-
position++;
|
|
4517
|
-
length = 0;
|
|
4518
|
-
for (let i = 0; i < numberOfDigits; i++) {
|
|
4519
|
-
length = length * 256 + bytes[position];
|
|
4520
|
-
position++;
|
|
4521
|
-
}
|
|
4522
|
-
}
|
|
4523
|
-
if (length === 128) {
|
|
4572
|
+
} else if (length === 128) {
|
|
4524
4573
|
length = 0;
|
|
4525
4574
|
while (bytes[position + length] !== 0 || bytes[position + length + 1] !== 0) {
|
|
4575
|
+
if (length > bytes.byteLength) {
|
|
4576
|
+
throw new TypeError("invalid indefinite form length");
|
|
4577
|
+
}
|
|
4526
4578
|
length++;
|
|
4527
4579
|
}
|
|
4528
4580
|
const byteLength2 = position + length + 2;
|
|
@@ -4531,6 +4583,14 @@ function parseElement(bytes) {
|
|
|
4531
4583
|
contents: bytes.subarray(position, position + length),
|
|
4532
4584
|
raw: bytes.subarray(0, byteLength2)
|
|
4533
4585
|
};
|
|
4586
|
+
} else {
|
|
4587
|
+
let numberOfDigits = bytes[position] & 127;
|
|
4588
|
+
position++;
|
|
4589
|
+
length = 0;
|
|
4590
|
+
for (let i = 0; i < numberOfDigits; i++) {
|
|
4591
|
+
length = length * 256 + bytes[position];
|
|
4592
|
+
position++;
|
|
4593
|
+
}
|
|
4534
4594
|
}
|
|
4535
4595
|
const byteLength = position + length;
|
|
4536
4596
|
return {
|
|
@@ -4558,7 +4618,12 @@ async function importX509(x509, alg, options) {
|
|
|
4558
4618
|
if (typeof x509 !== "string" || x509.indexOf("-----BEGIN CERTIFICATE-----") !== 0) {
|
|
4559
4619
|
throw new TypeError('"x509" must be X.509 formatted string');
|
|
4560
4620
|
}
|
|
4561
|
-
|
|
4621
|
+
let spki;
|
|
4622
|
+
try {
|
|
4623
|
+
spki = getSPKI(x509);
|
|
4624
|
+
} catch (cause) {
|
|
4625
|
+
throw new TypeError("failed to parse the X.509 certificate", { cause });
|
|
4626
|
+
}
|
|
4562
4627
|
return fromSPKI(spki, alg, options);
|
|
4563
4628
|
}
|
|
4564
4629
|
async function importPKCS8(pkcs8, alg, options) {
|
|
@@ -4614,19 +4679,19 @@ var init_check_key_type = __esm({
|
|
|
4614
4679
|
"../node_modules/jose/dist/browser/lib/check_key_type.js"() {
|
|
4615
4680
|
init_invalid_key_input();
|
|
4616
4681
|
init_is_key_like();
|
|
4617
|
-
symmetricTypeCheck = (key) => {
|
|
4682
|
+
symmetricTypeCheck = (alg, key) => {
|
|
4618
4683
|
if (key instanceof Uint8Array)
|
|
4619
4684
|
return;
|
|
4620
4685
|
if (!is_key_like_default(key)) {
|
|
4621
|
-
throw new TypeError(
|
|
4686
|
+
throw new TypeError(withAlg(alg, key, ...types, "Uint8Array"));
|
|
4622
4687
|
}
|
|
4623
4688
|
if (key.type !== "secret") {
|
|
4624
4689
|
throw new TypeError(`${types.join(" or ")} instances for symmetric algorithms must be of type "secret"`);
|
|
4625
4690
|
}
|
|
4626
4691
|
};
|
|
4627
|
-
asymmetricTypeCheck = (key, usage) => {
|
|
4692
|
+
asymmetricTypeCheck = (alg, key, usage) => {
|
|
4628
4693
|
if (!is_key_like_default(key)) {
|
|
4629
|
-
throw new TypeError(
|
|
4694
|
+
throw new TypeError(withAlg(alg, key, ...types));
|
|
4630
4695
|
}
|
|
4631
4696
|
if (key.type === "secret") {
|
|
4632
4697
|
throw new TypeError(`${types.join(" or ")} instances for asymmetric algorithms must not be of type "secret"`);
|
|
@@ -4647,9 +4712,9 @@ var init_check_key_type = __esm({
|
|
|
4647
4712
|
checkKeyType = (alg, key, usage) => {
|
|
4648
4713
|
const symmetric = alg.startsWith("HS") || alg === "dir" || alg.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(alg);
|
|
4649
4714
|
if (symmetric) {
|
|
4650
|
-
symmetricTypeCheck(key);
|
|
4715
|
+
symmetricTypeCheck(alg, key);
|
|
4651
4716
|
} else {
|
|
4652
|
-
asymmetricTypeCheck(key, usage);
|
|
4717
|
+
asymmetricTypeCheck(alg, key, usage);
|
|
4653
4718
|
}
|
|
4654
4719
|
};
|
|
4655
4720
|
check_key_type_default = checkKeyType;
|
|
@@ -4751,7 +4816,7 @@ var init_aesgcmkw = __esm({
|
|
|
4751
4816
|
});
|
|
4752
4817
|
|
|
4753
4818
|
// ../node_modules/jose/dist/browser/lib/decrypt_key_management.js
|
|
4754
|
-
async function decryptKeyManagement(alg, key, encryptedKey, joseHeader) {
|
|
4819
|
+
async function decryptKeyManagement(alg, key, encryptedKey, joseHeader, options) {
|
|
4755
4820
|
check_key_type_default(alg, key, "decrypt");
|
|
4756
4821
|
switch (alg) {
|
|
4757
4822
|
case "dir": {
|
|
@@ -4805,6 +4870,9 @@ async function decryptKeyManagement(alg, key, encryptedKey, joseHeader) {
|
|
|
4805
4870
|
throw new JWEInvalid("JWE Encrypted Key missing");
|
|
4806
4871
|
if (typeof joseHeader.p2c !== "number")
|
|
4807
4872
|
throw new JWEInvalid(`JOSE Header "p2c" (PBES2 Count) missing or invalid`);
|
|
4873
|
+
const p2cLimit = (options === null || options === void 0 ? void 0 : options.maxPBES2Count) || 1e4;
|
|
4874
|
+
if (joseHeader.p2c > p2cLimit)
|
|
4875
|
+
throw new JWEInvalid(`JOSE Header "p2c" (PBES2 Count) out is of acceptable bounds`);
|
|
4808
4876
|
if (typeof joseHeader.p2s !== "string")
|
|
4809
4877
|
throw new JWEInvalid(`JOSE Header "p2s" (PBES2 Salt) missing or invalid`);
|
|
4810
4878
|
return decrypt2(alg, key, encryptedKey, joseHeader.p2c, decode(joseHeader.p2s));
|
|
@@ -4991,9 +5059,9 @@ async function flattenedDecrypt(jwe, key, options) {
|
|
|
4991
5059
|
}
|
|
4992
5060
|
let cek;
|
|
4993
5061
|
try {
|
|
4994
|
-
cek = await decrypt_key_management_default(alg, key, encryptedKey, joseHeader);
|
|
5062
|
+
cek = await decrypt_key_management_default(alg, key, encryptedKey, joseHeader, options);
|
|
4995
5063
|
} catch (err) {
|
|
4996
|
-
if (err instanceof TypeError) {
|
|
5064
|
+
if (err instanceof TypeError || err instanceof JWEInvalid || err instanceof JOSENotSupported) {
|
|
4997
5065
|
throw err;
|
|
4998
5066
|
}
|
|
4999
5067
|
cek = cek_default(enc);
|
|
@@ -5621,6 +5689,8 @@ function subtleDsa(alg, algorithm) {
|
|
|
5621
5689
|
case (isCloudflareWorkers() && "EdDSA"):
|
|
5622
5690
|
const { namedCurve } = algorithm;
|
|
5623
5691
|
return { name: namedCurve, namedCurve };
|
|
5692
|
+
case "EdDSA":
|
|
5693
|
+
return { name: algorithm.name };
|
|
5624
5694
|
default:
|
|
5625
5695
|
throw new JOSENotSupported(`alg ${alg} is not supported either by JOSE or your javascript runtime`);
|
|
5626
5696
|
}
|
|
@@ -6911,7 +6981,7 @@ function getModulusLengthOption(options) {
|
|
|
6911
6981
|
return modulusLength;
|
|
6912
6982
|
}
|
|
6913
6983
|
async function generateKeyPair(alg, options) {
|
|
6914
|
-
var _a, _b;
|
|
6984
|
+
var _a, _b, _c;
|
|
6915
6985
|
let algorithm;
|
|
6916
6986
|
let keyUsages;
|
|
6917
6987
|
switch (alg) {
|
|
@@ -6972,17 +7042,44 @@ async function generateKeyPair(alg, options) {
|
|
|
6972
7042
|
throw new JOSENotSupported("Invalid or unsupported crv option provided");
|
|
6973
7043
|
}
|
|
6974
7044
|
break;
|
|
7045
|
+
case "EdDSA":
|
|
7046
|
+
keyUsages = ["sign", "verify"];
|
|
7047
|
+
const crv = (_a = options === null || options === void 0 ? void 0 : options.crv) !== null && _a !== void 0 ? _a : "Ed25519";
|
|
7048
|
+
switch (crv) {
|
|
7049
|
+
case "Ed25519":
|
|
7050
|
+
case "Ed448":
|
|
7051
|
+
algorithm = { name: crv };
|
|
7052
|
+
break;
|
|
7053
|
+
default:
|
|
7054
|
+
throw new JOSENotSupported("Invalid or unsupported crv option provided");
|
|
7055
|
+
}
|
|
7056
|
+
break;
|
|
6975
7057
|
case "ECDH-ES":
|
|
6976
7058
|
case "ECDH-ES+A128KW":
|
|
6977
7059
|
case "ECDH-ES+A192KW":
|
|
6978
|
-
case "ECDH-ES+A256KW":
|
|
6979
|
-
algorithm = { name: "ECDH", namedCurve: (_a = options === null || options === void 0 ? void 0 : options.crv) !== null && _a !== void 0 ? _a : "P-256" };
|
|
7060
|
+
case "ECDH-ES+A256KW": {
|
|
6980
7061
|
keyUsages = ["deriveKey", "deriveBits"];
|
|
7062
|
+
const crv2 = (_b = options === null || options === void 0 ? void 0 : options.crv) !== null && _b !== void 0 ? _b : "P-256";
|
|
7063
|
+
switch (crv2) {
|
|
7064
|
+
case "P-256":
|
|
7065
|
+
case "P-384":
|
|
7066
|
+
case "P-521": {
|
|
7067
|
+
algorithm = { name: "ECDH", namedCurve: crv2 };
|
|
7068
|
+
break;
|
|
7069
|
+
}
|
|
7070
|
+
case "X25519":
|
|
7071
|
+
case "X448":
|
|
7072
|
+
algorithm = { name: crv2 };
|
|
7073
|
+
break;
|
|
7074
|
+
default:
|
|
7075
|
+
throw new JOSENotSupported("Invalid or unsupported crv option provided, supported values are P-256, P-384, P-521, X25519, and X448");
|
|
7076
|
+
}
|
|
6981
7077
|
break;
|
|
7078
|
+
}
|
|
6982
7079
|
default:
|
|
6983
7080
|
throw new JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
|
|
6984
7081
|
}
|
|
6985
|
-
return webcrypto_default.subtle.generateKey(algorithm, (
|
|
7082
|
+
return webcrypto_default.subtle.generateKey(algorithm, (_c = options === null || options === void 0 ? void 0 : options.extractable) !== null && _c !== void 0 ? _c : false, keyUsages);
|
|
6986
7083
|
}
|
|
6987
7084
|
var init_generate = __esm({
|
|
6988
7085
|
"../node_modules/jose/dist/browser/runtime/generate.js"() {
|
|
@@ -7370,8 +7467,8 @@ var require_ConfigurationError = __commonJS({
|
|
|
7370
7467
|
"../node_modules/@inrupt/solid-client-authn-core/dist/errors/ConfigurationError.js"(exports) {
|
|
7371
7468
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7372
7469
|
var ConfigurationError = class extends Error {
|
|
7373
|
-
constructor(
|
|
7374
|
-
super(
|
|
7470
|
+
constructor(message2) {
|
|
7471
|
+
super(message2);
|
|
7375
7472
|
}
|
|
7376
7473
|
};
|
|
7377
7474
|
exports.default = ConfigurationError;
|
|
@@ -7412,8 +7509,8 @@ var require_OidcProviderError = __commonJS({
|
|
|
7412
7509
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7413
7510
|
exports.OidcProviderError = void 0;
|
|
7414
7511
|
var OidcProviderError = class extends Error {
|
|
7415
|
-
constructor(
|
|
7416
|
-
super(
|
|
7512
|
+
constructor(message2, error2, errorDescription) {
|
|
7513
|
+
super(message2);
|
|
7417
7514
|
this.error = error2;
|
|
7418
7515
|
this.errorDescription = errorDescription;
|
|
7419
7516
|
}
|
|
@@ -18142,10 +18239,10 @@ var require_graphTypes = __commonJS({
|
|
|
18142
18239
|
var require_JsonLdError = __commonJS({
|
|
18143
18240
|
"../node_modules/jsonld/lib/JsonLdError.js"(exports, module2) {
|
|
18144
18241
|
module2.exports = class JsonLdError extends Error {
|
|
18145
|
-
constructor(
|
|
18146
|
-
super(
|
|
18242
|
+
constructor(message2 = "An unspecified JSON-LD error occurred.", name = "jsonld.Error", details = {}) {
|
|
18243
|
+
super(message2);
|
|
18147
18244
|
this.name = name;
|
|
18148
|
-
this.message =
|
|
18245
|
+
this.message = message2;
|
|
18149
18246
|
this.details = details;
|
|
18150
18247
|
}
|
|
18151
18248
|
};
|
|
@@ -24912,9 +25009,9 @@ var require_dom = __commonJS({
|
|
|
24912
25009
|
ExceptionCode.INVALID_MODIFICATION_ERR = (ExceptionMessage[13] = "Invalid modification", 13);
|
|
24913
25010
|
ExceptionCode.NAMESPACE_ERR = (ExceptionMessage[14] = "Invalid namespace", 14);
|
|
24914
25011
|
ExceptionCode.INVALID_ACCESS_ERR = (ExceptionMessage[15] = "Invalid access", 15);
|
|
24915
|
-
function DOMException(code,
|
|
24916
|
-
if (
|
|
24917
|
-
var error2 =
|
|
25012
|
+
function DOMException(code, message2) {
|
|
25013
|
+
if (message2 instanceof Error) {
|
|
25014
|
+
var error2 = message2;
|
|
24918
25015
|
} else {
|
|
24919
25016
|
error2 = this;
|
|
24920
25017
|
Error.call(this, ExceptionMessage[code]);
|
|
@@ -24923,8 +25020,8 @@ var require_dom = __commonJS({
|
|
|
24923
25020
|
Error.captureStackTrace(this, DOMException);
|
|
24924
25021
|
}
|
|
24925
25022
|
error2.code = code;
|
|
24926
|
-
if (
|
|
24927
|
-
this.message = this.message + ": " +
|
|
25023
|
+
if (message2)
|
|
25024
|
+
this.message = this.message + ": " + message2;
|
|
24928
25025
|
return error2;
|
|
24929
25026
|
}
|
|
24930
25027
|
DOMException.prototype = Error.prototype;
|
|
@@ -26215,8 +26312,8 @@ var require_sax = __commonJS({
|
|
|
26215
26312
|
var S_ATTR_END = 5;
|
|
26216
26313
|
var S_TAG_SPACE = 6;
|
|
26217
26314
|
var S_TAG_CLOSE = 7;
|
|
26218
|
-
function ParseError(
|
|
26219
|
-
this.message =
|
|
26315
|
+
function ParseError(message2, locator) {
|
|
26316
|
+
this.message = message2;
|
|
26220
26317
|
this.locator = locator;
|
|
26221
26318
|
if (Error.captureStackTrace)
|
|
26222
26319
|
Error.captureStackTrace(this, ParseError);
|
|
@@ -27080,19 +27177,59 @@ var BrowserSession = class {
|
|
|
27080
27177
|
}
|
|
27081
27178
|
};
|
|
27082
27179
|
|
|
27180
|
+
// src/files/BinaryFile.ts
|
|
27181
|
+
var BinaryFile = class {
|
|
27182
|
+
constructor(url, data) {
|
|
27183
|
+
this.url = url;
|
|
27184
|
+
this.data = data;
|
|
27185
|
+
}
|
|
27186
|
+
blob() {
|
|
27187
|
+
return this.data;
|
|
27188
|
+
}
|
|
27189
|
+
};
|
|
27190
|
+
|
|
27191
|
+
// src/files/BrokenFile.ts
|
|
27192
|
+
var BrokenFile = class {
|
|
27193
|
+
constructor(url, status) {
|
|
27194
|
+
this.url = url;
|
|
27195
|
+
this.status = status;
|
|
27196
|
+
}
|
|
27197
|
+
toString() {
|
|
27198
|
+
return `${this.status.toString()} - ${this.url}`;
|
|
27199
|
+
}
|
|
27200
|
+
blob() {
|
|
27201
|
+
return null;
|
|
27202
|
+
}
|
|
27203
|
+
};
|
|
27204
|
+
|
|
27205
|
+
// src/files/HttpStatus.ts
|
|
27206
|
+
var HttpStatus = class {
|
|
27207
|
+
constructor(code, text) {
|
|
27208
|
+
this.code = code;
|
|
27209
|
+
this.text = text;
|
|
27210
|
+
}
|
|
27211
|
+
toString() {
|
|
27212
|
+
return this.text ? `${this.code} - ${this.text}` : this.code.toString();
|
|
27213
|
+
}
|
|
27214
|
+
};
|
|
27215
|
+
|
|
27083
27216
|
// src/files/FileFetcher.ts
|
|
27084
27217
|
var FileFetcher = class {
|
|
27085
27218
|
constructor(session) {
|
|
27086
27219
|
this.session = session;
|
|
27087
27220
|
}
|
|
27088
|
-
|
|
27221
|
+
fetchFile(url) {
|
|
27089
27222
|
return __async(this, null, function* () {
|
|
27090
|
-
|
|
27091
|
-
|
|
27092
|
-
|
|
27093
|
-
|
|
27094
|
-
|
|
27095
|
-
|
|
27223
|
+
const response = yield this.session.authenticatedFetch(url);
|
|
27224
|
+
if (response.ok) {
|
|
27225
|
+
const blob = yield response.blob();
|
|
27226
|
+
return new BinaryFile(url, blob);
|
|
27227
|
+
} else {
|
|
27228
|
+
return new BrokenFile(
|
|
27229
|
+
url,
|
|
27230
|
+
new HttpStatus(response.status, response.statusText)
|
|
27231
|
+
);
|
|
27232
|
+
}
|
|
27096
27233
|
});
|
|
27097
27234
|
}
|
|
27098
27235
|
};
|
|
@@ -27512,8 +27649,8 @@ var NamedNode = /* @__PURE__ */ function(_Node) {
|
|
|
27512
27649
|
throw new Error('NamedNode IRI "' + iri + '" must be absolute.');
|
|
27513
27650
|
}
|
|
27514
27651
|
if (_this.value.includes(" ")) {
|
|
27515
|
-
var
|
|
27516
|
-
throw new Error(
|
|
27652
|
+
var message2 = 'Error: NamedNode IRI "' + iri + '" must not contain unencoded spaces.';
|
|
27653
|
+
throw new Error(message2);
|
|
27517
27654
|
}
|
|
27518
27655
|
return _this;
|
|
27519
27656
|
}
|
|
@@ -30997,8 +31134,8 @@ var N3Parser = class {
|
|
|
30997
31134
|
_emit(subject, predicate, object, graph3) {
|
|
30998
31135
|
this._callback(null, this._quad(subject, predicate, object, graph3 || this.DEFAULTGRAPH));
|
|
30999
31136
|
}
|
|
31000
|
-
_error(
|
|
31001
|
-
const err = new Error(`${
|
|
31137
|
+
_error(message2, token) {
|
|
31138
|
+
const err = new Error(`${message2} on line ${token.line}.`);
|
|
31002
31139
|
err.context = {
|
|
31003
31140
|
token,
|
|
31004
31141
|
line: token.line,
|
|
@@ -38701,13 +38838,13 @@ var Fetcher = /* @__PURE__ */ function() {
|
|
|
38701
38838
|
}
|
|
38702
38839
|
}
|
|
38703
38840
|
}, function(err) {
|
|
38704
|
-
var
|
|
38705
|
-
|
|
38706
|
-
console.log(
|
|
38841
|
+
var message2 = err.message || err.statusText;
|
|
38842
|
+
message2 = "Failed to load <" + uri + "> " + message2;
|
|
38843
|
+
console.log(message2);
|
|
38707
38844
|
if (err.response && err.response.status) {
|
|
38708
|
-
|
|
38845
|
+
message2 += " status: " + err.response.status;
|
|
38709
38846
|
}
|
|
38710
|
-
userCallback(false,
|
|
38847
|
+
userCallback(false, message2, err.response);
|
|
38711
38848
|
});
|
|
38712
38849
|
}
|
|
38713
38850
|
}, {
|
|
@@ -39199,16 +39336,16 @@ var Fetcher = /* @__PURE__ */ function() {
|
|
|
39199
39336
|
return this.redirectToProxy(proxyUri, options);
|
|
39200
39337
|
}
|
|
39201
39338
|
}
|
|
39202
|
-
var
|
|
39339
|
+
var message2;
|
|
39203
39340
|
if (response instanceof Error) {
|
|
39204
|
-
|
|
39341
|
+
message2 = "Fetch error: " + response.message;
|
|
39205
39342
|
} else {
|
|
39206
|
-
|
|
39343
|
+
message2 = response.statusText;
|
|
39207
39344
|
if (response.responseText) {
|
|
39208
|
-
|
|
39345
|
+
message2 += " ".concat(response.responseText);
|
|
39209
39346
|
}
|
|
39210
39347
|
}
|
|
39211
|
-
return this.failFetch(options,
|
|
39348
|
+
return this.failFetch(options, message2, response.status || 998, response);
|
|
39212
39349
|
}
|
|
39213
39350
|
}, {
|
|
39214
39351
|
key: "addType",
|
|
@@ -39663,8 +39800,8 @@ var PodOS = class {
|
|
|
39663
39800
|
fetch(uri) {
|
|
39664
39801
|
return this.store.fetch(uri);
|
|
39665
39802
|
}
|
|
39666
|
-
|
|
39667
|
-
return this.fileFetcher.
|
|
39803
|
+
fetchFile(url) {
|
|
39804
|
+
return this.fileFetcher.fetchFile(url);
|
|
39668
39805
|
}
|
|
39669
39806
|
trackSession(callback) {
|
|
39670
39807
|
return this.session.trackSession(callback);
|
|
@@ -39795,7 +39932,28 @@ const PosDescription = class {
|
|
|
39795
39932
|
}
|
|
39796
39933
|
};
|
|
39797
39934
|
|
|
39798
|
-
const
|
|
39935
|
+
const BrokenImage = ({ file }) => {
|
|
39936
|
+
const iconName = iconForStatus(file.status);
|
|
39937
|
+
return (h("div", null,
|
|
39938
|
+
h("a", { class: "error", href: file.url },
|
|
39939
|
+
h("div", null,
|
|
39940
|
+
h("ion-icon", { name: iconName })),
|
|
39941
|
+
h("div", { class: "code" }, file.status.code),
|
|
39942
|
+
h("div", { class: "text" }, file.status.text))));
|
|
39943
|
+
};
|
|
39944
|
+
function iconForStatus(status) {
|
|
39945
|
+
switch (status.code) {
|
|
39946
|
+
case 401:
|
|
39947
|
+
case 403:
|
|
39948
|
+
return 'lock-closed-outline';
|
|
39949
|
+
case 404:
|
|
39950
|
+
return 'help-circle-outline';
|
|
39951
|
+
default:
|
|
39952
|
+
return 'alert-circle-outline';
|
|
39953
|
+
}
|
|
39954
|
+
}
|
|
39955
|
+
|
|
39956
|
+
const posImageCss = ":host{--width:300px;--height:300px;--border-radius:0}img,ion-skeleton-text,div.error{border-radius:var(--border-radius);width:var(--width);height:var(--height)}.error{display:flex;opacity:0.8;background:repeating-linear-gradient( -45deg, rgba(150, 0, 0, 0.1), rgba(150, 0, 0, 0.1) 10px, #fff 5px, #fff 25px );flex-direction:column;border:1px solid red;color:black;align-items:center;justify-content:center;word-break:break-all;padding:1rem;box-sizing:border-box}.error ion-icon{color:#282828;--ionicon-stroke-width:calc(var(--width) / 5);font-size:calc(var(--width) / 2)}a{text-decoration:none;width:var(--width);height:var(--height)}.code{font-weight:bold;font-size:calc(var(--width) / 8)}.text{font-size:calc(var(--width) / 20)}";
|
|
39799
39957
|
|
|
39800
39958
|
const PosImage = class {
|
|
39801
39959
|
constructor(hostRef) {
|
|
@@ -39813,9 +39971,14 @@ const PosImage = class {
|
|
|
39813
39971
|
async fetchBlob() {
|
|
39814
39972
|
try {
|
|
39815
39973
|
this.loading = true;
|
|
39816
|
-
const
|
|
39817
|
-
|
|
39818
|
-
|
|
39974
|
+
const file = await this.os.fetchFile(this.src);
|
|
39975
|
+
if (file.blob()) {
|
|
39976
|
+
this.dataUri = URL.createObjectURL(file.blob());
|
|
39977
|
+
this.error = null;
|
|
39978
|
+
}
|
|
39979
|
+
else {
|
|
39980
|
+
this.brokenFile = file;
|
|
39981
|
+
}
|
|
39819
39982
|
}
|
|
39820
39983
|
catch (err) {
|
|
39821
39984
|
this.error = err;
|
|
@@ -39831,6 +39994,9 @@ const PosImage = class {
|
|
|
39831
39994
|
if (this.error) {
|
|
39832
39995
|
return h("div", { class: "error" }, this.error.message);
|
|
39833
39996
|
}
|
|
39997
|
+
if (this.brokenFile) {
|
|
39998
|
+
return h(BrokenImage, { file: this.brokenFile });
|
|
39999
|
+
}
|
|
39834
40000
|
return h("img", { src: this.dataUri });
|
|
39835
40001
|
}
|
|
39836
40002
|
static get watchers() { return {
|