@pagopa/io-react-native-wallet 2.3.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/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/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/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/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/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/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/package.json +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/utils/auth.ts +12 -0
- package/src/utils/par.ts +12 -4
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { SignJWT, type CryptoContext } from "@pagopa/io-react-native-jwt";
|
|
2
|
+
import { v4 as uuidv4 } from "uuid";
|
|
3
|
+
import { IssuerResponseError } from "../../../utils/errors";
|
|
4
|
+
import { hasStatusOrThrow, type Out } from "../../../utils/misc";
|
|
5
|
+
import { createPopToken } from "../../../utils/pop";
|
|
6
|
+
import * as WalletInstanceAttestation from "../../../wallet-instance-attestation";
|
|
7
|
+
import type { EvaluateIssuerTrust } from "../../issuance";
|
|
8
|
+
import {
|
|
9
|
+
MrtdPopVerificationResult,
|
|
10
|
+
type IasPayload,
|
|
11
|
+
type MrtdPayload,
|
|
12
|
+
} from "./types";
|
|
13
|
+
import type { VerifyAndParseChallengeInfo } from "./01-verify-and-parse-challenge-info";
|
|
14
|
+
|
|
15
|
+
export type ValidateChallenge = (
|
|
16
|
+
issuerConf: Out<EvaluateIssuerTrust>["issuerConf"],
|
|
17
|
+
verifyUrl: string,
|
|
18
|
+
mrtd_auth_session: string,
|
|
19
|
+
mrtd_pop_nonce: string,
|
|
20
|
+
mrtd: MrtdPayload,
|
|
21
|
+
ias: IasPayload,
|
|
22
|
+
context: {
|
|
23
|
+
wiaCryptoContext: CryptoContext;
|
|
24
|
+
walletInstanceAttestation: string;
|
|
25
|
+
appFetch?: GlobalFetch["fetch"];
|
|
26
|
+
}
|
|
27
|
+
) => Promise<MrtdPopVerificationResult>;
|
|
28
|
+
|
|
29
|
+
export type BuildChallengeCallbackUrl = (
|
|
30
|
+
redirectUri: Out<ValidateChallenge>["redirect_uri"],
|
|
31
|
+
valPopNonce: Out<ValidateChallenge>["mrtd_val_pop_nonce"],
|
|
32
|
+
authSession: Out<VerifyAndParseChallengeInfo>["mrtd_auth_session"]
|
|
33
|
+
) => Promise<{
|
|
34
|
+
callbackUrl: string;
|
|
35
|
+
}>;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Validates the MRTD signed challenge by sending the MRTD and IAS payloads to the issuer.
|
|
39
|
+
* This function must be called after {@link initChallenge} and after obtaining the MRTD and IAS payloads
|
|
40
|
+
* through the CIE PACE process.
|
|
41
|
+
*
|
|
42
|
+
* @param issuerConf - The issuer configuration containing the JWKS for signature verification.
|
|
43
|
+
* @param verifyUrl - The endpoint to call to validate the challenge.
|
|
44
|
+
* @param mrtd_auth_session - Session identifier for session binding obtained from the MRTD Proof JWT.
|
|
45
|
+
* @param mrtd_pop_nonce - Nonce value obtained from the MRTD Proof JWT.
|
|
46
|
+
* @param mrtd - MRTD validation data containing Data Groups and SOD.
|
|
47
|
+
* @param ias - IAS validation data containing Anti-Cloning Public Key, and SOD.
|
|
48
|
+
* @param context - The context containing the WIA crypto context used to retrieve the client public key,
|
|
49
|
+
* the wallet instance attestation and an optional fetch implementation.
|
|
50
|
+
* @returns The MRTD PoP Verification Result containing the validation nonce and redirect URI to complete the flow.
|
|
51
|
+
*/
|
|
52
|
+
export const validateChallenge: ValidateChallenge = async (
|
|
53
|
+
issuerConf,
|
|
54
|
+
verifyUrl,
|
|
55
|
+
mrtd_auth_session,
|
|
56
|
+
mrtd_pop_nonce,
|
|
57
|
+
mrtd,
|
|
58
|
+
ias,
|
|
59
|
+
context
|
|
60
|
+
) => {
|
|
61
|
+
const {
|
|
62
|
+
appFetch = fetch,
|
|
63
|
+
walletInstanceAttestation,
|
|
64
|
+
wiaCryptoContext,
|
|
65
|
+
} = context;
|
|
66
|
+
|
|
67
|
+
const aud = issuerConf.openid_credential_issuer.credential_issuer;
|
|
68
|
+
const iss = WalletInstanceAttestation.decode(walletInstanceAttestation)
|
|
69
|
+
.payload.cnf.jwk.kid;
|
|
70
|
+
|
|
71
|
+
const signedWiaPoP = await createPopToken(
|
|
72
|
+
{
|
|
73
|
+
jti: `${uuidv4()}`,
|
|
74
|
+
aud,
|
|
75
|
+
iss,
|
|
76
|
+
},
|
|
77
|
+
wiaCryptoContext
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
const { kid } = await wiaCryptoContext.getPublicKey();
|
|
81
|
+
|
|
82
|
+
const mrtd_validation_jwt = await new SignJWT(wiaCryptoContext)
|
|
83
|
+
.setProtectedHeader({
|
|
84
|
+
typ: "mrtd-ias+jwt",
|
|
85
|
+
kid,
|
|
86
|
+
})
|
|
87
|
+
.setPayload({
|
|
88
|
+
iss,
|
|
89
|
+
aud,
|
|
90
|
+
document_type: "cie",
|
|
91
|
+
mrtd,
|
|
92
|
+
ias,
|
|
93
|
+
})
|
|
94
|
+
.setIssuedAt()
|
|
95
|
+
.setExpirationTime("5m")
|
|
96
|
+
.sign();
|
|
97
|
+
|
|
98
|
+
const requestBody = {
|
|
99
|
+
mrtd_validation_jwt,
|
|
100
|
+
mrtd_auth_session,
|
|
101
|
+
mrtd_pop_nonce,
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const verifyResult = await appFetch(verifyUrl, {
|
|
105
|
+
method: "POST",
|
|
106
|
+
headers: {
|
|
107
|
+
"Content-Type": "application/json",
|
|
108
|
+
"OAuth-Client-Attestation": walletInstanceAttestation,
|
|
109
|
+
"OAuth-Client-Attestation-PoP": signedWiaPoP,
|
|
110
|
+
},
|
|
111
|
+
body: JSON.stringify(requestBody),
|
|
112
|
+
})
|
|
113
|
+
.then(hasStatusOrThrow(202, IssuerResponseError))
|
|
114
|
+
.then((res) => res.json());
|
|
115
|
+
|
|
116
|
+
const verifyResultParsed = MrtdPopVerificationResult.parse(verifyResult);
|
|
117
|
+
return verifyResultParsed;
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* 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.
|
|
122
|
+
* Builds the callback URL to which the end user should be redirected to continue the authentication flow after the MRTD challenge validation.
|
|
123
|
+
* @param redirectUri - The redirect URI provided by the issuer after the challenge validation to continue the authentication flow.
|
|
124
|
+
* @param valPopNonce - The MRTD validation PoP nonce obtained from the challenge validation response.
|
|
125
|
+
* @param authSession - The MRTD authentication session identifier used for session binding.
|
|
126
|
+
* @returns An object containing the callback URL
|
|
127
|
+
*/
|
|
128
|
+
export const buildChallengeCallbackUrl: BuildChallengeCallbackUrl = async (
|
|
129
|
+
redirectUri,
|
|
130
|
+
valPopNonce,
|
|
131
|
+
authSession
|
|
132
|
+
) => {
|
|
133
|
+
const params = new URLSearchParams({
|
|
134
|
+
mrtd_val_pop_nonce: valPopNonce,
|
|
135
|
+
mrtd_auth_session: authSession,
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
const callbackUrl = `${redirectUri}?${params}`;
|
|
139
|
+
return { callbackUrl };
|
|
140
|
+
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# MRTD PoP flow
|
|
2
|
+
|
|
3
|
+
**MRTD-PoP (Machine Readable Travel Document - Proof of Possession)** flow for the IO Wallet, following the [eID Wallet L2+ Credential Issuance specification](https://italia.github.io/eid-wallet-it-docs/versione-corrente/en/credential-issuance-l2plus.html).
|
|
4
|
+
|
|
5
|
+
The MRTD-PoP flow is used to prove possession of an MRTD (such as a CIE) during the issuance of high-assurance credentials. The process involves a challenge-response protocol between the wallet and the issuer, leveraging JWTs and cryptographic attestation.
|
|
6
|
+
|
|
7
|
+
This flow is part of the [PID issuance flow](../README.md) and must be started after the `continueUserAuthorizationWithMRTDPoPChallenge` function. Once MRTD PoP is completed, the PID issuance flow must continue with the `completeUserAuthorizationWithQueryMode` function with the authorization url obtained from the validation.
|
|
8
|
+
|
|
9
|
+
> **⚠️ Important**: The entire flow must be initiated and concluded within the same web context (e.g., the same WebView instance) to maintain session continuity. Using different contexts (such as switching between an external browser and a WebView) will result in session loss and authentication failures due to cookie/session mismatch (JSESSIONID).
|
|
10
|
+
|
|
11
|
+
## Sequence Diagram
|
|
12
|
+
|
|
13
|
+
```mermaid
|
|
14
|
+
graph TD;
|
|
15
|
+
A@{ shape: subproc, label: "continueUserAuthorizationWithMRTDPoPChallenge" }
|
|
16
|
+
subgraph MRTD PoP
|
|
17
|
+
B[verifyAndParseChallengeInfo]
|
|
18
|
+
C[initChallenge]
|
|
19
|
+
E[validateChallenge]
|
|
20
|
+
end
|
|
21
|
+
F@{ shape: subproc, label: "completeUserAuthorizationWithQueryModeChallenge" }
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
A -.-> B
|
|
25
|
+
B --> C
|
|
26
|
+
C -->E
|
|
27
|
+
E -.-> F
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Example
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
// Verify and parse challenge info and extract challenge data: initialization url, session and nonce
|
|
35
|
+
const {
|
|
36
|
+
htu: initUrl,
|
|
37
|
+
mrtd_auth_session,
|
|
38
|
+
mrtd_pop_jwt_nonce,
|
|
39
|
+
} = await Credential.Issuance.MRTDPoP.verifyAndParseChallengeInfo(
|
|
40
|
+
issuerConf,
|
|
41
|
+
challenge_info,
|
|
42
|
+
{ wiaCryptoContext }
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
// Initialize challenge and obtain the challenge text to sign the CIE PACE protocol and validation url
|
|
46
|
+
const {
|
|
47
|
+
htu: validationUrl,
|
|
48
|
+
challenge,
|
|
49
|
+
mrtd_pop_nonce,
|
|
50
|
+
} = await Credential.Issuance.MRTDPoP.initChallenge(
|
|
51
|
+
issuerConf,
|
|
52
|
+
initUrl,
|
|
53
|
+
mrtd_auth_session,
|
|
54
|
+
mrtd_pop_jwt_nonce,
|
|
55
|
+
{
|
|
56
|
+
walletInstanceAttestation,
|
|
57
|
+
wiaCryptoContext,
|
|
58
|
+
appFetch,
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
// CIE cryptographic interaction: you need to sign the challenge with the CIE through NFC interaction
|
|
63
|
+
const { nis, mrtds } = /* NFC interactions functions */
|
|
64
|
+
|
|
65
|
+
// Validate challenge
|
|
66
|
+
const { mrtd_val_pop_nonce, redirect_uri } =
|
|
67
|
+
await Credential.Issuance.MRTDPoP.validateChallenge(
|
|
68
|
+
issuerConf,
|
|
69
|
+
validationUrl,
|
|
70
|
+
mrtd_auth_session,
|
|
71
|
+
mrtd_pop_nonce,
|
|
72
|
+
mrtd,
|
|
73
|
+
ias,
|
|
74
|
+
{
|
|
75
|
+
walletInstanceAttestation,
|
|
76
|
+
wiaCryptoContext,
|
|
77
|
+
appFetch,
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
// Build the callback url
|
|
82
|
+
const { callbackUrl } = await Credential.Issuance.buildChallengeCallbackUrl(
|
|
83
|
+
redirect_uri,
|
|
84
|
+
mrtd_val_pop_nonce,
|
|
85
|
+
mrtd_auth_session
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
// 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.
|
|
89
|
+
const authRedirectUrl = /* From a browser or webview redirect */
|
|
90
|
+
|
|
91
|
+
// Use the authRedirectUrl to continue the PID issuance flow
|
|
92
|
+
```
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {
|
|
2
|
+
verifyAndParseChallengeInfo,
|
|
3
|
+
type VerifyAndParseChallengeInfo,
|
|
4
|
+
} from "./01-verify-and-parse-challenge-info";
|
|
5
|
+
import { initChallenge, type InitChallenge } from "./02-init-challenge";
|
|
6
|
+
import {
|
|
7
|
+
validateChallenge,
|
|
8
|
+
buildChallengeCallbackUrl,
|
|
9
|
+
type ValidateChallenge,
|
|
10
|
+
type BuildChallengeCallbackUrl,
|
|
11
|
+
} from "./03-validate-challenge";
|
|
12
|
+
import type { MrtdPayload, IasPayload } from "./types";
|
|
13
|
+
|
|
14
|
+
export {
|
|
15
|
+
verifyAndParseChallengeInfo,
|
|
16
|
+
initChallenge,
|
|
17
|
+
validateChallenge,
|
|
18
|
+
buildChallengeCallbackUrl,
|
|
19
|
+
};
|
|
20
|
+
export type {
|
|
21
|
+
VerifyAndParseChallengeInfo,
|
|
22
|
+
InitChallenge,
|
|
23
|
+
ValidateChallenge,
|
|
24
|
+
BuildChallengeCallbackUrl,
|
|
25
|
+
MrtdPayload,
|
|
26
|
+
IasPayload,
|
|
27
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
|
|
3
|
+
export type MrtdProofChallengeInfo = z.infer<typeof MrtdProofChallengeInfo>;
|
|
4
|
+
export const MrtdProofChallengeInfo = z.object({
|
|
5
|
+
protectedHeader: z.object({
|
|
6
|
+
typ: z.literal("mrtd-ias+jwt"),
|
|
7
|
+
alg: z.string(),
|
|
8
|
+
kid: z.string(),
|
|
9
|
+
}),
|
|
10
|
+
payload: z.object({
|
|
11
|
+
iss: z.string(),
|
|
12
|
+
aud: z.string(),
|
|
13
|
+
iat: z.number(),
|
|
14
|
+
exp: z.number(),
|
|
15
|
+
status: z.literal("require_interaction"),
|
|
16
|
+
type: z.literal("mrtd+ias"),
|
|
17
|
+
mrtd_auth_session: z.string(),
|
|
18
|
+
state: z.string(),
|
|
19
|
+
mrtd_pop_jwt_nonce: z.string(),
|
|
20
|
+
htu: z.string(),
|
|
21
|
+
htm: z.literal("POST"),
|
|
22
|
+
}),
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export type MrtdPoPChallenge = z.infer<typeof MrtdPoPChallenge>;
|
|
26
|
+
export const MrtdPoPChallenge = z.object({
|
|
27
|
+
protectedHeader: z.object({
|
|
28
|
+
typ: z.literal("mrtd-ias-pop+jwt"),
|
|
29
|
+
alg: z.string(),
|
|
30
|
+
kid: z.string(),
|
|
31
|
+
}),
|
|
32
|
+
payload: z.object({
|
|
33
|
+
iss: z.string(),
|
|
34
|
+
aud: z.string(),
|
|
35
|
+
iat: z.number(),
|
|
36
|
+
exp: z.number(),
|
|
37
|
+
challenge: z.string(),
|
|
38
|
+
mrtd_pop_nonce: z.string(),
|
|
39
|
+
mrz: z.string().optional(),
|
|
40
|
+
htu: z.string(),
|
|
41
|
+
htm: z.literal("POST"),
|
|
42
|
+
}),
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
export type MrtdPayload = {
|
|
46
|
+
dg1: string;
|
|
47
|
+
dg11: string;
|
|
48
|
+
sod_mrtd: string;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export type IasPayload = {
|
|
52
|
+
ias_pk: string;
|
|
53
|
+
sod_ias: string;
|
|
54
|
+
challenge_signed: string;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export type MrtdPopVerificationResult = z.infer<
|
|
58
|
+
typeof MrtdPopVerificationResult
|
|
59
|
+
>;
|
|
60
|
+
export const MrtdPopVerificationResult = z.object({
|
|
61
|
+
status: z.literal("require_interaction"),
|
|
62
|
+
type: z.literal("redirect_to_web"),
|
|
63
|
+
mrtd_val_pop_nonce: z.string(),
|
|
64
|
+
redirect_uri: z.string(),
|
|
65
|
+
});
|
package/src/utils/auth.ts
CHANGED
|
@@ -35,3 +35,15 @@ export const AuthorizationErrorShape = z.object({
|
|
|
35
35
|
* Type of the identification result.
|
|
36
36
|
*/
|
|
37
37
|
export type AuthorizationResult = z.infer<typeof AuthorizationResultShape>;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* MRTD PoP Challenge Info response structure
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
export const AuthorizationChallengeResultShape = z.object({
|
|
44
|
+
challenge_info: z.string(),
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
export type AuthorizationChallengeResult = z.infer<
|
|
48
|
+
typeof AuthorizationChallengeResultShape
|
|
49
|
+
>;
|
package/src/utils/par.ts
CHANGED
|
@@ -12,10 +12,18 @@ import { IssuerResponseError } from "./errors";
|
|
|
12
12
|
import { LogLevel, Logger } from "./logging";
|
|
13
13
|
|
|
14
14
|
export type AuthorizationDetail = z.infer<typeof AuthorizationDetail>;
|
|
15
|
-
export const AuthorizationDetail = z.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
export const AuthorizationDetail = z.union([
|
|
16
|
+
z.object({
|
|
17
|
+
type: z.literal("openid_credential"),
|
|
18
|
+
credential_configuration_id: z.string(),
|
|
19
|
+
}),
|
|
20
|
+
z.object({
|
|
21
|
+
type: z.literal("it_l2+document_proof"),
|
|
22
|
+
idphinting: z.string(),
|
|
23
|
+
challenge_method: z.literal("mrtd+ias"),
|
|
24
|
+
challenge_redirect_uri: z.string(),
|
|
25
|
+
}),
|
|
26
|
+
]);
|
|
19
27
|
|
|
20
28
|
export type AuthorizationDetails = z.infer<typeof AuthorizationDetails>;
|
|
21
29
|
export const AuthorizationDetails = z.array(AuthorizationDetail);
|