@pagopa/io-react-native-wallet 2.0.0-next.0 → 2.0.0-next.2
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/lib/commonjs/credential/issuance/02-evaluate-issuer-trust.js +2 -2
- package/lib/commonjs/credential/issuance/02-evaluate-issuer-trust.js.map +1 -1
- package/lib/commonjs/credential/presentation/02-evaluate-rp-trust.js +2 -2
- package/lib/commonjs/credential/presentation/02-evaluate-rp-trust.js.map +1 -1
- package/lib/commonjs/credential/presentation/05-verify-request-object.js.map +1 -1
- package/lib/commonjs/credential/presentation/08-send-authorization-response.js.map +1 -1
- package/lib/commonjs/trust/README.md +147 -0
- package/lib/commonjs/trust/build-chain.js +252 -0
- package/lib/commonjs/trust/build-chain.js.map +1 -0
- package/lib/commonjs/trust/errors.js +24 -1
- package/lib/commonjs/trust/errors.js.map +1 -1
- package/lib/commonjs/trust/index.js +11 -276
- package/lib/commonjs/trust/index.js.map +1 -1
- package/lib/commonjs/trust/utils.js +30 -1
- package/lib/commonjs/trust/utils.js.map +1 -1
- package/lib/commonjs/trust/{chain.js → verify-chain.js} +87 -15
- package/lib/commonjs/trust/verify-chain.js.map +1 -0
- package/lib/commonjs/utils/errors.js.map +1 -1
- package/lib/module/credential/issuance/02-evaluate-issuer-trust.js +1 -1
- package/lib/module/credential/issuance/02-evaluate-issuer-trust.js.map +1 -1
- package/lib/module/credential/presentation/02-evaluate-rp-trust.js +1 -1
- package/lib/module/credential/presentation/02-evaluate-rp-trust.js.map +1 -1
- package/lib/module/credential/presentation/05-verify-request-object.js.map +1 -1
- package/lib/module/credential/presentation/08-send-authorization-response.js +1 -1
- package/lib/module/credential/presentation/08-send-authorization-response.js.map +1 -1
- package/lib/module/trust/README.md +147 -0
- package/lib/module/trust/build-chain.js +235 -0
- package/lib/module/trust/build-chain.js.map +1 -0
- package/lib/module/trust/errors.js +23 -2
- package/lib/module/trust/errors.js.map +1 -1
- package/lib/module/trust/index.js +5 -262
- package/lib/module/trust/index.js.map +1 -1
- package/lib/module/trust/utils.js +27 -0
- package/lib/module/trust/utils.js.map +1 -1
- package/lib/module/trust/{chain.js → verify-chain.js} +85 -14
- package/lib/module/trust/verify-chain.js.map +1 -0
- package/lib/module/utils/errors.js +1 -1
- package/lib/module/utils/errors.js.map +1 -1
- package/lib/typescript/credential/issuance/02-evaluate-issuer-trust.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/02-evaluate-rp-trust.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/05-verify-request-object.d.ts +1 -1
- package/lib/typescript/credential/presentation/05-verify-request-object.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/08-send-authorization-response.d.ts +2 -2
- package/lib/typescript/credential/presentation/08-send-authorization-response.d.ts.map +1 -1
- package/lib/typescript/credential/status/types.d.ts +6 -6
- package/lib/typescript/sd-jwt/index.d.ts +12 -12
- package/lib/typescript/sd-jwt/types.d.ts +6 -6
- package/lib/typescript/trust/build-chain.d.ts +1284 -0
- package/lib/typescript/trust/build-chain.d.ts.map +1 -0
- package/lib/typescript/trust/errors.d.ts +22 -0
- package/lib/typescript/trust/errors.d.ts.map +1 -1
- package/lib/typescript/trust/index.d.ts +5 -1299
- package/lib/typescript/trust/index.d.ts.map +1 -1
- package/lib/typescript/trust/types.d.ts +54 -54
- package/lib/typescript/trust/utils.d.ts +10 -0
- package/lib/typescript/trust/utils.d.ts.map +1 -1
- package/lib/typescript/trust/verify-chain.d.ts +39 -0
- package/lib/typescript/trust/verify-chain.d.ts.map +1 -0
- package/lib/typescript/utils/errors.d.ts +2 -2
- package/lib/typescript/utils/errors.d.ts.map +1 -1
- package/lib/typescript/wallet-instance-attestation/types.d.ts +21 -21
- package/package.json +2 -2
- package/src/credential/issuance/02-evaluate-issuer-trust.ts +1 -1
- package/src/credential/presentation/02-evaluate-rp-trust.ts +1 -1
- package/src/credential/presentation/05-verify-request-object.ts +1 -1
- package/src/credential/presentation/08-send-authorization-response.ts +4 -4
- package/src/trust/README.md +147 -0
- package/src/trust/build-chain.ts +395 -0
- package/src/trust/errors.ts +32 -1
- package/src/trust/index.ts +5 -435
- package/src/trust/utils.ts +35 -0
- package/src/trust/{chain.ts → verify-chain.ts} +132 -16
- package/src/utils/errors.ts +4 -4
- package/lib/commonjs/trust/chain.js.map +0 -1
- package/lib/module/trust/chain.js.map +0 -1
- package/lib/typescript/trust/chain.d.ts +0 -21
- package/lib/typescript/trust/chain.d.ts.map +0 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/trust/index.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/trust/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,eAAe,CAAC;AACvC,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAC;AACzC,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AAEjC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC"}
|
@@ -234,6 +234,11 @@ export declare const EntityStatement: z.ZodObject<{
|
|
234
234
|
}[] | undefined;
|
235
235
|
}>;
|
236
236
|
}, "strip", z.ZodTypeAny, {
|
237
|
+
header: {
|
238
|
+
alg: string;
|
239
|
+
kid: string;
|
240
|
+
typ: "entity-statement+jwt";
|
241
|
+
};
|
237
242
|
payload: {
|
238
243
|
iss: string;
|
239
244
|
sub: string;
|
@@ -270,12 +275,12 @@ export declare const EntityStatement: z.ZodObject<{
|
|
270
275
|
trust_mark: string;
|
271
276
|
}[] | undefined;
|
272
277
|
};
|
278
|
+
}, {
|
273
279
|
header: {
|
274
280
|
alg: string;
|
275
281
|
kid: string;
|
276
282
|
typ: "entity-statement+jwt";
|
277
283
|
};
|
278
|
-
}, {
|
279
284
|
payload: {
|
280
285
|
iss: string;
|
281
286
|
sub: string;
|
@@ -312,11 +317,6 @@ export declare const EntityStatement: z.ZodObject<{
|
|
312
317
|
trust_mark: string;
|
313
318
|
}[] | undefined;
|
314
319
|
};
|
315
|
-
header: {
|
316
|
-
alg: string;
|
317
|
-
kid: string;
|
318
|
-
typ: "entity-statement+jwt";
|
319
|
-
};
|
320
320
|
}>;
|
321
321
|
export type EntityConfigurationHeader = z.infer<typeof EntityConfigurationHeader>;
|
322
322
|
export declare const EntityConfigurationHeader: z.ZodObject<{
|
@@ -1132,6 +1132,11 @@ export declare const TrustAnchorEntityConfiguration: z.ZodObject<{
|
|
1132
1132
|
}>;
|
1133
1133
|
}, z.ZodTypeAny, "passthrough">>;
|
1134
1134
|
}, "strip", z.ZodTypeAny, {
|
1135
|
+
header: {
|
1136
|
+
alg: string;
|
1137
|
+
kid: string;
|
1138
|
+
typ: "entity-statement+jwt";
|
1139
|
+
};
|
1135
1140
|
payload: {
|
1136
1141
|
iss: string;
|
1137
1142
|
sub: string;
|
@@ -1188,12 +1193,12 @@ export declare const TrustAnchorEntityConfiguration: z.ZodObject<{
|
|
1188
1193
|
} & {
|
1189
1194
|
[k: string]: unknown;
|
1190
1195
|
};
|
1196
|
+
}, {
|
1191
1197
|
header: {
|
1192
1198
|
alg: string;
|
1193
1199
|
kid: string;
|
1194
1200
|
typ: "entity-statement+jwt";
|
1195
1201
|
};
|
1196
|
-
}, {
|
1197
1202
|
payload: {
|
1198
1203
|
iss: string;
|
1199
1204
|
sub: string;
|
@@ -1250,11 +1255,6 @@ export declare const TrustAnchorEntityConfiguration: z.ZodObject<{
|
|
1250
1255
|
} & {
|
1251
1256
|
[k: string]: unknown;
|
1252
1257
|
};
|
1253
|
-
header: {
|
1254
|
-
alg: string;
|
1255
|
-
kid: string;
|
1256
|
-
typ: "entity-statement+jwt";
|
1257
|
-
};
|
1258
1258
|
}>;
|
1259
1259
|
export type CredentialIssuerEntityConfiguration = z.infer<typeof CredentialIssuerEntityConfiguration>;
|
1260
1260
|
export declare const CredentialIssuerEntityConfiguration: z.ZodIntersection<z.ZodObject<{
|
@@ -2056,6 +2056,11 @@ export declare const CredentialIssuerEntityConfiguration: z.ZodIntersection<z.Zo
|
|
2056
2056
|
}>;
|
2057
2057
|
}, z.ZodTypeAny, "passthrough">>;
|
2058
2058
|
}, "strip", z.ZodTypeAny, {
|
2059
|
+
header: {
|
2060
|
+
alg: string;
|
2061
|
+
kid: string;
|
2062
|
+
typ: "entity-statement+jwt";
|
2063
|
+
};
|
2059
2064
|
payload: {
|
2060
2065
|
iss: string;
|
2061
2066
|
sub: string;
|
@@ -2112,12 +2117,12 @@ export declare const CredentialIssuerEntityConfiguration: z.ZodIntersection<z.Zo
|
|
2112
2117
|
} & {
|
2113
2118
|
[k: string]: unknown;
|
2114
2119
|
};
|
2120
|
+
}, {
|
2115
2121
|
header: {
|
2116
2122
|
alg: string;
|
2117
2123
|
kid: string;
|
2118
2124
|
typ: "entity-statement+jwt";
|
2119
2125
|
};
|
2120
|
-
}, {
|
2121
2126
|
payload: {
|
2122
2127
|
iss: string;
|
2123
2128
|
sub: string;
|
@@ -2174,11 +2179,6 @@ export declare const CredentialIssuerEntityConfiguration: z.ZodIntersection<z.Zo
|
|
2174
2179
|
} & {
|
2175
2180
|
[k: string]: unknown;
|
2176
2181
|
};
|
2177
|
-
header: {
|
2178
|
-
alg: string;
|
2179
|
-
kid: string;
|
2180
|
-
typ: "entity-statement+jwt";
|
2181
|
-
};
|
2182
2182
|
}>, z.ZodObject<{
|
2183
2183
|
payload: z.ZodObject<{
|
2184
2184
|
jwks: z.ZodObject<{
|
@@ -5368,6 +5368,11 @@ export declare const RelyingPartyEntityConfiguration: z.ZodIntersection<z.ZodObj
|
|
5368
5368
|
}>;
|
5369
5369
|
}, z.ZodTypeAny, "passthrough">>;
|
5370
5370
|
}, "strip", z.ZodTypeAny, {
|
5371
|
+
header: {
|
5372
|
+
alg: string;
|
5373
|
+
kid: string;
|
5374
|
+
typ: "entity-statement+jwt";
|
5375
|
+
};
|
5371
5376
|
payload: {
|
5372
5377
|
iss: string;
|
5373
5378
|
sub: string;
|
@@ -5424,12 +5429,12 @@ export declare const RelyingPartyEntityConfiguration: z.ZodIntersection<z.ZodObj
|
|
5424
5429
|
} & {
|
5425
5430
|
[k: string]: unknown;
|
5426
5431
|
};
|
5432
|
+
}, {
|
5427
5433
|
header: {
|
5428
5434
|
alg: string;
|
5429
5435
|
kid: string;
|
5430
5436
|
typ: "entity-statement+jwt";
|
5431
5437
|
};
|
5432
|
-
}, {
|
5433
5438
|
payload: {
|
5434
5439
|
iss: string;
|
5435
5440
|
sub: string;
|
@@ -5486,11 +5491,6 @@ export declare const RelyingPartyEntityConfiguration: z.ZodIntersection<z.ZodObj
|
|
5486
5491
|
} & {
|
5487
5492
|
[k: string]: unknown;
|
5488
5493
|
};
|
5489
|
-
header: {
|
5490
|
-
alg: string;
|
5491
|
-
kid: string;
|
5492
|
-
typ: "entity-statement+jwt";
|
5493
|
-
};
|
5494
5494
|
}>, z.ZodObject<{
|
5495
5495
|
payload: z.ZodObject<{
|
5496
5496
|
metadata: z.ZodObject<{
|
@@ -7246,6 +7246,11 @@ export declare const WalletProviderEntityConfiguration: z.ZodIntersection<z.ZodO
|
|
7246
7246
|
}>;
|
7247
7247
|
}, z.ZodTypeAny, "passthrough">>;
|
7248
7248
|
}, "strip", z.ZodTypeAny, {
|
7249
|
+
header: {
|
7250
|
+
alg: string;
|
7251
|
+
kid: string;
|
7252
|
+
typ: "entity-statement+jwt";
|
7253
|
+
};
|
7249
7254
|
payload: {
|
7250
7255
|
iss: string;
|
7251
7256
|
sub: string;
|
@@ -7302,12 +7307,12 @@ export declare const WalletProviderEntityConfiguration: z.ZodIntersection<z.ZodO
|
|
7302
7307
|
} & {
|
7303
7308
|
[k: string]: unknown;
|
7304
7309
|
};
|
7310
|
+
}, {
|
7305
7311
|
header: {
|
7306
7312
|
alg: string;
|
7307
7313
|
kid: string;
|
7308
7314
|
typ: "entity-statement+jwt";
|
7309
7315
|
};
|
7310
|
-
}, {
|
7311
7316
|
payload: {
|
7312
7317
|
iss: string;
|
7313
7318
|
sub: string;
|
@@ -7364,11 +7369,6 @@ export declare const WalletProviderEntityConfiguration: z.ZodIntersection<z.ZodO
|
|
7364
7369
|
} & {
|
7365
7370
|
[k: string]: unknown;
|
7366
7371
|
};
|
7367
|
-
header: {
|
7368
|
-
alg: string;
|
7369
|
-
kid: string;
|
7370
|
-
typ: "entity-statement+jwt";
|
7371
|
-
};
|
7372
7372
|
}>, z.ZodObject<{
|
7373
7373
|
payload: z.ZodObject<{
|
7374
7374
|
metadata: z.ZodObject<{
|
@@ -8788,6 +8788,11 @@ export declare const EntityConfiguration: z.ZodUnion<[z.ZodIntersection<z.ZodObj
|
|
8788
8788
|
}>;
|
8789
8789
|
}, z.ZodTypeAny, "passthrough">>;
|
8790
8790
|
}, "strip", z.ZodTypeAny, {
|
8791
|
+
header: {
|
8792
|
+
alg: string;
|
8793
|
+
kid: string;
|
8794
|
+
typ: "entity-statement+jwt";
|
8795
|
+
};
|
8791
8796
|
payload: {
|
8792
8797
|
iss: string;
|
8793
8798
|
sub: string;
|
@@ -8844,12 +8849,12 @@ export declare const EntityConfiguration: z.ZodUnion<[z.ZodIntersection<z.ZodObj
|
|
8844
8849
|
} & {
|
8845
8850
|
[k: string]: unknown;
|
8846
8851
|
};
|
8852
|
+
}, {
|
8847
8853
|
header: {
|
8848
8854
|
alg: string;
|
8849
8855
|
kid: string;
|
8850
8856
|
typ: "entity-statement+jwt";
|
8851
8857
|
};
|
8852
|
-
}, {
|
8853
8858
|
payload: {
|
8854
8859
|
iss: string;
|
8855
8860
|
sub: string;
|
@@ -8906,11 +8911,6 @@ export declare const EntityConfiguration: z.ZodUnion<[z.ZodIntersection<z.ZodObj
|
|
8906
8911
|
} & {
|
8907
8912
|
[k: string]: unknown;
|
8908
8913
|
};
|
8909
|
-
header: {
|
8910
|
-
alg: string;
|
8911
|
-
kid: string;
|
8912
|
-
typ: "entity-statement+jwt";
|
8913
|
-
};
|
8914
8914
|
}>, z.ZodObject<{
|
8915
8915
|
payload: z.ZodObject<{
|
8916
8916
|
metadata: z.ZodObject<{
|
@@ -10328,6 +10328,11 @@ export declare const EntityConfiguration: z.ZodUnion<[z.ZodIntersection<z.ZodObj
|
|
10328
10328
|
}>;
|
10329
10329
|
}, z.ZodTypeAny, "passthrough">>;
|
10330
10330
|
}, "strip", z.ZodTypeAny, {
|
10331
|
+
header: {
|
10332
|
+
alg: string;
|
10333
|
+
kid: string;
|
10334
|
+
typ: "entity-statement+jwt";
|
10335
|
+
};
|
10331
10336
|
payload: {
|
10332
10337
|
iss: string;
|
10333
10338
|
sub: string;
|
@@ -10384,12 +10389,12 @@ export declare const EntityConfiguration: z.ZodUnion<[z.ZodIntersection<z.ZodObj
|
|
10384
10389
|
} & {
|
10385
10390
|
[k: string]: unknown;
|
10386
10391
|
};
|
10392
|
+
}, {
|
10387
10393
|
header: {
|
10388
10394
|
alg: string;
|
10389
10395
|
kid: string;
|
10390
10396
|
typ: "entity-statement+jwt";
|
10391
10397
|
};
|
10392
|
-
}, {
|
10393
10398
|
payload: {
|
10394
10399
|
iss: string;
|
10395
10400
|
sub: string;
|
@@ -10446,11 +10451,6 @@ export declare const EntityConfiguration: z.ZodUnion<[z.ZodIntersection<z.ZodObj
|
|
10446
10451
|
} & {
|
10447
10452
|
[k: string]: unknown;
|
10448
10453
|
};
|
10449
|
-
header: {
|
10450
|
-
alg: string;
|
10451
|
-
kid: string;
|
10452
|
-
typ: "entity-statement+jwt";
|
10453
|
-
};
|
10454
10454
|
}>, z.ZodObject<{
|
10455
10455
|
payload: z.ZodObject<{
|
10456
10456
|
jwks: z.ZodObject<{
|
@@ -13638,6 +13638,11 @@ export declare const EntityConfiguration: z.ZodUnion<[z.ZodIntersection<z.ZodObj
|
|
13638
13638
|
}>;
|
13639
13639
|
}, z.ZodTypeAny, "passthrough">>;
|
13640
13640
|
}, "strip", z.ZodTypeAny, {
|
13641
|
+
header: {
|
13642
|
+
alg: string;
|
13643
|
+
kid: string;
|
13644
|
+
typ: "entity-statement+jwt";
|
13645
|
+
};
|
13641
13646
|
payload: {
|
13642
13647
|
iss: string;
|
13643
13648
|
sub: string;
|
@@ -13694,12 +13699,12 @@ export declare const EntityConfiguration: z.ZodUnion<[z.ZodIntersection<z.ZodObj
|
|
13694
13699
|
} & {
|
13695
13700
|
[k: string]: unknown;
|
13696
13701
|
};
|
13702
|
+
}, {
|
13697
13703
|
header: {
|
13698
13704
|
alg: string;
|
13699
13705
|
kid: string;
|
13700
13706
|
typ: "entity-statement+jwt";
|
13701
13707
|
};
|
13702
|
-
}, {
|
13703
13708
|
payload: {
|
13704
13709
|
iss: string;
|
13705
13710
|
sub: string;
|
@@ -13756,11 +13761,6 @@ export declare const EntityConfiguration: z.ZodUnion<[z.ZodIntersection<z.ZodObj
|
|
13756
13761
|
} & {
|
13757
13762
|
[k: string]: unknown;
|
13758
13763
|
};
|
13759
|
-
header: {
|
13760
|
-
alg: string;
|
13761
|
-
kid: string;
|
13762
|
-
typ: "entity-statement+jwt";
|
13763
|
-
};
|
13764
13764
|
}>, z.ZodIntersection<z.ZodObject<{
|
13765
13765
|
header: z.ZodObject<{
|
13766
13766
|
typ: z.ZodLiteral<"entity-statement+jwt">;
|
@@ -14560,6 +14560,11 @@ export declare const EntityConfiguration: z.ZodUnion<[z.ZodIntersection<z.ZodObj
|
|
14560
14560
|
}>;
|
14561
14561
|
}, z.ZodTypeAny, "passthrough">>;
|
14562
14562
|
}, "strip", z.ZodTypeAny, {
|
14563
|
+
header: {
|
14564
|
+
alg: string;
|
14565
|
+
kid: string;
|
14566
|
+
typ: "entity-statement+jwt";
|
14567
|
+
};
|
14563
14568
|
payload: {
|
14564
14569
|
iss: string;
|
14565
14570
|
sub: string;
|
@@ -14616,12 +14621,12 @@ export declare const EntityConfiguration: z.ZodUnion<[z.ZodIntersection<z.ZodObj
|
|
14616
14621
|
} & {
|
14617
14622
|
[k: string]: unknown;
|
14618
14623
|
};
|
14624
|
+
}, {
|
14619
14625
|
header: {
|
14620
14626
|
alg: string;
|
14621
14627
|
kid: string;
|
14622
14628
|
typ: "entity-statement+jwt";
|
14623
14629
|
};
|
14624
|
-
}, {
|
14625
14630
|
payload: {
|
14626
14631
|
iss: string;
|
14627
14632
|
sub: string;
|
@@ -14678,11 +14683,6 @@ export declare const EntityConfiguration: z.ZodUnion<[z.ZodIntersection<z.ZodObj
|
|
14678
14683
|
} & {
|
14679
14684
|
[k: string]: unknown;
|
14680
14685
|
};
|
14681
|
-
header: {
|
14682
|
-
alg: string;
|
14683
|
-
kid: string;
|
14684
|
-
typ: "entity-statement+jwt";
|
14685
|
-
};
|
14686
14686
|
}>, z.ZodObject<{
|
14687
14687
|
payload: z.ZodObject<{
|
14688
14688
|
metadata: z.ZodObject<{
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import type { JWK, JWTDecodeResult } from "../utils/jwk";
|
2
|
+
import type { TrustAnchorEntityConfiguration } from "./types";
|
2
3
|
export type ParsedToken = {
|
3
4
|
header: JWTDecodeResult["protectedHeader"];
|
4
5
|
payload: JWTDecodeResult["payload"];
|
@@ -9,4 +10,13 @@ export declare const verify: (token: string, kid: string, jwks: JWK[]) => Promis
|
|
9
10
|
* It seems like typescript can't correctly infer the return type of the function.
|
10
11
|
*/
|
11
12
|
export declare const decode: (token: string) => ParsedToken;
|
13
|
+
/**
|
14
|
+
* Extracts the X.509 Trust Anchor certificate (Base64 encoded) from the
|
15
|
+
* Trust Anchor's Entity Configuration.
|
16
|
+
*
|
17
|
+
* @param trustAnchorEntity The entity configuration of the known trust anchor.
|
18
|
+
* @returns The Base64 encoded X.509 certificate string.
|
19
|
+
* @throws {FederationError} If the certificate cannot be derived.
|
20
|
+
*/
|
21
|
+
export declare function getTrustAnchorX509Certificate(trustAnchorEntity: TrustAnchorEntityConfiguration): string;
|
12
22
|
//# sourceMappingURL=utils.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/trust/utils.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,GAAG,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEzD,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,eAAe,CAAC,iBAAiB,CAAC,CAAC;IAC3C,OAAO,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;CACrC,CAAC;AAIF,eAAO,MAAM,MAAM,UACV,MAAM,OACR,MAAM,QACL,GAAG,EAAE,KACV,QAAQ,WAAW,CAOrB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,MAAM,UAAW,MAAM,KAAG,WAGtC,CAAC"}
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/trust/utils.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,GAAG,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEzD,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,SAAS,CAAC;AAE9D,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,eAAe,CAAC,iBAAiB,CAAC,CAAC;IAC3C,OAAO,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;CACrC,CAAC;AAIF,eAAO,MAAM,MAAM,UACV,MAAM,OACR,MAAM,QACL,GAAG,EAAE,KACV,QAAQ,WAAW,CAOrB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,MAAM,UAAW,MAAM,KAAG,WAGtC,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,6BAA6B,CAC3C,iBAAiB,EAAE,8BAA8B,GAChD,MAAM,CAqBR"}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
import { TrustAnchorEntityConfiguration } from "./types";
|
2
|
+
import { type ParsedToken } from "./utils";
|
3
|
+
import { type X509CertificateOptions } from "@pagopa/io-react-native-crypto";
|
4
|
+
/**
|
5
|
+
* Validates a provided trust chain against a known trust anchor, including X.509 certificate checks.
|
6
|
+
*
|
7
|
+
* @param trustAnchorEntity The entity configuration of the known trust anchor (for JWT validation).
|
8
|
+
* @param chain The chain of statements to be validated.
|
9
|
+
* @param x509Options Options for X.509 certificate validation.
|
10
|
+
* @returns The list of parsed tokens representing the chain.
|
11
|
+
* @throws {FederationError} If the chain is not valid (JWT or X.509). Specific errors like TrustChainEmptyError, X509ValidationError may be thrown.
|
12
|
+
*/
|
13
|
+
export declare function validateTrustChain(trustAnchorEntity: TrustAnchorEntityConfiguration, chain: string[], x509Options: X509CertificateOptions): Promise<ParsedToken[]>;
|
14
|
+
/**
|
15
|
+
* Given a trust chain, obtain a new trust chain by fetching each element's fresh version
|
16
|
+
*
|
17
|
+
* @param chain The original chain
|
18
|
+
* @param appFetch (optional) fetch api implementation
|
19
|
+
* @returns A list of signed token that represent the trust chain, in the same order of the provided chain
|
20
|
+
* @throws {FederationError} If the chain is not valid
|
21
|
+
*/
|
22
|
+
export declare function renewTrustChain(chain: string[], appFetch?: GlobalFetch["fetch"]): Promise<string[]>;
|
23
|
+
/**
|
24
|
+
* Verify a given trust chain is actually valid.
|
25
|
+
* It can handle fast chain renewal, which means we try to fetch a fresh version of each statement.
|
26
|
+
*
|
27
|
+
* @param trustAnchorEntity The entity configuration of the known trust anchor
|
28
|
+
* @param chain The chain of statements to be validated
|
29
|
+
* @param x509Options Options for the verification process
|
30
|
+
* @param appFetch (optional) fetch api implementation
|
31
|
+
* @param renewOnFail Whether to attempt to renew the trust chain if the initial validation fails
|
32
|
+
* @returns The result of the chain validation
|
33
|
+
* @throws {FederationError} If the chain is not valid
|
34
|
+
*/
|
35
|
+
export declare function verifyTrustChain(trustAnchorEntity: TrustAnchorEntityConfiguration, chain: string[], x509Options?: X509CertificateOptions, { appFetch, renewOnFail, }?: {
|
36
|
+
appFetch?: GlobalFetch["fetch"];
|
37
|
+
renewOnFail?: boolean;
|
38
|
+
}): Promise<ReturnType<typeof validateTrustChain>>;
|
39
|
+
//# sourceMappingURL=verify-chain.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"verify-chain.d.ts","sourceRoot":"","sources":["../../../src/trust/verify-chain.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,8BAA8B,EAC/B,MAAM,SAAS,CAAC;AAGjB,OAAO,EAGL,KAAK,WAAW,EAEjB,MAAM,SAAS,CAAC;AAUjB,OAAO,EAGL,KAAK,sBAAsB,EAC5B,MAAM,gCAAgC,CAAC;AAiBxC;;;;;;;;GAQG;AACH,wBAAsB,kBAAkB,CACtC,iBAAiB,EAAE,8BAA8B,EACjD,KAAK,EAAE,MAAM,EAAE,EACf,WAAW,EAAE,sBAAsB,GAClC,OAAO,CAAC,WAAW,EAAE,CAAC,CAkHxB;AAED;;;;;;;GAOG;AACH,wBAAsB,eAAe,CACnC,KAAK,EAAE,MAAM,EAAE,EACf,QAAQ,GAAE,WAAW,CAAC,OAAO,CAAS,GACrC,OAAO,CAAC,MAAM,EAAE,CAAC,CA8CnB;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,gBAAgB,CACpC,iBAAiB,EAAE,8BAA8B,EACjD,KAAK,EAAE,MAAM,EAAE,EACf,WAAW,GAAE,sBAIZ,EACD,EACE,QAAgB,EAChB,WAAkB,GACnB,GAAE;IAAE,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAAC,WAAW,CAAC,EAAE,OAAO,CAAA;CAAO,GACjE,OAAO,CAAC,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC,CAWhD"}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import type { ProblemDetail } from "../client/generated/wallet-provider";
|
2
|
-
import type
|
3
|
-
import
|
2
|
+
import { type IssuerResponseErrorCode, IssuerResponseErrorCodes, type RelyingPartyResponseErrorCode, RelyingPartyResponseErrorCodes, type WalletProviderResponseErrorCode, WalletProviderResponseErrorCodes } from "./error-codes";
|
3
|
+
import type { CredentialIssuerEntityConfiguration } from "../trust/types";
|
4
4
|
export { IssuerResponseErrorCodes, WalletProviderResponseErrorCodes, RelyingPartyResponseErrorCodes, };
|
5
5
|
type GenericErrorReason = string | Record<string, unknown>;
|
6
6
|
/**
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/utils/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,KAAK,
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/utils/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EACL,KAAK,uBAAuB,EAC5B,wBAAwB,EACxB,KAAK,6BAA6B,EAClC,8BAA8B,EAC9B,KAAK,+BAA+B,EACpC,gCAAgC,EACjC,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,gBAAgB,CAAC;AAE1E,OAAO,EACL,wBAAwB,EACxB,gCAAgC,EAChC,8BAA8B,GAC/B,CAAC;AAGF,KAAK,kBAAkB,GAAG,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE3D;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,UAClB,OAAO,MAAM,EAAE,kBAAkB,GAAG,MAAM,GAAG,MAAM,MAAM,CAAC,GAAG,SAAS,CAAC,KAC7E,MASW,CAAC;AAEf;;;;;;;;;;GAUG;AACH,qBAAa,aAAc,SAAQ,KAAK;IACtC,6DAA6D;IAC7D,IAAI,EAAE,MAAM,CAA2B;gBAE3B,OAAO,CAAC,EAAE,MAAM;CAI7B;AAED;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,aAAa;IACjD,IAAI,SAAqC;IAEzC,iDAAiD;IACjD,KAAK,EAAE,MAAM,CAAC;IAEd,8CAA8C;IAC9C,MAAM,EAAE,MAAM,CAAC;gBAEH,EACV,OAAO,EACP,KAAqB,EACrB,MAAsB,GACv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,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;IAKjD,SAAS,CAAC,aAAa,EAAE,yBAAyB;CAUnD"}
|
@@ -246,6 +246,15 @@ export declare const WalletInstanceAttestationRequestJwt: z.ZodObject<{
|
|
246
246
|
integrity_assertion: string;
|
247
247
|
}>>;
|
248
248
|
}, "strip", z.ZodTypeAny, {
|
249
|
+
header: {
|
250
|
+
alg: string;
|
251
|
+
kid: string;
|
252
|
+
typ: string;
|
253
|
+
x5c?: string[] | undefined;
|
254
|
+
trust_chain?: string[] | undefined;
|
255
|
+
} & {
|
256
|
+
typ: "wp-war+jwt";
|
257
|
+
};
|
249
258
|
payload: {
|
250
259
|
iss: string;
|
251
260
|
iat: number;
|
@@ -285,6 +294,7 @@ export declare const WalletInstanceAttestationRequestJwt: z.ZodObject<{
|
|
285
294
|
hardware_signature: string;
|
286
295
|
integrity_assertion: string;
|
287
296
|
};
|
297
|
+
}, {
|
288
298
|
header: {
|
289
299
|
alg: string;
|
290
300
|
kid: string;
|
@@ -294,7 +304,6 @@ export declare const WalletInstanceAttestationRequestJwt: z.ZodObject<{
|
|
294
304
|
} & {
|
295
305
|
typ: "wp-war+jwt";
|
296
306
|
};
|
297
|
-
}, {
|
298
307
|
payload: {
|
299
308
|
iss: string;
|
300
309
|
iat: number;
|
@@ -334,15 +343,6 @@ export declare const WalletInstanceAttestationRequestJwt: z.ZodObject<{
|
|
334
343
|
hardware_signature: string;
|
335
344
|
integrity_assertion: string;
|
336
345
|
};
|
337
|
-
header: {
|
338
|
-
alg: string;
|
339
|
-
kid: string;
|
340
|
-
typ: string;
|
341
|
-
x5c?: string[] | undefined;
|
342
|
-
trust_chain?: string[] | undefined;
|
343
|
-
} & {
|
344
|
-
typ: "wp-war+jwt";
|
345
|
-
};
|
346
346
|
}>;
|
347
347
|
export type WalletInstanceAttestationJwt = z.infer<typeof WalletInstanceAttestationJwt>;
|
348
348
|
export declare const WalletInstanceAttestationJwt: z.ZodObject<{
|
@@ -591,6 +591,16 @@ export declare const WalletInstanceAttestationJwt: z.ZodObject<{
|
|
591
591
|
wallet_name?: string | undefined;
|
592
592
|
}>>;
|
593
593
|
}, "strip", z.ZodTypeAny, {
|
594
|
+
header: {
|
595
|
+
alg: string;
|
596
|
+
kid: string;
|
597
|
+
typ: string;
|
598
|
+
x5c?: string[] | undefined;
|
599
|
+
trust_chain?: string[] | undefined;
|
600
|
+
} & {
|
601
|
+
typ: "oauth-client-attestation+jwt";
|
602
|
+
trust_chain: string[];
|
603
|
+
};
|
594
604
|
payload: {
|
595
605
|
iss: string;
|
596
606
|
iat: number;
|
@@ -629,6 +639,7 @@ export declare const WalletInstanceAttestationJwt: z.ZodObject<{
|
|
629
639
|
wallet_link?: string | undefined;
|
630
640
|
wallet_name?: string | undefined;
|
631
641
|
};
|
642
|
+
}, {
|
632
643
|
header: {
|
633
644
|
alg: string;
|
634
645
|
kid: string;
|
@@ -639,7 +650,6 @@ export declare const WalletInstanceAttestationJwt: z.ZodObject<{
|
|
639
650
|
typ: "oauth-client-attestation+jwt";
|
640
651
|
trust_chain: string[];
|
641
652
|
};
|
642
|
-
}, {
|
643
653
|
payload: {
|
644
654
|
iss: string;
|
645
655
|
iat: number;
|
@@ -678,16 +688,6 @@ export declare const WalletInstanceAttestationJwt: z.ZodObject<{
|
|
678
688
|
wallet_link?: string | undefined;
|
679
689
|
wallet_name?: string | undefined;
|
680
690
|
};
|
681
|
-
header: {
|
682
|
-
alg: string;
|
683
|
-
kid: string;
|
684
|
-
typ: string;
|
685
|
-
x5c?: string[] | undefined;
|
686
|
-
trust_chain?: string[] | undefined;
|
687
|
-
} & {
|
688
|
-
typ: "oauth-client-attestation+jwt";
|
689
|
-
trust_chain: string[];
|
690
|
-
};
|
691
691
|
}>;
|
692
692
|
export type WalletAttestationResponse = z.infer<typeof WalletAttestationResponse>;
|
693
693
|
export declare const WalletAttestationResponse: z.ZodObject<{
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@pagopa/io-react-native-wallet",
|
3
|
-
"version": "2.0.0-next.
|
3
|
+
"version": "2.0.0-next.2",
|
4
4
|
"description": "Provide data structures, helpers and API for IO Wallet",
|
5
5
|
"main": "lib/commonjs/index",
|
6
6
|
"module": "lib/module/index",
|
@@ -53,7 +53,7 @@
|
|
53
53
|
"registry": "https://registry.npmjs.org/"
|
54
54
|
},
|
55
55
|
"devDependencies": {
|
56
|
-
"@pagopa/io-react-native-crypto": "^
|
56
|
+
"@pagopa/io-react-native-crypto": "^1.2.2",
|
57
57
|
"@pagopa/io-react-native-jwt": "^2.1.0",
|
58
58
|
"@react-native/eslint-config": "^0.75.5",
|
59
59
|
"@rushstack/eslint-patch": "^1.3.2",
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import { getCredentialIssuerEntityConfiguration } from "../../trust";
|
2
1
|
import { CredentialIssuerEntityConfiguration } from "../../trust/types";
|
3
2
|
import type { StartFlow } from "./01-start-flow";
|
4
3
|
import type { Out } from "../../utils/misc";
|
4
|
+
import { getCredentialIssuerEntityConfiguration } from "../../trust/build-chain";
|
5
5
|
|
6
6
|
export type EvaluateIssuerTrust = (
|
7
7
|
issuerUrl: Out<StartFlow>["issuerUrl"],
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import { getRelyingPartyEntityConfiguration } from "../../trust";
|
2
1
|
import { RelyingPartyEntityConfiguration } from "../../trust/types";
|
3
2
|
import type { StartFlow } from "../issuance/01-start-flow";
|
4
3
|
import type { Out } from "../../utils/misc";
|
4
|
+
import { getRelyingPartyEntityConfiguration } from "../../trust/build-chain";
|
5
5
|
|
6
6
|
export type EvaluateRelyingPartyTrust = (
|
7
7
|
rpUrl: Out<StartFlow>["issuerUrl"],
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { decode as decodeJwt, verify } from "@pagopa/io-react-native-jwt";
|
2
|
-
import type { RelyingPartyEntityConfiguration } from "../../trust";
|
3
2
|
import { InvalidRequestObjectError } from "./errors";
|
4
3
|
import { RequestObject } from "./types";
|
5
4
|
import { getJwksFromConfig } from "./04-retrieve-rp-jwks";
|
5
|
+
import type { RelyingPartyEntityConfiguration } from "../../trust/types";
|
6
6
|
|
7
7
|
export type VerifyRequestObject = (
|
8
8
|
requestObjectEncodedJwt: string,
|
@@ -1,24 +1,24 @@
|
|
1
1
|
import { EncryptJwe } from "@pagopa/io-react-native-jwt";
|
2
2
|
import uuid from "react-native-uuid";
|
3
|
-
import {
|
3
|
+
import { type FetchJwks, getJwksFromConfig } from "./04-retrieve-rp-jwks";
|
4
4
|
import type { VerifyRequestObject } from "./05-verify-request-object";
|
5
5
|
import { NoSuitableKeysFoundInEntityConfiguration } from "./errors";
|
6
6
|
import { hasStatusOrThrow, type Out } from "../../utils/misc";
|
7
7
|
import {
|
8
|
-
type RemotePresentation,
|
9
8
|
DirectAuthorizationBodyPayload,
|
10
9
|
ErrorResponse,
|
11
10
|
type LegacyRemotePresentation,
|
11
|
+
type RemotePresentation,
|
12
12
|
} from "./types";
|
13
13
|
import * as z from "zod";
|
14
14
|
import type { JWK } from "../../utils/jwk";
|
15
|
-
import type { RelyingPartyEntityConfiguration } from "../../trust";
|
16
15
|
import {
|
17
16
|
RelyingPartyResponseError,
|
17
|
+
RelyingPartyResponseErrorCodes,
|
18
18
|
ResponseErrorBuilder,
|
19
19
|
UnexpectedStatusCodeError,
|
20
|
-
RelyingPartyResponseErrorCodes,
|
21
20
|
} from "../../utils/errors";
|
21
|
+
import type { RelyingPartyEntityConfiguration } from "../../trust/types";
|
22
22
|
|
23
23
|
export type AuthorizationResponse = z.infer<typeof AuthorizationResponse>;
|
24
24
|
export const AuthorizationResponse = z.object({
|