@pagopa/io-wallet-oid4vp 1.5.8 → 2.0.0-launchpad

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.mjs CHANGED
@@ -1,13 +1,13 @@
1
1
  // src/authorization-request/create-authorization-request.ts
2
2
  import {
3
3
  createJarRequest,
4
- jwtHeaderFromJwtSigner,
5
4
  signedAuthorizationRequestJwtHeaderTyp
6
5
  } from "@pagopa/io-wallet-oauth2";
7
6
  import {
8
7
  ItWalletSpecsVersion,
9
8
  ValidationError,
10
9
  createVersionDispatcher,
10
+ jwtHeaderFromJwtSigner,
11
11
  objectToQueryParams,
12
12
  parseWithErrorHandling
13
13
  } from "@pagopa/io-wallet-utils";
@@ -129,14 +129,14 @@ function getLeafCertificate(certificateChain) {
129
129
  }
130
130
 
131
131
  // src/authorization-request/z-authorization-request.ts
132
+ import { zSignedAuthorizationRequestJwtHeaderTyp } from "@pagopa/io-wallet-oauth2";
133
+ import { itWalletCredentialVerifierMetadataV1_3 } from "@pagopa/io-wallet-oid-federation";
132
134
  import {
133
135
  zAlgValueNotNone,
134
136
  zCertificateChain,
135
137
  zJwtPayload,
136
- zSignedAuthorizationRequestJwtHeaderTyp,
137
138
  zTrustChain
138
- } from "@pagopa/io-wallet-oauth2";
139
- import { itWalletCredentialVerifierMetadataV1_3 } from "@pagopa/io-wallet-oid-federation";
139
+ } from "@pagopa/io-wallet-utils";
140
140
  import { z } from "zod";
141
141
  var zOpenid4vpCredentialVerifierMetadata = itWalletCredentialVerifierMetadataV1_3.partial({
142
142
  application_type: true,
@@ -272,8 +272,8 @@ function validateJarSignerForAuthorizationRequest(specsVersion, jwtSigner, paylo
272
272
  }
273
273
 
274
274
  // src/authorization-request/fetch-authorization-request.ts
275
- import { Oauth2JwtParseError } from "@openid4vc/oauth2";
276
275
  import {
276
+ JwtParseError,
277
277
  UnexpectedStatusCodeError,
278
278
  ValidationError as ValidationError2,
279
279
  createFetcher,
@@ -474,7 +474,7 @@ async function fetchAuthorizationRequest(options) {
474
474
  sendBy: parsedQrCode.request ? "value" : "reference"
475
475
  };
476
476
  } catch (error) {
477
- if (error instanceof ValidationError2 || error instanceof Oauth2JwtParseError || error instanceof Oid4vpError || error instanceof UnexpectedStatusCodeError) {
477
+ if (error instanceof ValidationError2 || error instanceof JwtParseError || error instanceof Oid4vpError || error instanceof UnexpectedStatusCodeError) {
478
478
  throw error;
479
479
  }
480
480
  throw new Oid4vpError(
@@ -484,16 +484,14 @@ async function fetchAuthorizationRequest(options) {
484
484
  }
485
485
 
486
486
  // src/authorization-request/parse-authorization-request.ts
487
- import {
488
- Oauth2JwtParseError as Oauth2JwtParseError2,
489
- verifyJwt
490
- } from "@openid4vc/oauth2";
491
- import { decodeJwt } from "@pagopa/io-wallet-oauth2";
492
487
  import {
493
488
  ItWalletSpecsVersion as ItWalletSpecsVersion2,
494
489
  ItWalletSpecsVersionError,
490
+ JwtParseError as JwtParseError2,
495
491
  ValidationError as ValidationError3,
496
- dispatchByVersion
492
+ decodeJwt,
493
+ dispatchByVersion,
494
+ verifyJwt
497
495
  } from "@pagopa/io-wallet-utils";
498
496
  function getPublicKeyForVerification(options) {
499
497
  const { header, payload } = options;
@@ -587,7 +585,7 @@ async function parseAuthorizeRequest(options) {
587
585
  }
588
586
  };
589
587
  } catch (error) {
590
- if (error instanceof ItWalletSpecsVersionError || error instanceof ValidationError3 || error instanceof Oauth2JwtParseError2 || error instanceof Oid4vpError)
588
+ if (error instanceof ItWalletSpecsVersionError || error instanceof ValidationError3 || error instanceof JwtParseError2 || error instanceof Oid4vpError)
591
589
  throw error;
592
590
  throw new ParseAuthorizeRequestError(
593
591
  `Unexpected error during Request Object parsing: ${error instanceof Error ? error.message : String(error)}`
@@ -602,7 +600,9 @@ import {
602
600
  } from "@pagopa/io-wallet-utils";
603
601
 
604
602
  // src/authorization-response/build-jarm-response.ts
605
- import { encodeToBase64Url as encodeToBase64Url2 } from "@pagopa/io-wallet-utils";
603
+ import {
604
+ encodeToBase64Url as encodeToBase64Url2
605
+ } from "@pagopa/io-wallet-utils";
606
606
 
607
607
  // src/jarm/jarm-extract-jwks.ts
608
608
  function extractEncryptionJwkFromJwks(jwks, {
@@ -756,15 +756,235 @@ async function createAuthorizationResponse3(options) {
756
756
  return dispatchCreateAuthorizationResponse(options);
757
757
  }
758
758
 
759
+ // src/authorization-response/create-openid4vp-authorization-response.ts
760
+ import { Oauth2Error } from "@pagopa/io-wallet-oauth2";
761
+ import {
762
+ ContentType,
763
+ UnexpectedStatusCodeError as UnexpectedStatusCodeError2,
764
+ addSecondsToDate,
765
+ dateToSeconds,
766
+ encodeToBase64Url as encodeToBase64Url3,
767
+ hasStatusOrThrow as hasStatusOrThrow2,
768
+ jwtHeaderFromJwtSigner as jwtHeaderFromJwtSigner2,
769
+ parseWithErrorHandling as parseWithErrorHandling2,
770
+ zJwkSet
771
+ } from "@pagopa/io-wallet-utils";
772
+ var jarmResponseModes = /* @__PURE__ */ new Set([
773
+ "jwt",
774
+ "query.jwt",
775
+ "fragment.jwt",
776
+ "form_post.jwt",
777
+ "direct_post.jwt",
778
+ "dc_api.jwt"
779
+ ]);
780
+ function assertValueSupported(options) {
781
+ const { actual, errorMessage, supported } = options;
782
+ const found = supported.find((value) => value === actual);
783
+ if (!found) {
784
+ throw new Oauth2Error(errorMessage);
785
+ }
786
+ return found;
787
+ }
788
+ function assertClientJarmMetadataSupported(clientMetadata, serverMetadata) {
789
+ const {
790
+ authorization_encrypted_response_alg: encryptedAlg,
791
+ authorization_encrypted_response_enc: encryptedEnc,
792
+ authorization_signed_response_alg: signedAlg
793
+ } = clientMetadata;
794
+ if (encryptedAlg) {
795
+ assertValueSupported({
796
+ actual: encryptedAlg,
797
+ errorMessage: `Invalid authorization_encrypted_response_alg ${encryptedAlg}`,
798
+ supported: serverMetadata.authorization_encryption_alg_values_supported
799
+ });
800
+ }
801
+ if (encryptedEnc) {
802
+ assertValueSupported({
803
+ actual: encryptedEnc,
804
+ errorMessage: `Invalid authorization_encrypted_response_enc ${encryptedEnc}`,
805
+ supported: serverMetadata.authorization_encryption_enc_values_supported
806
+ });
807
+ }
808
+ if (signedAlg && serverMetadata.authorization_signed_response_alg_values_supported) {
809
+ assertValueSupported({
810
+ actual: signedAlg,
811
+ errorMessage: `Invalid authorization_signed_response_alg ${signedAlg}`,
812
+ supported: serverMetadata.authorization_signed_response_alg_values_supported
813
+ });
814
+ }
815
+ }
816
+ async function fetchJwks(jwksUrl, fetchCallback) {
817
+ if (!fetchCallback) {
818
+ throw new Oauth2Error(
819
+ `Missing fetch callback required to resolve jwks_uri '${jwksUrl}'.`
820
+ );
821
+ }
822
+ const response = await fetchCallback(jwksUrl, {
823
+ headers: {
824
+ Accept: `${ContentType.JwkSet}, ${ContentType.Json};q=0.9`
825
+ }
826
+ });
827
+ await hasStatusOrThrow2(200, UnexpectedStatusCodeError2)(response);
828
+ return parseWithErrorHandling2(
829
+ zJwkSet,
830
+ await response.json(),
831
+ `Validation of JWKs from jwks_uri '${jwksUrl}' failed`
832
+ );
833
+ }
834
+ async function createJarmAuthorizationResponse(options) {
835
+ const { callbacks, jarmAuthorizationResponse, jweEncryptor, jwtSigner } = options;
836
+ if (!jwtSigner && jweEncryptor) {
837
+ const { encryptionJwk: encryptionJwk2, jwe: jwe2 } = await callbacks.encryptJwe(
838
+ jweEncryptor,
839
+ JSON.stringify(jarmAuthorizationResponse)
840
+ );
841
+ return {
842
+ encryptionJwk: encryptionJwk2,
843
+ jarmAuthorizationResponseJwt: jwe2
844
+ };
845
+ }
846
+ if (jwtSigner && !jweEncryptor) {
847
+ const { jwt } = await callbacks.signJwt(jwtSigner, {
848
+ header: jwtHeaderFromJwtSigner2(jwtSigner),
849
+ payload: jarmAuthorizationResponse
850
+ });
851
+ return {
852
+ jarmAuthorizationResponseJwt: jwt
853
+ };
854
+ }
855
+ if (!jwtSigner || !jweEncryptor) {
856
+ throw new Oauth2Error(
857
+ "JWT signer and/or encryptor are required to create a JARM auth response."
858
+ );
859
+ }
860
+ const signed = await callbacks.signJwt(jwtSigner, {
861
+ header: jwtHeaderFromJwtSigner2(jwtSigner),
862
+ payload: jarmAuthorizationResponse
863
+ });
864
+ const { encryptionJwk, jwe } = await callbacks.encryptJwe(
865
+ jweEncryptor,
866
+ signed.jwt
867
+ );
868
+ return {
869
+ encryptionJwk,
870
+ jarmAuthorizationResponseJwt: jwe
871
+ };
872
+ }
873
+ async function createOpenid4vpAuthorizationResponse(options) {
874
+ const { authorizationRequestPayload, jarm } = options;
875
+ const authorizationResponsePayload = {
876
+ ...options.authorizationResponsePayload,
877
+ state: authorizationRequestPayload.state
878
+ };
879
+ const { prefix: clientIdPrefix } = extractClientIdPrefix(
880
+ authorizationRequestPayload.client_id
881
+ );
882
+ if (authorizationRequestPayload.response_mode && jarmResponseModes.has(authorizationRequestPayload.response_mode) && !jarm) {
883
+ throw new Oauth2Error(
884
+ `Missing jarm options for creating Jarm response with response mode '${authorizationRequestPayload.response_mode}'`
885
+ );
886
+ }
887
+ if (!jarm) {
888
+ return { authorizationResponsePayload };
889
+ }
890
+ if ((clientIdPrefix === "openid_federation" /* OPENID_FEDERATION */ || clientIdPrefix === "none" /* NONE */) && !options.clientMetadata) {
891
+ throw new Oauth2Error(
892
+ "When OpenID Federation is used as the client id prefix (https/openid_federation), passing externally fetched and verified 'clientMetadata' to 'createOpenid4vpAuthorizationResponse' is required."
893
+ );
894
+ }
895
+ const clientMetadata = options.clientMetadata ?? authorizationRequestPayload.client_metadata;
896
+ if (!clientMetadata) {
897
+ throw new Oauth2Error(
898
+ "Missing client metadata in the request params to assert Jarm metadata support."
899
+ );
900
+ }
901
+ const jwks = clientMetadata.jwks ? clientMetadata.jwks : clientMetadata.jwks_uri ? await fetchJwks(clientMetadata.jwks_uri, options.callbacks.fetch) : void 0;
902
+ if (!jwks) {
903
+ throw new Oauth2Error(
904
+ "Missing 'jwks' or 'jwks_uri' in client metadata. Cannot extract encryption JWK."
905
+ );
906
+ }
907
+ assertClientJarmMetadataSupported(clientMetadata, jarm.serverMetadata);
908
+ const encryptionJwk = jarm.encryption?.jwk ?? extractEncryptionJwkFromJwks(jwks, {
909
+ supportedAlgValues: jarm.serverMetadata.authorization_encryption_alg_values_supported ?? (clientMetadata.authorization_encrypted_response_alg ? [clientMetadata.authorization_encrypted_response_alg] : void 0)
910
+ });
911
+ if (!encryptionJwk) {
912
+ throw new Oauth2Error(
913
+ "No encryption JWK provided and could not extract encryption JWK from client metadata. Failed to create JARM response."
914
+ );
915
+ }
916
+ const enc = clientMetadata.encrypted_response_enc_values_supported ? jarm.serverMetadata.authorization_encryption_enc_values_supported.find(
917
+ (value) => clientMetadata.encrypted_response_enc_values_supported?.includes(
918
+ value
919
+ )
920
+ ) ?? clientMetadata.encrypted_response_enc_values_supported[0] ?? "A128GCM" : clientMetadata.authorization_encrypted_response_enc ?? "A128GCM";
921
+ assertValueSupported({
922
+ actual: enc,
923
+ errorMessage: `Invalid 'enc' value ${enc}. Supported values are ${jarm.serverMetadata.authorization_encryption_enc_values_supported.join(", ")}`,
924
+ supported: jarm.serverMetadata.authorization_encryption_enc_values_supported
925
+ });
926
+ const alg = encryptionJwk.alg ?? clientMetadata.authorization_encrypted_response_alg ?? "ECDH-ES";
927
+ assertValueSupported({
928
+ actual: alg,
929
+ errorMessage: `Invalid 'alg' value ${alg}. Supported values are ${jarm.serverMetadata.authorization_encryption_alg_values_supported.join(", ")}`,
930
+ supported: jarm.serverMetadata.authorization_encryption_alg_values_supported
931
+ });
932
+ if (clientMetadata.authorization_signed_response_alg && jarm.jwtSigner && clientMetadata.authorization_signed_response_alg !== jarm.jwtSigner.alg) {
933
+ throw new Oauth2Error(
934
+ `Invalid signed response alg value ${jarm.jwtSigner.alg}. Expected ${clientMetadata.authorization_signed_response_alg}.`
935
+ );
936
+ }
937
+ const additionalJwtPayload = jarm.jwtSigner ? {
938
+ aud: jarm.audience ?? (() => {
939
+ throw new Oauth2Error(
940
+ "Missing required aud in JARM configuration for creating OpenID4VP authorization response."
941
+ );
942
+ })(),
943
+ exp: jarm.expiresInSeconds ? dateToSeconds(addSecondsToDate(/* @__PURE__ */ new Date(), jarm.expiresInSeconds)) : dateToSeconds(addSecondsToDate(/* @__PURE__ */ new Date(), 600)),
944
+ iss: jarm.authorizationServer ?? (() => {
945
+ throw new Oauth2Error(
946
+ "Missing required iss in JARM configuration for creating OpenID4VP authorization response."
947
+ );
948
+ })()
949
+ } : void 0;
950
+ const jarmResponsePayload = {
951
+ ...authorizationResponsePayload,
952
+ ...additionalJwtPayload
953
+ };
954
+ const { encryptionJwk: usedEncryptionJwk, jarmAuthorizationResponseJwt } = await createJarmAuthorizationResponse({
955
+ callbacks: {
956
+ encryptJwe: options.callbacks.encryptJwe,
957
+ signJwt: options.callbacks.signJwt
958
+ },
959
+ jarmAuthorizationResponse: jarmResponsePayload,
960
+ jweEncryptor: jarm.encryption ? {
961
+ alg,
962
+ apu: jarm.encryption.nonce ? encodeToBase64Url3(jarm.encryption.nonce) : void 0,
963
+ apv: encodeToBase64Url3(authorizationRequestPayload.nonce),
964
+ enc,
965
+ method: "jwk",
966
+ publicJwk: encryptionJwk
967
+ } : void 0,
968
+ jwtSigner: jarm.jwtSigner
969
+ });
970
+ return {
971
+ authorizationResponsePayload: jarmResponsePayload,
972
+ jarm: {
973
+ encryptionJwk: usedEncryptionJwk,
974
+ responseJwt: jarmAuthorizationResponseJwt
975
+ }
976
+ };
977
+ }
978
+
759
979
  // src/authorization-response/fetch-authorization-response.ts
760
980
  import {
761
981
  CONTENT_TYPES,
762
982
  HEADERS,
763
- UnexpectedStatusCodeError as UnexpectedStatusCodeError2,
983
+ UnexpectedStatusCodeError as UnexpectedStatusCodeError3,
764
984
  ValidationError as ValidationError4,
765
985
  createFetcher as createFetcher2,
766
- hasStatusOrThrow as hasStatusOrThrow2,
767
- parseWithErrorHandling as parseWithErrorHandling2
986
+ hasStatusOrThrow as hasStatusOrThrow3,
987
+ parseWithErrorHandling as parseWithErrorHandling3
768
988
  } from "@pagopa/io-wallet-utils";
769
989
 
770
990
  // src/authorization-response/z-authorization-response.ts
@@ -814,12 +1034,12 @@ async function fetchAuthorizationResponse(options) {
814
1034
  method: "POST"
815
1035
  }
816
1036
  );
817
- await hasStatusOrThrow2(
1037
+ await hasStatusOrThrow3(
818
1038
  200,
819
- UnexpectedStatusCodeError2
1039
+ UnexpectedStatusCodeError3
820
1040
  )(authorizationResponseResult);
821
1041
  const authorizationResponseResultJson = await authorizationResponseResult.json();
822
- const parsedAuthorizationResponseResult = parseWithErrorHandling2(
1042
+ const parsedAuthorizationResponseResult = parseWithErrorHandling3(
823
1043
  zOpenid4vpAuthorizationResponseResult,
824
1044
  authorizationResponseResultJson
825
1045
  );
@@ -837,7 +1057,7 @@ async function fetchAuthorizationResponse(options) {
837
1057
  }
838
1058
  return parsedAuthorizationResponseResult;
839
1059
  } catch (error) {
840
- if (error instanceof UnexpectedStatusCodeError2 || error instanceof ValidationError4 || error instanceof FetchAuthorizationResponseError) {
1060
+ if (error instanceof UnexpectedStatusCodeError3 || error instanceof ValidationError4 || error instanceof FetchAuthorizationResponseError) {
841
1061
  throw error;
842
1062
  }
843
1063
  throw new FetchAuthorizationResponseError(
@@ -847,21 +1067,23 @@ async function fetchAuthorizationResponse(options) {
847
1067
  }
848
1068
 
849
1069
  // src/authorization-response/parse-authorization-response.ts
850
- import { parseWithErrorHandling as parseWithErrorHandling5 } from "@pagopa/io-wallet-utils";
1070
+ import {
1071
+ parseWithErrorHandling as parseWithErrorHandling6
1072
+ } from "@pagopa/io-wallet-utils";
851
1073
 
852
1074
  // src/jarm/parse-jarm-authorization-response.ts
853
1075
  import {
854
1076
  decodeJwtHeader as decodeJwtHeader2,
1077
+ parseWithErrorHandling as parseWithErrorHandling5,
855
1078
  zCompactJwe as zCompactJwe2,
856
1079
  zCompactJwt as zCompactJwt2
857
- } from "@pagopa/io-wallet-oauth2";
858
- import { parseWithErrorHandling as parseWithErrorHandling4 } from "@pagopa/io-wallet-utils";
1080
+ } from "@pagopa/io-wallet-utils";
859
1081
  import z7 from "zod";
860
1082
 
861
1083
  // src/vp-token/parse-vp-token.ts
862
- import { parseIfJson, parseWithErrorHandling as parseWithErrorHandling3 } from "@pagopa/io-wallet-utils";
1084
+ import { parseIfJson, parseWithErrorHandling as parseWithErrorHandling4 } from "@pagopa/io-wallet-utils";
863
1085
  function parseVpToken(vpToken) {
864
- return parseWithErrorHandling3(
1086
+ return parseWithErrorHandling4(
865
1087
  zVpToken,
866
1088
  parseIfJson(vpToken),
867
1089
  "Could not parse dcql vp_token. Expected an object where the values are encoded presentations"
@@ -882,20 +1104,20 @@ function validateOpenid4vpAuthorizationResponsePayload(options) {
882
1104
  }
883
1105
 
884
1106
  // src/jarm/verify-jarm-authorization-response.ts
885
- import { jwtSignerFromJwt } from "@openid4vc/oauth2";
1107
+ import { Oauth2Error as Oauth2Error2 } from "@pagopa/io-wallet-oauth2";
886
1108
  import {
887
- Oauth2Error,
888
1109
  decodeJwt as decodeJwt2,
889
1110
  decodeJwtHeader,
1111
+ jwtSignerFromJwt,
1112
+ stringToJsonWithErrorHandling,
890
1113
  zCompactJwe,
891
1114
  zCompactJwt,
892
1115
  zJwtHeader as zJwtHeader2
893
- } from "@pagopa/io-wallet-oauth2";
894
- import { stringToJsonWithErrorHandling } from "@pagopa/io-wallet-utils";
1116
+ } from "@pagopa/io-wallet-utils";
895
1117
  import z6 from "zod";
896
1118
 
897
1119
  // src/jarm/z-jarm.ts
898
- import { zJwtHeader, zJwtPayload as zJwtPayload2 } from "@pagopa/io-wallet-oauth2";
1120
+ import { zJwtHeader, zJwtPayload as zJwtPayload2 } from "@pagopa/io-wallet-utils";
899
1121
  import { z as z5 } from "zod";
900
1122
  var zJarmHeader = z5.object({
901
1123
  ...zJwtHeader.shape,
@@ -951,7 +1173,7 @@ var decryptJarmAuthorizationResponseJwt = async (options) => {
951
1173
  jwk: encryptionJwk
952
1174
  });
953
1175
  if (!result.decrypted) {
954
- throw new Oauth2Error("Failed to decrypt jarm auth response.");
1176
+ throw new Oauth2Error2("Failed to decrypt jarm auth response.");
955
1177
  }
956
1178
  return {
957
1179
  decryptionJwk: result.decryptionJwk,
@@ -976,7 +1198,7 @@ async function verifyJarmAuthorizationResponse(options) {
976
1198
  decryptedRequestData.payload
977
1199
  ).success;
978
1200
  if (!requestDataIsEncrypted && !responseIsSigned) {
979
- throw new Oauth2Error(
1201
+ throw new Oauth2Error2(
980
1202
  "Jarm Auth Response must be either encrypted, signed, or signed and encrypted."
981
1203
  );
982
1204
  }
@@ -998,27 +1220,27 @@ async function verifyJarmAuthorizationResponse(options) {
998
1220
  payload: jwsPayload
999
1221
  });
1000
1222
  if (!verificationResult.verified) {
1001
- throw new Oauth2Error("Jarm Auth Response is not valid.");
1223
+ throw new Oauth2Error2("Jarm Auth Response is not valid.");
1002
1224
  }
1003
1225
  const expectedAudience = authorizationRequestPayload.client_id;
1004
1226
  const expectedIssuer = authorizationRequestPayload.iss;
1005
1227
  if (response.aud !== expectedAudience) {
1006
- throw new Oauth2Error(
1228
+ throw new Oauth2Error2(
1007
1229
  `Jarm Auth Response contains 'aud' value '${response.aud}', but expected '${expectedAudience}'.`
1008
1230
  );
1009
1231
  }
1010
1232
  if (expectedIssuer && response.iss !== expectedIssuer) {
1011
- throw new Oauth2Error(
1233
+ throw new Oauth2Error2(
1012
1234
  `Jarm Auth Response contains 'iss' value '${response.iss}', but expected '${expectedIssuer}'.`
1013
1235
  );
1014
1236
  }
1015
1237
  const now = options.now ?? /* @__PURE__ */ new Date();
1016
1238
  const nowSeconds = Math.floor(now.getTime() / 1e3);
1017
1239
  if (response.exp < nowSeconds) {
1018
- throw new Oauth2Error("Jarm Auth Response has expired.");
1240
+ throw new Oauth2Error2("Jarm Auth Response has expired.");
1019
1241
  }
1020
1242
  if (response.nbf !== void 0 && response.nbf > nowSeconds) {
1021
- throw new Oauth2Error("Jarm Auth Response is not active yet.");
1243
+ throw new Oauth2Error2("Jarm Auth Response is not active yet.");
1022
1244
  }
1023
1245
  jarmAuthorizationResponse = response;
1024
1246
  } else {
@@ -1041,7 +1263,7 @@ async function verifyJarmAuthorizationResponse(options) {
1041
1263
  // src/jarm/parse-jarm-authorization-response.ts
1042
1264
  async function parseJarmAuthorizationResponse(options) {
1043
1265
  const { authorizationRequestPayload, callbacks, jarmResponseJwt, now } = options;
1044
- const jarmAuthorizationResponseJwt = parseWithErrorHandling4(
1266
+ const jarmAuthorizationResponseJwt = parseWithErrorHandling5(
1045
1267
  z7.union([zCompactJwt2, zCompactJwe2]),
1046
1268
  jarmResponseJwt,
1047
1269
  "Invalid jarm authorization response jwt."
@@ -1056,7 +1278,7 @@ async function parseJarmAuthorizationResponse(options) {
1056
1278
  headerSchema: zJarmHeader,
1057
1279
  jwt: jarmAuthorizationResponseJwt
1058
1280
  });
1059
- const authorizationResponsePayload = parseWithErrorHandling4(
1281
+ const authorizationResponsePayload = parseWithErrorHandling5(
1060
1282
  zOpenid4vpAuthorizationResponse,
1061
1283
  verifiedJarmResponse.jarmAuthorizationResponse,
1062
1284
  "Failed to parse openid4vp authorization response."
@@ -1088,7 +1310,7 @@ async function parseAuthorizationResponse(options) {
1088
1310
  jarmResponseJwt: authorizationResponse.response
1089
1311
  });
1090
1312
  }
1091
- const authorizationResponsePayload = parseWithErrorHandling5(
1313
+ const authorizationResponsePayload = parseWithErrorHandling6(
1092
1314
  zOpenid4vpAuthorizationResponse,
1093
1315
  authorizationResponse,
1094
1316
  "Failed to parse openid4vp authorization response."
@@ -1103,11 +1325,6 @@ async function parseAuthorizationResponse(options) {
1103
1325
  expectedNonce: authorizationRequestPayload.nonce
1104
1326
  };
1105
1327
  }
1106
-
1107
- // src/index.ts
1108
- import {
1109
- createOpenid4vpAuthorizationResponse
1110
- } from "@openid4vc/openid4vp";
1111
1328
  export {
1112
1329
  ClientIdPrefix,
1113
1330
  CreateAuthorizationResponseError,