@pagopa/io-react-native-wallet 2.2.0 → 2.4.0
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/README.md +4 -3
- package/lib/commonjs/credential/index.js +3 -1
- package/lib/commonjs/credential/index.js.map +1 -1
- package/lib/commonjs/credential/issuance/03-start-user-authorization.js +24 -6
- package/lib/commonjs/credential/issuance/03-start-user-authorization.js.map +1 -1
- package/lib/commonjs/credential/issuance/04-complete-user-authorization.js +26 -2
- package/lib/commonjs/credential/issuance/04-complete-user-authorization.js.map +1 -1
- package/lib/commonjs/credential/issuance/README.md +155 -18
- package/lib/commonjs/credential/issuance/index.js +9 -1
- package/lib/commonjs/credential/issuance/index.js.map +1 -1
- package/lib/commonjs/credential/issuance/mrtd-pop/01-verify-and-parse-challenge-info.js +57 -0
- package/lib/commonjs/credential/issuance/mrtd-pop/01-verify-and-parse-challenge-info.js.map +1 -0
- package/lib/commonjs/credential/issuance/mrtd-pop/02-init-challenge.js +61 -0
- package/lib/commonjs/credential/issuance/mrtd-pop/02-init-challenge.js.map +1 -0
- package/lib/commonjs/credential/issuance/mrtd-pop/03-validate-challenge.js +95 -0
- package/lib/commonjs/credential/issuance/mrtd-pop/03-validate-challenge.js.map +1 -0
- package/lib/commonjs/credential/issuance/mrtd-pop/README.md +92 -0
- package/lib/commonjs/credential/issuance/mrtd-pop/index.js +33 -0
- package/lib/commonjs/credential/issuance/mrtd-pop/index.js.map +1 -0
- package/lib/commonjs/credential/issuance/mrtd-pop/types.js +57 -0
- package/lib/commonjs/credential/issuance/mrtd-pop/types.js.map +1 -0
- package/lib/commonjs/credential/offer/01-start-flow.js +75 -0
- package/lib/commonjs/credential/offer/01-start-flow.js.map +1 -0
- package/lib/commonjs/credential/offer/02-fetch-credential-offer.js +45 -0
- package/lib/commonjs/credential/offer/02-fetch-credential-offer.js.map +1 -0
- package/lib/commonjs/credential/offer/README.md +174 -0
- package/lib/commonjs/credential/offer/errors.js +22 -0
- package/lib/commonjs/credential/offer/errors.js.map +1 -0
- package/lib/commonjs/credential/offer/index.js +25 -0
- package/lib/commonjs/credential/offer/index.js.map +1 -0
- package/lib/commonjs/credential/offer/types.js +51 -0
- package/lib/commonjs/credential/offer/types.js.map +1 -0
- package/lib/commonjs/credential/presentation/01-start-flow.js +1 -1
- package/lib/commonjs/credentials-catalogue/README.md +15 -0
- package/lib/commonjs/credentials-catalogue/fetch-and-parse-catalogue.js +42 -0
- package/lib/commonjs/credentials-catalogue/fetch-and-parse-catalogue.js.map +1 -0
- package/lib/commonjs/credentials-catalogue/index.js +13 -0
- package/lib/commonjs/credentials-catalogue/index.js.map +1 -0
- package/lib/commonjs/credentials-catalogue/types.js +99 -0
- package/lib/commonjs/credentials-catalogue/types.js.map +1 -0
- package/lib/commonjs/index.js +3 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/utils/auth.js +9 -1
- package/lib/commonjs/utils/auth.js.map +1 -1
- package/lib/commonjs/utils/par.js +7 -2
- package/lib/commonjs/utils/par.js.map +1 -1
- package/lib/commonjs/utils/zod.js +28 -0
- package/lib/commonjs/utils/zod.js.map +1 -0
- package/lib/module/credential/index.js +2 -1
- package/lib/module/credential/index.js.map +1 -1
- package/lib/module/credential/issuance/03-start-user-authorization.js +24 -6
- package/lib/module/credential/issuance/03-start-user-authorization.js.map +1 -1
- package/lib/module/credential/issuance/04-complete-user-authorization.js +25 -2
- package/lib/module/credential/issuance/04-complete-user-authorization.js.map +1 -1
- package/lib/module/credential/issuance/README.md +155 -18
- package/lib/module/credential/issuance/index.js +3 -2
- package/lib/module/credential/issuance/index.js.map +1 -1
- package/lib/module/credential/issuance/mrtd-pop/01-verify-and-parse-challenge-info.js +50 -0
- package/lib/module/credential/issuance/mrtd-pop/01-verify-and-parse-challenge-info.js.map +1 -0
- package/lib/module/credential/issuance/mrtd-pop/02-init-challenge.js +52 -0
- package/lib/module/credential/issuance/mrtd-pop/02-init-challenge.js.map +1 -0
- package/lib/module/credential/issuance/mrtd-pop/03-validate-challenge.js +85 -0
- package/lib/module/credential/issuance/mrtd-pop/03-validate-challenge.js.map +1 -0
- package/lib/module/credential/issuance/mrtd-pop/README.md +92 -0
- package/lib/module/credential/issuance/mrtd-pop/index.js +5 -0
- package/lib/module/credential/issuance/mrtd-pop/index.js.map +1 -0
- package/lib/module/credential/issuance/mrtd-pop/types.js +46 -0
- package/lib/module/credential/issuance/mrtd-pop/types.js.map +1 -0
- package/lib/module/credential/offer/01-start-flow.js +66 -0
- package/lib/module/credential/offer/01-start-flow.js.map +1 -0
- package/lib/module/credential/offer/02-fetch-credential-offer.js +38 -0
- package/lib/module/credential/offer/02-fetch-credential-offer.js.map +1 -0
- package/lib/module/credential/offer/README.md +174 -0
- package/lib/module/credential/offer/errors.js +14 -0
- package/lib/module/credential/offer/errors.js.map +1 -0
- package/lib/module/credential/offer/index.js +5 -0
- package/lib/module/credential/offer/index.js.map +1 -0
- package/lib/module/credential/offer/types.js +41 -0
- package/lib/module/credential/offer/types.js.map +1 -0
- package/lib/module/credential/presentation/01-start-flow.js +1 -1
- package/lib/module/credentials-catalogue/README.md +15 -0
- package/lib/module/credentials-catalogue/fetch-and-parse-catalogue.js +35 -0
- package/lib/module/credentials-catalogue/fetch-and-parse-catalogue.js.map +1 -0
- package/lib/module/credentials-catalogue/index.js +2 -0
- package/lib/module/credentials-catalogue/index.js.map +1 -0
- package/lib/module/credentials-catalogue/types.js +89 -0
- package/lib/module/credentials-catalogue/types.js.map +1 -0
- package/lib/module/index.js +2 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils/auth.js +8 -0
- package/lib/module/utils/auth.js.map +1 -1
- package/lib/module/utils/par.js +7 -2
- package/lib/module/utils/par.js.map +1 -1
- package/lib/module/utils/zod.js +20 -0
- package/lib/module/utils/zod.js.map +1 -0
- package/lib/typescript/credential/index.d.ts +2 -1
- package/lib/typescript/credential/index.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/01-start-flow.d.ts +1 -1
- package/lib/typescript/credential/issuance/03-start-user-authorization.d.ts +14 -4
- package/lib/typescript/credential/issuance/03-start-user-authorization.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts +9 -1
- package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/index.d.ts +4 -3
- package/lib/typescript/credential/issuance/index.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/mrtd-pop/01-verify-and-parse-challenge-info.d.ts +25 -0
- package/lib/typescript/credential/issuance/mrtd-pop/01-verify-and-parse-challenge-info.d.ts.map +1 -0
- package/lib/typescript/credential/issuance/mrtd-pop/02-init-challenge.d.ts +23 -0
- package/lib/typescript/credential/issuance/mrtd-pop/02-init-challenge.d.ts.map +1 -0
- package/lib/typescript/credential/issuance/mrtd-pop/03-validate-challenge.d.ts +39 -0
- package/lib/typescript/credential/issuance/mrtd-pop/03-validate-challenge.d.ts.map +1 -0
- package/lib/typescript/credential/issuance/mrtd-pop/index.d.ts +7 -0
- package/lib/typescript/credential/issuance/mrtd-pop/index.d.ts.map +1 -0
- package/lib/typescript/credential/issuance/mrtd-pop/types.d.ts +201 -0
- package/lib/typescript/credential/issuance/mrtd-pop/types.d.ts.map +1 -0
- package/lib/typescript/credential/offer/01-start-flow.d.ts +172 -0
- package/lib/typescript/credential/offer/01-start-flow.d.ts.map +1 -0
- package/lib/typescript/credential/offer/02-fetch-credential-offer.d.ts +20 -0
- package/lib/typescript/credential/offer/02-fetch-credential-offer.d.ts.map +1 -0
- package/lib/typescript/credential/offer/errors.d.ts +10 -0
- package/lib/typescript/credential/offer/errors.d.ts.map +1 -0
- package/lib/typescript/credential/offer/index.d.ts +7 -0
- package/lib/typescript/credential/offer/index.d.ts.map +1 -0
- package/lib/typescript/credential/offer/types.d.ts +264 -0
- package/lib/typescript/credential/offer/types.d.ts.map +1 -0
- package/lib/typescript/credential/presentation/01-start-flow.d.ts +1 -1
- package/lib/typescript/credentials-catalogue/fetch-and-parse-catalogue.d.ts +15 -0
- package/lib/typescript/credentials-catalogue/fetch-and-parse-catalogue.d.ts.map +1 -0
- package/lib/typescript/credentials-catalogue/index.d.ts +3 -0
- package/lib/typescript/credentials-catalogue/index.d.ts.map +1 -0
- package/lib/typescript/credentials-catalogue/types.d.ts +844 -0
- package/lib/typescript/credentials-catalogue/types.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +2 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/utils/auth.d.ts +11 -0
- package/lib/typescript/utils/auth.d.ts.map +1 -1
- package/lib/typescript/utils/par.d.ts +34 -4
- package/lib/typescript/utils/par.d.ts.map +1 -1
- package/lib/typescript/utils/zod.d.ts +15 -0
- package/lib/typescript/utils/zod.d.ts.map +1 -0
- package/package.json +21 -2
- package/src/credential/index.ts +2 -1
- package/src/credential/issuance/01-start-flow.ts +1 -1
- package/src/credential/issuance/03-start-user-authorization.ts +30 -7
- package/src/credential/issuance/04-complete-user-authorization.ts +43 -1
- package/src/credential/issuance/README.md +155 -18
- package/src/credential/issuance/index.ts +7 -1
- package/src/credential/issuance/mrtd-pop/01-verify-and-parse-challenge-info.ts +70 -0
- package/src/credential/issuance/mrtd-pop/02-init-challenge.ts +82 -0
- package/src/credential/issuance/mrtd-pop/03-validate-challenge.ts +140 -0
- package/src/credential/issuance/mrtd-pop/README.md +92 -0
- package/src/credential/issuance/mrtd-pop/index.ts +27 -0
- package/src/credential/issuance/mrtd-pop/types.ts +65 -0
- package/src/credential/offer/01-start-flow.ts +89 -0
- package/src/credential/offer/02-fetch-credential-offer.ts +54 -0
- package/src/credential/offer/README.md +174 -0
- package/src/credential/offer/errors.ts +17 -0
- package/src/credential/offer/index.ts +16 -0
- package/src/credential/offer/types.ts +59 -0
- package/src/credential/presentation/01-start-flow.ts +1 -1
- package/src/credentials-catalogue/README.md +15 -0
- package/src/credentials-catalogue/fetch-and-parse-catalogue.ts +54 -0
- package/src/credentials-catalogue/index.ts +2 -0
- package/src/credentials-catalogue/types.ts +97 -0
- package/src/index.ts +2 -0
- package/src/utils/auth.ts +12 -0
- package/src/utils/par.ts +12 -4
- package/src/utils/zod.ts +28 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { decode as decodeJwt, verify } from "@pagopa/io-react-native-jwt";
|
|
2
|
+
import { hasStatusOrThrow } from "../utils/misc";
|
|
3
|
+
import { IoWalletError } from "../utils/errors";
|
|
4
|
+
import { DigitalCredentialsCatalogue } from "./types";
|
|
5
|
+
import { getTrustAnchorEntityConfiguration } from "../trust/build-chain";
|
|
6
|
+
/**
|
|
7
|
+
* Fetch and parse the Digital Credential Catalogue from the Trust Anchor.
|
|
8
|
+
* The catalogue's JWT signature is verified against the Trust Anchor's JWKs.
|
|
9
|
+
*
|
|
10
|
+
* @param trustAnchorUrl Base URL of the Trust Anchor
|
|
11
|
+
* @param context.appFetch (optional) fetch API implementation. Default: built-in fetch
|
|
12
|
+
* @returns The Digital Credential Catalogue payload
|
|
13
|
+
*/
|
|
14
|
+
export const fetchAndParseCatalogue = async function (trustAnchorBaseUrl) {
|
|
15
|
+
let {
|
|
16
|
+
appFetch = fetch
|
|
17
|
+
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
18
|
+
const trustAnchorConfig = await getTrustAnchorEntityConfiguration(trustAnchorBaseUrl);
|
|
19
|
+
const responseText = await appFetch(`${trustAnchorConfig.payload.sub}/.well-known/credential-catalogue`, {
|
|
20
|
+
method: "GET"
|
|
21
|
+
}).then(hasStatusOrThrow(200)).then(res => res.text());
|
|
22
|
+
const responseJwt = decodeJwt(responseText);
|
|
23
|
+
const catalogueKid = responseJwt.protectedHeader.kid;
|
|
24
|
+
const trustAnchorJwk = trustAnchorConfig.payload.jwks.keys.find(jwk => jwk.kid === catalogueKid);
|
|
25
|
+
if (!trustAnchorJwk) {
|
|
26
|
+
throw new IoWalletError(`Could not find JWK with kid ${catalogueKid} in Trust Anchor's Entity Configuration`);
|
|
27
|
+
}
|
|
28
|
+
await verify(responseText, trustAnchorJwk);
|
|
29
|
+
const parsedDigitalCredentialsCatalogue = DigitalCredentialsCatalogue.parse({
|
|
30
|
+
header: responseJwt.protectedHeader,
|
|
31
|
+
payload: responseJwt.payload
|
|
32
|
+
});
|
|
33
|
+
return parsedDigitalCredentialsCatalogue.payload;
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=fetch-and-parse-catalogue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["decode","decodeJwt","verify","hasStatusOrThrow","IoWalletError","DigitalCredentialsCatalogue","getTrustAnchorEntityConfiguration","fetchAndParseCatalogue","trustAnchorBaseUrl","appFetch","fetch","arguments","length","undefined","trustAnchorConfig","responseText","payload","sub","method","then","res","text","responseJwt","catalogueKid","protectedHeader","kid","trustAnchorJwk","jwks","keys","find","jwk","parsedDigitalCredentialsCatalogue","parse","header"],"sourceRoot":"../../../src","sources":["credentials-catalogue/fetch-and-parse-catalogue.ts"],"mappings":"AAAA,SAASA,MAAM,IAAIC,SAAS,EAAEC,MAAM,QAAQ,6BAA6B;AACzE,SAASC,gBAAgB,QAAQ,eAAe;AAChD,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,2BAA2B,QAAQ,SAAS;AACrD,SAASC,iCAAiC,QAAQ,sBAAsB;AAMxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,sBAAsB,GAAG,eAAAA,CACpCC,kBAA0B,EAE0B;EAAA,IADpD;IAAEC,QAAQ,GAAGC;EAA2B,CAAC,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAE9C,MAAMG,iBAAiB,GACrB,MAAMR,iCAAiC,CAACE,kBAAkB,CAAC;EAE7D,MAAMO,YAAY,GAAG,MAAMN,QAAQ,CAChC,GAAEK,iBAAiB,CAACE,OAAO,CAACC,GAAI,mCAAkC,EACnE;IAAEC,MAAM,EAAE;EAAM,CAClB,CAAC,CACEC,IAAI,CAAChB,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAC3BgB,IAAI,CAAEC,GAAG,IAAKA,GAAG,CAACC,IAAI,CAAC,CAAC,CAAC;EAE5B,MAAMC,WAAW,GAAGrB,SAAS,CAACc,YAAY,CAAC;EAC3C,MAAMQ,YAAY,GAAGD,WAAW,CAACE,eAAe,CAACC,GAAG;EAEpD,MAAMC,cAAc,GAAGZ,iBAAiB,CAACE,OAAO,CAACW,IAAI,CAACC,IAAI,CAACC,IAAI,CAC5DC,GAAG,IAAKA,GAAG,CAACL,GAAG,KAAKF,YACvB,CAAC;EAED,IAAI,CAACG,cAAc,EAAE;IACnB,MAAM,IAAItB,aAAa,CACpB,+BAA8BmB,YAAa,yCAC9C,CAAC;EACH;EAEA,MAAMrB,MAAM,CAACa,YAAY,EAAEW,cAAc,CAAC;EAE1C,MAAMK,iCAAiC,GAAG1B,2BAA2B,CAAC2B,KAAK,CAAC;IAC1EC,MAAM,EAAEX,WAAW,CAACE,eAAe;IACnCR,OAAO,EAAEM,WAAW,CAACN;EACvB,CAAC,CAAC;EAEF,OAAOe,iCAAiC,CAACf,OAAO;AAClD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["fetchAndParseCatalogue"],"sourceRoot":"../../../src","sources":["credentials-catalogue/index.ts"],"mappings":"AAAA,SAASA,sBAAsB,QAAQ,6BAA6B"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { UnixTime } from "../sd-jwt/types";
|
|
3
|
+
const CredentialPurpose = z.object({
|
|
4
|
+
id: z.string(),
|
|
5
|
+
description: z.string(),
|
|
6
|
+
category: z.string(),
|
|
7
|
+
subcategory: z.string(),
|
|
8
|
+
claims_required: z.array(z.string()),
|
|
9
|
+
claim_recommended: z.array(z.string())
|
|
10
|
+
});
|
|
11
|
+
const CredentialIssuer = z.object({
|
|
12
|
+
id: z.string(),
|
|
13
|
+
organization_name: z.string(),
|
|
14
|
+
organization_code: z.string(),
|
|
15
|
+
organization_country: z.string(),
|
|
16
|
+
contacts: z.array(z.string()).optional(),
|
|
17
|
+
homepage_uri: z.string().optional(),
|
|
18
|
+
logo_uri: z.string().optional(),
|
|
19
|
+
policy_uri: z.string().optional(),
|
|
20
|
+
tos_uri: z.string().optional()
|
|
21
|
+
});
|
|
22
|
+
const AuthenticSource = z.object({
|
|
23
|
+
id: z.string(),
|
|
24
|
+
organization_name: z.string(),
|
|
25
|
+
organization_code: z.string(),
|
|
26
|
+
organization_country: z.string(),
|
|
27
|
+
source_type: z.enum(["public", "private"]),
|
|
28
|
+
contacts: z.array(z.string()).optional(),
|
|
29
|
+
homepage_uri: z.string().optional(),
|
|
30
|
+
logo_uri: z.string().optional(),
|
|
31
|
+
user_information: z.string().optional()
|
|
32
|
+
});
|
|
33
|
+
const CredentialFormat = z.object({
|
|
34
|
+
configuration_id: z.string(),
|
|
35
|
+
format: z.enum(["dc+sd-jwt", "mso_mdoc"]),
|
|
36
|
+
vct: z.string().url().optional(),
|
|
37
|
+
docType: z.string().optional(),
|
|
38
|
+
schema_uri: z.string().url().optional(),
|
|
39
|
+
"schema_uri#integrity": z.string().optional()
|
|
40
|
+
});
|
|
41
|
+
const Claim = z.object({
|
|
42
|
+
name: z.string(),
|
|
43
|
+
taxonomy_ref: z.string(),
|
|
44
|
+
display_name: z.string()
|
|
45
|
+
});
|
|
46
|
+
export const DigitalCredential = z.object({
|
|
47
|
+
version: z.string(),
|
|
48
|
+
credential_type: z.string(),
|
|
49
|
+
legal_type: z.string(),
|
|
50
|
+
name: z.string(),
|
|
51
|
+
description: z.string(),
|
|
52
|
+
validity_info: z.object({
|
|
53
|
+
max_validity_days: z.number(),
|
|
54
|
+
status_methods: z.array(z.string()),
|
|
55
|
+
allowed_states: z.array(z.string())
|
|
56
|
+
}),
|
|
57
|
+
authentication: z.object({
|
|
58
|
+
user_auth_required: z.boolean(),
|
|
59
|
+
min_loa: z.string(),
|
|
60
|
+
supported_eid_schemes: z.array(z.string())
|
|
61
|
+
}),
|
|
62
|
+
purposes: z.array(CredentialPurpose),
|
|
63
|
+
issuers: z.array(CredentialIssuer),
|
|
64
|
+
authentic_sources: z.array(AuthenticSource),
|
|
65
|
+
formats: z.array(CredentialFormat),
|
|
66
|
+
claims: z.array(Claim)
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* The Digital Credentials Catalogue published by the Trust Anchor
|
|
71
|
+
*
|
|
72
|
+
* @version 1.1.0
|
|
73
|
+
* @see https://italia.github.io/eid-wallet-it-docs/releases/1.1.0/en/registry-catalogue.html
|
|
74
|
+
*/
|
|
75
|
+
export const DigitalCredentialsCatalogue = z.object({
|
|
76
|
+
header: z.object({
|
|
77
|
+
typ: z.string(),
|
|
78
|
+
alg: z.string(),
|
|
79
|
+
kid: z.string()
|
|
80
|
+
}),
|
|
81
|
+
payload: z.object({
|
|
82
|
+
catalog_version: z.string(),
|
|
83
|
+
taxonomy_uri: z.string().url(),
|
|
84
|
+
credentials: z.array(DigitalCredential),
|
|
85
|
+
iat: UnixTime,
|
|
86
|
+
exp: UnixTime
|
|
87
|
+
})
|
|
88
|
+
});
|
|
89
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["z","UnixTime","CredentialPurpose","object","id","string","description","category","subcategory","claims_required","array","claim_recommended","CredentialIssuer","organization_name","organization_code","organization_country","contacts","optional","homepage_uri","logo_uri","policy_uri","tos_uri","AuthenticSource","source_type","enum","user_information","CredentialFormat","configuration_id","format","vct","url","docType","schema_uri","Claim","name","taxonomy_ref","display_name","DigitalCredential","version","credential_type","legal_type","validity_info","max_validity_days","number","status_methods","allowed_states","authentication","user_auth_required","boolean","min_loa","supported_eid_schemes","purposes","issuers","authentic_sources","formats","claims","DigitalCredentialsCatalogue","header","typ","alg","kid","payload","catalog_version","taxonomy_uri","credentials","iat","ex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C,CAACU,KAAK,CAACE,gBAAgB,CAAC;EAClCyC,iBAAiB,EAAErD,CAAC,CAACU,KAAK,CAACY,eAAe,CAAC;EAC3CgC,OAAO,EAAEtD,CAAC,CAACU,KAAK,CAACgB,gBAAgB,CAAC;EAClC6B,MAAM,EAAEvD,CAAC,CAACU,KAAK,CAACuB,KAAK;AACvB,CAAC,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMuB,2BAA2B,GAAGxD,CAAC,CAACG,MAAM,CAAC;EAClDsD,MAAM,EAAEzD,CAAC,CAACG,MAAM,CAAC;IACfuD,GAAG,EAAE1D,CAAC,CAACK,MAAM,CAAC,CAAC;IACfsD,GAAG,EAAE3D,CAAC,CAACK,MAAM,CAAC,CAAC;IACfuD,GAAG,EAAE5D,CAAC,CAACK,MAAM,CAAC;EAChB,CAAC,CAAC;EACFwD,OAAO,EAAE7D,CAAC,CAACG,MAAM,CAAC;IAChB2D,eAAe,EAAE9D,CAAC,CAACK,MAAM,CAAC,CAAC;IAC3B0D,YAAY,EAAE/D,CAAC,CAACK,MAAM,CAAC,CAAC,CAACyB,GAAG,CAAC,CAAC;IAC9BkC,WAAW,EAAEhE,CAAC,CAACU,KAAK,CAAC2B,iBAAiB,CAAC;IACvC4B,GAAG,EAAEhE,QAAQ;IACbiE,GAAG,EAAEjE;EACP,CAAC;AACH,CAAC,CAAC"}
|
package/lib/module/index.js
CHANGED
|
@@ -3,6 +3,7 @@ import { fixBase64EncodingOnKey } from "./utils/jwk";
|
|
|
3
3
|
// https://github.com/facebook/react-native/issues/24428
|
|
4
4
|
import "react-native-url-polyfill/auto";
|
|
5
5
|
import * as Credential from "./credential";
|
|
6
|
+
import * as CredentialsCatalogue from "./credentials-catalogue";
|
|
6
7
|
import * as PID from "./pid";
|
|
7
8
|
import * as SdJwt from "./sd-jwt";
|
|
8
9
|
import * as Mdoc from "./mdoc";
|
|
@@ -13,5 +14,5 @@ import * as WalletInstance from "./wallet-instance";
|
|
|
13
14
|
import * as Logging from "./utils/logging";
|
|
14
15
|
import { AuthorizationDetail, AuthorizationDetails } from "./utils/par";
|
|
15
16
|
import { createCryptoContextFor } from "./utils/crypto";
|
|
16
|
-
export { SdJwt, Mdoc, PID, Credential, WalletInstanceAttestation, WalletInstance, Errors, Trust, createCryptoContextFor, AuthorizationDetail, AuthorizationDetails, fixBase64EncodingOnKey, Logging };
|
|
17
|
+
export { SdJwt, Mdoc, PID, Credential, CredentialsCatalogue, WalletInstanceAttestation, WalletInstance, Errors, Trust, createCryptoContextFor, AuthorizationDetail, AuthorizationDetails, fixBase64EncodingOnKey, Logging };
|
|
17
18
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["fixBase64EncodingOnKey","Credential","PID","SdJwt","Mdoc","Errors","WalletInstanceAttestation","Trust","WalletInstance","Logging","AuthorizationDetail","AuthorizationDetails","createCryptoContextFor"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AACA,SAASA,sBAAsB,QAAQ,aAAa;AACpD;AACA;AACA,OAAO,gCAAgC;AAEvC,OAAO,KAAKC,UAAU,MAAM,cAAc;AAC1C,OAAO,KAAKC,GAAG,MAAM,OAAO;AAC5B,OAAO,KAAKC,KAAK,MAAM,UAAU;AACjC,OAAO,KAAKC,IAAI,MAAM,QAAQ;AAC9B,OAAO,KAAKC,MAAM,MAAM,gBAAgB;AACxC,OAAO,KAAKC,yBAAyB,MAAM,+BAA+B;AAC1E,OAAO,KAAKC,KAAK,MAAM,SAAS;AAChC,OAAO,KAAKC,cAAc,MAAM,mBAAmB;AACnD,OAAO,KAAKC,OAAO,MAAM,iBAAiB;AAC1C,SAASC,mBAAmB,EAAEC,oBAAoB,QAAQ,aAAa;AACvE,SAASC,sBAAsB,QAAQ,gBAAgB;AAGvD,SACET,KAAK,EACLC,IAAI,EACJF,GAAG,
|
|
1
|
+
{"version":3,"names":["fixBase64EncodingOnKey","Credential","CredentialsCatalogue","PID","SdJwt","Mdoc","Errors","WalletInstanceAttestation","Trust","WalletInstance","Logging","AuthorizationDetail","AuthorizationDetails","createCryptoContextFor"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AACA,SAASA,sBAAsB,QAAQ,aAAa;AACpD;AACA;AACA,OAAO,gCAAgC;AAEvC,OAAO,KAAKC,UAAU,MAAM,cAAc;AAC1C,OAAO,KAAKC,oBAAoB,MAAM,yBAAyB;AAC/D,OAAO,KAAKC,GAAG,MAAM,OAAO;AAC5B,OAAO,KAAKC,KAAK,MAAM,UAAU;AACjC,OAAO,KAAKC,IAAI,MAAM,QAAQ;AAC9B,OAAO,KAAKC,MAAM,MAAM,gBAAgB;AACxC,OAAO,KAAKC,yBAAyB,MAAM,+BAA+B;AAC1E,OAAO,KAAKC,KAAK,MAAM,SAAS;AAChC,OAAO,KAAKC,cAAc,MAAM,mBAAmB;AACnD,OAAO,KAAKC,OAAO,MAAM,iBAAiB;AAC1C,SAASC,mBAAmB,EAAEC,oBAAoB,QAAQ,aAAa;AACvE,SAASC,sBAAsB,QAAQ,gBAAgB;AAGvD,SACET,KAAK,EACLC,IAAI,EACJF,GAAG,EACHF,UAAU,EACVC,oBAAoB,EACpBK,yBAAyB,EACzBE,cAAc,EACdH,MAAM,EACNE,KAAK,EACLK,sBAAsB,EACtBF,mBAAmB,EACnBC,oBAAoB,EACpBZ,sBAAsB,EACtBU,OAAO"}
|
package/lib/module/utils/auth.js
CHANGED
|
@@ -32,4 +32,12 @@ export const AuthorizationErrorShape = z.object({
|
|
|
32
32
|
/**
|
|
33
33
|
* Type of the identification result.
|
|
34
34
|
*/
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* MRTD PoP Challenge Info response structure
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
export const AuthorizationChallengeResultShape = z.object({
|
|
41
|
+
challenge_info: z.string()
|
|
42
|
+
});
|
|
35
43
|
//# sourceMappingURL=auth.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["z","AuthorizationResultShape","object","code","string","state","iss","optional","AuthorizationErrorShape","error","error_description","error_uri"],"sourceRoot":"../../../src","sources":["utils/auth.ts"],"mappings":"AAAA,OAAO,KAAKA,CAAC,MAAM,KAAK;;AAExB;AACA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA,OAAO,MAAMC,wBAAwB,GAAGD,CAAC,CAACE,MAAM,CAAC;EAC/CC,IAAI,EAAEH,CAAC,CAACI,MAAM,CAAC,CAAC;EAChBC,KAAK,EAAEL,CAAC,CAACI,MAAM,CAAC,CAAC;EACjBE,GAAG,EAAEN,CAAC,CAACI,MAAM,CAAC,CAAC,CAACG,QAAQ,CAAC;AAC3B,CAAC,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,uBAAuB,GAAGR,CAAC,CAACE,MAAM,CAAC;EAC9CO,KAAK,EAAET,CAAC,CAACI,MAAM,CAAC,CAAC;EAAE;EACnBM,iBAAiB,EAAEV,CAAC,CAACI,MAAM,CAAC,CAAC,CAACG,QAAQ,CAAC,CAAC;EACxCI,SAAS,EAAEX,CAAC,CAACI,MAAM,CAAC,CAAC,CAACG,QAAQ,CAAC,CAAC;EAChCF,KAAK,EAAEL,CAAC,CAACI,MAAM,CAAC,CAAC,CAACG,QAAQ,CAAC;AAC7B,CAAC,CAAC;;AAEF;AACA;AACA"}
|
|
1
|
+
{"version":3,"names":["z","AuthorizationResultShape","object","code","string","state","iss","optional","AuthorizationErrorShape","error","error_description","error_uri","AuthorizationChallengeResultShape","challenge_info"],"sourceRoot":"../../../src","sources":["utils/auth.ts"],"mappings":"AAAA,OAAO,KAAKA,CAAC,MAAM,KAAK;;AAExB;AACA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA,OAAO,MAAMC,wBAAwB,GAAGD,CAAC,CAACE,MAAM,CAAC;EAC/CC,IAAI,EAAEH,CAAC,CAACI,MAAM,CAAC,CAAC;EAChBC,KAAK,EAAEL,CAAC,CAACI,MAAM,CAAC,CAAC;EACjBE,GAAG,EAAEN,CAAC,CAACI,MAAM,CAAC,CAAC,CAACG,QAAQ,CAAC;AAC3B,CAAC,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,uBAAuB,GAAGR,CAAC,CAACE,MAAM,CAAC;EAC9CO,KAAK,EAAET,CAAC,CAACI,MAAM,CAAC,CAAC;EAAE;EACnBM,iBAAiB,EAAEV,CAAC,CAACI,MAAM,CAAC,CAAC,CAACG,QAAQ,CAAC,CAAC;EACxCI,SAAS,EAAEX,CAAC,CAACI,MAAM,CAAC,CAAC,CAACG,QAAQ,CAAC,CAAC;EAChCF,KAAK,EAAEL,CAAC,CAACI,MAAM,CAAC,CAAC,CAACG,QAAQ,CAAC;AAC7B,CAAC,CAAC;;AAEF;AACA;AACA;;AAGA;AACA;AACA;;AAEA,OAAO,MAAMK,iCAAiC,GAAGZ,CAAC,CAACE,MAAM,CAAC;EACxDW,cAAc,EAAEb,CAAC,CAACI,MAAM,CAAC;AAC3B,CAAC,CAAC"}
|
package/lib/module/utils/par.js
CHANGED
|
@@ -6,10 +6,15 @@ import { generateRandomAlphaNumericString, hasStatusOrThrow } from "./misc";
|
|
|
6
6
|
import { createPopToken } from "./pop";
|
|
7
7
|
import { IssuerResponseError } from "./errors";
|
|
8
8
|
import { LogLevel, Logger } from "./logging";
|
|
9
|
-
export const AuthorizationDetail = z.object({
|
|
9
|
+
export const AuthorizationDetail = z.union([z.object({
|
|
10
10
|
type: z.literal("openid_credential"),
|
|
11
11
|
credential_configuration_id: z.string()
|
|
12
|
-
})
|
|
12
|
+
}), z.object({
|
|
13
|
+
type: z.literal("it_l2+document_proof"),
|
|
14
|
+
idphinting: z.string(),
|
|
15
|
+
challenge_method: z.literal("mrtd+ias"),
|
|
16
|
+
challenge_redirect_uri: z.string()
|
|
17
|
+
})]);
|
|
13
18
|
export const AuthorizationDetails = z.array(AuthorizationDetail);
|
|
14
19
|
export const ParResponse = z.object({
|
|
15
20
|
request_uri: z.string(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["sha256ToBase64","SignJWT","v4","uuidv4","z","WalletInstanceAttestation","generateRandomAlphaNumericString","hasStatusOrThrow","createPopToken","IssuerResponseError","LogLevel","Logger","AuthorizationDetail","object","type","literal","credential_configuration_id","string","AuthorizationDetails","array","ParResponse","request_uri","expires_in","number","makeParRequest","_ref","wiaCryptoContext","appFetch","parEndpoint","walletInstanceAttestation","_ref2","codeVerifier","responseMode","clientId","redirectUri","authorizationDetails","scope","aud","wiaPublicKey","getPublicKey","iss","decode","payload","cnf","jwk","kid","signedWiaPoP","jti","codeChallengeMethod","codeChallenge","signedJwtForPar","setProtectedHeader","typ","setPayload","response_type","response_mode","client_id","state","code_challenge","code_challenge_method","redirect_uri","authorization_details","setIssuedAt","setExpirationTime","sign","formBody","URLSearchParams","request","log","DEBUG","method","headers","body","toString","then","res","json","parse","result"],"sourceRoot":"../../../src","sources":["utils/par.ts"],"mappings":"AAAA,SACEA,cAAc,EAEdC,OAAO,QACF,6BAA6B;AACpC,SAASC,EAAE,IAAIC,MAAM,QAAQ,MAAM;AACnC,OAAO,KAAKC,CAAC,MAAM,KAAK;AACxB,OAAO,KAAKC,yBAAyB,MAAM,gCAAgC;AAC3E,SAASC,gCAAgC,EAAEC,gBAAgB,QAAQ,QAAQ;AAC3E,SAASC,cAAc,QAAQ,OAAO;AACtC,SAASC,mBAAmB,QAAQ,UAAU;AAC9C,SAASC,QAAQ,EAAEC,MAAM,QAAQ,WAAW;AAG5C,OAAO,MAAMC,mBAAmB,GAAGR,CAAC,CAACS,MAAM,CAAC;
|
|
1
|
+
{"version":3,"names":["sha256ToBase64","SignJWT","v4","uuidv4","z","WalletInstanceAttestation","generateRandomAlphaNumericString","hasStatusOrThrow","createPopToken","IssuerResponseError","LogLevel","Logger","AuthorizationDetail","union","object","type","literal","credential_configuration_id","string","idphinting","challenge_method","challenge_redirect_uri","AuthorizationDetails","array","ParResponse","request_uri","expires_in","number","makeParRequest","_ref","wiaCryptoContext","appFetch","parEndpoint","walletInstanceAttestation","_ref2","codeVerifier","responseMode","clientId","redirectUri","authorizationDetails","scope","aud","wiaPublicKey","getPublicKey","iss","decode","payload","cnf","jwk","kid","signedWiaPoP","jti","codeChallengeMethod","codeChallenge","signedJwtForPar","setProtectedHeader","typ","setPayload","response_type","response_mode","client_id","state","code_challenge","code_challenge_method","redirect_uri","authorization_details","setIssuedAt","setExpirationTime","sign","formBody","URLSearchParams","request","log","DEBUG","method","headers","body","toString","then","res","json","parse","result"],"sourceRoot":"../../../src","sources":["utils/par.ts"],"mappings":"AAAA,SACEA,cAAc,EAEdC,OAAO,QACF,6BAA6B;AACpC,SAASC,EAAE,IAAIC,MAAM,QAAQ,MAAM;AACnC,OAAO,KAAKC,CAAC,MAAM,KAAK;AACxB,OAAO,KAAKC,yBAAyB,MAAM,gCAAgC;AAC3E,SAASC,gCAAgC,EAAEC,gBAAgB,QAAQ,QAAQ;AAC3E,SAASC,cAAc,QAAQ,OAAO;AACtC,SAASC,mBAAmB,QAAQ,UAAU;AAC9C,SAASC,QAAQ,EAAEC,MAAM,QAAQ,WAAW;AAG5C,OAAO,MAAMC,mBAAmB,GAAGR,CAAC,CAACS,KAAK,CAAC,CACzCT,CAAC,CAACU,MAAM,CAAC;EACPC,IAAI,EAAEX,CAAC,CAACY,OAAO,CAAC,mBAAmB,CAAC;EACpCC,2BAA2B,EAAEb,CAAC,CAACc,MAAM,CAAC;AACxC,CAAC,CAAC,EACFd,CAAC,CAACU,MAAM,CAAC;EACPC,IAAI,EAAEX,CAAC,CAACY,OAAO,CAAC,sBAAsB,CAAC;EACvCG,UAAU,EAAEf,CAAC,CAACc,MAAM,CAAC,CAAC;EACtBE,gBAAgB,EAAEhB,CAAC,CAACY,OAAO,CAAC,UAAU,CAAC;EACvCK,sBAAsB,EAAEjB,CAAC,CAACc,MAAM,CAAC;AACnC,CAAC,CAAC,CACH,CAAC;AAGF,OA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0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @see https://github.com/JacobWeisenburger/zod_utilz/blob/main/src/stringToJSON.ts
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
const literalSchema = z.union([z.string(), z.number(), z.boolean(), z.null()]);
|
|
7
|
+
const jsonSchema = z.lazy(() => z.union([literalSchema, z.array(jsonSchema), z.record(jsonSchema)]));
|
|
8
|
+
export const json = () => jsonSchema;
|
|
9
|
+
export const stringToJSONSchema = z.string().transform((str, ctx) => {
|
|
10
|
+
try {
|
|
11
|
+
return JSON.parse(str);
|
|
12
|
+
} catch (e) {
|
|
13
|
+
ctx.addIssue({
|
|
14
|
+
code: "custom",
|
|
15
|
+
message: "Invalid JSON"
|
|
16
|
+
});
|
|
17
|
+
return z.NEVER;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=zod.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["z","literalSchema","union","string","number","boolean","null","jsonSchema","lazy","array","record","json","stringToJSONSchema","transform","str","ctx","JSON","parse","e","addIssue","code","message","NEVER"],"sourceRoot":"../../../src","sources":["utils/zod.ts"],"mappings":"AAAA;AACA;AACA;;AAEA,SAASA,CAAC,QAAQ,KAAK;AAEvB,MAAMC,aAAa,GAAGD,CAAC,CAACE,KAAK,CAAC,CAACF,CAAC,CAACG,MAAM,CAAC,CAAC,EAAEH,CAAC,CAACI,MAAM,CAAC,CAAC,EAAEJ,CAAC,CAACK,OAAO,CAAC,CAAC,EAAEL,CAAC,CAACM,IAAI,CAAC,CAAC,CAAC,CAAC;AAM9E,MAAMC,UAA2B,GAAGP,CAAC,CAACQ,IAAI,CAAC,MACzCR,CAAC,CAACE,KAAK,CAAC,CAACD,aAAa,EAAED,CAAC,CAACS,KAAK,CAACF,UAAU,CAAC,EAAEP,CAAC,CAACU,MAAM,CAACH,UAAU,CAAC,CAAC,CACpE,CAAC;AAED,OAAO,MAAMI,IAAI,GAAGA,CAAA,KAAMJ,UAAU;AAEpC,OAAO,MAAMK,kBAAkB,GAAGZ,CAAC,CAChCG,MAAM,CAAC,CAAC,CACRU,SAAS,CAAC,CAACC,GAAG,EAAEC,GAAG,KAAuC;EACzD,IAAI;IACF,OAAOC,IAAI,CAACC,KAAK,CAACH,GAAG,CAAC;EACxB,CAAC,CAAC,OAAOI,CAAC,EAAE;IACVH,GAAG,CAACI,QAAQ,CAAC;MAAEC,IAAI,EAAE,QAAQ;MAAEC,OAAO,EAAE;IAAe,CAAC,CAAC;IACzD,OAAOrB,CAAC,CAACsB,KAAK;EAChB;AACF,CAAC,CAAC"}
|
|
@@ -2,5 +2,6 @@ import * as Issuance from "./issuance";
|
|
|
2
2
|
import * as Presentation from "./presentation";
|
|
3
3
|
import * as Status from "./status";
|
|
4
4
|
import * as Trustmark from "./trustmark";
|
|
5
|
-
|
|
5
|
+
import * as Offer from "./offer";
|
|
6
|
+
export { Issuance, Presentation, Status, Trustmark, Offer };
|
|
6
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/credential/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,YAAY,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/credential/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,YAAY,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AAEjC,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WARNING: This is the first function to be called in the issuing flow. The next function to be called is {@link evaluateIssuerTrust}.
|
|
3
3
|
* The beginning of the issuing flow.
|
|
4
|
-
* To be implemented
|
|
4
|
+
* To be implemented according to the user touchpoint
|
|
5
5
|
*
|
|
6
6
|
* @returns The configuration ID of the Credential to be issued and the url of the Issuer
|
|
7
7
|
*/
|
|
@@ -2,7 +2,12 @@ import type { CryptoContext } from "@pagopa/io-react-native-jwt";
|
|
|
2
2
|
import { type Out } from "../../utils/misc";
|
|
3
3
|
import type { EvaluateIssuerTrust } from "./02-evaluate-issuer-trust";
|
|
4
4
|
import { AuthorizationDetail } from "../../utils/par";
|
|
5
|
-
export type StartUserAuthorization = (issuerConf: Out<EvaluateIssuerTrust>["issuerConf"], credentialIds: string[],
|
|
5
|
+
export type StartUserAuthorization = (issuerConf: Out<EvaluateIssuerTrust>["issuerConf"], credentialIds: string[], proof: {
|
|
6
|
+
proofType: "none";
|
|
7
|
+
} | {
|
|
8
|
+
proofType: "mrtd-pop";
|
|
9
|
+
idpHinting: string;
|
|
10
|
+
}, context: {
|
|
6
11
|
wiaCryptoContext: CryptoContext;
|
|
7
12
|
walletInstanceAttestation: string;
|
|
8
13
|
redirectUri: string;
|
|
@@ -22,15 +27,20 @@ export type StartUserAuthorization = (issuerConf: Out<EvaluateIssuerTrust>["issu
|
|
|
22
27
|
* it is possible to use the same access token for the issuance of all requested credentials.
|
|
23
28
|
* This is an HTTP POST request containing the Wallet Instance identifier (client id), the code challenge and challenge method as specified by PKCE according to RFC 9126
|
|
24
29
|
* along with the WTE and its proof of possession (WTE-PoP).
|
|
25
|
-
* Additionally, it includes a request object, which is a signed JWT encapsulating the type of digital credential requested (authorization_details),
|
|
26
|
-
* the application session identifier on the Wallet Instance side (state),
|
|
30
|
+
* Additionally, it includes a request object, which is a signed JWT encapsulating the type of digital credential requested (authorization_details), challenge method and
|
|
31
|
+
* redirect URI for the document proof step (if L2 flow), the application session identifier on the Wallet Instance side (state),
|
|
27
32
|
* the method (query or form_post.jwt) by which the Authorization Server
|
|
28
33
|
* should transmit the Authorization Response containing the authorization code issued upon the end user's authentication (response_mode)
|
|
29
34
|
* to the Wallet Instance's Token Endpoint to obtain the Access Token, and the redirectUri of the Wallet Instance where the Authorization Response
|
|
30
35
|
* should be delivered. The redirect is achived by using a custom URL scheme that the Wallet Instance is registered to handle.
|
|
31
36
|
* @param issuerConf The issuer configuration
|
|
32
37
|
* @param credentialIds The credential configuration IDs to be requested
|
|
33
|
-
* @param
|
|
38
|
+
* @param proof The configuration for the proof to be used in the request: "none" for standard flows, "document" for L2+ with MRTD verification.
|
|
39
|
+
* @param ctx The context object containing;
|
|
40
|
+
* - wiaCryptoContext: the Wallet Instance's cryptographic context
|
|
41
|
+
* - walletInstanceAttestation: the Wallet Instance's attestation
|
|
42
|
+
* - redirectUri: the redirect URI
|
|
43
|
+
* - appFetch: (optional) the fetch implementation
|
|
34
44
|
* @returns The URI to which the end user should be redirected to start the authentication flow, along with the client id, the code verifier and the credential definition(s)
|
|
35
45
|
*/
|
|
36
46
|
export declare const startUserAuthorization: StartUserAuthorization;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"03-start-user-authorization.d.ts","sourceRoot":"","sources":["../../../../src/credential/issuance/03-start-user-authorization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAEjE,OAAO,EAAoC,KAAK,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,OAAO,EAAE,mBAAmB,EAAkB,MAAM,iBAAiB,CAAC;AAGtE,MAAM,MAAM,sBAAsB,GAAG,CACnC,UAAU,EAAE,GAAG,CAAC,mBAAmB,CAAC,CAAC,YAAY,CAAC,EAClD,aAAa,EAAE,MAAM,EAAE,EACvB,OAAO,EAAE;IACP,gBAAgB,EAAE,aAAa,CAAC;IAChC,yBAAyB,EAAE,MAAM,CAAC;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CACjC,KACE,OAAO,CAAC;IACX,gBAAgB,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,oBAAoB,EAAE,mBAAmB,EAAE,CAAC;CAC7C,CAAC,CAAC;AAqFH
|
|
1
|
+
{"version":3,"file":"03-start-user-authorization.d.ts","sourceRoot":"","sources":["../../../../src/credential/issuance/03-start-user-authorization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAEjE,OAAO,EAAoC,KAAK,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,OAAO,EAAE,mBAAmB,EAAkB,MAAM,iBAAiB,CAAC;AAGtE,MAAM,MAAM,sBAAsB,GAAG,CACnC,UAAU,EAAE,GAAG,CAAC,mBAAmB,CAAC,CAAC,YAAY,CAAC,EAClD,aAAa,EAAE,MAAM,EAAE,EACvB,KAAK,EAAE;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,SAAS,EAAE,UAAU,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,EAC5E,OAAO,EAAE;IACP,gBAAgB,EAAE,aAAa,CAAC;IAChC,yBAAyB,EAAE,MAAM,CAAC;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CACjC,KACE,OAAO,CAAC;IACX,gBAAgB,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,oBAAoB,EAAE,mBAAmB,EAAE,CAAC;CAC7C,CAAC,CAAC;AAqFH;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,sBAAsB,EAAE,sBA8DpC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AuthorizationResult } from "../../utils/auth";
|
|
1
|
+
import { type AuthorizationChallengeResult, type AuthorizationResult } from "../../utils/auth";
|
|
2
2
|
import { type Out } from "../../utils/misc";
|
|
3
3
|
import type { StartUserAuthorization } from "./03-start-user-authorization";
|
|
4
4
|
import type { EvaluateIssuerTrust } from "./02-evaluate-issuer-trust";
|
|
@@ -8,6 +8,7 @@ import { RequestObject } from "../presentation/types";
|
|
|
8
8
|
* The interface of the phase to complete User authorization via strong identification when the response mode is "query" and the request credential is a PersonIdentificationData.
|
|
9
9
|
*/
|
|
10
10
|
export type CompleteUserAuthorizationWithQueryMode = (authRedirectUrl: string) => Promise<AuthorizationResult>;
|
|
11
|
+
export type ContinueUserAuthorizationWithMRTDPoPChallenge = (authRedirectUrl: string) => Promise<AuthorizationChallengeResult>;
|
|
11
12
|
export type CompleteUserAuthorizationWithFormPostJwtMode = (requestObject: Out<GetRequestedCredentialToBePresented>, pid: string, context: {
|
|
12
13
|
wiaCryptoContext: CryptoContext;
|
|
13
14
|
pidCryptoContext: CryptoContext;
|
|
@@ -17,6 +18,13 @@ export type GetRequestedCredentialToBePresented = (issuerRequestUri: Out<StartUs
|
|
|
17
18
|
export type BuildAuthorizationUrl = (issuerRequestUri: Out<StartUserAuthorization>["issuerRequestUri"], clientId: Out<StartUserAuthorization>["clientId"], issuerConf: Out<EvaluateIssuerTrust>["issuerConf"], idpHint?: string) => Promise<{
|
|
18
19
|
authUrl: string;
|
|
19
20
|
}>;
|
|
21
|
+
/**
|
|
22
|
+
* WARNING: this function must be called after obtaining the authorization redirect URL from the webviews (SPID and CIE L3) or browser for CIEID, and the PID
|
|
23
|
+
* issuance requires a MRTD PoP challenge.
|
|
24
|
+
* @param authRedirectUrl The URL to which the end user should be redirected to start the MRTD PoP validation flow
|
|
25
|
+
* @returns the authorization response which contains the challenge
|
|
26
|
+
*/
|
|
27
|
+
export declare const continueUserAuthorizationWithMRTDPoPChallenge: ContinueUserAuthorizationWithMRTDPoPChallenge;
|
|
20
28
|
/**
|
|
21
29
|
* WARNING: This function must be called after {@link startUserAuthorization}. The generated authUrl must be used to open a browser or webview capable of catching the redirectSchema to perform a get request to the authorization endpoint.
|
|
22
30
|
* Builds the authorization URL to which the end user should be redirected to continue the authentication flow.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"04-complete-user-authorization.d.ts","sourceRoot":"","sources":["../../../../src/credential/issuance/04-complete-user-authorization.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"04-complete-user-authorization.d.ts","sourceRoot":"","sources":["../../../../src/credential/issuance/04-complete-user-authorization.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,4BAA4B,EACjC,KAAK,mBAAmB,EACzB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAoB,KAAK,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAG5E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAGL,KAAK,aAAa,EACnB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAA2B,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAQ/E;;GAEG;AACH,MAAM,MAAM,sCAAsC,GAAG,CACnD,eAAe,EAAE,MAAM,KACpB,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAElC,MAAM,MAAM,6CAA6C,GAAG,CAC1D,eAAe,EAAE,MAAM,KACpB,OAAO,CAAC,4BAA4B,CAA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4CAA4C,EAAE,4CAoFxD,CAAC;AAEJ;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,YAC5B,OAAO,KACf,mBAqBF,CAAC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { type StartFlow } from "./01-start-flow";
|
|
2
2
|
import { evaluateIssuerTrust, type EvaluateIssuerTrust } from "./02-evaluate-issuer-trust";
|
|
3
3
|
import { startUserAuthorization, type StartUserAuthorization } from "./03-start-user-authorization";
|
|
4
|
-
import { completeUserAuthorizationWithQueryMode, completeUserAuthorizationWithFormPostJwtMode, parseAuthorizationResponse, buildAuthorizationUrl, type CompleteUserAuthorizationWithQueryMode, type CompleteUserAuthorizationWithFormPostJwtMode, type GetRequestedCredentialToBePresented, type BuildAuthorizationUrl
|
|
4
|
+
import { continueUserAuthorizationWithMRTDPoPChallenge, completeUserAuthorizationWithQueryMode, completeUserAuthorizationWithFormPostJwtMode, parseAuthorizationResponse, buildAuthorizationUrl, getRequestedCredentialToBePresented, type ContinueUserAuthorizationWithMRTDPoPChallenge, type CompleteUserAuthorizationWithQueryMode, type CompleteUserAuthorizationWithFormPostJwtMode, type GetRequestedCredentialToBePresented, type BuildAuthorizationUrl } from "./04-complete-user-authorization";
|
|
5
5
|
import { authorizeAccess, type AuthorizeAccess } from "./05-authorize-access";
|
|
6
6
|
import { obtainCredential, type ObtainCredential } from "./06-obtain-credential";
|
|
7
7
|
import { verifyAndParseCredential, type VerifyAndParseCredential } from "./07-verify-and-parse-credential";
|
|
8
8
|
import * as Errors from "./errors";
|
|
9
|
-
|
|
10
|
-
export
|
|
9
|
+
import * as MRTDPoP from "./mrtd-pop";
|
|
10
|
+
export { MRTDPoP, evaluateIssuerTrust, startUserAuthorization, buildAuthorizationUrl, completeUserAuthorizationWithQueryMode, continueUserAuthorizationWithMRTDPoPChallenge, getRequestedCredentialToBePresented, completeUserAuthorizationWithFormPostJwtMode, authorizeAccess, obtainCredential, verifyAndParseCredential, parseAuthorizationResponse, Errors, };
|
|
11
|
+
export type { StartFlow, EvaluateIssuerTrust, StartUserAuthorization, BuildAuthorizationUrl, ContinueUserAuthorizationWithMRTDPoPChallenge, CompleteUserAuthorizationWithQueryMode, GetRequestedCredentialToBePresented, CompleteUserAuthorizationWithFormPostJwtMode, AuthorizeAccess, ObtainCredential, VerifyAndParseCredential, };
|
|
11
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/credential/issuance/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EACL,mBAAmB,EACnB,KAAK,mBAAmB,EACzB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,sBAAsB,EACtB,KAAK,sBAAsB,EAC5B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,sCAAsC,EACtC,4CAA4C,EAC5C,0BAA0B,EAC1B,qBAAqB,EACrB,KAAK,sCAAsC,EAC3C,KAAK,4CAA4C,EACjD,KAAK,mCAAmC,EACxC,KAAK,qBAAqB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/credential/issuance/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EACL,mBAAmB,EACnB,KAAK,mBAAmB,EACzB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,sBAAsB,EACtB,KAAK,sBAAsB,EAC5B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,6CAA6C,EAC7C,sCAAsC,EACtC,4CAA4C,EAC5C,0BAA0B,EAC1B,qBAAqB,EACrB,mCAAmC,EACnC,KAAK,6CAA6C,EAClD,KAAK,sCAAsC,EAC3C,KAAK,4CAA4C,EACjD,KAAK,mCAAmC,EACxC,KAAK,qBAAqB,EAC3B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EACL,gBAAgB,EAChB,KAAK,gBAAgB,EACtB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,wBAAwB,EACxB,KAAK,wBAAwB,EAC9B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AAEtC,OAAO,EACL,OAAO,EACP,mBAAmB,EACnB,sBAAsB,EACtB,qBAAqB,EACrB,sCAAsC,EACtC,6CAA6C,EAC7C,mCAAmC,EACnC,4CAA4C,EAC5C,eAAe,EACf,gBAAgB,EAChB,wBAAwB,EACxB,0BAA0B,EAC1B,MAAM,GACP,CAAC;AACF,YAAY,EACV,SAAS,EACT,mBAAmB,EACnB,sBAAsB,EACtB,qBAAqB,EACrB,6CAA6C,EAC7C,sCAAsC,EACtC,mCAAmC,EACnC,4CAA4C,EAC5C,eAAe,EACf,gBAAgB,EAChB,wBAAwB,GACzB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type CryptoContext } from "@pagopa/io-react-native-jwt";
|
|
2
|
+
import { MrtdProofChallengeInfo } from "./types";
|
|
3
|
+
import type { EvaluateIssuerTrust } from "../../issuance";
|
|
4
|
+
import type { Out } from "../../../utils/misc";
|
|
5
|
+
export type VerifyAndParseChallengeInfo = (issuerConf: Out<EvaluateIssuerTrust>["issuerConf"], challengeInfoJwt: string, context: {
|
|
6
|
+
wiaCryptoContext: CryptoContext;
|
|
7
|
+
}) => Promise<MrtdProofChallengeInfo["payload"]>;
|
|
8
|
+
/**
|
|
9
|
+
* Verifies and parses the payload of a MRTD Proof Challenge Info JWT obtained after the primary authentication.
|
|
10
|
+
*
|
|
11
|
+
* This function performs the following steps:
|
|
12
|
+
* 1. Validates the JWT signature using the issuer's JWKS.
|
|
13
|
+
* 2. Decodes the JWT and parses its structure according to the {@link MrtdProofChallengeInfo} schema.
|
|
14
|
+
* 3. Verifies that the `aud` claim matches the client's public key ID.
|
|
15
|
+
* 4. Checks that the JWT is not expired and was not issued in the future.
|
|
16
|
+
*
|
|
17
|
+
* @param issuerConf - The issuer configuration containing the JWKS for signature verification.
|
|
18
|
+
* @param challengeInfoJwt - The JWT string representing the MRTD Proof Challenge Info.
|
|
19
|
+
* @param context - The context containing the WIA crypto context used to retrieve the client public key.
|
|
20
|
+
* @returns The parsed payload of the MRTD Proof Challenge Info JWT.
|
|
21
|
+
* @throws {Error} If the JWT signature is invalid, the structure is malformed, the `aud` claim does not match,
|
|
22
|
+
* or the JWT is expired/not yet valid.
|
|
23
|
+
*/
|
|
24
|
+
export declare const verifyAndParseChallengeInfo: VerifyAndParseChallengeInfo;
|
|
25
|
+
//# sourceMappingURL=01-verify-and-parse-challenge-info.d.ts.map
|
package/lib/typescript/credential/issuance/mrtd-pop/01-verify-and-parse-challenge-info.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"01-verify-and-parse-challenge-info.d.ts","sourceRoot":"","sources":["../../../../../src/credential/issuance/mrtd-pop/01-verify-and-parse-challenge-info.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,aAAa,EACnB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAG/C,MAAM,MAAM,2BAA2B,GAAG,CACxC,UAAU,EAAE,GAAG,CAAC,mBAAmB,CAAC,CAAC,YAAY,CAAC,EAClD,gBAAgB,EAAE,MAAM,EACxB,OAAO,EAAE;IACP,gBAAgB,EAAE,aAAa,CAAC;CACjC,KACE,OAAO,CAAC,sBAAsB,CAAC,SAAS,CAAC,CAAC,CAAC;AAEhD;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,2BAA2B,EAAE,2BAmCzC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type Out } from "../../../utils/misc";
|
|
2
|
+
import type { CryptoContext } from "@pagopa/io-react-native-jwt";
|
|
3
|
+
import type { EvaluateIssuerTrust } from "../../issuance";
|
|
4
|
+
import { MrtdPoPChallenge } from "./types";
|
|
5
|
+
export type InitChallenge = (issuerConf: Out<EvaluateIssuerTrust>["issuerConf"], initUrl: string, mrtd_auth_session: string, mrtd_pop_jwt_nonce: string, context: {
|
|
6
|
+
wiaCryptoContext: CryptoContext;
|
|
7
|
+
walletInstanceAttestation: string;
|
|
8
|
+
appFetch?: GlobalFetch["fetch"];
|
|
9
|
+
}) => Promise<MrtdPoPChallenge["payload"]>;
|
|
10
|
+
/**
|
|
11
|
+
* Initialaizes the MRTD challenge with the data received from the issuer after the primary authentication.
|
|
12
|
+
* This function must be called after {@link verifyAndParseChallengeInfo}.
|
|
13
|
+
*
|
|
14
|
+
* @param issuerConf - The issuer configuration containing the JWKS for signature verification.
|
|
15
|
+
* @param initUrl - The endpoint to call to initialize the challenge.
|
|
16
|
+
* @param mrtd_auth_session - Session identifier for session binding obtained from the MRTD Proof JWT.
|
|
17
|
+
* @param mrtd_pop_jwt_nonce - Nonce value obtained from the MRTD Proof JWT.
|
|
18
|
+
* @param context - The context containing the WIA crypto context used to retrieve the client public key,
|
|
19
|
+
* the wallet instance attestation and an optional fetch implementation.
|
|
20
|
+
* @returns The payload of the MRTD PoP Challenge JWT.
|
|
21
|
+
*/
|
|
22
|
+
export declare const initChallenge: InitChallenge;
|
|
23
|
+
//# sourceMappingURL=02-init-challenge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"02-init-challenge.d.ts","sourceRoot":"","sources":["../../../../../src/credential/issuance/mrtd-pop/02-init-challenge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,GAAG,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAIjE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAG1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C,MAAM,MAAM,aAAa,GAAG,CAC1B,UAAU,EAAE,GAAG,CAAC,mBAAmB,CAAC,CAAC,YAAY,CAAC,EAClD,OAAO,EAAE,MAAM,EACf,iBAAiB,EAAE,MAAM,EACzB,kBAAkB,EAAE,MAAM,EAC1B,OAAO,EAAE;IACP,gBAAgB,EAAE,aAAa,CAAC;IAChC,yBAAyB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CACjC,KACE,OAAO,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,CAAC;AAE1C;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,aAAa,EAAE,aA+C3B,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type CryptoContext } from "@pagopa/io-react-native-jwt";
|
|
2
|
+
import { type Out } from "../../../utils/misc";
|
|
3
|
+
import type { EvaluateIssuerTrust } from "../../issuance";
|
|
4
|
+
import { MrtdPopVerificationResult, type IasPayload, type MrtdPayload } from "./types";
|
|
5
|
+
import type { VerifyAndParseChallengeInfo } from "./01-verify-and-parse-challenge-info";
|
|
6
|
+
export type ValidateChallenge = (issuerConf: Out<EvaluateIssuerTrust>["issuerConf"], verifyUrl: string, mrtd_auth_session: string, mrtd_pop_nonce: string, mrtd: MrtdPayload, ias: IasPayload, context: {
|
|
7
|
+
wiaCryptoContext: CryptoContext;
|
|
8
|
+
walletInstanceAttestation: string;
|
|
9
|
+
appFetch?: GlobalFetch["fetch"];
|
|
10
|
+
}) => Promise<MrtdPopVerificationResult>;
|
|
11
|
+
export type BuildChallengeCallbackUrl = (redirectUri: Out<ValidateChallenge>["redirect_uri"], valPopNonce: Out<ValidateChallenge>["mrtd_val_pop_nonce"], authSession: Out<VerifyAndParseChallengeInfo>["mrtd_auth_session"]) => Promise<{
|
|
12
|
+
callbackUrl: string;
|
|
13
|
+
}>;
|
|
14
|
+
/**
|
|
15
|
+
* Validates the MRTD signed challenge by sending the MRTD and IAS payloads to the issuer.
|
|
16
|
+
* This function must be called after {@link initChallenge} and after obtaining the MRTD and IAS payloads
|
|
17
|
+
* through the CIE PACE process.
|
|
18
|
+
*
|
|
19
|
+
* @param issuerConf - The issuer configuration containing the JWKS for signature verification.
|
|
20
|
+
* @param verifyUrl - The endpoint to call to validate the challenge.
|
|
21
|
+
* @param mrtd_auth_session - Session identifier for session binding obtained from the MRTD Proof JWT.
|
|
22
|
+
* @param mrtd_pop_nonce - Nonce value obtained from the MRTD Proof JWT.
|
|
23
|
+
* @param mrtd - MRTD validation data containing Data Groups and SOD.
|
|
24
|
+
* @param ias - IAS validation data containing Anti-Cloning Public Key, and SOD.
|
|
25
|
+
* @param context - The context containing the WIA crypto context used to retrieve the client public key,
|
|
26
|
+
* the wallet instance attestation and an optional fetch implementation.
|
|
27
|
+
* @returns The MRTD PoP Verification Result containing the validation nonce and redirect URI to complete the flow.
|
|
28
|
+
*/
|
|
29
|
+
export declare const validateChallenge: ValidateChallenge;
|
|
30
|
+
/**
|
|
31
|
+
* WARNING: This function must be called after {@link validateChallenge}. The generated authUrl must be used to open a browser or webview capable of catching the redirectSchema to perform a get request to the authorization endpoint.
|
|
32
|
+
* Builds the callback URL to which the end user should be redirected to continue the authentication flow after the MRTD challenge validation.
|
|
33
|
+
* @param redirectUri - The redirect URI provided by the issuer after the challenge validation to continue the authentication flow.
|
|
34
|
+
* @param valPopNonce - The MRTD validation PoP nonce obtained from the challenge validation response.
|
|
35
|
+
* @param authSession - The MRTD authentication session identifier used for session binding.
|
|
36
|
+
* @returns An object containing the callback URL
|
|
37
|
+
*/
|
|
38
|
+
export declare const buildChallengeCallbackUrl: BuildChallengeCallbackUrl;
|
|
39
|
+
//# sourceMappingURL=03-validate-challenge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"03-validate-challenge.d.ts","sourceRoot":"","sources":["../../../../../src/credential/issuance/mrtd-pop/03-validate-challenge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAG1E,OAAO,EAAoB,KAAK,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAGjE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EACL,yBAAyB,EACzB,KAAK,UAAU,EACf,KAAK,WAAW,EACjB,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAC;AAExF,MAAM,MAAM,iBAAiB,GAAG,CAC9B,UAAU,EAAE,GAAG,CAAC,mBAAmB,CAAC,CAAC,YAAY,CAAC,EAClD,SAAS,EAAE,MAAM,EACjB,iBAAiB,EAAE,MAAM,EACzB,cAAc,EAAE,MAAM,EACtB,IAAI,EAAE,WAAW,EACjB,GAAG,EAAE,UAAU,EACf,OAAO,EAAE;IACP,gBAAgB,EAAE,aAAa,CAAC;IAChC,yBAAyB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CACjC,KACE,OAAO,CAAC,yBAAyB,CAAC,CAAC;AAExC,MAAM,MAAM,yBAAyB,GAAG,CACtC,WAAW,EAAE,GAAG,CAAC,iBAAiB,CAAC,CAAC,cAAc,CAAC,EACnD,WAAW,EAAE,GAAG,CAAC,iBAAiB,CAAC,CAAC,oBAAoB,CAAC,EACzD,WAAW,EAAE,GAAG,CAAC,2BAA2B,CAAC,CAAC,mBAAmB,CAAC,KAC/D,OAAO,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC,CAAC;AAEH;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,iBAAiB,EAAE,iBAkE/B,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB,EAAE,yBAYvC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { verifyAndParseChallengeInfo, type VerifyAndParseChallengeInfo } from "./01-verify-and-parse-challenge-info";
|
|
2
|
+
import { initChallenge, type InitChallenge } from "./02-init-challenge";
|
|
3
|
+
import { validateChallenge, buildChallengeCallbackUrl, type ValidateChallenge, type BuildChallengeCallbackUrl } from "./03-validate-challenge";
|
|
4
|
+
import type { MrtdPayload, IasPayload } from "./types";
|
|
5
|
+
export { verifyAndParseChallengeInfo, initChallenge, validateChallenge, buildChallengeCallbackUrl, };
|
|
6
|
+
export type { VerifyAndParseChallengeInfo, InitChallenge, ValidateChallenge, BuildChallengeCallbackUrl, MrtdPayload, IasPayload, };
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/credential/issuance/mrtd-pop/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAC3B,KAAK,2BAA2B,EACjC,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,EACL,iBAAiB,EACjB,yBAAyB,EACzB,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,EAC/B,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAEvD,OAAO,EACL,2BAA2B,EAC3B,aAAa,EACb,iBAAiB,EACjB,yBAAyB,GAC1B,CAAC;AACF,YAAY,EACV,2BAA2B,EAC3B,aAAa,EACb,iBAAiB,EACjB,yBAAyB,EACzB,WAAW,EACX,UAAU,GACX,CAAC"}
|