@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.
Files changed (77) hide show
  1. package/lib/commonjs/credential/issuance/03-start-user-authorization.js +24 -6
  2. package/lib/commonjs/credential/issuance/03-start-user-authorization.js.map +1 -1
  3. package/lib/commonjs/credential/issuance/04-complete-user-authorization.js +26 -2
  4. package/lib/commonjs/credential/issuance/04-complete-user-authorization.js.map +1 -1
  5. package/lib/commonjs/credential/issuance/README.md +155 -18
  6. package/lib/commonjs/credential/issuance/index.js +9 -1
  7. package/lib/commonjs/credential/issuance/index.js.map +1 -1
  8. package/lib/commonjs/credential/issuance/mrtd-pop/01-verify-and-parse-challenge-info.js +57 -0
  9. package/lib/commonjs/credential/issuance/mrtd-pop/01-verify-and-parse-challenge-info.js.map +1 -0
  10. package/lib/commonjs/credential/issuance/mrtd-pop/02-init-challenge.js +61 -0
  11. package/lib/commonjs/credential/issuance/mrtd-pop/02-init-challenge.js.map +1 -0
  12. package/lib/commonjs/credential/issuance/mrtd-pop/03-validate-challenge.js +95 -0
  13. package/lib/commonjs/credential/issuance/mrtd-pop/03-validate-challenge.js.map +1 -0
  14. package/lib/commonjs/credential/issuance/mrtd-pop/README.md +92 -0
  15. package/lib/commonjs/credential/issuance/mrtd-pop/index.js +33 -0
  16. package/lib/commonjs/credential/issuance/mrtd-pop/index.js.map +1 -0
  17. package/lib/commonjs/credential/issuance/mrtd-pop/types.js +57 -0
  18. package/lib/commonjs/credential/issuance/mrtd-pop/types.js.map +1 -0
  19. package/lib/commonjs/utils/auth.js +9 -1
  20. package/lib/commonjs/utils/auth.js.map +1 -1
  21. package/lib/commonjs/utils/par.js +7 -2
  22. package/lib/commonjs/utils/par.js.map +1 -1
  23. package/lib/module/credential/issuance/03-start-user-authorization.js +24 -6
  24. package/lib/module/credential/issuance/03-start-user-authorization.js.map +1 -1
  25. package/lib/module/credential/issuance/04-complete-user-authorization.js +25 -2
  26. package/lib/module/credential/issuance/04-complete-user-authorization.js.map +1 -1
  27. package/lib/module/credential/issuance/README.md +155 -18
  28. package/lib/module/credential/issuance/index.js +3 -2
  29. package/lib/module/credential/issuance/index.js.map +1 -1
  30. package/lib/module/credential/issuance/mrtd-pop/01-verify-and-parse-challenge-info.js +50 -0
  31. package/lib/module/credential/issuance/mrtd-pop/01-verify-and-parse-challenge-info.js.map +1 -0
  32. package/lib/module/credential/issuance/mrtd-pop/02-init-challenge.js +52 -0
  33. package/lib/module/credential/issuance/mrtd-pop/02-init-challenge.js.map +1 -0
  34. package/lib/module/credential/issuance/mrtd-pop/03-validate-challenge.js +85 -0
  35. package/lib/module/credential/issuance/mrtd-pop/03-validate-challenge.js.map +1 -0
  36. package/lib/module/credential/issuance/mrtd-pop/README.md +92 -0
  37. package/lib/module/credential/issuance/mrtd-pop/index.js +5 -0
  38. package/lib/module/credential/issuance/mrtd-pop/index.js.map +1 -0
  39. package/lib/module/credential/issuance/mrtd-pop/types.js +46 -0
  40. package/lib/module/credential/issuance/mrtd-pop/types.js.map +1 -0
  41. package/lib/module/utils/auth.js +8 -0
  42. package/lib/module/utils/auth.js.map +1 -1
  43. package/lib/module/utils/par.js +7 -2
  44. package/lib/module/utils/par.js.map +1 -1
  45. package/lib/typescript/credential/issuance/03-start-user-authorization.d.ts +14 -4
  46. package/lib/typescript/credential/issuance/03-start-user-authorization.d.ts.map +1 -1
  47. package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts +9 -1
  48. package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts.map +1 -1
  49. package/lib/typescript/credential/issuance/index.d.ts +4 -3
  50. package/lib/typescript/credential/issuance/index.d.ts.map +1 -1
  51. package/lib/typescript/credential/issuance/mrtd-pop/01-verify-and-parse-challenge-info.d.ts +25 -0
  52. package/lib/typescript/credential/issuance/mrtd-pop/01-verify-and-parse-challenge-info.d.ts.map +1 -0
  53. package/lib/typescript/credential/issuance/mrtd-pop/02-init-challenge.d.ts +23 -0
  54. package/lib/typescript/credential/issuance/mrtd-pop/02-init-challenge.d.ts.map +1 -0
  55. package/lib/typescript/credential/issuance/mrtd-pop/03-validate-challenge.d.ts +39 -0
  56. package/lib/typescript/credential/issuance/mrtd-pop/03-validate-challenge.d.ts.map +1 -0
  57. package/lib/typescript/credential/issuance/mrtd-pop/index.d.ts +7 -0
  58. package/lib/typescript/credential/issuance/mrtd-pop/index.d.ts.map +1 -0
  59. package/lib/typescript/credential/issuance/mrtd-pop/types.d.ts +201 -0
  60. package/lib/typescript/credential/issuance/mrtd-pop/types.d.ts.map +1 -0
  61. package/lib/typescript/utils/auth.d.ts +11 -0
  62. package/lib/typescript/utils/auth.d.ts.map +1 -1
  63. package/lib/typescript/utils/par.d.ts +34 -4
  64. package/lib/typescript/utils/par.d.ts.map +1 -1
  65. package/package.json +1 -1
  66. package/src/credential/issuance/03-start-user-authorization.ts +30 -7
  67. package/src/credential/issuance/04-complete-user-authorization.ts +43 -1
  68. package/src/credential/issuance/README.md +155 -18
  69. package/src/credential/issuance/index.ts +7 -1
  70. package/src/credential/issuance/mrtd-pop/01-verify-and-parse-challenge-info.ts +70 -0
  71. package/src/credential/issuance/mrtd-pop/02-init-challenge.ts +82 -0
  72. package/src/credential/issuance/mrtd-pop/03-validate-challenge.ts +140 -0
  73. package/src/credential/issuance/mrtd-pop/README.md +92 -0
  74. package/src/credential/issuance/mrtd-pop/index.ts +27 -0
  75. package/src/credential/issuance/mrtd-pop/types.ts +65 -0
  76. package/src/utils/auth.ts +12 -0
  77. package/src/utils/par.ts +12 -4
@@ -62,19 +62,23 @@ const selectResponseMode = (issuerConf, credentialIds) => {
62
62
  * it is possible to use the same access token for the issuance of all requested credentials.
63
63
  * 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
64
64
  * along with the WTE and its proof of possession (WTE-PoP).
65
- * Additionally, it includes a request object, which is a signed JWT encapsulating the type of digital credential requested (authorization_details),
66
- * the application session identifier on the Wallet Instance side (state),
65
+ * Additionally, it includes a request object, which is a signed JWT encapsulating the type of digital credential requested (authorization_details), challenge method and
66
+ * redirect URI for the document proof step (if L2 flow), the application session identifier on the Wallet Instance side (state),
67
67
  * the method (query or form_post.jwt) by which the Authorization Server
68
68
  * should transmit the Authorization Response containing the authorization code issued upon the end user's authentication (response_mode)
69
69
  * to the Wallet Instance's Token Endpoint to obtain the Access Token, and the redirectUri of the Wallet Instance where the Authorization Response
70
70
  * should be delivered. The redirect is achived by using a custom URL scheme that the Wallet Instance is registered to handle.
71
71
  * @param issuerConf The issuer configuration
72
72
  * @param credentialIds The credential configuration IDs to be requested
73
- * @param ctx The context object containing the Wallet Instance's cryptographic context, the Wallet Instance's attestation, the redirect URI and the fetch implementation
73
+ * @param proof The configuration for the proof to be used in the request: "none" for standard flows, "document" for L2+ with MRTD verification.
74
+ * @param ctx The context object containing;
75
+ * - wiaCryptoContext: the Wallet Instance's cryptographic context
76
+ * - walletInstanceAttestation: the Wallet Instance's attestation
77
+ * - redirectUri: the redirect URI
78
+ * - appFetch: (optional) the fetch implementation
74
79
  * @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)
75
80
  */
76
-
77
- const startUserAuthorization = async (issuerConf, credentialIds, ctx) => {
81
+ const startUserAuthorization = async (issuerConf, credentialIds, proof, ctx) => {
78
82
  const {
79
83
  wiaCryptoContext,
80
84
  walletInstanceAttestation,
@@ -89,12 +93,26 @@ const startUserAuthorization = async (issuerConf, credentialIds, ctx) => {
89
93
  const codeVerifier = (0, _misc.generateRandomAlphaNumericString)(64);
90
94
  const parEndpoint = issuerConf.oauth_authorization_server.pushed_authorization_request_endpoint;
91
95
  const aud = issuerConf.openid_credential_issuer.credential_issuer;
92
- const credentialDefinition = credentialIds.map(c => selectCredentialDefinition(issuerConf, c));
93
96
  const responseMode = selectResponseMode(issuerConf, credentialIds);
94
97
  const getPar = (0, _par.makeParRequest)({
95
98
  wiaCryptoContext,
96
99
  appFetch
97
100
  });
101
+ const credentialDefinition = [...credentialIds.map(c => selectCredentialDefinition(issuerConf, c))];
102
+ if (proof.proofType === "mrtd-pop") {
103
+ /**
104
+ * When we requests a PID using eID Substantial Authentication with MRTD Verification, we must include
105
+ * an additional Authorization Details Object in the authorization_details
106
+ *
107
+ * See https://italia.github.io/eid-wallet-it-docs/versione-corrente/en/credential-issuance-endpoint.html#pushed-authorization-request-endpoint
108
+ */
109
+ credentialDefinition.push({
110
+ type: "it_l2+document_proof",
111
+ idphinting: proof.idpHinting,
112
+ challenge_method: "mrtd+ias",
113
+ challenge_redirect_uri: redirectUri
114
+ });
115
+ }
98
116
  const issuerRequestUri = await getPar(parEndpoint, walletInstanceAttestation, {
99
117
  aud,
100
118
  clientId,
@@ -1 +1 @@
1
- {"version":3,"names":["_misc","require","_par","_logging","selectCredentialDefinition","issuerConf","credentialId","credential_configurations_supported","openid_credential_issuer","result","Object","keys","filter","e","includes","map","credential_configuration_id","type","Logger","log","LogLevel","ERROR","JSON","stringify","Error","selectResponseMode","credentialIds","responseModeSupported","oauth_authorization_server","response_modes_supported","responseModeSet","Set","add","match","size","values","responseMode","DEBUG","startUserAuthorization","ctx","wiaCryptoContext","walletInstanceAttestation","redirectUri","appFetch","fetch","clientId","getPublicKey","then","_","kid","codeVerifier","generateRandomAlphaNumericString","parEndpoint","pushed_authorization_request_endpoint","aud","credential_issuer","credentialDefinition","c","getPar","makeParRequest","issuerRequestUri","authorizationDetails","exports"],"sourceRoot":"../../../../src","sources":["credential/issuance/03-start-user-authorization.ts"],"mappings":";;;;;;AAEA,IAAAA,KAAA,GAAAC,OAAA;AAGA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAkBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMG,0BAA0B,GAAGA,CACjCC,UAAkD,EAClDC,YAA4C,KACpB;EACxB,MAAMC,mCAAmC,GACvCF,UAAU,CAACG,wBAAwB,CAACD,mCA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,CAAC;EACD,MAAMrB,YAAY,GAAGX,kBAAkB,CAACpB,UAAU,EAAEqB,aAAa,CAAC;EAClE,MAAMgC,MAAM,GAAG,IAAAC,mBAAc,EAAC;IAAEnB,gBAAgB;IAAEG;EAAS,CAAC,CAAC;EAC7D,MAAMiB,gBAAgB,GAAG,MAAMF,MAAM,CACnCN,WAAW,EACXX,yBAAyB,EACzB;IACEa,GAAG;IACHT,QAAQ;IACRK,YAAY;IACZR,WAAW;IACXN,YAAY;IACZyB,oBAAoB,EAAEL;EACxB,CACF,CAAC;EAED,OAAO;IAAEI,gBAAgB;IAAEf,QAAQ;IAAEK,YAAY;IAAEM;EAAqB,CAAC;AAC3E,CAAC;AAACM,OAAA,CAAAxB,sBAAA,GAAAA,sBAAA"}
1
+ {"version":3,"names":["_misc","require","_par","_logging","selectCredentialDefinition","issuerConf","credentialId","credential_configurations_supported","openid_credential_issuer","result","Object","keys","filter","e","includes","map","credential_configuration_id","type","Logger","log","LogLevel","ERROR","JSON","stringify","Error","selectResponseMode","credentialIds","responseModeSupported","oauth_authorization_server","response_modes_supported","responseModeSet","Set","add","match","size","values","responseMode","DEBUG","startUserAuthorization","proof","ctx","wiaCryptoContext","walletInstanceAttestation","redirectUri","appFetch","fetch","clientId","getPublicKey","then","_","kid","codeVerifier","generateRandomAlphaNumericString","parEndpoint","pushed_authorization_request_endpoint","aud","credential_issuer","getPar","makeParRequest","credentialDefinition","c","proofType","push","idphinting","idpHinting","challenge_method","challenge_redirect_uri","issuerRequestUri","authorizationDetails","exports"],"sourceRoot":"../../../../src","sources":["credential/issuance/03-start-user-authorization.ts"],"mappings":";;;;;;AAEA,IAAAA,KAAA,GAAAC,OAAA;AAGA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAmBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMG,0BAA0B,GAAGA,CACjCC,UAAkD,EAClDC,YAA4C,KACpB;EACxB,MAAMC,mCAAmC,GACvC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,EAAEqB,aAAa,CAAC;EAClE,MAAM+B,MAAM,GAAG,IAAAC,mBAAc,EAAC;IAAEjB,gBAAgB;IAAEG;EAAS,CAAC,CAAC;EAE7D,MAAMe,oBAAoB,GAAG,CAC3B,GAAGjC,aAAa,CAACX,GAAG,CAAE6C,CAAC,IAAKxD,0BAA0B,CAACC,UAAU,EAAEuD,CAAC,CAAC,CAAC,CACvE;EAED,IAAIrB,KAAK,CAACsB,SAAS,KAAK,UAAU,EAAE;IAClC;AACJ;AACA;AACA;AACA;AACA;IACIF,oBAAoB,CAACG,IAAI,CAAC;MACxB7C,IAAI,EAAE,sBAAsB;MAC5B8C,UAAU,EAAExB,KAAK,CAACyB,UAAU;MAC5BC,gBAAgB,EAAE,UAAU;MAC5BC,sBAAsB,EAAEvB;IAC1B,CAAC,CAAC;EACJ;EAEA,MAAMwB,gBAAgB,GAAG,MAAMV,MAAM,CACnCJ,WAAW,EACXX,yBAAyB,EACzB;IACEa,GAAG;IACHT,QAAQ;IACRK,YAAY;IACZR,WAAW;IACXP,YAAY;IACZgC,oBAAoB,EAAET;EACxB,CACF,CAAC;EAED,OAAO;IAAEQ,gBAAgB;IAAErB,QAAQ;IAAEK,YAAY;IAAEQ;EAAqB,CAAC;AAC3E,CAAC;AAACU,OAAA,CAAA/B,sBAAA,GAAAA,sBAAA"}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.parseAuthorizationResponse = exports.getRequestedCredentialToBePresented = exports.completeUserAuthorizationWithQueryMode = exports.completeUserAuthorizationWithFormPostJwtMode = exports.buildAuthorizationUrl = void 0;
6
+ exports.parseAuthorizationResponse = exports.getRequestedCredentialToBePresented = exports.continueUserAuthorizationWithMRTDPoPChallenge = exports.completeUserAuthorizationWithQueryMode = exports.completeUserAuthorizationWithFormPostJwtMode = exports.buildAuthorizationUrl = void 0;
7
7
  var _auth = require("../../utils/auth");
8
8
  var _misc = require("../../utils/misc");
9
9
  var _parseUrl = _interopRequireDefault(require("parse-url"));
@@ -20,6 +20,29 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
20
20
  * 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.
21
21
  */
22
22
 
23
+ /**
24
+ * 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
25
+ * issuance requires a MRTD PoP challenge.
26
+ * @param authRedirectUrl The URL to which the end user should be redirected to start the MRTD PoP validation flow
27
+ * @returns the authorization response which contains the challenge
28
+ */
29
+ const continueUserAuthorizationWithMRTDPoPChallenge = async authRedirectUrl => {
30
+ _logging.Logger.log(_logging.LogLevel.DEBUG, `The requested credential is a PersonIdentificationData and requires MRTD PoP, starting MRTD PoP validation from auth redirect`);
31
+ const query = (0, _parseUrl.default)(authRedirectUrl).query;
32
+ const authResParsed = _auth.AuthorizationChallengeResultShape.safeParse(query);
33
+ if (!authResParsed.success) {
34
+ const authErr = _auth.AuthorizationErrorShape.safeParse(query);
35
+ if (!authErr.success) {
36
+ _logging.Logger.log(_logging.LogLevel.ERROR, `Error while parsing the authorization response: ${authResParsed.error.message}`);
37
+ throw new _errors2.AuthorizationError(authResParsed.error.message); // an error occured while parsing the result and the error
38
+ }
39
+
40
+ _logging.Logger.log(_logging.LogLevel.ERROR, `Error while authorizating with the idp: ${JSON.stringify(authErr)}`);
41
+ throw new _errors2.AuthorizationIdpError(authErr.data.error, authErr.data.error_description);
42
+ }
43
+ return authResParsed.data;
44
+ };
45
+
23
46
  /**
24
47
  * 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.
25
48
  * Builds the authorization URL to which the end user should be redirected to continue the authentication flow.
@@ -29,6 +52,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
29
52
  * @param idpHint Unique identifier of the IDP selected by the user (optional)
30
53
  * @returns An object containing the authorization URL
31
54
  */
55
+ exports.continueUserAuthorizationWithMRTDPoPChallenge = continueUserAuthorizationWithMRTDPoPChallenge;
32
56
  const buildAuthorizationUrl = async (issuerRequestUri, clientId, issuerConf, idpHint) => {
33
57
  const authzRequestEndpoint = issuerConf.oauth_authorization_server.authorization_endpoint;
34
58
  const params = new URLSearchParams({
@@ -53,7 +77,7 @@ const buildAuthorizationUrl = async (issuerRequestUri, clientId, issuerConf, idp
53
77
  */
54
78
  exports.buildAuthorizationUrl = buildAuthorizationUrl;
55
79
  const completeUserAuthorizationWithQueryMode = async authRedirectUrl => {
56
- _logging.Logger.log(_logging.LogLevel.DEBUG, `The requeste credential is a PersonIdentificationData, completing the user authorization with query mode`);
80
+ _logging.Logger.log(_logging.LogLevel.DEBUG, `The requested credential is a PersonIdentificationData, completing the user authorization with query mode`);
57
81
  const query = (0, _parseUrl.default)(authRedirectUrl).query;
58
82
  return parseAuthorizationResponse(query);
59
83
  };
@@ -1 +1 @@
1
- {"version":3,"names":["_auth","require","_misc","_parseUrl","_interopRequireDefault","_errors","_ioReactNativeJwt","_types","_types2","_decoder","_errors2","_logging","_","obj","__esModule","default","buildAuthorizationUrl","issuerRequestUri","clientId","issuerConf","idpHint","authzRequestEndpoint","oauth_authorization_server","authorization_endpoint","params","URLSearchParams","client_id","request_uri","append","authUrl","exports","completeUserAuthorizationWithQueryMode","authRedirectUrl","Logger","log","LogLevel","DEBUG","query","parseUrl","parseAuthorizationResponse","getRequestedCredentialToBePresented","appFetch","arguments","length","undefined","fetch","toString","requestObject","method","then","hasStatusOrThrow","IssuerResponseError","res","text","jws","decode","reqObj","RequestObject","safeParse","payload","success","ERROR","error","message","ValidationFailed","reason","data","completeUserAuthorizationWithFormPostJwtMode","pid","_ref","wiaCryptoContext","pidCryptoContext","dcql_query","Error","dcqlQueryResult","Presentation","evaluateDcqlQuery","credentialsToPresent","map","_ref2","requiredDisclosures","rest","requestedClaims","_ref3","claimName","remotePresentations","prepareRemotePresentations","nonce","authzResponsePayload","createAuthzResponsePayload","state","body","response","resUriRes","response_uri","headers","reqUri","json","responseUri","ResponseUriResultShape","redirect_uri","getJwtFromFormPost","cbRes","decodedJwt","authRes","authResParsed","AuthorizationResultShape","authErr","AuthorizationErrorShape","AuthorizationError","JSON","stringify","AuthorizationIdpError","error_description","_ref4","kid","getPublicKey","SignJWT","setProtectedHeader","typ","setPayload","vp_token","reduce","_ref5","credentialId","vpToken","setIssuedAt","setExpirationTime","sign"],"sourceRoot":"../../../../src","sources":["credential/issuance/04-complete-user-authorization.ts"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AAEA,IAAAE,SAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAEA,IAAAK,iBAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AACA,IAAAS,QAAA,GAAAT,OAAA;AACA,IAAAU,QAAA,GAAAV,OAAA;AACA,IAAAW,CAAA,GAAAX,OAAA;AAAkC,SAAAG,uBAAAS,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAGlC;AACA;AACA;;AA+BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMG,qBAA4C,GAAG,MAAAA,CAC1DC,gBAAgB,EAChBC,QAAQ,EACRC,UAAU,EACVC,OAAO,KACJ;EACH,MAAMC,oBAAoB,GACxBF,UAAU,CAACG,0BAA0B,CAACC,sBAAsB;EAE9D,MAAMC,MAAM,GAAG,IAAIC,eAAe,CAAC;IACjCC,SAAS,EAAER,QAAQ;IACnBS,WAAW,EAAEV;EACf,CAAC,CAAC;EAEF,IAAIG,OAAO,EAAE;IACXI,MAAM,CAACI,MAAM,CAAC,SAAS,EAAER,OAAO,CAAC;EACn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K,EACb,2CAA0CiD,IAAI,CAACC,SAAS,CAACJ,OAAO,CAAE,EACrE,CAAC;IACD,MAAM,IAAIK,8BAAqB,CAC7BL,OAAO,CAACzC,IAAI,CAACJ,KAAK,EAClB6C,OAAO,CAACzC,IAAI,CAAC+C,iBACf,CAAC;EACH;EACA,OAAOR,aAAa,CAACvC,IAAI;AAC3B,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPApC,OAAA,CAAAS,0BAAA,GAAAA,0BAAA;AAQA,MAAMkD,0BAA0B,GAAG,MAAAyB,KAAA,IAQZ;EAAA,IARmB;IACxCxB,KAAK;IACLL,mBAAmB;IACnBf;EAKF,CAAC,GAAA4C,KAAA;EACC,MAAM;IAAEC;EAAI,CAAC,GAAG,MAAM7C,gBAAgB,CAAC8C,YAAY,CAAC,CAAC;EAErD,OAAO,IAAIC,yBAAO,CAAC/C,gBAAgB,CAAC,CACjCgD,kBAAkB,CAAC;IAClBC,GAAG,EAAE,KAAK;IACVJ;EACF,CAAC,CAAC,CACDK,UAAU,CAAC;IACV;AACN;AACA;AACA;AACA;IACM,IAAI9B,KAAK,GAAG;MAAEA;IAAM,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3B+B,QAAQ,EAAEpC,mBAAmB,CAACqC,MAAM,CAClC,CAACD,QAAQ,EAAAE,KAAA;MAAA,IAAE;QAAEC,YAAY;QAAEC;MAAQ,CAAC,GAAAF,KAAA;MAAA,OAAM;QACxC,GAAGF,QAAQ;QACX,CAACG,YAAY,GAAGC;MAClB,CAAC;IAAA,CAAC,EACF,CAAC,CACH;EACF,CAAC,CAAC,CACDC,WAAW,CAAC,CAAC,CACbC,iBAAiB,CAAC,IAAI,CAAC,CACvBC,IAAI,CAAC,CAAC;AACX,CAAC"}
1
+ {"version":3,"names":["_auth","require","_misc","_parseUrl","_interopRequireDefault","_errors","_ioReactNativeJwt","_types","_types2","_decoder","_errors2","_logging","_","obj","__esModule","default","continueUserAuthorizationWithMRTDPoPChallenge","authRedirectUrl","Logger","log","LogLevel","DEBUG","query","parseUrl","authResParsed","AuthorizationChallengeResultShape","safeParse","success","authErr","AuthorizationErrorShape","ERROR","error","message","AuthorizationError","JSON","stringify","AuthorizationIdpError","data","error_description","exports","buildAuthorizationUrl","issuerRequestUri","clientId","issuerConf","idpHint","authzRequestEndpoint","oauth_authorization_server","authorization_endpoint","params","URLSearchParams","client_id","request_uri","append","authUrl","completeUserAuthorizationWithQueryMode","parseAuthorizationResponse","getRequestedCredentialToBePresented","appFetch","arguments","length","undefined","fetch","toString","requestObject","method","then","hasStatusOrThrow","IssuerResponseError","res","text","jws","decode","reqObj","RequestObject","payload","ValidationFailed","reason","completeUserAuthorizationWithFormPostJwtMode","pid","_ref","wiaCryptoContext","pidCryptoContext","dcql_query","Error","dcqlQueryResult","Presentation","evaluateDcqlQuery","credentialsToPresent","map","_ref2","requiredDisclosures","rest","requestedClaims","_ref3","claimName","remotePresentations","prepareRemotePresentations","nonce","authzResponsePayload","createAuthzResponsePayload","state","body","response","resUriRes","response_uri","headers","reqUri","json","responseUri","ResponseUriResultShape","redirect_uri","getJwtFromFormPost","cbRes","decodedJwt","authRes","AuthorizationResultShape","_ref4","kid","getPublicKey","SignJWT","setProtectedHeader","typ","setPayload","vp_token","reduce","_ref5","credentialId","vpToken","setIssuedAt","setExpirationTime","sign"],"sourceRoot":"../../../../src","sources":["credential/issuance/04-complete-user-authorization.ts"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAOA,IAAAC,KAAA,GAAAD,OAAA;AAEA,IAAAE,SAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAEA,IAAAK,iBAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AACA,IAAAS,QAAA,GAAAT,OAAA;AACA,IAAAU,QAAA,GAAAV,OAAA;AAC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C,CAAC,CACDC,WAAW,CAAC,CAAC,CACbC,iBAAiB,CAAC,IAAI,CAAC,CACvBC,IAAI,CAAC,CAAC;AACX,CAAC"}
@@ -23,30 +23,45 @@ graph TD;
23
23
  6[obtainCredential]
24
24
  7[verifyAndParseCredential]
25
25
  credSel{Is credential an eID?}
26
+ proofSel{Requires MRTD PoP?}
27
+ M1[continueUserAuthorizationWithMRTDPoPChallenge]
28
+ subgraph MRTD PoP flow
29
+ M2[verifyAndParseChallengeInfo]
30
+ M3[initChallenge]
31
+ M4[validateChallenge]
32
+ end
26
33
 
27
34
  0 --> 1
28
35
  1 --> 2
29
36
  2 --> 3
30
37
  3 --> credSel
31
- credSel -->|Yes| E4
38
+ credSel -->|Yes| proofSel
32
39
  credSel -->|No| C4
40
+ proofSel --> |Yes| M1
41
+ proofSel --> |No| E4
33
42
  C4 --> C4.1
34
43
  C4.1 --> 5
35
44
  E4 --> 5
36
45
  5 --> 6
37
46
  6 --> 7
47
+
48
+ M1 --> M2
49
+ M2 --> M3
50
+ M3 --> M4
51
+ M4 --> E4
52
+
38
53
  ```
39
54
 
40
55
  ## Mapped results
41
56
 
42
57
  The following errors are mapped to a `IssuerResponseError` with specific codes.
43
58
 
44
- |HTTP Status|Error Code|Description|
45
- |-----------|----------|-----------|
46
- |`201 Created`|`ERR_CREDENTIAL_ISSUING_NOT_SYNCHRONOUS`| This response is returned by the credential issuer when the request has been queued because the credential cannot be issued synchronously. The consumer should try to obtain the credential at a later time. Although `201 Created` is not considered an error, it is mapped as an error in this context in order to handle the case where the credential issuance is not synchronous. This allows keeping the flow consistent and handle the case where the credential is not immediately available.|
47
- |`403 Forbidden`|`ERR_CREDENTIAL_INVALID_STATUS`|This response is returned by the credential issuer when the requested credential has an invalid status. It might contain more details in the `reason` property.|
48
- |`404 Not Found`|`ERR_CREDENTIAL_INVALID_STATUS`| This response is returned by the credential issuer when the authenticated user is not entitled to receive the requested credential. It might contain more details in the `reason` property.|
49
- |`*`|`ERR_ISSUER_GENERIC_ERROR`|This is a generic error code to map unexpected errors that occurred when interacting with the Issuer.|
59
+ | HTTP Status | Error Code | Description |
60
+ | --------------- | ---------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
61
+ | `201 Created` | `ERR_CREDENTIAL_ISSUING_NOT_SYNCHRONOUS` | This response is returned by the credential issuer when the request has been queued because the credential cannot be issued synchronously. The consumer should try to obtain the credential at a later time. Although `201 Created` is not considered an error, it is mapped as an error in this context in order to handle the case where the credential issuance is not synchronous. This allows keeping the flow consistent and handle the case where the credential is not immediately available. |
62
+ | `403 Forbidden` | `ERR_CREDENTIAL_INVALID_STATUS` | This response is returned by the credential issuer when the requested credential has an invalid status. It might contain more details in the `reason` property. |
63
+ | `404 Not Found` | `ERR_CREDENTIAL_INVALID_STATUS` | This response is returned by the credential issuer when the authenticated user is not entitled to receive the requested credential. It might contain more details in the `reason` property. |
64
+ | `*` | `ERR_ISSUER_GENERIC_ERROR` | This is a generic error code to map unexpected errors that occurred when interacting with the Issuer. |
50
65
 
51
66
  ## Strong authentication for eID issuance (Query Mode)
52
67
 
@@ -60,6 +75,17 @@ CIE+PIN(L3) requires a different flow due to the physical card presence. Helper
60
75
 
61
76
  The expected result from the authentication process is in provided in the query string as defined in the [JWT Secured Authorization Response Mode for OAuth 2.0 (JARM)](https://openid.net/specs/oauth-v2-jarm.html#name-response-mode-queryjwt).
62
77
 
78
+ #### eID Substantial Authentication (L2+) with MRTD Verification
79
+
80
+ MRTD Verification is a sub-flow of the Issuance flow and is used when the requested eID requires **eID Substantial Authentication (LoA3) with MRTD (Machine Readable Travel Document) Verification**. This method provides an alternative to CIEid LoA High authentication, requiring two distinct steps to complete the authorization:
81
+
82
+ 1. **Primary Authentication**: LoA3 electronic identification (SPID or CIEid L2).
83
+ 2. **MRTD Proof of Possession (PoP)**: Electronic document reading and cryptographic verification.
84
+
85
+ This process is initiated by the Authorization Server responding to the primary authentication step with a redirect that includes a challenge in the query string, which is handled by the `continueUserAuthorizationWithMRTDPoPChallenge` function. Once the MRTD PoP is completed, the user must continue the PID issuance flow with the `completeUserAuthorizationWithQueryMode` function.
86
+
87
+ Complete documentation for the MRTD PoP flow can be found here: [mrtd-pop](./mrtd-pop/README.md)
88
+
63
89
  ## Authentication through credentials (Form Post JWT Mode)
64
90
 
65
91
  When the credential is different than an eID, the flow requires the user to present other credentials in order to obtain the requested one. This is done through the `getRequestedCredentialToBePresented` followed by the `completeUserAuthorizationWithFormPostJwtMode`.
@@ -122,8 +148,9 @@ const { issuerConf } = await Credential.Issuance.evaluateIssuerTrust(issuerUrl);
122
148
  // Start user authorization
123
149
  const { issuerRequestUri, clientId, codeVerifier } =
124
150
  await Credential.Issuance.startUserAuthorization(
125
- issuerConf,
126
- [credentialId],
151
+ issuerConf,
152
+ [credentialId],
153
+ { proofType: "none" },
127
154
  {
128
155
  walletInstanceAttestation,
129
156
  redirectUri: REDIRECT_URI,
@@ -199,10 +226,10 @@ const { parsedCredential } =
199
226
  issuerConf,
200
227
  credential,
201
228
  credential_configuration_id,
202
- {
203
- credentialCryptoContext,
229
+ {
230
+ credentialCryptoContext,
204
231
  ignoreMissingAttributes: true,
205
- includeUndefinedAttributes: false
232
+ includeUndefinedAttributes: false
206
233
  },
207
234
  mockX509CertRoot
208
235
  );
@@ -285,6 +312,7 @@ const { issuerRequestUri, clientId, codeVerifier, credentialDefinition } =
285
312
  await Credential.Issuance.startUserAuthorization(
286
313
  issuerConf,
287
314
  [credentialId], // Request authorization for one or more credentials
315
+ { proofType: "none" },
288
316
  {
289
317
  walletInstanceAttestation,
290
318
  redirectUri,
@@ -296,12 +324,7 @@ const { issuerRequestUri, clientId, codeVerifier, credentialDefinition } =
296
324
  // Complete the authorization process with query mode with the authorizationContext which opens the browser
297
325
  const { code } =
298
326
  await Credential.Issuance.completeUserAuthorizationWithQueryMode(
299
- issuerRequestUri,
300
- clientId,
301
- issuerConf,
302
- idpHint,
303
- redirectUri,
304
- authorizationContext
327
+ issuerRequestUri
305
328
  );
306
329
 
307
330
  // Create DPoP context which will be used for the whole issuance flow
@@ -372,3 +395,117 @@ return {
372
395
  The result of this flow is a raw credential and a parsed credential which must be stored securely in the wallet along with its crypto key.
373
396
 
374
397
  </details>
398
+
399
+ <details>
400
+ <summary>eID issuance flow with MRTD PoP validation</summary>
401
+
402
+ ```ts
403
+ /**
404
+ *
405
+ * Previous steps are the sames as the "eID issuance flow" example
406
+ *
407
+ */
408
+
409
+ // Start user authorization indicating "mrtd-pop" as the proof type with the idpHint of the
410
+ // chosen identification method
411
+ const { issuerRequestUri, clientId, codeVerifier, credentialDefinition } =
412
+ await Credential.Issuance.startUserAuthorization(
413
+ issuerConf,
414
+ [credentialId],
415
+ { proofType: "mrtd-pop", idpHinting: idpHint },
416
+ {
417
+ walletInstanceAttestation,
418
+ redirectUri: redirectUri,
419
+ wiaCryptoContext,
420
+ appFetch,
421
+ }
422
+ );
423
+
424
+ // Obtain the Authorization URL
425
+ const { authUrl } = await Credential.Issuance.buildAuthorizationUrl(
426
+ issuerRequestUri,
427
+ clientId,
428
+ issuerConf,
429
+ idpHint
430
+ );
431
+
432
+ // Extract challenge info from the Authorization URL
433
+ const { challenge_info } =
434
+ await Credential.Issuance.continueUserAuthorizationWithMRTDPoPChallenge(
435
+ authUrl
436
+ );
437
+
438
+ // Verify and parse challenge info and extract challenge data: initialization url, session and nonce
439
+ const {
440
+ htu: initUrl,
441
+ mrtd_auth_session,
442
+ mrtd_pop_jwt_nonce,
443
+ } = await Credential.Issuance.MRTDPoP.verifyAndParseChallengeInfo(
444
+ issuerConf,
445
+ challenge_info,
446
+ { wiaCryptoContext }
447
+ );
448
+
449
+ // Initialize challenge and obtain the challenge text to sign the CIE PACE protocol and validation url
450
+ const {
451
+ htu: validationUrl,
452
+ challenge,
453
+ mrtd_pop_nonce,
454
+ } = await Credential.Issuance.MRTDPoP.initChallenge(
455
+ issuerConf,
456
+ initUrl,
457
+ mrtd_auth_session,
458
+ mrtd_pop_jwt_nonce,
459
+ {
460
+ walletInstanceAttestation,
461
+ wiaCryptoContext,
462
+ appFetch,
463
+ }
464
+ );
465
+
466
+ // CIE cryptographic interaction: you need to sign the challenge with the CIE through NFC interaction
467
+ const { nis, mrtds } = /* NFC interactions functions */
468
+
469
+ // Validate challenge
470
+ const { mrtd_val_pop_nonce, redirect_uri } =
471
+ await Credential.Issuance.MRTDPoP.validateChallenge(
472
+ issuerConf,
473
+ validationUrl,
474
+ mrtd_auth_session,
475
+ mrtd_pop_nonce,
476
+ mrtd,
477
+ ias,
478
+ {
479
+ walletInstanceAttestation,
480
+ wiaCryptoContext,
481
+ appFetch,
482
+ }
483
+ );
484
+
485
+ // Build the callback url
486
+ const { callbackUrl } = await Credential.Issuance.buildChallengeCallbackUrl(
487
+ redirect_uri,
488
+ mrtd_val_pop_nonce,
489
+ mrtd_auth_session
490
+ );
491
+
492
+ // 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.
493
+ const authRedirectUrl = /* From a browser or webview redirect */
494
+
495
+ // Complete the authorization process with query mode using the returned callback url
496
+ const { code } =
497
+ await Credential.Issuance.completeUserAuthorizationWithQueryMode(
498
+ authRedirectUrl
499
+ );
500
+
501
+ /**
502
+ *
503
+ * The next steps are the same as the "eID issuance flow" example
504
+ *
505
+ */
506
+ };
507
+ ```
508
+
509
+ The result of this flow is a raw credential and a parsed credential which must be stored securely in the wallet along with its crypto key.
510
+
511
+ </details>
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.Errors = void 0;
6
+ exports.MRTDPoP = exports.Errors = void 0;
7
7
  Object.defineProperty(exports, "authorizeAccess", {
8
8
  enumerable: true,
9
9
  get: function () {
@@ -28,6 +28,12 @@ Object.defineProperty(exports, "completeUserAuthorizationWithQueryMode", {
28
28
  return _completeUserAuthorization.completeUserAuthorizationWithQueryMode;
29
29
  }
30
30
  });
31
+ Object.defineProperty(exports, "continueUserAuthorizationWithMRTDPoPChallenge", {
32
+ enumerable: true,
33
+ get: function () {
34
+ return _completeUserAuthorization.continueUserAuthorizationWithMRTDPoPChallenge;
35
+ }
36
+ });
31
37
  Object.defineProperty(exports, "evaluateIssuerTrust", {
32
38
  enumerable: true,
33
39
  get: function () {
@@ -72,6 +78,8 @@ var _obtainCredential = require("./06-obtain-credential");
72
78
  var _verifyAndParseCredential = require("./07-verify-and-parse-credential");
73
79
  var Errors = _interopRequireWildcard(require("./errors"));
74
80
  exports.Errors = Errors;
81
+ var MRTDPoP = _interopRequireWildcard(require("./mrtd-pop"));
82
+ exports.MRTDPoP = MRTDPoP;
75
83
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
76
84
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
77
85
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_evaluateIssuerTrust","require","_startUserAuthorization","_completeUserAuthorization","_authorizeAccess","_obtainCredential","_verifyAndParseCredential","Errors","_interopRequireWildcard","exports","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set"],"sourceRoot":"../../../../src","sources":["credential/issuance/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAAA,oBAAA,GAAAC,OAAA;AAIA,IAAAC,uBAAA,GAAAD,OAAA;AAIA,IAAAE,0BAAA,GAAAF,OAAA;AAWA,IAAAG,gBAAA,GAAAH,OAAA;AACA,IAAAI,iBAAA,GAAAJ,OAAA;AAIA,IAAAK,yBAAA,GAAAL,OAAA;AAIA,IAAAM,MAAA,GAAAC,uBAAA,CAAAP,OAAA;AAAmCQ,OAAA,CAAAF,MAAA,GAAAA,MAAA;AAAA,SAAAG,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAH,wBAAAO,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CAAAL,GAAA,SAAAM,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAX,GAAA,QAAAW,GAAA,kBAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAd,GAAA,EAAAW,GAAA,SAAAI,IAAA,GAAAR,qBAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAV,GAAA,EAAAW,GAAA,cAAAI,IAAA,KAAAA,IAAA,CAAAV,GAAA,IAAAU,IAAA,CAAAC,GAAA,KAAAR,MAAA,CAAAC,cAAA,CAAAH,MAAA,EAAAK,GAAA,EAAAI,IAAA,YAAAT,MAAA,CAAAK,GAAA,IAAAX,GAAA,CAAAW,GAAA,SAAAL,MAAA,CAAAJ,OAAA,GAAAF,GAAA,MAAAG,KAAA,IAAAA,KAAA,CAAAa,GAAA,CAAAhB,GAAA,EAAAM,MAAA,YAAAA,MAAA"}
1
+ {"version":3,"names":["_evaluateIssuerTrust","require","_startUserAuthorization","_completeUserAuthorization","_authorizeAccess","_obtainCredential","_verifyAndParseCredential","Errors","_interopRequireWildcard","exports","MRTDPoP","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set"],"sourceRoot":"../../../../src","sources":["credential/issuance/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAAA,oBAAA,GAAAC,OAAA;AAIA,IAAAC,uBAAA,GAAAD,OAAA;AAIA,IAAAE,0BAAA,GAAAF,OAAA;AAaA,IAAAG,gBAAA,GAAAH,OAAA;AACA,IAAAI,iBAAA,GAAAJ,OAAA;AAIA,IAAAK,yBAAA,GAAAL,OAAA;AAIA,IAAAM,MAAA,GAAAC,uBAAA,CAAAP,OAAA;AAAmCQ,OAAA,CAAAF,MAAA,GAAAA,MAAA;AACnC,IAAAG,OAAA,GAAAF,uBAAA,CAAAP,OAAA;AAAsCQ,OAAA,CAAAC,OAAA,GAAAA,OAAA;AAAA,SAAAC,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAJ,wBAAAQ,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CAAAL,GAAA,SAAAM,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAX,GAAA,QAAAW,GAAA,kBAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAd,GAAA,EAAAW,GAAA,SAAAI,IAAA,GAAAR,qBAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAV,GAAA,EAAAW,GAAA,cAAAI,IAAA,KAAAA,IAAA,CAAAV,GAAA,IAAAU,IAAA,CAAAC,GAAA,KAAAR,MAAA,CAAAC,cAAA,CAAAH,MAAA,EAAAK,GAAA,EAAAI,IAAA,YAAAT,MAAA,CAAAK,GAAA,IAAAX,GAAA,CAAAW,GAAA,SAAAL,MAAA,CAAAJ,OAAA,GAAAF,GAAA,MAAAG,KAAA,IAAAA,KAAA,CAAAa,GAAA,CAAAhB,GAAA,EAAAM,MAAA,YAAAA,MAAA"}
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.verifyAndParseChallengeInfo = void 0;
7
+ var _ioReactNativeJwt = require("@pagopa/io-react-native-jwt");
8
+ var _types = require("./types");
9
+ var _errors = require("../../../utils/errors");
10
+ /**
11
+ * Verifies and parses the payload of a MRTD Proof Challenge Info JWT obtained after the primary authentication.
12
+ *
13
+ * This function performs the following steps:
14
+ * 1. Validates the JWT signature using the issuer's JWKS.
15
+ * 2. Decodes the JWT and parses its structure according to the {@link MrtdProofChallengeInfo} schema.
16
+ * 3. Verifies that the `aud` claim matches the client's public key ID.
17
+ * 4. Checks that the JWT is not expired and was not issued in the future.
18
+ *
19
+ * @param issuerConf - The issuer configuration containing the JWKS for signature verification.
20
+ * @param challengeInfoJwt - The JWT string representing the MRTD Proof Challenge Info.
21
+ * @param context - The context containing the WIA crypto context used to retrieve the client public key.
22
+ * @returns The parsed payload of the MRTD Proof Challenge Info JWT.
23
+ * @throws {Error} If the JWT signature is invalid, the structure is malformed, the `aud` claim does not match,
24
+ * or the JWT is expired/not yet valid.
25
+ */
26
+ const verifyAndParseChallengeInfo = async (issuerConf, challengeInfoJwt, _ref) => {
27
+ let {
28
+ wiaCryptoContext
29
+ } = _ref;
30
+ // Verify JWT signature
31
+ await (0, _ioReactNativeJwt.verify)(challengeInfoJwt, issuerConf.oauth_authorization_server.jwks.keys);
32
+
33
+ // Decode JWT
34
+ const challengeInfoDecoded = (0, _ioReactNativeJwt.decode)(challengeInfoJwt);
35
+
36
+ // Parse and validate structure
37
+ const challengeInfoParsed = _types.MrtdProofChallengeInfo.safeParse(challengeInfoDecoded);
38
+ if (!challengeInfoParsed.success) {
39
+ throw new _errors.IoWalletError("Malformed challenge info.");
40
+ }
41
+ const payload = challengeInfoParsed.data.payload;
42
+
43
+ // Verify aud claim
44
+ const clientId = await wiaCryptoContext.getPublicKey().then(_ => _.kid);
45
+ if (payload.aud !== clientId) {
46
+ throw new _errors.IoWalletError("aud claim does not match client_id.");
47
+ }
48
+
49
+ // Verify iat and exp
50
+ const now = Math.floor(Date.now() / 1000);
51
+ if (payload.iat > now || payload.exp < now) {
52
+ throw new _errors.IoWalletError("JWT is not valid (issued in future or expired).");
53
+ }
54
+ return payload;
55
+ };
56
+ exports.verifyAndParseChallengeInfo = verifyAndParseChallengeInfo;
57
+ //# sourceMappingURL=01-verify-and-parse-challenge-info.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_ioReactNativeJwt","require","_types","_errors","verifyAndParseChallengeInfo","issuerConf","challengeInfoJwt","_ref","wiaCryptoContext","verifyJwt","oauth_authorization_server","jwks","keys","challengeInfoDecoded","decodeJwt","challengeInfoParsed","MrtdProofChallengeInfo","safeParse","success","IoWalletError","payload","data","clientId","getPublicKey","then","_","kid","aud","now","Math","floor","Date","iat","exp","exports"],"sourceRoot":"../../../../../src","sources":["credential/issuance/mrtd-pop/01-verify-and-parse-challenge-info.ts"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAKA,IAAAC,MAAA,GAAAD,OAAA;AAGA,IAAAE,OAAA,GAAAF,OAAA;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMG,2BAAwD,GAAG,MAAAA,CACtEC,UAAU,EACVC,gBAAwB,EAAAC,IAAA,KAErB;EAAA,IADH;IAAEC;EAAiB,CAAC,GAAAD,IAAA;EAEpB;EACA,MAAM,IAAAE,wBAAS,EACbH,gBAAgB,EAChBD,UAAU,CAACK,0BAA0B,CAACC,IAAI,CAACC,IAC7C,CAAC;;EAED;EACA,MAAMC,oBAAoB,GAAG,IAAAC,wBAAS,EAACR,gBAAgB,CAAC;;EAExD;EACA,MAAMS,mBAAmB,GACvBC,6BAAsB,CAACC,SAAS,CAACJ,oBAAoB,CAAC;EACxD,IAAI,CAACE,mBAAmB,CAACG,OAAO,EAAE;IAChC,MAAM,IAAIC,qBAAa,CAAC,2BAA2B,CAAC;EACtD;EACA,MAAMC,OAAO,GAAGL,mBAAmB,CAACM,IAAI,CAACD,OAAO;;EAEhD;EACA,MAAME,QAAQ,GAAG,MAAMd,gBAAgB,CAACe,YAAY,CAAC,CAAC,CAACC,IAAI,CAAEC,CAAC,IAAKA,CAAC,CAACC,GAAG,CAAC;EACzE,IAAIN,OAAO,CAACO,GAAG,KAAKL,QAAQ,EAAE;IAC5B,MAAM,IAAIH,qBAAa,CAAC,qCAAqC,CAAC;EAChE;;EAEA;EACA,MAAMS,GAAG,GAAGC,IAAI,CAACC,KAAK,CAACC,IAAI,CAACH,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC;EACzC,IAAIR,OAAO,CAACY,GAAG,GAAGJ,GAAG,IAAIR,OAAO,CAACa,GAAG,GAAGL,GAAG,EAAE;IAC1C,MAAM,IAAIT,qBAAa,CAAC,iDAAiD,CAAC;EAC5E;EAEA,OAAOC,OAAO;AAChB,CAAC;AAACc,OAAA,CAAA9B,2BAAA,GAAAA,2BAAA"}
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.initChallenge = void 0;
7
+ var _misc = require("../../../utils/misc");
8
+ var _uuid = require("uuid");
9
+ var _pop = require("../../../utils/pop");
10
+ var WalletInstanceAttestation = _interopRequireWildcard(require("../../../wallet-instance-attestation"));
11
+ var _errors = require("../../../utils/errors");
12
+ var _ioReactNativeJwt = require("@pagopa/io-react-native-jwt");
13
+ var _types = require("./types");
14
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
15
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
16
+ /**
17
+ * Initialaizes the MRTD challenge with the data received from the issuer after the primary authentication.
18
+ * This function must be called after {@link verifyAndParseChallengeInfo}.
19
+ *
20
+ * @param issuerConf - The issuer configuration containing the JWKS for signature verification.
21
+ * @param initUrl - The endpoint to call to initialize the challenge.
22
+ * @param mrtd_auth_session - Session identifier for session binding obtained from the MRTD Proof JWT.
23
+ * @param mrtd_pop_jwt_nonce - Nonce value obtained from the MRTD Proof JWT.
24
+ * @param context - The context containing the WIA crypto context used to retrieve the client public key,
25
+ * the wallet instance attestation and an optional fetch implementation.
26
+ * @returns The payload of the MRTD PoP Challenge JWT.
27
+ */
28
+ const initChallenge = async (issuerConf, initUrl, mrtd_auth_session, mrtd_pop_jwt_nonce, context) => {
29
+ const {
30
+ appFetch = fetch,
31
+ walletInstanceAttestation,
32
+ wiaCryptoContext
33
+ } = context;
34
+ const aud = issuerConf.openid_credential_issuer.credential_issuer;
35
+ const iss = WalletInstanceAttestation.decode(walletInstanceAttestation).payload.cnf.jwk.kid;
36
+ const signedWiaPoP = await (0, _pop.createPopToken)({
37
+ jti: `${(0, _uuid.v4)()}`,
38
+ aud,
39
+ iss
40
+ }, wiaCryptoContext);
41
+ const requestBody = {
42
+ mrtd_auth_session,
43
+ mrtd_pop_jwt_nonce
44
+ };
45
+ const mrtdPoPChallengeJwt = await appFetch(initUrl, {
46
+ method: "POST",
47
+ headers: {
48
+ "Content-Type": "application/json",
49
+ "OAuth-Client-Attestation": walletInstanceAttestation,
50
+ "OAuth-Client-Attestation-PoP": signedWiaPoP
51
+ },
52
+ body: JSON.stringify(requestBody)
53
+ }).then((0, _misc.hasStatusOrThrow)(202, _errors.IssuerResponseError)).then(res => res.text());
54
+ const mrtdPoPChallengeDecoded = (0, _ioReactNativeJwt.decode)(mrtdPoPChallengeJwt);
55
+ const {
56
+ payload
57
+ } = _types.MrtdPoPChallenge.parse(mrtdPoPChallengeDecoded);
58
+ return payload;
59
+ };
60
+ exports.initChallenge = initChallenge;
61
+ //# sourceMappingURL=02-init-challenge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_misc","require","_uuid","_pop","WalletInstanceAttestation","_interopRequireWildcard","_errors","_ioReactNativeJwt","_types","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","initChallenge","issuerConf","initUrl","mrtd_auth_session","mrtd_pop_jwt_nonce","context","appFetch","fetch","walletInstanceAttestation","wiaCryptoContext","aud","openid_credential_issuer","credential_issuer","iss","decode","payload","cnf","jwk","kid","signedWiaPoP","createPopToken","jti","uuidv4","requestBody","mrtdPoPChallengeJwt","method","headers","body","JSON","stringify","then","hasStatusOrThrow","IssuerResponseError","res","text","mrtdPoPChallengeDecoded","decodeJwt","MrtdPoPChallenge","parse","exports"],"sourceRoot":"../../../../../src","sources":["credential/issuance/mrtd-pop/02-init-challenge.ts"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAEA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAF,OAAA;AACA,IAAAG,yBAAA,GAAAC,uBAAA,CAAAJ,OAAA;AAEA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,iBAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAA2C,SAAAQ,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAA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