@sphereon/oid4vci-common 0.19.1-feature.SSISDK.26.27 → 0.19.1-fix.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -152,7 +152,6 @@ __export(index_exports, {
152
152
  createCodeChallenge: () => createCodeChallenge,
153
153
  createProofOfPossession: () => createProofOfPossession,
154
154
  credentialIssuerMetadataFieldNames: () => credentialIssuerMetadataFieldNames,
155
- credentialIssuerMetadataFieldNamesV1_0_15: () => credentialIssuerMetadataFieldNamesV1_0_15,
156
155
  credentialSupportedV8ToV13: () => credentialSupportedV8ToV13,
157
156
  credentialsSupportedV8ToV13: () => credentialsSupportedV8ToV13,
158
157
  decodeJsonProperties: () => decodeJsonProperties,
@@ -168,7 +167,6 @@ __export(index_exports, {
168
167
  generateNonce: () => generateNonce,
169
168
  generateRandomString: () => generateRandomString,
170
169
  getClientIdFromCredentialOfferPayload: () => getClientIdFromCredentialOfferPayload,
171
- getCredentialConfigurationIdsFromOfferV1_0_15: () => getCredentialConfigurationIdsFromOfferV1_0_15,
172
170
  getCredentialOfferPayload: () => getCredentialOfferPayload,
173
171
  getCredentialRequestForVersion: () => getCredentialRequestForVersion,
174
172
  getFormatForVersion: () => getFormatForVersion,
@@ -200,10 +198,8 @@ __export(index_exports, {
200
198
  isPreAuthCode: () => isPreAuthCode,
201
199
  isValidURL: () => isValidURL,
202
200
  isW3cCredentialSupported: () => isW3cCredentialSupported,
203
- normalizeOfferInput: () => normalizeOfferInput,
204
201
  post: () => post,
205
202
  resolveCredentialOfferURI: () => resolveCredentialOfferURI,
206
- supportedOID4VCICredentialFormat: () => supportedOID4VCICredentialFormat,
207
203
  toAuthorizationResponsePayload: () => toAuthorizationResponsePayload,
208
204
  toUniformCredentialOfferPayload: () => toUniformCredentialOfferPayload,
209
205
  toUniformCredentialOfferRequest: () => toUniformCredentialOfferRequest,
@@ -233,14 +229,6 @@ init_cjs_shims();
233
229
 
234
230
  // lib/types/Generic.types.ts
235
231
  init_cjs_shims();
236
- var supportedOID4VCICredentialFormat = [
237
- "jwt_vc_json",
238
- "jwt_vc_json-ld",
239
- "ldp_vc",
240
- "dc+sd-jwt",
241
- "jwt_vc",
242
- "mso_mdoc"
243
- ];
244
232
  var PRE_AUTH_CODE_LITERAL = "pre-authorized_code";
245
233
  var PRE_AUTH_GRANT_LITERAL = "urn:ietf:params:oauth:grant-type:pre-authorized_code";
246
234
 
@@ -361,26 +349,6 @@ var credentialIssuerMetadataFieldNames = [
361
349
  "signed_metadata"
362
350
  ];
363
351
 
364
- // lib/types/v1_0_15.types.ts
365
- init_cjs_shims();
366
- var credentialIssuerMetadataFieldNamesV1_0_15 = [
367
- "credential_issuer",
368
- "credential_configurations_supported",
369
- "credential_endpoint",
370
- "nonce_endpoint",
371
- "deferred_credential_endpoint",
372
- "notification_endpoint",
373
- "credential_response_encryption",
374
- "batch_credential_issuance",
375
- "authorization_servers",
376
- "token_endpoint",
377
- "display",
378
- "credential_supplier_config",
379
- "credential_identifiers_supported",
380
- "signed_metadata",
381
- "authorization_challenge_endpoint"
382
- ];
383
-
384
352
  // lib/types/ServerMetadata.ts
385
353
  init_cjs_shims();
386
354
  var authorizationServerMetadataFieldNames = [
@@ -463,7 +431,6 @@ var OpenId4VCIVersion = /* @__PURE__ */ function(OpenId4VCIVersion2) {
463
431
  OpenId4VCIVersion2[OpenId4VCIVersion2["VER_1_0_11"] = 1011] = "VER_1_0_11";
464
432
  OpenId4VCIVersion2[OpenId4VCIVersion2["VER_1_0_12"] = 1012] = "VER_1_0_12";
465
433
  OpenId4VCIVersion2[OpenId4VCIVersion2["VER_1_0_13"] = 1013] = "VER_1_0_13";
466
- OpenId4VCIVersion2[OpenId4VCIVersion2["VER_1_0_15"] = 1015] = "VER_1_0_15";
467
434
  OpenId4VCIVersion2[OpenId4VCIVersion2["VER_UNKNOWN"] = Number.MAX_VALUE] = "VER_UNKNOWN";
468
435
  return OpenId4VCIVersion2;
469
436
  }({});
@@ -524,12 +491,57 @@ var TokenError = class _TokenError extends Error {
524
491
  // lib/types/QRCode.types.ts
525
492
  init_cjs_shims();
526
493
 
494
+ // lib/functions/FormatUtils.ts
495
+ init_cjs_shims();
496
+ function isFormat(formatObject, format) {
497
+ return formatObject.format === format;
498
+ }
499
+ __name(isFormat, "isFormat");
500
+ function isNotFormat(formatObject, format) {
501
+ return formatObject.format !== format;
502
+ }
503
+ __name(isNotFormat, "isNotFormat");
504
+ var isUniformFormat = /* @__PURE__ */ __name((format) => {
505
+ return [
506
+ "jwt_vc_json",
507
+ "jwt_vc_json-ld",
508
+ "ldp_vc",
509
+ "vc+sd-jwt",
510
+ "mso_mdoc"
511
+ ].includes(format);
512
+ }, "isUniformFormat");
513
+ function getUniformFormat(format) {
514
+ if (isUniformFormat(format)) {
515
+ return format;
516
+ }
517
+ if (format.toLocaleLowerCase() === "jwt_vc" || format.toLocaleLowerCase() === "jwt") {
518
+ return "jwt_vc";
519
+ }
520
+ if (format === "ldp_vc" || format === "ldp") {
521
+ return "ldp_vc";
522
+ }
523
+ throw new Error(`Invalid format: ${format}`);
524
+ }
525
+ __name(getUniformFormat, "getUniformFormat");
526
+ function getFormatForVersion(format, version) {
527
+ const uniformFormat = isUniformFormat(format) ? format : getUniformFormat(format);
528
+ if (version === OpenId4VCIVersion.VER_1_0_08) {
529
+ if (uniformFormat === "jwt_vc_json") {
530
+ return "jwt_vc";
531
+ } else if (uniformFormat === "ldp_vc" || uniformFormat === "jwt_vc_json-ld") {
532
+ return "ldp_vc";
533
+ }
534
+ }
535
+ return uniformFormat;
536
+ }
537
+ __name(getFormatForVersion, "getFormatForVersion");
538
+
527
539
  // lib/functions/CredentialRequestUtil.ts
528
- function getTypesFromRequest(credentialRequest, format, opts) {
540
+ function getTypesFromRequest(credentialRequest, opts) {
529
541
  let types = [];
530
542
  if ("credential_identifier" in credentialRequest && credentialRequest.credential_identifier) {
531
543
  throw Error(`Cannot get types from request when it contains a credential_identifier`);
532
- } else if (format === "jwt_vc_json-ld" || format === "ldp_vc" || format === "jwt_vc" || format === "jwt_vc_json") {
544
+ } else if (credentialRequest.format === "jwt_vc_json-ld" || credentialRequest.format === "ldp_vc" || credentialRequest.format === "jwt_vc" || credentialRequest.format === "jwt_vc_json") {
533
545
  if ("credential_definition" in credentialRequest && credentialRequest.credential_definition) {
534
546
  types = "types" in credentialRequest.credential_definition ? credentialRequest.credential_definition.types : credentialRequest.credential_definition.type;
535
547
  }
@@ -539,11 +551,11 @@ function getTypesFromRequest(credentialRequest, format, opts) {
539
551
  if ("types" in credentialRequest && Array.isArray(credentialRequest.types)) {
540
552
  types = credentialRequest.types;
541
553
  }
542
- } else if (format === "dc+sd-jwt" && "vct" in credentialRequest) {
554
+ } else if (credentialRequest.format === "vc+sd-jwt" && "vct" in credentialRequest) {
543
555
  types = [
544
556
  credentialRequest.vct
545
557
  ];
546
- } else if (format === "mso_mdoc" && "doctype" in credentialRequest) {
558
+ } else if (credentialRequest.format === "mso_mdoc" && "doctype" in credentialRequest) {
547
559
  types = [
548
560
  credentialRequest.doctype
549
561
  ];
@@ -557,16 +569,17 @@ function getTypesFromRequest(credentialRequest, format, opts) {
557
569
  return types;
558
570
  }
559
571
  __name(getTypesFromRequest, "getTypesFromRequest");
560
- function getCredentialRequestForVersion(credentialRequest, format, version) {
572
+ function getCredentialRequestForVersion(credentialRequest, version) {
561
573
  if (version === OpenId4VCIVersion.VER_1_0_08) {
562
- const types = getTypesFromRequest(credentialRequest, format, {
574
+ const draft8Format = getFormatForVersion(credentialRequest.format, version);
575
+ const types = getTypesFromRequest(credentialRequest, {
563
576
  filterVerifiableCredential: true
564
577
  });
565
578
  if (credentialRequest.credential_subject_issuance) {
566
579
  throw Error("Experimental subject issuance is not supported for older versions of the spec");
567
580
  }
568
581
  return {
569
- format,
582
+ format: draft8Format,
570
583
  proof: credentialRequest.proof,
571
584
  type: types[0]
572
585
  };
@@ -779,7 +792,6 @@ __name(acquireDeferredCredentialImpl, "acquireDeferredCredentialImpl");
779
792
  init_cjs_shims();
780
793
  var import_ssi_types2 = require("@sphereon/ssi-types");
781
794
  var import_jwt_decode = require("jwt-decode");
782
- var import_oid4vc_common = require("@sphereon/oid4vc-common");
783
795
  var logger2 = import_ssi_types2.Loggers.DEFAULT.get("sphereon:oid4vci:offer");
784
796
  function determineSpecVersionFromURI(uri) {
785
797
  let version = determineSpecVersionFromScheme(uri, OpenId4VCIVersion.VER_UNKNOWN) ?? OpenId4VCIVersion.VER_UNKNOWN;
@@ -799,102 +811,42 @@ function determineSpecVersionFromURI(uri) {
799
811
  OpenId4VCIVersion.VER_1_0_11
800
812
  ], "grants.user_pin_required");
801
813
  version = getVersionFromURIParam(uri, version, [
802
- OpenId4VCIVersion.VER_1_0_13,
803
- OpenId4VCIVersion.VER_1_0_15
814
+ OpenId4VCIVersion.VER_1_0_13
804
815
  ], "credential_configuration_ids");
805
816
  version = getVersionFromURIParam(uri, version, [
806
- OpenId4VCIVersion.VER_1_0_13,
807
- OpenId4VCIVersion.VER_1_0_15
817
+ OpenId4VCIVersion.VER_1_0_13
808
818
  ], "tx_code");
809
- version = getVersionFromURIParam(uri, version, [
810
- OpenId4VCIVersion.VER_1_0_15
811
- ], "credential_offer_uri ");
812
819
  if (version === OpenId4VCIVersion.VER_UNKNOWN) {
813
- version = OpenId4VCIVersion.VER_1_0_15;
820
+ version = OpenId4VCIVersion.VER_1_0_13;
814
821
  }
815
822
  return version;
816
823
  }
817
824
  __name(determineSpecVersionFromURI, "determineSpecVersionFromURI");
818
825
  function determineSpecVersionFromScheme(credentialOfferURI, openId4VCIVersion) {
819
826
  const scheme = getScheme(credentialOfferURI);
820
- const url = toUrlWithDummyBase(credentialOfferURI);
821
- const qp = url.searchParams;
822
- if (scheme === DefaultURISchemes.INITIATE_ISSUANCE) {
823
- if (qp.has("credential_offer") || qp.has("credential_offer_uri")) {
824
- return recordVersion(openId4VCIVersion, [
825
- OpenId4VCIVersion.VER_1_0_15
826
- ], scheme);
827
- }
828
- if (qp.has("credential_type") || qp.has("issuer")) {
829
- return recordVersion(openId4VCIVersion, [
830
- OpenId4VCIVersion.VER_1_0_08
831
- ], scheme);
832
- }
827
+ if (credentialOfferURI.includes(DefaultURISchemes.INITIATE_ISSUANCE)) {
833
828
  return recordVersion(openId4VCIVersion, [
834
- OpenId4VCIVersion.VER_UNKNOWN
829
+ OpenId4VCIVersion.VER_1_0_08
835
830
  ], scheme);
836
831
  }
837
- if (scheme === DefaultURISchemes.CREDENTIAL_OFFER) {
838
- if (qp.has("credential_offer_uri")) {
832
+ if (credentialOfferURI.includes("credential_offer_uri")) {
833
+ return void 0;
834
+ } else if (credentialOfferURI.includes(DefaultURISchemes.CREDENTIAL_OFFER)) {
835
+ if (credentialOfferURI.includes("credentials:") || credentialOfferURI.includes("credentials%22")) {
839
836
  return recordVersion(openId4VCIVersion, [
840
- OpenId4VCIVersion.VER_1_0_15
837
+ OpenId4VCIVersion.VER_1_0_11
841
838
  ], scheme);
842
839
  }
843
- const rawParam = getParamValueLoose(qp, "credential_offer");
844
- if (rawParam) {
845
- const decoded = tryDecodeOffer(rawParam);
846
- const version = sniffOfferVersion(decoded);
847
- if (version !== OpenId4VCIVersion.VER_UNKNOWN) {
848
- return recordVersion(openId4VCIVersion, [
849
- version
850
- ], scheme);
851
- }
852
- }
840
+ return recordVersion(openId4VCIVersion, [
841
+ OpenId4VCIVersion.VER_1_0_13
842
+ ], scheme);
843
+ } else {
853
844
  return recordVersion(openId4VCIVersion, [
854
845
  OpenId4VCIVersion.VER_UNKNOWN
855
846
  ], scheme);
856
847
  }
857
- return recordVersion(openId4VCIVersion, [
858
- OpenId4VCIVersion.VER_UNKNOWN
859
- ], scheme);
860
848
  }
861
849
  __name(determineSpecVersionFromScheme, "determineSpecVersionFromScheme");
862
- function toUrlWithDummyBase(uri) {
863
- const normalized = uri.replace(/^openid-[^?]+:\/\//, "https://dummy/?");
864
- return new URL(normalized);
865
- }
866
- __name(toUrlWithDummyBase, "toUrlWithDummyBase");
867
- function getParamValueLoose(qp, key) {
868
- if (qp.has(key)) return qp.get(key);
869
- if (qp.has(`?${key}`)) return qp.get(`?${key}`);
870
- return null;
871
- }
872
- __name(getParamValueLoose, "getParamValueLoose");
873
- function tryDecodeOffer(input) {
874
- let candidate = input;
875
- try {
876
- candidate = decodeURIComponent(candidate);
877
- } catch {
878
- }
879
- if (!/[{}]/.test(candidate) && /^[A-Za-z0-9\-_]+$/.test(candidate)) {
880
- try {
881
- const b64 = candidate.replace(/-/g, "+").replace(/_/g, "/").padEnd(Math.ceil(candidate.length / 4) * 4, "=");
882
- candidate = atob(b64);
883
- } catch {
884
- }
885
- }
886
- return candidate;
887
- }
888
- __name(tryDecodeOffer, "tryDecodeOffer");
889
- function sniffOfferVersion(jsonLike) {
890
- if (!jsonLike) return OpenId4VCIVersion.VER_UNKNOWN;
891
- const has = /* @__PURE__ */ __name((k) => new RegExp(`"${k}"\\s*:`, "i").test(jsonLike), "has");
892
- if (has("credentials")) return OpenId4VCIVersion.VER_1_0_11;
893
- if (has("credential_configuration_id")) return OpenId4VCIVersion.VER_1_0_13;
894
- if (has("credential_configuration_ids")) return OpenId4VCIVersion.VER_1_0_15;
895
- return OpenId4VCIVersion.VER_UNKNOWN;
896
- }
897
- __name(sniffOfferVersion, "sniffOfferVersion");
898
850
  function getScheme(credentialOfferURI) {
899
851
  if (!credentialOfferURI || !credentialOfferURI.includes("://")) {
900
852
  throw Error("Invalid credential offer URI");
@@ -950,9 +902,7 @@ var getStateFromCredentialOfferPayload = /* @__PURE__ */ __name((credentialOffer
950
902
  return;
951
903
  }, "getStateFromCredentialOfferPayload");
952
904
  function determineSpecVersionFromOffer(offer) {
953
- if (isCredentialOfferV1_0_15(offer)) {
954
- return OpenId4VCIVersion.VER_1_0_15;
955
- } else if (isCredentialOfferV1_0_13(offer)) {
905
+ if (isCredentialOfferV1_0_13(offer)) {
956
906
  return OpenId4VCIVersion.VER_1_0_13;
957
907
  } else if (isCredentialOfferV1_0_11(offer)) {
958
908
  return OpenId4VCIVersion.VER_1_0_11;
@@ -1033,20 +983,6 @@ function isCredentialOfferV1_0_13(offer) {
1033
983
  return "credential_offer_uri" in offer;
1034
984
  }
1035
985
  __name(isCredentialOfferV1_0_13, "isCredentialOfferV1_0_13");
1036
- function isCredentialOfferV1_0_15(offer) {
1037
- if (!offer) {
1038
- return false;
1039
- }
1040
- offer = normalizeOfferInput(offer);
1041
- if ("credential_issuer" in offer && "credential_configuration_ids" in offer) {
1042
- return Array.isArray(offer.credential_configuration_ids);
1043
- }
1044
- if ("credential_offer" in offer && offer["credential_offer"]) {
1045
- return isCredentialOfferV1_0_15(offer["credential_offer"]);
1046
- }
1047
- return "credential_offer_uri" in offer;
1048
- }
1049
- __name(isCredentialOfferV1_0_15, "isCredentialOfferV1_0_15");
1050
986
  async function toUniformCredentialOfferRequest(offer, opts) {
1051
987
  let version = opts?.version ?? determineSpecVersionFromOffer(offer);
1052
988
  let originalCredentialOffer = offer.credential_offer;
@@ -1082,7 +1018,6 @@ async function toUniformCredentialOfferRequest(offer, opts) {
1082
1018
  }
1083
1019
  __name(toUniformCredentialOfferRequest, "toUniformCredentialOfferRequest");
1084
1020
  function isPreAuthCode(request) {
1085
- request = normalizeOfferInput(request);
1086
1021
  const payload = "credential_offer" in request ? request.credential_offer : request;
1087
1022
  return payload?.grants?.[PRE_AUTH_GRANT_LITERAL]?.[PRE_AUTH_CODE_LITERAL] !== void 0;
1088
1023
  }
@@ -1116,8 +1051,7 @@ async function resolveCredentialOfferURI(uri) {
1116
1051
  return response.successBody;
1117
1052
  }
1118
1053
  __name(resolveCredentialOfferURI, "resolveCredentialOfferURI");
1119
- function toUniformCredentialOfferPayload(rawOffer, opts) {
1120
- const offer = normalizeOfferInput(rawOffer);
1054
+ function toUniformCredentialOfferPayload(offer, opts) {
1121
1055
  const version = opts?.version ?? determineSpecVersionFromOffer(offer);
1122
1056
  if (version >= OpenId4VCIVersion.VER_1_0_11) {
1123
1057
  const orig = offer;
@@ -1186,7 +1120,6 @@ function determineFlowType(suppliedOffer, version) {
1186
1120
  }
1187
1121
  __name(determineFlowType, "determineFlowType");
1188
1122
  function getCredentialOfferPayload(offer) {
1189
- offer = normalizeOfferInput(offer);
1190
1123
  let payload;
1191
1124
  if ("credential_offer" in offer && offer["credential_offer"]) {
1192
1125
  payload = offer.credential_offer;
@@ -1197,7 +1130,6 @@ function getCredentialOfferPayload(offer) {
1197
1130
  }
1198
1131
  __name(getCredentialOfferPayload, "getCredentialOfferPayload");
1199
1132
  function determineGrantTypes(offer) {
1200
- offer = normalizeOfferInput(offer);
1201
1133
  let grants;
1202
1134
  if ("grants" in offer && offer.grants) {
1203
1135
  grants = offer.grants;
@@ -1270,25 +1202,6 @@ function getTypesFromOfferV1_0_11(credentialOffer, opts) {
1270
1202
  return types;
1271
1203
  }
1272
1204
  __name(getTypesFromOfferV1_0_11, "getTypesFromOfferV1_0_11");
1273
- function getCredentialConfigurationIdsFromOfferV1_0_15(offer) {
1274
- return offer.credential_configuration_ids ?? [];
1275
- }
1276
- __name(getCredentialConfigurationIdsFromOfferV1_0_15, "getCredentialConfigurationIdsFromOfferV1_0_15");
1277
- function normalizeOfferInput(input) {
1278
- if (typeof input !== "string") {
1279
- return input;
1280
- }
1281
- if (import_ssi_types2.ObjectUtils.isString(input) && input.startsWith("ey")) {
1282
- const payload = (0, import_oid4vc_common.base64urlToString)(input);
1283
- return JSON.parse(payload);
1284
- }
1285
- try {
1286
- return JSON.parse(input);
1287
- } catch {
1288
- }
1289
- return input;
1290
- }
1291
- __name(normalizeOfferInput, "normalizeOfferInput");
1292
1205
 
1293
1206
  // lib/functions/Encoding.ts
1294
1207
  init_cjs_shims();
@@ -1512,7 +1425,7 @@ function getTypesFromCredentialSupported(credentialSupported, opts) {
1512
1425
  let types = [];
1513
1426
  if (credentialSupported.format === "jwt_vc_json" || credentialSupported.format === "jwt_vc" || credentialSupported.format === "jwt_vc_json-ld" || credentialSupported.format === "ldp_vc") {
1514
1427
  types = getTypesFromObject(credentialSupported) ?? [];
1515
- } else if (credentialSupported.format === "dc+sd-jwt") {
1428
+ } else if (credentialSupported.format === "vc+sd-jwt") {
1516
1429
  types = [
1517
1430
  credentialSupported.vct
1518
1431
  ];
@@ -1534,7 +1447,7 @@ __name(getTypesFromCredentialSupported, "getTypesFromCredentialSupported");
1534
1447
  // lib/functions/IssuerMetadataUtils.ts
1535
1448
  init_cjs_shims();
1536
1449
  function getSupportedCredentials(opts) {
1537
- const { version = OpenId4VCIVersion.VER_1_0_15, types } = opts ?? {};
1450
+ const { version = OpenId4VCIVersion.VER_1_0_13, types } = opts ?? {};
1538
1451
  if (types && Array.isArray(types)) {
1539
1452
  if (version < OpenId4VCIVersion.VER_1_0_13) {
1540
1453
  return types.flatMap((typeSet) => getSupportedCredential({
@@ -1563,9 +1476,7 @@ function getSupportedCredentials(opts) {
1563
1476
  __name(getSupportedCredentials, "getSupportedCredentials");
1564
1477
  function determineVersionsFromIssuerMetadata(issuerMetadata) {
1565
1478
  const versions = /* @__PURE__ */ new Set();
1566
- if ("credential_configurations_supported" in issuerMetadata) {
1567
- versions.add(OpenId4VCIVersion.VER_1_0_15);
1568
- } else if ("authorization_server" in issuerMetadata) {
1479
+ if ("authorization_server" in issuerMetadata) {
1569
1480
  versions.add(OpenId4VCIVersion.VER_1_0_11);
1570
1481
  } else if ("authorization_servers" in issuerMetadata) {
1571
1482
  versions.add(OpenId4VCIVersion.VER_1_0_13);
@@ -1588,10 +1499,9 @@ function determineVersionsFromIssuerMetadata(issuerMetadata) {
1588
1499
  }
1589
1500
  __name(determineVersionsFromIssuerMetadata, "determineVersionsFromIssuerMetadata");
1590
1501
  function getSupportedCredential(opts) {
1591
- const { issuerMetadata, types, format, version = OpenId4VCIVersion.VER_1_0_15 } = opts ?? {};
1502
+ const { issuerMetadata, types, format, version = OpenId4VCIVersion.VER_1_0_13 } = opts ?? {};
1592
1503
  let credentialConfigurationsV11 = void 0;
1593
1504
  let credentialConfigurationsV13 = void 0;
1594
- let credentialConfigurationsV15 = void 0;
1595
1505
  if (version < OpenId4VCIVersion.VER_1_0_12 || issuerMetadata?.credential_configurations_supported === void 0 && issuerMetadata?.credentials_supported) {
1596
1506
  if (issuerMetadata?.credentials_supported && !Array.isArray(issuerMetadata?.credentials_supported)) {
1597
1507
  credentialConfigurationsV11 = [];
@@ -1601,25 +1511,15 @@ function getSupportedCredential(opts) {
1601
1511
  }
1602
1512
  credentialConfigurationsV11?.push(supported);
1603
1513
  });
1604
- } else if (version >= OpenId4VCIVersion.VER_1_0_15) {
1605
- credentialConfigurationsV15 = issuerMetadata?.credential_configurations_supported ?? {};
1606
1514
  } else {
1607
1515
  credentialConfigurationsV11 = issuerMetadata?.credentials_supported ?? [];
1608
1516
  }
1609
- } else if (version == OpenId4VCIVersion.VER_1_0_13) {
1610
- credentialConfigurationsV13 = issuerMetadata?.credential_configurations_supported ?? {};
1611
1517
  } else {
1612
- credentialConfigurationsV15 = issuerMetadata?.credential_configurations_supported ?? {};
1518
+ credentialConfigurationsV13 = issuerMetadata?.credential_configurations_supported ?? {};
1613
1519
  }
1614
1520
  if (!issuerMetadata || !issuerMetadata.credential_configurations_supported && !issuerMetadata.credentials_supported) {
1615
1521
  VCI_LOG_COMMON.warning(`No credential issuer metadata or supported credentials found for issuer}`);
1616
- if (version < OpenId4VCIVersion.VER_1_0_13) {
1617
- return credentialConfigurationsV11;
1618
- } else if (version >= OpenId4VCIVersion.VER_1_0_15) {
1619
- return credentialConfigurationsV15;
1620
- } else {
1621
- return credentialConfigurationsV15;
1622
- }
1522
+ return version < OpenId4VCIVersion.VER_1_0_13 ? credentialConfigurationsV11 : credentialConfigurationsV13;
1623
1523
  }
1624
1524
  const normalizedTypes = Array.isArray(types) ? types : types ? [
1625
1525
  types
@@ -1636,14 +1536,12 @@ function getSupportedCredential(opts) {
1636
1536
  } else if (types2) {
1637
1537
  isTypeMatch = normalizedTypes.every((type) => types2.includes(type));
1638
1538
  } else {
1639
- const hasValidCredentialDefinition = isW3cCredentialSupported(config) && "credential_definition" in config && config.credential_definition && typeof config.credential_definition === "object" && true && "type" in config.credential_definition && Array.isArray(config.credential_definition.type);
1640
- if (hasValidCredentialDefinition) {
1641
- const credDef = config.credential_definition;
1642
- isTypeMatch = normalizedTypes.every((type) => credDef.type.includes(type));
1539
+ if (isW3cCredentialSupported(config) && "credential_definition" in config) {
1540
+ isTypeMatch = normalizedTypes.every((type) => config.credential_definition.type.includes(type));
1643
1541
  } else if (isW3cCredentialSupported(config) && "type" in config && Array.isArray(config.type)) {
1644
1542
  isTypeMatch = normalizedTypes.every((type) => config.type.includes(type));
1645
- } else if (isW3cCredentialSupported(config) && "types" in config && Array.isArray(config.types)) {
1646
- isTypeMatch = normalizedTypes.every((type) => config.types.includes(type));
1543
+ } else if (isW3cCredentialSupported(config) && "types" in config) {
1544
+ isTypeMatch = normalizedTypes.every((type) => config.types?.includes(type));
1647
1545
  }
1648
1546
  }
1649
1547
  }
@@ -1651,17 +1549,7 @@ function getSupportedCredential(opts) {
1651
1549
  return isTypeMatch && isFormatMatch ? config : void 0;
1652
1550
  }
1653
1551
  __name(filterMatchingConfig, "filterMatchingConfig");
1654
- if (credentialConfigurationsV15) {
1655
- return Object.entries(credentialConfigurationsV15).reduce((filteredConfigs, [id, config]) => {
1656
- if (filterMatchingConfig(config)) {
1657
- filteredConfigs[id] = config;
1658
- if (!config.id) {
1659
- config.id = id;
1660
- }
1661
- }
1662
- return filteredConfigs;
1663
- }, {});
1664
- } else if (credentialConfigurationsV13) {
1552
+ if (credentialConfigurationsV13) {
1665
1553
  return Object.entries(credentialConfigurationsV13).reduce((filteredConfigs, [id, config]) => {
1666
1554
  if (filterMatchingConfig(config)) {
1667
1555
  filteredConfigs[id] = config;
@@ -1724,51 +1612,6 @@ function getIssuerName(url, credentialIssuerMetadata) {
1724
1612
  }
1725
1613
  __name(getIssuerName, "getIssuerName");
1726
1614
 
1727
- // lib/functions/FormatUtils.ts
1728
- init_cjs_shims();
1729
- function isFormat(formatObject, format) {
1730
- return formatObject.format === format;
1731
- }
1732
- __name(isFormat, "isFormat");
1733
- function isNotFormat(formatObject, format) {
1734
- return formatObject.format !== format;
1735
- }
1736
- __name(isNotFormat, "isNotFormat");
1737
- var isUniformFormat = /* @__PURE__ */ __name((format) => {
1738
- return [
1739
- "jwt_vc_json",
1740
- "jwt_vc_json-ld",
1741
- "ldp_vc",
1742
- "dc+sd-jwt",
1743
- "mso_mdoc"
1744
- ].includes(format);
1745
- }, "isUniformFormat");
1746
- function getUniformFormat(format) {
1747
- if (isUniformFormat(format)) {
1748
- return format;
1749
- }
1750
- if (format.toLocaleLowerCase() === "jwt_vc" || format.toLocaleLowerCase() === "jwt") {
1751
- return "jwt_vc";
1752
- }
1753
- if (format === "ldp_vc" || format === "ldp") {
1754
- return "ldp_vc";
1755
- }
1756
- throw new Error(`Invalid format: ${format}`);
1757
- }
1758
- __name(getUniformFormat, "getUniformFormat");
1759
- function getFormatForVersion(format, version) {
1760
- const uniformFormat = isUniformFormat(format) ? format : getUniformFormat(format);
1761
- if (version === OpenId4VCIVersion.VER_1_0_08) {
1762
- if (uniformFormat === "jwt_vc_json") {
1763
- return "jwt_vc";
1764
- } else if (uniformFormat === "ldp_vc" || uniformFormat === "jwt_vc_json-ld") {
1765
- return "ldp_vc";
1766
- }
1767
- }
1768
- return uniformFormat;
1769
- }
1770
- __name(getFormatForVersion, "getFormatForVersion");
1771
-
1772
1615
  // lib/functions/ProofUtil.ts
1773
1616
  init_cjs_shims();
1774
1617
  var import_ssi_types3 = require("@sphereon/ssi-types");
@@ -1936,7 +1779,7 @@ var toAuthorizationResponsePayload = /* @__PURE__ */ __name((input) => {
1936
1779
 
1937
1780
  // lib/functions/RandomUtils.ts
1938
1781
  init_cjs_shims();
1939
- var import_oid4vc_common2 = require("@sphereon/oid4vc-common");
1782
+ var import_oid4vc_common = require("@sphereon/oid4vc-common");
1940
1783
  var u8a = __toESM(require("uint8arrays"), 1);
1941
1784
  var import_randomBytes = __toESM(require_randomBytes(), 1);
1942
1785
  var { toString } = u8a;
@@ -1957,7 +1800,7 @@ var createCodeChallenge = /* @__PURE__ */ __name((codeVerifier, codeChallengeMet
1957
1800
  if (codeChallengeMethod === CodeChallengeMethod.plain) {
1958
1801
  return codeVerifier;
1959
1802
  } else if (!codeChallengeMethod || codeChallengeMethod === CodeChallengeMethod.S256) {
1960
- return toString((0, import_oid4vc_common2.defaultHasher)(codeVerifier, "sha256"), "base64url");
1803
+ return toString((0, import_oid4vc_common.defaultHasher)(codeVerifier, "sha256"), "base64url");
1961
1804
  } else {
1962
1805
  throw Error(`code challenge method ${codeChallengeMethod} not implemented`);
1963
1806
  }