@pagopa/io-wallet-oid4vci 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.d.mts +14890 -751
- package/dist/index.d.ts +14890 -751
- package/dist/index.js +170 -177
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +31 -32
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -8
package/dist/index.mjs
CHANGED
|
@@ -100,7 +100,7 @@ var CredentialAuthorizationHeaderError = class extends Oid4vciError {
|
|
|
100
100
|
import {
|
|
101
101
|
jwtSignerFromJwt,
|
|
102
102
|
verifyJwt
|
|
103
|
-
} from "@
|
|
103
|
+
} from "@pagopa/io-wallet-utils";
|
|
104
104
|
async function verifyAuthorizationResponse(options) {
|
|
105
105
|
if (options.authorizationResponse.iss !== options.iss)
|
|
106
106
|
throw new Oid4vciError(
|
|
@@ -637,10 +637,8 @@ var createCredentialRequest = async (options) => {
|
|
|
637
637
|
// src/credential-request/v1.3/create-credential-request.ts
|
|
638
638
|
import {
|
|
639
639
|
HashAlgorithm,
|
|
640
|
-
calculateJwkThumbprint
|
|
641
|
-
} from "@openid4vc/oauth2";
|
|
642
|
-
import {
|
|
643
640
|
ValidationError as ValidationError3,
|
|
641
|
+
calculateJwkThumbprint,
|
|
644
642
|
dateToSeconds as dateToSeconds2,
|
|
645
643
|
parseWithErrorHandling as parseWithErrorHandling2
|
|
646
644
|
} from "@pagopa/io-wallet-utils";
|
|
@@ -746,24 +744,22 @@ async function createCredentialRequest3(options) {
|
|
|
746
744
|
}
|
|
747
745
|
|
|
748
746
|
// src/credential-request/parse-credential-request.ts
|
|
749
|
-
import {
|
|
750
|
-
Oauth2JwtParseError,
|
|
751
|
-
decodeJwt,
|
|
752
|
-
extractDpopJwtFromHeaders
|
|
753
|
-
} from "@pagopa/io-wallet-oauth2";
|
|
747
|
+
import { extractDpopJwtFromHeaders } from "@pagopa/io-wallet-oauth2";
|
|
754
748
|
import {
|
|
755
749
|
HEADERS,
|
|
756
750
|
HashAlgorithm as HashAlgorithm2,
|
|
757
751
|
ItWalletSpecsVersion as ItWalletSpecsVersion7,
|
|
758
752
|
ItWalletSpecsVersionError as ItWalletSpecsVersionError4,
|
|
753
|
+
JwtParseError,
|
|
759
754
|
ValidationError as ValidationError4,
|
|
760
755
|
calculateJwkThumbprint as calculateJwkThumbprint2,
|
|
761
756
|
createVersionDispatcher as createVersionDispatcher4,
|
|
757
|
+
decodeJwt as decodeJwt2,
|
|
762
758
|
parseWithErrorHandling as parseWithErrorHandling3
|
|
763
759
|
} from "@pagopa/io-wallet-utils";
|
|
764
760
|
|
|
765
761
|
// src/credential-request/z-proof-jwt.ts
|
|
766
|
-
import { zJwk } from "@pagopa/io-wallet-
|
|
762
|
+
import { zJwk } from "@pagopa/io-wallet-utils";
|
|
767
763
|
import { z as z8 } from "zod";
|
|
768
764
|
var zBaseProofJwtHeader = z8.object({
|
|
769
765
|
alg: z8.string().min(1),
|
|
@@ -839,7 +835,7 @@ function validateProofPayloadSemantics(options) {
|
|
|
839
835
|
}
|
|
840
836
|
}
|
|
841
837
|
function parseProofJwt(options) {
|
|
842
|
-
const decoded =
|
|
838
|
+
const decoded = decodeJwt2({
|
|
843
839
|
errorMessagePrefix: "Error decoding credential request proof JWT:",
|
|
844
840
|
jwt: options.jwt
|
|
845
841
|
});
|
|
@@ -1040,7 +1036,7 @@ async function parseCredentialRequest(options) {
|
|
|
1040
1036
|
isDeferredFlow
|
|
1041
1037
|
});
|
|
1042
1038
|
} catch (error) {
|
|
1043
|
-
if (error instanceof ItWalletSpecsVersionError4 || error instanceof
|
|
1039
|
+
if (error instanceof ItWalletSpecsVersionError4 || error instanceof JwtParseError || error instanceof ValidationError4 || error instanceof CredentialAuthorizationHeaderError || error instanceof MissingDpopProofError || error instanceof InvalidDpopProofError) {
|
|
1044
1040
|
throw error;
|
|
1045
1041
|
}
|
|
1046
1042
|
throw new ParseCredentialRequestError(
|
|
@@ -1051,34 +1047,37 @@ async function parseCredentialRequest(options) {
|
|
|
1051
1047
|
}
|
|
1052
1048
|
|
|
1053
1049
|
// src/credential-request/verify-credential-request-jwt-proof.ts
|
|
1054
|
-
import { calculateJwkThumbprint as calculateJwkThumbprint3, jwtSignerFromJwt as jwtSignerFromJwt3 } from "@openid4vc/oauth2";
|
|
1055
1050
|
import {
|
|
1056
1051
|
HashAlgorithm as HashAlgorithm3,
|
|
1057
|
-
Oauth2JwtParseError as Oauth2JwtParseError3,
|
|
1058
|
-
decodeJwt as decodeJwt3,
|
|
1059
|
-
verifyJwt as verifyJwt3
|
|
1060
|
-
} from "@pagopa/io-wallet-oauth2";
|
|
1061
|
-
import {
|
|
1062
1052
|
ItWalletSpecsVersion as ItWalletSpecsVersion8,
|
|
1063
1053
|
ItWalletSpecsVersionError as ItWalletSpecsVersionError5,
|
|
1054
|
+
JwtParseError as JwtParseError3,
|
|
1064
1055
|
ValidationError as ValidationError6,
|
|
1056
|
+
calculateJwkThumbprint as calculateJwkThumbprint3,
|
|
1065
1057
|
createVersionDispatcher as createVersionDispatcher5,
|
|
1058
|
+
decodeJwt as decodeJwt4,
|
|
1059
|
+
jwtSignerFromJwt as jwtSignerFromJwt3,
|
|
1060
|
+
verifyJwt as verifyJwt3,
|
|
1066
1061
|
verifyJwtIatOrThrow
|
|
1067
1062
|
} from "@pagopa/io-wallet-utils";
|
|
1068
1063
|
|
|
1069
1064
|
// src/credential-request/verify-key-attestation-jwt.ts
|
|
1070
1065
|
import {
|
|
1071
|
-
|
|
1066
|
+
JwtParseError as JwtParseError2,
|
|
1067
|
+
ValidationError as ValidationError5,
|
|
1068
|
+
decodeJwt as decodeJwt3,
|
|
1072
1069
|
jwtSignerFromJwt as jwtSignerFromJwt2,
|
|
1073
1070
|
verifyJwt as verifyJwt2
|
|
1074
|
-
} from "@
|
|
1075
|
-
import { decodeJwt as decodeJwt2 } from "@pagopa/io-wallet-oauth2";
|
|
1076
|
-
import { ValidationError as ValidationError5 } from "@pagopa/io-wallet-utils";
|
|
1071
|
+
} from "@pagopa/io-wallet-utils";
|
|
1077
1072
|
|
|
1078
1073
|
// src/wallet-provider/z-key-attestation.ts
|
|
1079
|
-
import { zCertificateChain, zJwk as zJwk2, zTrustChain } from "@pagopa/io-wallet-oauth2";
|
|
1080
1074
|
import { zKeyStorageLevelV1_3 } from "@pagopa/io-wallet-oid-federation";
|
|
1081
|
-
import {
|
|
1075
|
+
import {
|
|
1076
|
+
zCertificateChain,
|
|
1077
|
+
zItwSupportedSignatureAlg,
|
|
1078
|
+
zJwk as zJwk2,
|
|
1079
|
+
zTrustChain
|
|
1080
|
+
} from "@pagopa/io-wallet-utils";
|
|
1082
1081
|
import { z as z9 } from "zod";
|
|
1083
1082
|
var zStatusList = z9.object({
|
|
1084
1083
|
idx: z9.number(),
|
|
@@ -1111,7 +1110,7 @@ var keyAttestationTypeHeader = zKeyAttestationTypeHeader.value;
|
|
|
1111
1110
|
// src/credential-request/verify-key-attestation-jwt.ts
|
|
1112
1111
|
async function verifyKeyAttestationJwt(options) {
|
|
1113
1112
|
try {
|
|
1114
|
-
const { header, payload } =
|
|
1113
|
+
const { header, payload } = decodeJwt3({
|
|
1115
1114
|
errorMessagePrefix: "Error decoding key attestation JWT:",
|
|
1116
1115
|
headerSchema: zKeyAttestationHeader,
|
|
1117
1116
|
jwt: options.keyAttestationJwt,
|
|
@@ -1140,7 +1139,7 @@ async function verifyKeyAttestationJwt(options) {
|
|
|
1140
1139
|
}
|
|
1141
1140
|
return { header, payload, signer };
|
|
1142
1141
|
} catch (error) {
|
|
1143
|
-
if (error instanceof VerifyKeyAttestationJwtError || error instanceof ValidationError5 || error instanceof
|
|
1142
|
+
if (error instanceof VerifyKeyAttestationJwtError || error instanceof ValidationError5 || error instanceof JwtParseError2) {
|
|
1144
1143
|
throw error;
|
|
1145
1144
|
}
|
|
1146
1145
|
throw new VerifyKeyAttestationJwtError(
|
|
@@ -1184,7 +1183,7 @@ function verifyProofJwtIatOrThrow(options) {
|
|
|
1184
1183
|
}
|
|
1185
1184
|
}
|
|
1186
1185
|
async function verifyProofV1_0(options) {
|
|
1187
|
-
const { header, payload } =
|
|
1186
|
+
const { header, payload } = decodeJwt4({
|
|
1188
1187
|
errorMessagePrefix: "Error decoding credential request proof JWT:",
|
|
1189
1188
|
headerSchema: zProofJwtHeaderV1_0,
|
|
1190
1189
|
jwt: options.jwt,
|
|
@@ -1206,7 +1205,7 @@ async function verifyProofV1_0(options) {
|
|
|
1206
1205
|
return { header, payload, signer };
|
|
1207
1206
|
}
|
|
1208
1207
|
async function verifyProofV1_3(options) {
|
|
1209
|
-
const { header, payload } =
|
|
1208
|
+
const { header, payload } = decodeJwt4({
|
|
1210
1209
|
errorMessagePrefix: "Error decoding credential request proof JWT:",
|
|
1211
1210
|
headerSchema: zProofJwtHeaderV1_3,
|
|
1212
1211
|
jwt: options.jwt,
|
|
@@ -1270,7 +1269,7 @@ async function verifyCredentialRequestJwtProof(options) {
|
|
|
1270
1269
|
}
|
|
1271
1270
|
return await dispatchVerifyProof({ ...options, now });
|
|
1272
1271
|
} catch (error) {
|
|
1273
|
-
if (error instanceof VerifyCredentialRequestJwtProofError || error instanceof VerifyKeyAttestationJwtError || error instanceof ItWalletSpecsVersionError5 || error instanceof ValidationError6 || error instanceof
|
|
1272
|
+
if (error instanceof VerifyCredentialRequestJwtProofError || error instanceof VerifyKeyAttestationJwtError || error instanceof ItWalletSpecsVersionError5 || error instanceof ValidationError6 || error instanceof JwtParseError3) {
|
|
1274
1273
|
throw error;
|
|
1275
1274
|
}
|
|
1276
1275
|
throw new VerifyCredentialRequestJwtProofError(
|
|
@@ -1451,7 +1450,7 @@ import {
|
|
|
1451
1450
|
} from "@pagopa/io-wallet-utils";
|
|
1452
1451
|
|
|
1453
1452
|
// src/credential-response/z-credential-response.ts
|
|
1454
|
-
import { zAlgValueNotNone, zJwk as zJwk3 } from "@pagopa/io-wallet-
|
|
1453
|
+
import { zAlgValueNotNone, zJwk as zJwk3 } from "@pagopa/io-wallet-utils";
|
|
1455
1454
|
import { z as z13 } from "zod";
|
|
1456
1455
|
var zCredentialResponseEncryption = z13.looseObject({
|
|
1457
1456
|
alg: zAlgValueNotNone,
|
|
@@ -1500,7 +1499,6 @@ async function fetchCredentialResponse(options) {
|
|
|
1500
1499
|
}
|
|
1501
1500
|
|
|
1502
1501
|
// src/metadata/fetch-metadata.ts
|
|
1503
|
-
import { decodeJwt as decodeJwt4 } from "@pagopa/io-wallet-oauth2";
|
|
1504
1502
|
import { itWalletEntityStatementClaimsSchema as itWalletEntityStatementClaimsSchema2 } from "@pagopa/io-wallet-oid-federation";
|
|
1505
1503
|
import {
|
|
1506
1504
|
ItWalletSpecsVersion as ItWalletSpecsVersion10,
|
|
@@ -1509,6 +1507,7 @@ import {
|
|
|
1509
1507
|
ValidationError as ValidationError9,
|
|
1510
1508
|
createFetcher as createFetcher4,
|
|
1511
1509
|
createVersionDispatcher as createVersionDispatcher7,
|
|
1510
|
+
decodeJwt as decodeJwt5,
|
|
1512
1511
|
hasStatusOrThrow as hasStatusOrThrow4,
|
|
1513
1512
|
parseWithErrorHandling as parseWithErrorHandling7
|
|
1514
1513
|
} from "@pagopa/io-wallet-utils";
|
|
@@ -1565,7 +1564,7 @@ async function tryFederationDiscovery(fetch, baseUrl, verifyJwt4) {
|
|
|
1565
1564
|
return void 0;
|
|
1566
1565
|
}
|
|
1567
1566
|
const entityStatement = await response.text();
|
|
1568
|
-
const { header, payload } =
|
|
1567
|
+
const { header, payload } = decodeJwt5({
|
|
1569
1568
|
errorMessagePrefix: "Error decoding entity statement JWT:",
|
|
1570
1569
|
jwt: entityStatement,
|
|
1571
1570
|
payloadSchema: itWalletEntityStatementClaimsSchema2
|