@sphereon/ssi-sdk.oid4vci-holder 0.34.1-feature.SSISDK.13.39 → 0.34.1-feature.SSISDK.13.50

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.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { AuthorizationChallengeCodeResponse, EndpointMetadataResult, CredentialOfferRequestWithBaseUrl, AuthzFlowType, AuthorizationRequestOpts, AuthorizationServerClientOpts, CredentialConfigurationSupported, ExperimentalSubjectIssuance, CredentialResponse, AuthorizationResponse, CredentialsSupportedDisplay, IssuerCredentialSubject, MetadataDisplay, NotificationRequest, Jwt } from '@sphereon/oid4vci-common';
1
+ import { AuthorizationChallengeCodeResponse, EndpointMetadataResult, CredentialOfferRequestWithBaseUrl, AuthzFlowType, AuthorizationRequestOpts, AuthorizationServerClientOpts, CredentialConfigurationSupported, ExperimentalSubjectIssuance, CredentialResponseV1_0_15, CredentialResponse, AuthorizationResponse, CredentialsSupportedDisplay, IssuerCredentialSubject, MetadataDisplay, NotificationRequest, Jwt } from '@sphereon/oid4vci-common';
2
2
  import { IIdentifierResolution, ManagedIdentifierMethod, ManagedIdentifierOptsOrResult, ManagedIdentifierResult } from '@sphereon/ssi-sdk-ext.identifier-resolution';
3
3
  import { IJwtService } from '@sphereon/ssi-sdk-ext.jwt-service';
4
4
  import { IIdentifier, IPluginMethodMap, IAgentContext, ICredentialVerifier, ICredentialIssuer, IDIDManager, IResolver, IKeyManager, TKeyType, VerificationPolicies, TAgent, IAgentPlugin } from '@veramo/core';
@@ -356,6 +356,7 @@ declare enum OID4VCIMachineGuards {
356
356
  requirePinGuard = "oid4vciRequirePinGuard",
357
357
  requireAuthorizationGuard = "oid4vciRequireAuthorizationGuard",
358
358
  noAuthorizationGuard = "oid4vciNoAuthorizationGuard",
359
+ hasNonceEndpointGuard = "oid4vciHasNonceEndpointGuard ",
359
360
  hasAuthorizationResponse = "oid4vciHasAuthorizationResponse",
360
361
  hasNoContactIdentityGuard = "oid4vciHasNoContactIdentityGuard",
361
362
  verificationCodeGuard = "oid4vciVerificationCodeGuard",
@@ -482,7 +483,7 @@ type CredentialToAccept = {
482
483
  id?: string;
483
484
  types: string[];
484
485
  issuanceOpt: IssuanceOpts;
485
- credentialResponse: CredentialResponse;
486
+ credentialResponse: CredentialResponseV1_0_15 | CredentialResponse;
486
487
  };
487
488
  type GetCredentialConfigsSupportedArgs = {
488
489
  client: OpenID4VCIClient;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { AuthorizationChallengeCodeResponse, EndpointMetadataResult, CredentialOfferRequestWithBaseUrl, AuthzFlowType, AuthorizationRequestOpts, AuthorizationServerClientOpts, CredentialConfigurationSupported, ExperimentalSubjectIssuance, CredentialResponse, AuthorizationResponse, CredentialsSupportedDisplay, IssuerCredentialSubject, MetadataDisplay, NotificationRequest, Jwt } from '@sphereon/oid4vci-common';
1
+ import { AuthorizationChallengeCodeResponse, EndpointMetadataResult, CredentialOfferRequestWithBaseUrl, AuthzFlowType, AuthorizationRequestOpts, AuthorizationServerClientOpts, CredentialConfigurationSupported, ExperimentalSubjectIssuance, CredentialResponseV1_0_15, CredentialResponse, AuthorizationResponse, CredentialsSupportedDisplay, IssuerCredentialSubject, MetadataDisplay, NotificationRequest, Jwt } from '@sphereon/oid4vci-common';
2
2
  import { IIdentifierResolution, ManagedIdentifierMethod, ManagedIdentifierOptsOrResult, ManagedIdentifierResult } from '@sphereon/ssi-sdk-ext.identifier-resolution';
3
3
  import { IJwtService } from '@sphereon/ssi-sdk-ext.jwt-service';
4
4
  import { IIdentifier, IPluginMethodMap, IAgentContext, ICredentialVerifier, ICredentialIssuer, IDIDManager, IResolver, IKeyManager, TKeyType, VerificationPolicies, TAgent, IAgentPlugin } from '@veramo/core';
@@ -356,6 +356,7 @@ declare enum OID4VCIMachineGuards {
356
356
  requirePinGuard = "oid4vciRequirePinGuard",
357
357
  requireAuthorizationGuard = "oid4vciRequireAuthorizationGuard",
358
358
  noAuthorizationGuard = "oid4vciNoAuthorizationGuard",
359
+ hasNonceEndpointGuard = "oid4vciHasNonceEndpointGuard ",
359
360
  hasAuthorizationResponse = "oid4vciHasAuthorizationResponse",
360
361
  hasNoContactIdentityGuard = "oid4vciHasNoContactIdentityGuard",
361
362
  verificationCodeGuard = "oid4vciVerificationCodeGuard",
@@ -482,7 +483,7 @@ type CredentialToAccept = {
482
483
  id?: string;
483
484
  types: string[];
484
485
  issuanceOpt: IssuanceOpts;
485
- credentialResponse: CredentialResponse;
486
+ credentialResponse: CredentialResponseV1_0_15 | CredentialResponse;
486
487
  };
487
488
  type GetCredentialConfigsSupportedArgs = {
488
489
  client: OpenID4VCIClient;
package/dist/index.js CHANGED
@@ -149,6 +149,7 @@ var OID4VCIMachineGuards = /* @__PURE__ */ function(OID4VCIMachineGuards2) {
149
149
  OID4VCIMachineGuards2["requirePinGuard"] = "oid4vciRequirePinGuard";
150
150
  OID4VCIMachineGuards2["requireAuthorizationGuard"] = "oid4vciRequireAuthorizationGuard";
151
151
  OID4VCIMachineGuards2["noAuthorizationGuard"] = "oid4vciNoAuthorizationGuard";
152
+ OID4VCIMachineGuards2["hasNonceEndpointGuard"] = "oid4vciHasNonceEndpointGuard ";
152
153
  OID4VCIMachineGuards2["hasAuthorizationResponse"] = "oid4vciHasAuthorizationResponse";
153
154
  OID4VCIMachineGuards2["hasNoContactIdentityGuard"] = "oid4vciHasNoContactIdentityGuard";
154
155
  OID4VCIMachineGuards2["verificationCodeGuard"] = "oid4vciVerificationCodeGuard";
@@ -1538,7 +1539,7 @@ var getCredentialBranding = /* @__PURE__ */ __name(async (args) => {
1538
1539
  const credentialBranding = {};
1539
1540
  await Promise.all(Object.entries(credentialsSupported).map(async ([configId, credentialsConfigSupported]) => {
1540
1541
  let sdJwtTypeMetadata;
1541
- if (credentialsConfigSupported.format === "vc+sd-jwt") {
1542
+ if (credentialsConfigSupported.format === "dc+sd-jwt") {
1542
1543
  const vct = credentialsConfigSupported.vct;
1543
1544
  if (vct.startsWith("http")) {
1544
1545
  try {
@@ -1604,7 +1605,13 @@ var selectCredentialLocaleBranding = /* @__PURE__ */ __name(async (args) => {
1604
1605
  }, "selectCredentialLocaleBranding");
1605
1606
  var verifyCredentialToAccept = /* @__PURE__ */ __name(async (args) => {
1606
1607
  const { mappedCredential, hasher, onVerifyEBSICredentialIssuer, schemaValidation, context } = args;
1607
- const credential = mappedCredential.credentialToAccept.credentialResponse.credential;
1608
+ const credentialResponse = mappedCredential.credentialToAccept.credentialResponse;
1609
+ let credential;
1610
+ if ("credential" in credentialResponse) {
1611
+ credential = credentialResponse.credential;
1612
+ } else if ("credentials" in credentialResponse && credentialResponse.credentials && Array.isArray(credentialResponse.credentials) && credentialResponse.credentials.length > 0) {
1613
+ credential = credentialResponse.credentials[0].credential;
1614
+ }
1608
1615
  if (!credential) {
1609
1616
  return Promise.reject(Error("No credential found in credential response"));
1610
1617
  }
@@ -1660,7 +1667,12 @@ var verifyCredentialToAccept = /* @__PURE__ */ __name(async (args) => {
1660
1667
  var mapCredentialToAccept = /* @__PURE__ */ __name(async (args) => {
1661
1668
  const { credentialToAccept, hasher } = args;
1662
1669
  const credentialResponse = credentialToAccept.credentialResponse;
1663
- const verifiableCredential = credentialResponse.credential;
1670
+ let verifiableCredential;
1671
+ if ("credential" in credentialResponse) {
1672
+ verifiableCredential = credentialResponse.credential;
1673
+ } else if ("credentials" in credentialResponse && credentialResponse.credentials && Array.isArray(credentialResponse.credentials) && credentialResponse.credentials.length > 0) {
1674
+ verifiableCredential = credentialResponse.credentials[0].credential;
1675
+ }
1664
1676
  if (!verifiableCredential) {
1665
1677
  return Promise.reject(Error("No credential found in credential response"));
1666
1678
  }
@@ -1994,7 +2006,7 @@ var getIssuanceCryptoSuite = /* @__PURE__ */ __name(async (opts) => {
1994
2006
  case "jwt":
1995
2007
  case "jwt_vc_json":
1996
2008
  case "jwt_vc":
1997
- case "vc+sd-jwt":
2009
+ case "dc+sd-jwt":
1998
2010
  case "mso_mdoc": {
1999
2011
  const supportedPreferences = jwtCryptographicSuitePreferences.filter((suite) => signing_algs_supported.includes(suite));
2000
2012
  if (supportedPreferences.length > 0) {
@@ -2132,7 +2144,7 @@ var OID4VCIHolder = class _OID4VCIHolder {
2132
2144
  oid4vciHolderStoreIssuerBranding: this.oid4vciHolderStoreIssuerBranding.bind(this)
2133
2145
  };
2134
2146
  vcFormatPreferences = [
2135
- "vc+sd-jwt",
2147
+ "dc+sd-jwt",
2136
2148
  "mso_mdoc",
2137
2149
  "jwt_vc_json",
2138
2150
  "jwt_vc",
@@ -2718,7 +2730,16 @@ var OID4VCIHolder = class _OID4VCIHolder {
2718
2730
  if (Array.isArray(subjectIssuance?.notification_events_supported)) {
2719
2731
  event = subjectIssuance.notification_events_supported.includes("credential_accepted_holder_signed") ? "credential_accepted_holder_signed" : "credential_deleted_holder_signed";
2720
2732
  logger.log(`Subject issuance/signing will be used, with event`, event);
2721
- const issuerVC = mappedCredentialToAccept.credentialToAccept.credentialResponse.credential;
2733
+ const credentialResponse = mappedCredentialToAccept.credentialToAccept.credentialResponse;
2734
+ let issuerVC;
2735
+ if ("credential" in credentialResponse) {
2736
+ issuerVC = credentialResponse.credential;
2737
+ } else if ("credentials" in credentialResponse && credentialResponse.credentials && Array.isArray(credentialResponse.credentials) && credentialResponse.credentials.length > 0) {
2738
+ issuerVC = credentialResponse.credentials[0].credential;
2739
+ }
2740
+ if (!issuerVC) {
2741
+ return Promise.reject(Error("No credential found in credential response"));
2742
+ }
2722
2743
  const wrappedIssuerVC = CredentialMapper2.toWrappedVerifiableCredential(issuerVC, {
2723
2744
  hasher: this.hasher ?? defaultHasher2
2724
2745
  });