@sphereon/ssi-sdk.siopv2-oid4vp-op-auth 0.34.1-feature.SSISDK.44.finish.dcql.313 → 0.34.1-feature.SSISDK.44.finish.dcql.315

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -526,7 +526,7 @@ __name(getSigningAlgo, "getSigningAlgo");
526
526
  import { calculateSdHash } from "@sphereon/pex/dist/main/lib/utils/index.js";
527
527
  import { isManagedIdentifierDidResult } from "@sphereon/ssi-sdk-ext.identifier-resolution";
528
528
  import { defaultGenerateDigest } from "@sphereon/ssi-sdk.sd-jwt";
529
- import { CredentialMapper, Loggers } from "@sphereon/ssi-types";
529
+ import { CredentialMapper, DocumentFormat, Loggers } from "@sphereon/ssi-types";
530
530
 
531
531
  // src/types/IDidAuthSiopOpAuthenticator.ts
532
532
  var LOGGER_NAMESPACE = "sphereon:siopv2-oid4vp:op-auth";
@@ -623,26 +623,21 @@ function extractOriginalCredential(credential) {
623
623
  }
624
624
  __name(extractOriginalCredential, "extractOriginalCredential");
625
625
  function detectCredentialFormat(credential) {
626
- if (typeof credential === "string") {
627
- if (credential.includes("~")) {
628
- return "dc+sd-jwt";
629
- }
630
- const parts = credential.split(".");
631
- if (parts.length === 3) {
626
+ const documentFormat = CredentialMapper.detectDocumentType(credential);
627
+ switch (documentFormat) {
628
+ case DocumentFormat.JWT:
632
629
  return "jwt_vc_json";
633
- }
634
- } else if (typeof credential === "object") {
635
- if ("compactSdJwtVc" in credential) {
630
+ case DocumentFormat.SD_JWT_VC:
636
631
  return "dc+sd-jwt";
637
- }
638
- if ("@context" in credential || "proof" in credential) {
632
+ case DocumentFormat.JSONLD:
639
633
  return "ldp_vc";
640
- }
641
- if ("doctype" in credential || "namespaces" in credential) {
634
+ case DocumentFormat.MSO_MDOC:
642
635
  return "mso_mdoc";
643
- }
636
+ case DocumentFormat.EIP712:
637
+ return "ldp_vc";
638
+ default:
639
+ return "jwt_vc_json";
644
640
  }
645
- return "jwt_vc_json";
646
641
  }
647
642
  __name(detectCredentialFormat, "detectCredentialFormat");
648
643
  function getIdentifierString(identifier) {