@openeudi/openid4vp 0.11.0 → 0.11.1

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
@@ -693,6 +693,6 @@ declare class LotlTrustStore implements TrustStore {
693
693
  private refresh;
694
694
  }
695
695
 
696
- declare const VERSION = "0.11.0";
696
+ declare const VERSION = "0.11.1";
697
697
 
698
698
  export { type AuthorizationRequest, type AuthorizationRequestInput, type AuthorizationResponse, type Cache, CertificateChainError, type ChainErrorReason, CompositeTrustStore, type CredentialClaims, type CredentialFormat, DecryptionFailedError, type EncryptedResponse, ExpiredCredentialError, type Fetcher, HAIP_DOCTYPE_NAMESPACES, type HaipQueryInput, type HaipValidationCode, HaipValidationError, type ICredentialParser, InMemoryCache, InvalidSignatureError, type IssuerInfo, type LotlAnchorMetadata, LotlFetchError, LotlSignatureError, LotlTrustStore, type LotlTrustStoreOptions, MalformedCredentialError, MdocParser, MissingDecryptionKeyError, MissingVerifierEncryptionKeyError, MultipleCredentialsNotSupportedError, NonceValidationError, OpenID4VPError, type ParseOptions, type PresentationResult, RevocationCheckFailedError, RevokedCertificateError, SdJwtParser, type SignedAuthorizationRequest, type SignedAuthorizationRequestInput, SignedRequestBuildError, type SignedRequestBuildErrorCode, StaticTrustStore, type TrustAnchor, TrustAnchorNotFoundError, type TrustStore, type TrustStoreHint, type TrustStoreInput, UnsupportedFormatError, UnsupportedJweError, VERSION, type VerifyAuthorizationResponseOptions, type VerifyOptions, type VerifyResult, buildHaipQuery, buildOid4vpSessionTranscript, buildOpenID4VPHandoverSessionTranscript, createAuthorizationRequest, createSignedAuthorizationRequest, decryptAuthorizationResponse, isHaipQuery, parsePresentation, validateHaipQuery, verifyAuthorizationResponse, verifyPresentation };
package/dist/index.d.ts CHANGED
@@ -693,6 +693,6 @@ declare class LotlTrustStore implements TrustStore {
693
693
  private refresh;
694
694
  }
695
695
 
696
- declare const VERSION = "0.11.0";
696
+ declare const VERSION = "0.11.1";
697
697
 
698
698
  export { type AuthorizationRequest, type AuthorizationRequestInput, type AuthorizationResponse, type Cache, CertificateChainError, type ChainErrorReason, CompositeTrustStore, type CredentialClaims, type CredentialFormat, DecryptionFailedError, type EncryptedResponse, ExpiredCredentialError, type Fetcher, HAIP_DOCTYPE_NAMESPACES, type HaipQueryInput, type HaipValidationCode, HaipValidationError, type ICredentialParser, InMemoryCache, InvalidSignatureError, type IssuerInfo, type LotlAnchorMetadata, LotlFetchError, LotlSignatureError, LotlTrustStore, type LotlTrustStoreOptions, MalformedCredentialError, MdocParser, MissingDecryptionKeyError, MissingVerifierEncryptionKeyError, MultipleCredentialsNotSupportedError, NonceValidationError, OpenID4VPError, type ParseOptions, type PresentationResult, RevocationCheckFailedError, RevokedCertificateError, SdJwtParser, type SignedAuthorizationRequest, type SignedAuthorizationRequestInput, SignedRequestBuildError, type SignedRequestBuildErrorCode, StaticTrustStore, type TrustAnchor, TrustAnchorNotFoundError, type TrustStore, type TrustStoreHint, type TrustStoreInput, UnsupportedFormatError, UnsupportedJweError, VERSION, type VerifyAuthorizationResponseOptions, type VerifyOptions, type VerifyResult, buildHaipQuery, buildOid4vpSessionTranscript, buildOpenID4VPHandoverSessionTranscript, createAuthorizationRequest, createSignedAuthorizationRequest, decryptAuthorizationResponse, isHaipQuery, parsePresentation, validateHaipQuery, verifyAuthorizationResponse, verifyPresentation };
package/dist/index.js CHANGED
@@ -9680,7 +9680,8 @@ async function verifyPresentation(vpToken, query, options) {
9680
9680
  const parsed = await parsePresentation(vpToken, options);
9681
9681
  const dcqlFormat = INTERNAL_TO_DCQL_FORMAT[parsed.format] ?? parsed.format;
9682
9682
  const decodedClaims = parsed.format === "mdoc" && parsed.namespacedClaims !== void 0 ? parsed.namespacedClaims : parsed.claims;
9683
- const presentedCredentialQuery = query.credentials.find((c) => c.format === dcqlFormat) ?? query.credentials[0];
9683
+ const sameFormat = query.credentials.filter((c) => c.format === dcqlFormat);
9684
+ const presentedCredentialQuery = sameFormat.find((c) => matchesCredentialType(c, parsed)) ?? sameFormat[0] ?? query.credentials[0];
9684
9685
  const decoded = {
9685
9686
  id: presentedCredentialQuery?.id ?? "presented",
9686
9687
  format: dcqlFormat,
@@ -9704,6 +9705,17 @@ async function verifyPresentation(vpToken, query, options) {
9704
9705
  valid: parsed.valid && match.satisfied
9705
9706
  };
9706
9707
  }
9708
+ function matchesCredentialType(credentialQuery, parsed) {
9709
+ if (parsed.format === "sd-jwt-vc") {
9710
+ const vctValues = credentialQuery.meta?.vct_values;
9711
+ return typeof parsed.vct === "string" && Array.isArray(vctValues) && vctValues.includes(parsed.vct);
9712
+ }
9713
+ if (parsed.format === "mdoc") {
9714
+ const doctype = credentialQuery.meta?.doctype_value;
9715
+ return typeof parsed.docType === "string" && doctype === parsed.docType;
9716
+ }
9717
+ return false;
9718
+ }
9707
9719
  function isEncryptedResponse(x) {
9708
9720
  return typeof x === "object" && x !== null && "response" in x && typeof x.response === "string" && Object.keys(x).length === 1;
9709
9721
  }
@@ -10441,7 +10453,7 @@ function equalBytes(a, b) {
10441
10453
 
10442
10454
  // src/index.ts
10443
10455
  init_errors();
10444
- var VERSION = "0.11.0";
10456
+ var VERSION = "0.11.1";
10445
10457
  /*! Bundled license information:
10446
10458
 
10447
10459
  pvtsutils/build/index.es.js: