@pagopa/io-wallet-oauth2 1.5.6 → 1.5.7
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 +4 -46
- package/dist/index.d.ts +4 -46
- package/dist/index.js +11 -22
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -22
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -1185,6 +1185,7 @@ type VerifiedWalletAttestationJwtV1_4 = Awaited<ReturnType<typeof verifyWalletAt
|
|
|
1185
1185
|
declare function verifyWalletAttestationJwt$1(options: VerifyWalletAttestationJwtOptionsV1_4): Promise<{
|
|
1186
1186
|
header: {
|
|
1187
1187
|
[x: string]: unknown;
|
|
1188
|
+
kid: string;
|
|
1188
1189
|
typ: "oauth-client-attestation+jwt";
|
|
1189
1190
|
x5c: string[];
|
|
1190
1191
|
alg: string;
|
|
@@ -1220,7 +1221,6 @@ declare function verifyWalletAttestationJwt$1(options: VerifyWalletAttestationJw
|
|
|
1220
1221
|
x5u?: string | undefined;
|
|
1221
1222
|
y?: string | undefined;
|
|
1222
1223
|
} | undefined;
|
|
1223
|
-
kid?: string | undefined;
|
|
1224
1224
|
};
|
|
1225
1225
|
payload: {
|
|
1226
1226
|
[x: string]: unknown;
|
|
@@ -1260,27 +1260,14 @@ declare function verifyWalletAttestationJwt$1(options: VerifyWalletAttestationJw
|
|
|
1260
1260
|
exp: number;
|
|
1261
1261
|
iat: number;
|
|
1262
1262
|
iss: string;
|
|
1263
|
-
status: {
|
|
1264
|
-
status_list: {
|
|
1265
|
-
idx: number;
|
|
1266
|
-
uri: string;
|
|
1267
|
-
};
|
|
1268
|
-
};
|
|
1269
1263
|
sub: string;
|
|
1270
1264
|
wallet_link: string;
|
|
1271
1265
|
wallet_name: string;
|
|
1272
|
-
eudi_wallet_info?: {
|
|
1273
|
-
general_info: {
|
|
1274
|
-
wallet_provider_name: string;
|
|
1275
|
-
wallet_solution_certification_information: string;
|
|
1276
|
-
wallet_solution_id: string;
|
|
1277
|
-
wallet_solution_version: string;
|
|
1278
|
-
};
|
|
1279
|
-
} | undefined;
|
|
1280
1266
|
nbf?: number | undefined;
|
|
1281
1267
|
aud?: string | undefined;
|
|
1282
1268
|
jti?: string | undefined;
|
|
1283
1269
|
nonce?: string | undefined;
|
|
1270
|
+
status?: Record<string, any> | undefined;
|
|
1284
1271
|
trust_chain?: [string, ...string[]] | undefined;
|
|
1285
1272
|
};
|
|
1286
1273
|
signer: _openid4vc_oauth2.JwtSignerWithJwk;
|
|
@@ -2920,21 +2907,8 @@ interface WalletAttestationOptionsV1_3 extends BaseWalletAttestationOptions {
|
|
|
2920
2907
|
*/
|
|
2921
2908
|
declare const createWalletAttestationJwt$1: (options: WalletAttestationOptionsV1_3) => Promise<WalletAttestationJwtV1_3>;
|
|
2922
2909
|
|
|
2923
|
-
declare const zWalletAttestationStatusV1_4: z$1.ZodObject<{
|
|
2924
|
-
status_list: z$1.ZodObject<{
|
|
2925
|
-
idx: z$1.ZodNumber;
|
|
2926
|
-
uri: z$1.ZodString;
|
|
2927
|
-
}, z$1.core.$strip>;
|
|
2928
|
-
}, z$1.core.$strip>;
|
|
2929
|
-
declare const zEudiWalletInfoV1_4: z$1.ZodObject<{
|
|
2930
|
-
general_info: z$1.ZodObject<{
|
|
2931
|
-
wallet_provider_name: z$1.ZodString;
|
|
2932
|
-
wallet_solution_certification_information: z$1.ZodURL;
|
|
2933
|
-
wallet_solution_id: z$1.ZodString;
|
|
2934
|
-
wallet_solution_version: z$1.ZodString;
|
|
2935
|
-
}, z$1.core.$strip>;
|
|
2936
|
-
}, z$1.core.$strip>;
|
|
2937
2910
|
declare const zWalletAttestationJwtHeaderV1_4: z$1.ZodObject<{
|
|
2911
|
+
kid: z$1.ZodString;
|
|
2938
2912
|
trust_chain: z$1.ZodOptional<z$1.ZodTuple<[z$1.ZodString], z$1.ZodString>>;
|
|
2939
2913
|
typ: z$1.ZodLiteral<"oauth-client-attestation+jwt">;
|
|
2940
2914
|
x5c: z$1.ZodArray<z$1.ZodString>;
|
|
@@ -2968,7 +2942,6 @@ declare const zWalletAttestationJwtHeaderV1_4: z$1.ZodObject<{
|
|
|
2968
2942
|
x5u: z$1.ZodOptional<z$1.ZodString>;
|
|
2969
2943
|
y: z$1.ZodOptional<z$1.ZodString>;
|
|
2970
2944
|
}, z$1.core.$loose>>;
|
|
2971
|
-
kid: z$1.ZodOptional<z$1.ZodString>;
|
|
2972
2945
|
}, z$1.core.$loose>;
|
|
2973
2946
|
declare const zWalletAttestationJwtPayloadV1_4: z$1.ZodObject<{
|
|
2974
2947
|
cnf: z$1.ZodObject<{
|
|
@@ -3002,37 +2975,23 @@ declare const zWalletAttestationJwtPayloadV1_4: z$1.ZodObject<{
|
|
|
3002
2975
|
y: z$1.ZodOptional<z$1.ZodString>;
|
|
3003
2976
|
}, z$1.core.$loose>;
|
|
3004
2977
|
}, z$1.core.$strip>;
|
|
3005
|
-
eudi_wallet_info: z$1.ZodOptional<z$1.ZodObject<{
|
|
3006
|
-
general_info: z$1.ZodObject<{
|
|
3007
|
-
wallet_provider_name: z$1.ZodString;
|
|
3008
|
-
wallet_solution_certification_information: z$1.ZodURL;
|
|
3009
|
-
wallet_solution_id: z$1.ZodString;
|
|
3010
|
-
wallet_solution_version: z$1.ZodString;
|
|
3011
|
-
}, z$1.core.$strip>;
|
|
3012
|
-
}, z$1.core.$strip>>;
|
|
3013
2978
|
exp: z$1.ZodNumber;
|
|
3014
2979
|
iat: z$1.ZodNumber;
|
|
3015
2980
|
iss: z$1.ZodString;
|
|
3016
2981
|
nbf: z$1.ZodOptional<z$1.ZodNumber>;
|
|
3017
|
-
status: z$1.ZodObject<{
|
|
3018
|
-
status_list: z$1.ZodObject<{
|
|
3019
|
-
idx: z$1.ZodNumber;
|
|
3020
|
-
uri: z$1.ZodString;
|
|
3021
|
-
}, z$1.core.$strip>;
|
|
3022
|
-
}, z$1.core.$strip>;
|
|
3023
2982
|
sub: z$1.ZodString;
|
|
3024
2983
|
wallet_link: z$1.ZodURL;
|
|
3025
2984
|
wallet_name: z$1.ZodString;
|
|
3026
2985
|
aud: z$1.ZodOptional<z$1.ZodString>;
|
|
3027
2986
|
jti: z$1.ZodOptional<z$1.ZodString>;
|
|
3028
2987
|
nonce: z$1.ZodOptional<z$1.ZodString>;
|
|
2988
|
+
status: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>>;
|
|
3029
2989
|
trust_chain: z$1.ZodOptional<z$1.ZodTuple<[z$1.ZodString], z$1.ZodString>>;
|
|
3030
2990
|
}, z$1.core.$loose>;
|
|
3031
2991
|
type WalletAttestationJwtV1_4 = string;
|
|
3032
2992
|
declare const zWalletAttestationJwtV1_4: z$1.ZodString;
|
|
3033
2993
|
|
|
3034
2994
|
interface WalletAttestationOptionsV1_4 extends Omit<BaseWalletAttestationOptions, "walletLink" | "walletName"> {
|
|
3035
|
-
eudiWalletInfo?: z$1.infer<typeof zEudiWalletInfoV1_4>;
|
|
3036
2995
|
nbf?: Date;
|
|
3037
2996
|
signer: {
|
|
3038
2997
|
alg: string;
|
|
@@ -3041,7 +3000,6 @@ interface WalletAttestationOptionsV1_4 extends Omit<BaseWalletAttestationOptions
|
|
|
3041
3000
|
trustChain?: [string, ...string[]];
|
|
3042
3001
|
x5c: [string, ...string[]];
|
|
3043
3002
|
};
|
|
3044
|
-
status: z$1.infer<typeof zWalletAttestationStatusV1_4>;
|
|
3045
3003
|
walletLink: string;
|
|
3046
3004
|
walletName: string;
|
|
3047
3005
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1185,6 +1185,7 @@ type VerifiedWalletAttestationJwtV1_4 = Awaited<ReturnType<typeof verifyWalletAt
|
|
|
1185
1185
|
declare function verifyWalletAttestationJwt$1(options: VerifyWalletAttestationJwtOptionsV1_4): Promise<{
|
|
1186
1186
|
header: {
|
|
1187
1187
|
[x: string]: unknown;
|
|
1188
|
+
kid: string;
|
|
1188
1189
|
typ: "oauth-client-attestation+jwt";
|
|
1189
1190
|
x5c: string[];
|
|
1190
1191
|
alg: string;
|
|
@@ -1220,7 +1221,6 @@ declare function verifyWalletAttestationJwt$1(options: VerifyWalletAttestationJw
|
|
|
1220
1221
|
x5u?: string | undefined;
|
|
1221
1222
|
y?: string | undefined;
|
|
1222
1223
|
} | undefined;
|
|
1223
|
-
kid?: string | undefined;
|
|
1224
1224
|
};
|
|
1225
1225
|
payload: {
|
|
1226
1226
|
[x: string]: unknown;
|
|
@@ -1260,27 +1260,14 @@ declare function verifyWalletAttestationJwt$1(options: VerifyWalletAttestationJw
|
|
|
1260
1260
|
exp: number;
|
|
1261
1261
|
iat: number;
|
|
1262
1262
|
iss: string;
|
|
1263
|
-
status: {
|
|
1264
|
-
status_list: {
|
|
1265
|
-
idx: number;
|
|
1266
|
-
uri: string;
|
|
1267
|
-
};
|
|
1268
|
-
};
|
|
1269
1263
|
sub: string;
|
|
1270
1264
|
wallet_link: string;
|
|
1271
1265
|
wallet_name: string;
|
|
1272
|
-
eudi_wallet_info?: {
|
|
1273
|
-
general_info: {
|
|
1274
|
-
wallet_provider_name: string;
|
|
1275
|
-
wallet_solution_certification_information: string;
|
|
1276
|
-
wallet_solution_id: string;
|
|
1277
|
-
wallet_solution_version: string;
|
|
1278
|
-
};
|
|
1279
|
-
} | undefined;
|
|
1280
1266
|
nbf?: number | undefined;
|
|
1281
1267
|
aud?: string | undefined;
|
|
1282
1268
|
jti?: string | undefined;
|
|
1283
1269
|
nonce?: string | undefined;
|
|
1270
|
+
status?: Record<string, any> | undefined;
|
|
1284
1271
|
trust_chain?: [string, ...string[]] | undefined;
|
|
1285
1272
|
};
|
|
1286
1273
|
signer: _openid4vc_oauth2.JwtSignerWithJwk;
|
|
@@ -2920,21 +2907,8 @@ interface WalletAttestationOptionsV1_3 extends BaseWalletAttestationOptions {
|
|
|
2920
2907
|
*/
|
|
2921
2908
|
declare const createWalletAttestationJwt$1: (options: WalletAttestationOptionsV1_3) => Promise<WalletAttestationJwtV1_3>;
|
|
2922
2909
|
|
|
2923
|
-
declare const zWalletAttestationStatusV1_4: z$1.ZodObject<{
|
|
2924
|
-
status_list: z$1.ZodObject<{
|
|
2925
|
-
idx: z$1.ZodNumber;
|
|
2926
|
-
uri: z$1.ZodString;
|
|
2927
|
-
}, z$1.core.$strip>;
|
|
2928
|
-
}, z$1.core.$strip>;
|
|
2929
|
-
declare const zEudiWalletInfoV1_4: z$1.ZodObject<{
|
|
2930
|
-
general_info: z$1.ZodObject<{
|
|
2931
|
-
wallet_provider_name: z$1.ZodString;
|
|
2932
|
-
wallet_solution_certification_information: z$1.ZodURL;
|
|
2933
|
-
wallet_solution_id: z$1.ZodString;
|
|
2934
|
-
wallet_solution_version: z$1.ZodString;
|
|
2935
|
-
}, z$1.core.$strip>;
|
|
2936
|
-
}, z$1.core.$strip>;
|
|
2937
2910
|
declare const zWalletAttestationJwtHeaderV1_4: z$1.ZodObject<{
|
|
2911
|
+
kid: z$1.ZodString;
|
|
2938
2912
|
trust_chain: z$1.ZodOptional<z$1.ZodTuple<[z$1.ZodString], z$1.ZodString>>;
|
|
2939
2913
|
typ: z$1.ZodLiteral<"oauth-client-attestation+jwt">;
|
|
2940
2914
|
x5c: z$1.ZodArray<z$1.ZodString>;
|
|
@@ -2968,7 +2942,6 @@ declare const zWalletAttestationJwtHeaderV1_4: z$1.ZodObject<{
|
|
|
2968
2942
|
x5u: z$1.ZodOptional<z$1.ZodString>;
|
|
2969
2943
|
y: z$1.ZodOptional<z$1.ZodString>;
|
|
2970
2944
|
}, z$1.core.$loose>>;
|
|
2971
|
-
kid: z$1.ZodOptional<z$1.ZodString>;
|
|
2972
2945
|
}, z$1.core.$loose>;
|
|
2973
2946
|
declare const zWalletAttestationJwtPayloadV1_4: z$1.ZodObject<{
|
|
2974
2947
|
cnf: z$1.ZodObject<{
|
|
@@ -3002,37 +2975,23 @@ declare const zWalletAttestationJwtPayloadV1_4: z$1.ZodObject<{
|
|
|
3002
2975
|
y: z$1.ZodOptional<z$1.ZodString>;
|
|
3003
2976
|
}, z$1.core.$loose>;
|
|
3004
2977
|
}, z$1.core.$strip>;
|
|
3005
|
-
eudi_wallet_info: z$1.ZodOptional<z$1.ZodObject<{
|
|
3006
|
-
general_info: z$1.ZodObject<{
|
|
3007
|
-
wallet_provider_name: z$1.ZodString;
|
|
3008
|
-
wallet_solution_certification_information: z$1.ZodURL;
|
|
3009
|
-
wallet_solution_id: z$1.ZodString;
|
|
3010
|
-
wallet_solution_version: z$1.ZodString;
|
|
3011
|
-
}, z$1.core.$strip>;
|
|
3012
|
-
}, z$1.core.$strip>>;
|
|
3013
2978
|
exp: z$1.ZodNumber;
|
|
3014
2979
|
iat: z$1.ZodNumber;
|
|
3015
2980
|
iss: z$1.ZodString;
|
|
3016
2981
|
nbf: z$1.ZodOptional<z$1.ZodNumber>;
|
|
3017
|
-
status: z$1.ZodObject<{
|
|
3018
|
-
status_list: z$1.ZodObject<{
|
|
3019
|
-
idx: z$1.ZodNumber;
|
|
3020
|
-
uri: z$1.ZodString;
|
|
3021
|
-
}, z$1.core.$strip>;
|
|
3022
|
-
}, z$1.core.$strip>;
|
|
3023
2982
|
sub: z$1.ZodString;
|
|
3024
2983
|
wallet_link: z$1.ZodURL;
|
|
3025
2984
|
wallet_name: z$1.ZodString;
|
|
3026
2985
|
aud: z$1.ZodOptional<z$1.ZodString>;
|
|
3027
2986
|
jti: z$1.ZodOptional<z$1.ZodString>;
|
|
3028
2987
|
nonce: z$1.ZodOptional<z$1.ZodString>;
|
|
2988
|
+
status: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>>;
|
|
3029
2989
|
trust_chain: z$1.ZodOptional<z$1.ZodTuple<[z$1.ZodString], z$1.ZodString>>;
|
|
3030
2990
|
}, z$1.core.$loose>;
|
|
3031
2991
|
type WalletAttestationJwtV1_4 = string;
|
|
3032
2992
|
declare const zWalletAttestationJwtV1_4: z$1.ZodString;
|
|
3033
2993
|
|
|
3034
2994
|
interface WalletAttestationOptionsV1_4 extends Omit<BaseWalletAttestationOptions, "walletLink" | "walletName"> {
|
|
3035
|
-
eudiWalletInfo?: z$1.infer<typeof zEudiWalletInfoV1_4>;
|
|
3036
2995
|
nbf?: Date;
|
|
3037
2996
|
signer: {
|
|
3038
2997
|
alg: string;
|
|
@@ -3041,7 +3000,6 @@ interface WalletAttestationOptionsV1_4 extends Omit<BaseWalletAttestationOptions
|
|
|
3041
3000
|
trustChain?: [string, ...string[]];
|
|
3042
3001
|
x5c: [string, ...string[]];
|
|
3043
3002
|
};
|
|
3044
|
-
status: z$1.infer<typeof zWalletAttestationStatusV1_4>;
|
|
3045
3003
|
walletLink: string;
|
|
3046
3004
|
walletName: string;
|
|
3047
3005
|
}
|
package/dist/index.js
CHANGED
|
@@ -796,22 +796,9 @@ async function verifyWalletAttestationJwt2(options) {
|
|
|
796
796
|
|
|
797
797
|
// src/client-attestation/v1.4/z-wallet-attestation.ts
|
|
798
798
|
var import_zod8 = require("zod");
|
|
799
|
-
var zWalletAttestationStatusV1_4 = import_zod8.z.object({
|
|
800
|
-
status_list: import_zod8.z.object({
|
|
801
|
-
idx: import_zod8.z.number().int(),
|
|
802
|
-
uri: import_zod8.z.string()
|
|
803
|
-
})
|
|
804
|
-
});
|
|
805
|
-
var zEudiWalletInfoV1_4 = import_zod8.z.object({
|
|
806
|
-
general_info: import_zod8.z.object({
|
|
807
|
-
wallet_provider_name: import_zod8.z.string(),
|
|
808
|
-
wallet_solution_certification_information: import_zod8.z.url(),
|
|
809
|
-
wallet_solution_id: import_zod8.z.string(),
|
|
810
|
-
wallet_solution_version: import_zod8.z.string()
|
|
811
|
-
})
|
|
812
|
-
});
|
|
813
799
|
var zWalletAttestationJwtHeaderV1_4 = import_zod8.z.looseObject({
|
|
814
800
|
...zJwtHeader.shape,
|
|
801
|
+
kid: import_zod8.z.string(),
|
|
815
802
|
trust_chain: zTrustChain.optional(),
|
|
816
803
|
typ: import_zod8.z.literal("oauth-client-attestation+jwt"),
|
|
817
804
|
x5c: zCertificateChain
|
|
@@ -821,12 +808,10 @@ var zWalletAttestationJwtPayloadV1_4 = import_zod8.z.looseObject({
|
|
|
821
808
|
cnf: import_zod8.z.object({
|
|
822
809
|
jwk: zJwk
|
|
823
810
|
}),
|
|
824
|
-
eudi_wallet_info: zEudiWalletInfoV1_4.optional(),
|
|
825
811
|
exp: import_zod8.z.number().int(),
|
|
826
812
|
iat: import_zod8.z.number().int(),
|
|
827
813
|
iss: import_zod8.z.string(),
|
|
828
814
|
nbf: import_zod8.z.number().optional(),
|
|
829
|
-
status: zWalletAttestationStatusV1_4,
|
|
830
815
|
sub: import_zod8.z.string(),
|
|
831
816
|
wallet_link: import_zod8.z.url(),
|
|
832
817
|
wallet_name: import_zod8.z.string()
|
|
@@ -2176,11 +2161,19 @@ var createWalletAttestationJwt2 = async (options) => {
|
|
|
2176
2161
|
|
|
2177
2162
|
// src/client-attestation/v1.4/create-wallet-attestation-jwt.ts
|
|
2178
2163
|
var import_io_wallet_utils19 = require("@pagopa/io-wallet-utils");
|
|
2164
|
+
var DEFAULT_EXPIRATION_SECONDS = 3600;
|
|
2165
|
+
var MAX_EXPIRATION_SECONDS = 86400;
|
|
2179
2166
|
var createWalletAttestationJwt3 = async (options) => {
|
|
2180
2167
|
try {
|
|
2181
2168
|
const { signJwt } = options.callbacks;
|
|
2182
2169
|
const iat = /* @__PURE__ */ new Date();
|
|
2183
|
-
const exp = options.expiresAt ?? (0, import_io_wallet_utils19.addSecondsToDate)(iat,
|
|
2170
|
+
const exp = options.expiresAt ?? (0, import_io_wallet_utils19.addSecondsToDate)(iat, DEFAULT_EXPIRATION_SECONDS);
|
|
2171
|
+
if (exp <= iat) {
|
|
2172
|
+
throw new import_io_wallet_utils19.ValidationError("exp must be after iat");
|
|
2173
|
+
}
|
|
2174
|
+
if (exp > (0, import_io_wallet_utils19.addSecondsToDate)(iat, MAX_EXPIRATION_SECONDS)) {
|
|
2175
|
+
throw new import_io_wallet_utils19.ValidationError("exp must not be more than 24 hours after iat");
|
|
2176
|
+
}
|
|
2184
2177
|
if (options.nbf && options.nbf >= exp) {
|
|
2185
2178
|
throw new import_io_wallet_utils19.ValidationError("nbf must be before exp");
|
|
2186
2179
|
}
|
|
@@ -2190,14 +2183,10 @@ var createWalletAttestationJwt3 = async (options) => {
|
|
|
2190
2183
|
exp: (0, import_io_wallet_utils19.dateToSeconds)(exp),
|
|
2191
2184
|
iat: (0, import_io_wallet_utils19.dateToSeconds)(iat),
|
|
2192
2185
|
iss: options.issuer,
|
|
2193
|
-
status: options.status,
|
|
2194
2186
|
sub: dpopJwkThumbprint,
|
|
2195
2187
|
wallet_link: options.walletLink,
|
|
2196
2188
|
wallet_name: options.walletName,
|
|
2197
|
-
...options.nbf && { nbf: (0, import_io_wallet_utils19.dateToSeconds)(options.nbf) }
|
|
2198
|
-
...options.eudiWalletInfo && {
|
|
2199
|
-
eudi_wallet_info: options.eudiWalletInfo
|
|
2200
|
-
}
|
|
2189
|
+
...options.nbf && { nbf: (0, import_io_wallet_utils19.dateToSeconds)(options.nbf) }
|
|
2201
2190
|
};
|
|
2202
2191
|
const header = {
|
|
2203
2192
|
alg: options.signer.alg,
|