@pod-os/elements 0.1.2-22a1ef1.0 → 0.1.2-991c3d7.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.
@@ -1840,6 +1840,30 @@ const Row = class {
1840
1840
  };
1841
1841
  Row.style = rowCss;
1842
1842
 
1843
+ const skeletonTextCss = ":host{--background:rgba(var(--background-rgb, var(--ion-text-color-rgb, 0, 0, 0)), 0.065);border-radius:var(--border-radius, inherit);display:block;width:100%;height:inherit;margin-top:4px;margin-bottom:4px;background:var(--background);line-height:10px;user-select:none;pointer-events:none}span{display:inline-block}:host(.in-media){margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;height:100%}:host(.skeleton-text-animated){position:relative;background:linear-gradient(to right, rgba(var(--background-rgb, var(--ion-text-color-rgb, 0, 0, 0)), 0.065) 8%, rgba(var(--background-rgb, var(--ion-text-color-rgb, 0, 0, 0)), 0.135) 18%, rgba(var(--background-rgb, var(--ion-text-color-rgb, 0, 0, 0)), 0.065) 33%);background-size:800px 104px;animation-duration:1s;animation-fill-mode:forwards;animation-iteration-count:infinite;animation-name:shimmer;animation-timing-function:linear}@keyframes shimmer{0%{background-position:-400px 0}100%{background-position:400px 0}}";
1844
+
1845
+ const SkeletonText = class {
1846
+ constructor(hostRef) {
1847
+ registerInstance(this, hostRef);
1848
+ /**
1849
+ * If `true`, the skeleton text will animate.
1850
+ */
1851
+ this.animated = false;
1852
+ }
1853
+ render() {
1854
+ const animated = this.animated && config.getBoolean('animated', true);
1855
+ const inMedia = hostContext('ion-avatar', this.el) || hostContext('ion-thumbnail', this.el);
1856
+ const mode = getIonMode$1(this);
1857
+ return (h(Host, { class: {
1858
+ [mode]: true,
1859
+ 'skeleton-text-animated': animated,
1860
+ 'in-media': inMedia
1861
+ } }, h("span", null, "\u00A0")));
1862
+ }
1863
+ get el() { return getElement$1(this); }
1864
+ };
1865
+ SkeletonText.style = skeletonTextCss;
1866
+
1843
1867
  const titleIosCss = ":host{--color:initial;display:flex;flex:1;align-items:center;transform:translateZ(0);color:var(--color)}:host(.ion-color){color:var(--ion-color-base)}.toolbar-title{display:block;width:100%;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;pointer-events:auto}:host(.title-small) .toolbar-title{white-space:normal}:host{left:0;top:0;padding-left:90px;padding-right:90px;padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);position:absolute;width:100%;height:100%;transform:translateZ(0);font-size:17px;font-weight:600;text-align:center;box-sizing:border-box;pointer-events:none}:host-context([dir=rtl]){left:unset;right:unset;right:0}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:90px;padding-inline-start:90px;-webkit-padding-end:90px;padding-inline-end:90px}}:host(.title-small){padding-left:9px;padding-right:9px;padding-top:6px;padding-bottom:16px;position:relative;font-size:13px;font-weight:normal}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host(.title-small){padding-left:unset;padding-right:unset;-webkit-padding-start:9px;padding-inline-start:9px;-webkit-padding-end:9px;padding-inline-end:9px}}:host(.title-large){padding-left:16px;padding-right:16px;padding-top:0;padding-bottom:0;transform-origin:left center;bottom:0;align-items:flex-end;min-width:100%;padding-bottom:6px;font-size:34px;font-weight:700;text-align:start}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host(.title-large){padding-left:unset;padding-right:unset;-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px}}:host(.title-large.title-rtl){transform-origin:right center}:host(.title-large.ion-cloned-element){--color:var(--ion-text-color, #000)}:host(.title-large) .toolbar-title{transform-origin:inherit}:host-context([dir=rtl]):host(.title-large) .toolbar-title,:host-context([dir=rtl]).title-large .toolbar-title{transform-origin:calc(100% - inherit)}";
1844
1868
 
1845
1869
  const titleMdCss = ":host{--color:initial;display:flex;flex:1;align-items:center;transform:translateZ(0);color:var(--color)}:host(.ion-color){color:var(--ion-color-base)}.toolbar-title{display:block;width:100%;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;pointer-events:auto}:host(.title-small) .toolbar-title{white-space:normal}:host{padding-left:20px;padding-right:20px;padding-top:0;padding-bottom:0;font-size:20px;font-weight:500;letter-spacing:0.0125em}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:20px;padding-inline-start:20px;-webkit-padding-end:20px;padding-inline-end:20px}}:host(.title-small){width:100%;height:100%;font-size:15px;font-weight:normal}";
@@ -2641,26 +2665,26 @@ var require_InruptError = __commonJS({
2641
2665
  }
2642
2666
  static lookupErrorIri(iri, messageParams) {
2643
2667
  if (InruptError.determineIfVocabTerm(iri)) {
2644
- const message = messageParams === void 0 ? iri.message : iri.messageParams(...messageParams);
2645
- return message === void 0 ? `Looked up error message IRI [${iri.value}], but found no message value.` : message;
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;
2646
2670
  }
2647
2671
  return `Error message looked up at: [${iri.value}]${messageParams === void 0 ? "" : `, with params [${messageParams.toString()}]`}`;
2648
2672
  }
2649
- static appendHttpResponseDetails(message, response, append) {
2673
+ static appendHttpResponseDetails(message2, response, append) {
2650
2674
  if (append && typeof response !== "undefined") {
2651
- return `${message} HTTP details: status code [${response.status}], status text [${response.statusText}].`;
2675
+ return `${message2} HTTP details: status code [${response.status}], status text [${response.statusText}].`;
2652
2676
  }
2653
- return message;
2677
+ return message2;
2654
2678
  }
2655
- static appendErrorIri(message, iri, append) {
2656
- return append ? `${message} Error IRI: [${iri.value}].` : message;
2679
+ static appendErrorIri(message2, iri, append) {
2680
+ return append ? `${message2} Error IRI: [${iri.value}].` : message2;
2657
2681
  }
2658
- static substituteParams(message, params) {
2659
- let fullMessage = message;
2682
+ static substituteParams(message2, params) {
2683
+ let fullMessage = message2;
2660
2684
  if (params !== void 0) {
2661
- const paramsRequired = message.split("{{").length - 1;
2685
+ const paramsRequired = message2.split("{{").length - 1;
2662
2686
  if (paramsRequired !== params.length) {
2663
- throw new Error(`Setting parameters on message [${message}], but it requires [${paramsRequired}] params and we received [${params.length}].`);
2687
+ throw new Error(`Setting parameters on message [${message2}], but it requires [${paramsRequired}] params and we received [${params.length}].`);
2664
2688
  }
2665
2689
  for (let i = 0; i < params.length; i += 1) {
2666
2690
  const marker = `{{${i}}}`;
@@ -3090,10 +3114,10 @@ var require_browser_ponyfill = __commonJS({
3090
3114
  try {
3091
3115
  new exports2.DOMException();
3092
3116
  } catch (err) {
3093
- exports2.DOMException = function(message, name) {
3094
- this.message = message;
3117
+ exports2.DOMException = function(message2, name) {
3118
+ this.message = message2;
3095
3119
  this.name = name;
3096
- var error2 = Error(message);
3120
+ var error2 = Error(message2);
3097
3121
  this.stack = error2.stack;
3098
3122
  };
3099
3123
  exports2.DOMException.prototype = Object.create(Error.prototype);
@@ -3325,9 +3349,9 @@ var JOSEError, JWTClaimValidationFailed, JWTExpired, JOSEAlgNotAllowed, JOSENotS
3325
3349
  var init_errors = __esm({
3326
3350
  "../node_modules/jose/dist/browser/util/errors.js"() {
3327
3351
  JOSEError = class extends Error {
3328
- constructor(message) {
3352
+ constructor(message2) {
3329
3353
  var _a;
3330
- super(message);
3354
+ super(message2);
3331
3355
  this.code = "ERR_JOSE_GENERIC";
3332
3356
  this.name = this.constructor.name;
3333
3357
  (_a = Error.captureStackTrace) === null || _a === void 0 ? void 0 : _a.call(Error, this, this.constructor);
@@ -3337,8 +3361,8 @@ var init_errors = __esm({
3337
3361
  }
3338
3362
  };
3339
3363
  JWTClaimValidationFailed = class extends JOSEError {
3340
- constructor(message, claim = "unspecified", reason = "unspecified") {
3341
- super(message);
3364
+ constructor(message2, claim = "unspecified", reason = "unspecified") {
3365
+ super(message2);
3342
3366
  this.code = "ERR_JWT_CLAIM_VALIDATION_FAILED";
3343
3367
  this.claim = claim;
3344
3368
  this.reason = reason;
@@ -3348,8 +3372,8 @@ var init_errors = __esm({
3348
3372
  }
3349
3373
  };
3350
3374
  JWTExpired = class extends JOSEError {
3351
- constructor(message, claim = "unspecified", reason = "unspecified") {
3352
- super(message);
3375
+ constructor(message2, claim = "unspecified", reason = "unspecified") {
3376
+ super(message2);
3353
3377
  this.code = "ERR_JWT_EXPIRED";
3354
3378
  this.claim = claim;
3355
3379
  this.reason = reason;
@@ -3531,8 +3555,9 @@ var init_check_cek_length = __esm({
3531
3555
  "../node_modules/jose/dist/browser/runtime/check_cek_length.js"() {
3532
3556
  init_errors();
3533
3557
  checkCekLength = (cek, expected) => {
3534
- if (cek.length << 3 !== expected) {
3535
- throw new JWEInvalid("Invalid Content Encryption Key length");
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`);
3536
3561
  }
3537
3562
  };
3538
3563
  check_cek_length_default = checkCekLength;
@@ -3567,7 +3592,7 @@ var init_timing_safe_equal = __esm({
3567
3592
 
3568
3593
  // ../node_modules/jose/dist/browser/runtime/env.js
3569
3594
  function isCloudflareWorkers() {
3570
- return typeof WebSocketPair === "function";
3595
+ return typeof WebSocketPair !== "undefined" || typeof navigator !== "undefined" && navigator.userAgent === "Cloudflare-Workers" || typeof EdgeRuntime !== "undefined" && EdgeRuntime === "vercel";
3571
3596
  }
3572
3597
  var init_env = __esm({
3573
3598
  "../node_modules/jose/dist/browser/runtime/env.js"() {
@@ -3650,6 +3675,12 @@ function checkSigCryptoKey(key, alg, ...usages) {
3650
3675
  throw unusable("NODE-ED25519");
3651
3676
  break;
3652
3677
  }
3678
+ case "EdDSA": {
3679
+ if (key.algorithm.name !== "Ed25519" && key.algorithm.name !== "Ed448") {
3680
+ throw unusable("Ed25519 or Ed448");
3681
+ }
3682
+ break;
3683
+ }
3653
3684
  case "ES256":
3654
3685
  case "ES384":
3655
3686
  case "ES512": {
@@ -3690,10 +3721,17 @@ function checkEncCryptoKey(key, alg, ...usages) {
3690
3721
  throw unusable(expected, "algorithm.length");
3691
3722
  break;
3692
3723
  }
3693
- case "ECDH":
3694
- if (!isAlgorithm(key.algorithm, "ECDH"))
3695
- throw unusable("ECDH");
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
+ }
3696
3733
  break;
3734
+ }
3697
3735
  case "PBES2-HS256+A128KW":
3698
3736
  case "PBES2-HS384+A192KW":
3699
3737
  case "PBES2-HS512+A256KW":
@@ -3724,29 +3762,34 @@ var init_crypto_key = __esm({
3724
3762
  });
3725
3763
 
3726
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
+ }
3727
3788
  var invalid_key_input_default;
3728
3789
  var init_invalid_key_input = __esm({
3729
3790
  "../node_modules/jose/dist/browser/lib/invalid_key_input.js"() {
3730
3791
  invalid_key_input_default = (actual, ...types2) => {
3731
- let msg2 = "Key must be ";
3732
- if (types2.length > 2) {
3733
- const last = types2.pop();
3734
- msg2 += `one of type ${types2.join(", ")}, or ${last}.`;
3735
- } else if (types2.length === 2) {
3736
- msg2 += `one of type ${types2[0]} or ${types2[1]}.`;
3737
- } else {
3738
- msg2 += `of type ${types2[0]}.`;
3739
- }
3740
- if (actual == null) {
3741
- msg2 += ` Received ${actual}`;
3742
- } else if (typeof actual === "function" && actual.name) {
3743
- msg2 += ` Received function ${actual.name}`;
3744
- } else if (typeof actual === "object" && actual != null) {
3745
- if (actual.constructor && actual.constructor.name) {
3746
- msg2 += ` Received an instance of ${actual.constructor.name}`;
3747
- }
3748
- }
3749
- return msg2;
3792
+ return message("Key must be ", actual, ...types2);
3750
3793
  };
3751
3794
  }
3752
3795
  });
@@ -3979,10 +4022,18 @@ async function deriveKey(publicKey, privateKey, algorithm, keyLength, apu = new
3979
4022
  }
3980
4023
  checkEncCryptoKey(privateKey, "ECDH", "deriveBits");
3981
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
+ }
3982
4033
  const sharedSecret = new Uint8Array(await webcrypto_default.subtle.deriveBits({
3983
- name: "ECDH",
4034
+ name: publicKey.algorithm.name,
3984
4035
  public: publicKey
3985
- }, privateKey, Math.ceil(parseInt(privateKey.algorithm.namedCurve.slice(-3), 10) / 8) << 3));
4036
+ }, privateKey, length));
3986
4037
  return concatKdf(sharedSecret, keyLength, value);
3987
4038
  }
3988
4039
  async function generateEpk(key) {
@@ -3995,7 +4046,7 @@ function ecdhAllowed(key) {
3995
4046
  if (!isCryptoKey(key)) {
3996
4047
  throw new TypeError(invalid_key_input_default(key, ...types));
3997
4048
  }
3998
- 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";
3999
4050
  }
4000
4051
  var init_ecdhes = __esm({
4001
4052
  "../node_modules/jose/dist/browser/runtime/ecdhes.js"() {
@@ -4244,8 +4295,14 @@ var init_asn1 = __esm({
4244
4295
  return "P-384";
4245
4296
  case findOid(keyData, [43, 129, 4, 0, 35]):
4246
4297
  return "P-521";
4247
- case (isCloudflareWorkers() && findOid(keyData, [43, 101, 112])):
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]):
4248
4303
  return "Ed25519";
4304
+ case findOid(keyData, [43, 101, 113]):
4305
+ return "Ed448";
4249
4306
  default:
4250
4307
  throw new JOSENotSupported("Invalid or unsupported EC Key Curve or OKP Key Sub Type");
4251
4308
  }
@@ -4294,15 +4351,22 @@ var init_asn1 = __esm({
4294
4351
  case "ECDH-ES":
4295
4352
  case "ECDH-ES+A128KW":
4296
4353
  case "ECDH-ES+A192KW":
4297
- case "ECDH-ES+A256KW":
4298
- algorithm = { name: "ECDH", namedCurve: getNamedCurve2(keyData) };
4354
+ case "ECDH-ES+A256KW": {
4355
+ const namedCurve = getNamedCurve2(keyData);
4356
+ algorithm = namedCurve.startsWith("P-") ? { name: "ECDH", namedCurve } : { name: namedCurve };
4299
4357
  keyUsages = isPublic ? [] : ["deriveBits"];
4300
4358
  break;
4301
- case (isCloudflareWorkers() && "EdDSA"):
4359
+ }
4360
+ case (isCloudflareWorkers() && "EdDSA"): {
4302
4361
  const namedCurve = getNamedCurve2(keyData).toUpperCase();
4303
4362
  algorithm = { name: `NODE-${namedCurve}`, namedCurve: `NODE-${namedCurve}` };
4304
4363
  keyUsages = isPublic ? ["verify"] : ["sign"];
4305
4364
  break;
4365
+ }
4366
+ case "EdDSA":
4367
+ algorithm = { name: getNamedCurve2(keyData) };
4368
+ keyUsages = isPublic ? ["verify"] : ["sign"];
4369
+ break;
4306
4370
  default:
4307
4371
  throw new JOSENotSupported('Invalid or unsupported "alg" (Algorithm) value');
4308
4372
  }
@@ -4425,9 +4489,27 @@ function subtleMapping(jwk) {
4425
4489
  keyUsages = jwk.d ? ["sign"] : ["verify"];
4426
4490
  break;
4427
4491
  default:
4428
- throw new JOSENotSupported('Invalid or unsupported JWK "crv" (Subtype of Key Pair) Parameter value');
4492
+ throw new JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
4429
4493
  }
4430
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
+ }
4431
4513
  default:
4432
4514
  throw new JOSENotSupported('Invalid or unsupported JWK "kty" (Key Type) Parameter value');
4433
4515
  }
@@ -4487,18 +4569,12 @@ function parseElement(bytes) {
4487
4569
  if (bytes[position] < 128) {
4488
4570
  length = bytes[position];
4489
4571
  position++;
4490
- } else {
4491
- let numberOfDigits = bytes[position] & 127;
4492
- position++;
4493
- length = 0;
4494
- for (let i = 0; i < numberOfDigits; i++) {
4495
- length = length * 256 + bytes[position];
4496
- position++;
4497
- }
4498
- }
4499
- if (length === 128) {
4572
+ } else if (length === 128) {
4500
4573
  length = 0;
4501
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
+ }
4502
4578
  length++;
4503
4579
  }
4504
4580
  const byteLength2 = position + length + 2;
@@ -4507,6 +4583,14 @@ function parseElement(bytes) {
4507
4583
  contents: bytes.subarray(position, position + length),
4508
4584
  raw: bytes.subarray(0, byteLength2)
4509
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
+ }
4510
4594
  }
4511
4595
  const byteLength = position + length;
4512
4596
  return {
@@ -4534,7 +4618,12 @@ async function importX509(x509, alg, options) {
4534
4618
  if (typeof x509 !== "string" || x509.indexOf("-----BEGIN CERTIFICATE-----") !== 0) {
4535
4619
  throw new TypeError('"x509" must be X.509 formatted string');
4536
4620
  }
4537
- const spki = getSPKI(x509);
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
+ }
4538
4627
  return fromSPKI(spki, alg, options);
4539
4628
  }
4540
4629
  async function importPKCS8(pkcs8, alg, options) {
@@ -4590,19 +4679,19 @@ var init_check_key_type = __esm({
4590
4679
  "../node_modules/jose/dist/browser/lib/check_key_type.js"() {
4591
4680
  init_invalid_key_input();
4592
4681
  init_is_key_like();
4593
- symmetricTypeCheck = (key) => {
4682
+ symmetricTypeCheck = (alg, key) => {
4594
4683
  if (key instanceof Uint8Array)
4595
4684
  return;
4596
4685
  if (!is_key_like_default(key)) {
4597
- throw new TypeError(invalid_key_input_default(key, ...types, "Uint8Array"));
4686
+ throw new TypeError(withAlg(alg, key, ...types, "Uint8Array"));
4598
4687
  }
4599
4688
  if (key.type !== "secret") {
4600
4689
  throw new TypeError(`${types.join(" or ")} instances for symmetric algorithms must be of type "secret"`);
4601
4690
  }
4602
4691
  };
4603
- asymmetricTypeCheck = (key, usage) => {
4692
+ asymmetricTypeCheck = (alg, key, usage) => {
4604
4693
  if (!is_key_like_default(key)) {
4605
- throw new TypeError(invalid_key_input_default(key, ...types));
4694
+ throw new TypeError(withAlg(alg, key, ...types));
4606
4695
  }
4607
4696
  if (key.type === "secret") {
4608
4697
  throw new TypeError(`${types.join(" or ")} instances for asymmetric algorithms must not be of type "secret"`);
@@ -4623,9 +4712,9 @@ var init_check_key_type = __esm({
4623
4712
  checkKeyType = (alg, key, usage) => {
4624
4713
  const symmetric = alg.startsWith("HS") || alg === "dir" || alg.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(alg);
4625
4714
  if (symmetric) {
4626
- symmetricTypeCheck(key);
4715
+ symmetricTypeCheck(alg, key);
4627
4716
  } else {
4628
- asymmetricTypeCheck(key, usage);
4717
+ asymmetricTypeCheck(alg, key, usage);
4629
4718
  }
4630
4719
  };
4631
4720
  check_key_type_default = checkKeyType;
@@ -4727,7 +4816,7 @@ var init_aesgcmkw = __esm({
4727
4816
  });
4728
4817
 
4729
4818
  // ../node_modules/jose/dist/browser/lib/decrypt_key_management.js
4730
- async function decryptKeyManagement(alg, key, encryptedKey, joseHeader) {
4819
+ async function decryptKeyManagement(alg, key, encryptedKey, joseHeader, options) {
4731
4820
  check_key_type_default(alg, key, "decrypt");
4732
4821
  switch (alg) {
4733
4822
  case "dir": {
@@ -4781,6 +4870,9 @@ async function decryptKeyManagement(alg, key, encryptedKey, joseHeader) {
4781
4870
  throw new JWEInvalid("JWE Encrypted Key missing");
4782
4871
  if (typeof joseHeader.p2c !== "number")
4783
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`);
4784
4876
  if (typeof joseHeader.p2s !== "string")
4785
4877
  throw new JWEInvalid(`JOSE Header "p2s" (PBES2 Salt) missing or invalid`);
4786
4878
  return decrypt2(alg, key, encryptedKey, joseHeader.p2c, decode(joseHeader.p2s));
@@ -4967,9 +5059,9 @@ async function flattenedDecrypt(jwe, key, options) {
4967
5059
  }
4968
5060
  let cek;
4969
5061
  try {
4970
- cek = await decrypt_key_management_default(alg, key, encryptedKey, joseHeader);
5062
+ cek = await decrypt_key_management_default(alg, key, encryptedKey, joseHeader, options);
4971
5063
  } catch (err) {
4972
- if (err instanceof TypeError) {
5064
+ if (err instanceof TypeError || err instanceof JWEInvalid || err instanceof JOSENotSupported) {
4973
5065
  throw err;
4974
5066
  }
4975
5067
  cek = cek_default(enc);
@@ -5597,6 +5689,8 @@ function subtleDsa(alg, algorithm) {
5597
5689
  case (isCloudflareWorkers() && "EdDSA"):
5598
5690
  const { namedCurve } = algorithm;
5599
5691
  return { name: namedCurve, namedCurve };
5692
+ case "EdDSA":
5693
+ return { name: algorithm.name };
5600
5694
  default:
5601
5695
  throw new JOSENotSupported(`alg ${alg} is not supported either by JOSE or your javascript runtime`);
5602
5696
  }
@@ -6887,7 +6981,7 @@ function getModulusLengthOption(options) {
6887
6981
  return modulusLength;
6888
6982
  }
6889
6983
  async function generateKeyPair(alg, options) {
6890
- var _a, _b;
6984
+ var _a, _b, _c;
6891
6985
  let algorithm;
6892
6986
  let keyUsages;
6893
6987
  switch (alg) {
@@ -6948,17 +7042,44 @@ async function generateKeyPair(alg, options) {
6948
7042
  throw new JOSENotSupported("Invalid or unsupported crv option provided");
6949
7043
  }
6950
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;
6951
7057
  case "ECDH-ES":
6952
7058
  case "ECDH-ES+A128KW":
6953
7059
  case "ECDH-ES+A192KW":
6954
- case "ECDH-ES+A256KW":
6955
- 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": {
6956
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
+ }
6957
7077
  break;
7078
+ }
6958
7079
  default:
6959
7080
  throw new JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
6960
7081
  }
6961
- return webcrypto_default.subtle.generateKey(algorithm, (_b = options === null || options === void 0 ? void 0 : options.extractable) !== null && _b !== void 0 ? _b : false, keyUsages);
7082
+ return webcrypto_default.subtle.generateKey(algorithm, (_c = options === null || options === void 0 ? void 0 : options.extractable) !== null && _c !== void 0 ? _c : false, keyUsages);
6962
7083
  }
6963
7084
  var init_generate = __esm({
6964
7085
  "../node_modules/jose/dist/browser/runtime/generate.js"() {
@@ -7346,8 +7467,8 @@ var require_ConfigurationError = __commonJS({
7346
7467
  "../node_modules/@inrupt/solid-client-authn-core/dist/errors/ConfigurationError.js"(exports) {
7347
7468
  Object.defineProperty(exports, "__esModule", { value: true });
7348
7469
  var ConfigurationError = class extends Error {
7349
- constructor(message) {
7350
- super(message);
7470
+ constructor(message2) {
7471
+ super(message2);
7351
7472
  }
7352
7473
  };
7353
7474
  exports.default = ConfigurationError;
@@ -7388,8 +7509,8 @@ var require_OidcProviderError = __commonJS({
7388
7509
  Object.defineProperty(exports, "__esModule", { value: true });
7389
7510
  exports.OidcProviderError = void 0;
7390
7511
  var OidcProviderError = class extends Error {
7391
- constructor(message, error2, errorDescription) {
7392
- super(message);
7512
+ constructor(message2, error2, errorDescription) {
7513
+ super(message2);
7393
7514
  this.error = error2;
7394
7515
  this.errorDescription = errorDescription;
7395
7516
  }
@@ -18118,10 +18239,10 @@ var require_graphTypes = __commonJS({
18118
18239
  var require_JsonLdError = __commonJS({
18119
18240
  "../node_modules/jsonld/lib/JsonLdError.js"(exports, module2) {
18120
18241
  module2.exports = class JsonLdError extends Error {
18121
- constructor(message = "An unspecified JSON-LD error occurred.", name = "jsonld.Error", details = {}) {
18122
- super(message);
18242
+ constructor(message2 = "An unspecified JSON-LD error occurred.", name = "jsonld.Error", details = {}) {
18243
+ super(message2);
18123
18244
  this.name = name;
18124
- this.message = message;
18245
+ this.message = message2;
18125
18246
  this.details = details;
18126
18247
  }
18127
18248
  };
@@ -24888,9 +25009,9 @@ var require_dom = __commonJS({
24888
25009
  ExceptionCode.INVALID_MODIFICATION_ERR = (ExceptionMessage[13] = "Invalid modification", 13);
24889
25010
  ExceptionCode.NAMESPACE_ERR = (ExceptionMessage[14] = "Invalid namespace", 14);
24890
25011
  ExceptionCode.INVALID_ACCESS_ERR = (ExceptionMessage[15] = "Invalid access", 15);
24891
- function DOMException(code, message) {
24892
- if (message instanceof Error) {
24893
- var error2 = message;
25012
+ function DOMException(code, message2) {
25013
+ if (message2 instanceof Error) {
25014
+ var error2 = message2;
24894
25015
  } else {
24895
25016
  error2 = this;
24896
25017
  Error.call(this, ExceptionMessage[code]);
@@ -24899,8 +25020,8 @@ var require_dom = __commonJS({
24899
25020
  Error.captureStackTrace(this, DOMException);
24900
25021
  }
24901
25022
  error2.code = code;
24902
- if (message)
24903
- this.message = this.message + ": " + message;
25023
+ if (message2)
25024
+ this.message = this.message + ": " + message2;
24904
25025
  return error2;
24905
25026
  }
24906
25027
  DOMException.prototype = Error.prototype;
@@ -26191,8 +26312,8 @@ var require_sax = __commonJS({
26191
26312
  var S_ATTR_END = 5;
26192
26313
  var S_TAG_SPACE = 6;
26193
26314
  var S_TAG_CLOSE = 7;
26194
- function ParseError(message, locator) {
26195
- this.message = message;
26315
+ function ParseError(message2, locator) {
26316
+ this.message = message2;
26196
26317
  this.locator = locator;
26197
26318
  if (Error.captureStackTrace)
26198
26319
  Error.captureStackTrace(this, ParseError);
@@ -27056,6 +27177,63 @@ var BrowserSession = class {
27056
27177
  }
27057
27178
  };
27058
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
+
27216
+ // src/files/FileFetcher.ts
27217
+ var FileFetcher = class {
27218
+ constructor(session) {
27219
+ this.session = session;
27220
+ }
27221
+ fetchFile(url) {
27222
+ return __async(this, null, function* () {
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
+ }
27233
+ });
27234
+ }
27235
+ };
27236
+
27059
27237
  // ../node_modules/@babel/runtime/helpers/esm/createClass.js
27060
27238
  function _defineProperties(target, props) {
27061
27239
  for (var i = 0; i < props.length; i++) {
@@ -27471,8 +27649,8 @@ var NamedNode = /* @__PURE__ */ function(_Node) {
27471
27649
  throw new Error('NamedNode IRI "' + iri + '" must be absolute.');
27472
27650
  }
27473
27651
  if (_this.value.includes(" ")) {
27474
- var message = 'Error: NamedNode IRI "' + iri + '" must not contain unencoded spaces.';
27475
- throw new Error(message);
27652
+ var message2 = 'Error: NamedNode IRI "' + iri + '" must not contain unencoded spaces.';
27653
+ throw new Error(message2);
27476
27654
  }
27477
27655
  return _this;
27478
27656
  }
@@ -30956,8 +31134,8 @@ var N3Parser = class {
30956
31134
  _emit(subject, predicate, object, graph3) {
30957
31135
  this._callback(null, this._quad(subject, predicate, object, graph3 || this.DEFAULTGRAPH));
30958
31136
  }
30959
- _error(message, token) {
30960
- const err = new Error(`${message} on line ${token.line}.`);
31137
+ _error(message2, token) {
31138
+ const err = new Error(`${message2} on line ${token.line}.`);
30961
31139
  err.context = {
30962
31140
  token,
30963
31141
  line: token.line,
@@ -38660,13 +38838,13 @@ var Fetcher = /* @__PURE__ */ function() {
38660
38838
  }
38661
38839
  }
38662
38840
  }, function(err) {
38663
- var message = err.message || err.statusText;
38664
- message = "Failed to load <" + uri + "> " + message;
38665
- console.log(message);
38841
+ var message2 = err.message || err.statusText;
38842
+ message2 = "Failed to load <" + uri + "> " + message2;
38843
+ console.log(message2);
38666
38844
  if (err.response && err.response.status) {
38667
- message += " status: " + err.response.status;
38845
+ message2 += " status: " + err.response.status;
38668
38846
  }
38669
- userCallback(false, message, err.response);
38847
+ userCallback(false, message2, err.response);
38670
38848
  });
38671
38849
  }
38672
38850
  }, {
@@ -39158,16 +39336,16 @@ var Fetcher = /* @__PURE__ */ function() {
39158
39336
  return this.redirectToProxy(proxyUri, options);
39159
39337
  }
39160
39338
  }
39161
- var message;
39339
+ var message2;
39162
39340
  if (response instanceof Error) {
39163
- message = "Fetch error: " + response.message;
39341
+ message2 = "Fetch error: " + response.message;
39164
39342
  } else {
39165
- message = response.statusText;
39343
+ message2 = response.statusText;
39166
39344
  if (response.responseText) {
39167
- message += " ".concat(response.responseText);
39345
+ message2 += " ".concat(response.responseText);
39168
39346
  }
39169
39347
  }
39170
- return this.failFetch(options, message, response.status || 998, response);
39348
+ return this.failFetch(options, message2, response.status || 998, response);
39171
39349
  }
39172
39350
  }, {
39173
39351
  key: "addType",
@@ -39614,6 +39792,7 @@ var PodOS = class {
39614
39792
  constructor() {
39615
39793
  this.session = new BrowserSession();
39616
39794
  this.store = new Store(this.session);
39795
+ this.fileFetcher = new FileFetcher(this.session);
39617
39796
  }
39618
39797
  handleIncomingRedirect() {
39619
39798
  this.session.handleIncomingRedirect();
@@ -39621,6 +39800,9 @@ var PodOS = class {
39621
39800
  fetch(uri) {
39622
39801
  return this.store.fetch(uri);
39623
39802
  }
39803
+ fetchFile(url) {
39804
+ return this.fileFetcher.fetchFile(url);
39805
+ }
39624
39806
  trackSession(callback) {
39625
39807
  return this.session.trackSession(callback);
39626
39808
  }
@@ -39721,7 +39903,7 @@ const PosAppGeneric = class {
39721
39903
  registerInstance(this, hostRef);
39722
39904
  }
39723
39905
  render() {
39724
- return (h("ion-grid", null, h("ion-row", null, h("ion-col", { size: "12", "size-sm": true }, h("ion-card", null, h("ion-card-header", null, h("img", { src: "https://dummyimage.com/250/ffffff/000000" }), h("ion-card-title", null, h("pos-label", null))), h("ion-card-content", null, h("pos-description", null)))), h("ion-col", { size: "12", "size-sm": true }, h("pos-literals", null)), h("ion-col", { size: "12", "size-sm": true }, h("pos-relations", null), h("pos-reverse-relations", null)))));
39906
+ return (h("ion-grid", null, h("ion-row", null, h("ion-col", { size: "12", "size-sm": true }, h("ion-card", null, h("ion-card-header", null, h("pos-image", { src: "https://dummyimage.com/250/eee/000" }), h("ion-card-title", null, h("pos-label", null))), h("ion-card-content", null, h("pos-description", null)))), h("ion-col", { size: "12", "size-sm": true }, h("pos-literals", null)), h("ion-col", { size: "12", "size-sm": true }, h("pos-relations", null), h("pos-reverse-relations", null)))));
39725
39907
  }
39726
39908
  };
39727
39909
 
@@ -39750,6 +39932,63 @@ const PosDescription = class {
39750
39932
  }
39751
39933
  };
39752
39934
 
39935
+ const BrokenImage = ({ file }) => {
39936
+ return h("div", { class: "error" }, file.toString());
39937
+ };
39938
+
39939
+ 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)}div.error{display:flex;background-color:#eee;border:1px solid red;color:red;align-items:center;justify-content:center;word-break:break-all;padding:1rem;box-sizing:border-box}";
39940
+
39941
+ const PosImage = class {
39942
+ constructor(hostRef) {
39943
+ registerInstance(this, hostRef);
39944
+ this.initializeOsEmitter = createEvent(this, "pod-os:init", 7);
39945
+ this.loading = true;
39946
+ this.setOs = async (os) => {
39947
+ this.os = os;
39948
+ };
39949
+ }
39950
+ componentWillLoad() {
39951
+ store.onChange('isLoggedIn', () => this.fetchBlob());
39952
+ this.initializeOsEmitter.emit(this.setOs);
39953
+ }
39954
+ async fetchBlob() {
39955
+ try {
39956
+ this.loading = true;
39957
+ const file = await this.os.fetchFile(this.src);
39958
+ if (file.blob()) {
39959
+ this.dataUri = URL.createObjectURL(file.blob());
39960
+ this.error = null;
39961
+ }
39962
+ else {
39963
+ this.brokenFile = file;
39964
+ }
39965
+ }
39966
+ catch (err) {
39967
+ this.error = err;
39968
+ }
39969
+ finally {
39970
+ this.loading = false;
39971
+ }
39972
+ }
39973
+ render() {
39974
+ if (this.loading) {
39975
+ return h("ion-skeleton-text", { animated: true });
39976
+ }
39977
+ if (this.error) {
39978
+ return h("div", { class: "error" }, this.error.message);
39979
+ }
39980
+ if (this.brokenFile) {
39981
+ return h(BrokenImage, { file: this.brokenFile });
39982
+ }
39983
+ return h("img", { src: this.dataUri });
39984
+ }
39985
+ static get watchers() { return {
39986
+ "os": ["fetchBlob"],
39987
+ "src": ["fetchBlob"]
39988
+ }; }
39989
+ };
39990
+ PosImage.style = posImageCss;
39991
+
39753
39992
  const PosLabel = class {
39754
39993
  constructor(hostRef) {
39755
39994
  registerInstance(this, hostRef);
@@ -40314,4 +40553,4 @@ const PosRouter = class {
40314
40553
  }
40315
40554
  };
40316
40555
 
40317
- export { App as ion_app, Button as ion_button, Card as ion_card, CardContent as ion_card_content, CardHeader as ion_card_header, CardTitle as ion_card_title, Col as ion_col, Content as ion_content, Footer as ion_footer, Grid as ion_grid, Header as ion_header, Icon as ion_icon, Item as ion_item, ItemDivider as ion_item_divider, ItemGroup as ion_item_group, Label as ion_label, List as ion_list, ProgressBar as ion_progress_bar, RippleEffect as ion_ripple_effect, Row as ion_row, ToolbarTitle as ion_title, Toolbar as ion_toolbar, PosApp as pos_app, PosAppGeneric as pos_app_generic, PosDemoApp as pos_demo_app, PosDescription as pos_description, PosLabel as pos_label, PosLiterals as pos_literals, PosLogin as pos_login, PosRelations as pos_relations, PosResource as pos_resource, PosReverseRelations as pos_reverse_relations, PosRichLink as pos_rich_link, PosRouter as pos_router };
40556
+ export { App as ion_app, Button as ion_button, Card as ion_card, CardContent as ion_card_content, CardHeader as ion_card_header, CardTitle as ion_card_title, Col as ion_col, Content as ion_content, Footer as ion_footer, Grid as ion_grid, Header as ion_header, Icon as ion_icon, Item as ion_item, ItemDivider as ion_item_divider, ItemGroup as ion_item_group, Label as ion_label, List as ion_list, ProgressBar as ion_progress_bar, RippleEffect as ion_ripple_effect, Row as ion_row, SkeletonText as ion_skeleton_text, ToolbarTitle as ion_title, Toolbar as ion_toolbar, PosApp as pos_app, PosAppGeneric as pos_app_generic, PosDemoApp as pos_demo_app, PosDescription as pos_description, PosImage as pos_image, PosLabel as pos_label, PosLiterals as pos_literals, PosLogin as pos_login, PosRelations as pos_relations, PosResource as pos_resource, PosReverseRelations as pos_reverse_relations, PosRichLink as pos_rich_link, PosRouter as pos_router };