@pagopa/io-react-native-wallet 2.0.0-next.2 → 2.0.0-next.4

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 (146) hide show
  1. package/lib/commonjs/credential/issuance/03-start-user-authorization.js +38 -24
  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 +75 -57
  4. package/lib/commonjs/credential/issuance/04-complete-user-authorization.js.map +1 -1
  5. package/lib/commonjs/credential/issuance/05-authorize-access.js +6 -10
  6. package/lib/commonjs/credential/issuance/05-authorize-access.js.map +1 -1
  7. package/lib/commonjs/credential/issuance/06-obtain-credential.js +43 -11
  8. package/lib/commonjs/credential/issuance/06-obtain-credential.js.map +1 -1
  9. package/lib/commonjs/credential/issuance/07-verify-and-parse-credential.js +51 -48
  10. package/lib/commonjs/credential/issuance/07-verify-and-parse-credential.js.map +1 -1
  11. package/lib/commonjs/credential/issuance/README.md +77 -45
  12. package/lib/commonjs/credential/issuance/const.js +1 -1
  13. package/lib/commonjs/credential/issuance/types.js +17 -10
  14. package/lib/commonjs/credential/issuance/types.js.map +1 -1
  15. package/lib/commonjs/credential/presentation/07-evaluate-dcql-query.js +6 -13
  16. package/lib/commonjs/credential/presentation/07-evaluate-dcql-query.js.map +1 -1
  17. package/lib/commonjs/credential/presentation/07-evaluate-input-descriptor.js +10 -11
  18. package/lib/commonjs/credential/presentation/07-evaluate-input-descriptor.js.map +1 -1
  19. package/lib/commonjs/credential/presentation/types.js +1 -1
  20. package/lib/commonjs/credential/presentation/types.js.map +1 -1
  21. package/lib/commonjs/credential/status/README.md +0 -1
  22. package/lib/commonjs/sd-jwt/__test__/index.test.js +11 -15
  23. package/lib/commonjs/sd-jwt/__test__/index.test.js.map +1 -1
  24. package/lib/commonjs/sd-jwt/__test__/types.test.js +5 -2
  25. package/lib/commonjs/sd-jwt/__test__/types.test.js.map +1 -1
  26. package/lib/commonjs/sd-jwt/__test__/utils.test.js +37 -0
  27. package/lib/commonjs/sd-jwt/__test__/utils.test.js.map +1 -0
  28. package/lib/commonjs/sd-jwt/index.js +26 -1
  29. package/lib/commonjs/sd-jwt/index.js.map +1 -1
  30. package/lib/commonjs/sd-jwt/types.js +71 -8
  31. package/lib/commonjs/sd-jwt/types.js.map +1 -1
  32. package/lib/commonjs/sd-jwt/utils.js +64 -0
  33. package/lib/commonjs/sd-jwt/utils.js.map +1 -0
  34. package/lib/commonjs/trust/types.js +18 -13
  35. package/lib/commonjs/trust/types.js.map +1 -1
  36. package/lib/commonjs/utils/par.js +32 -22
  37. package/lib/commonjs/utils/par.js.map +1 -1
  38. package/lib/commonjs/utils/pop.js +1 -1
  39. package/lib/commonjs/utils/pop.js.map +1 -1
  40. package/lib/commonjs/wallet-instance-attestation/types.js +4 -1
  41. package/lib/commonjs/wallet-instance-attestation/types.js.map +1 -1
  42. package/lib/module/credential/issuance/03-start-user-authorization.js +38 -24
  43. package/lib/module/credential/issuance/03-start-user-authorization.js.map +1 -1
  44. package/lib/module/credential/issuance/04-complete-user-authorization.js +76 -58
  45. package/lib/module/credential/issuance/04-complete-user-authorization.js.map +1 -1
  46. package/lib/module/credential/issuance/05-authorize-access.js +6 -10
  47. package/lib/module/credential/issuance/05-authorize-access.js.map +1 -1
  48. package/lib/module/credential/issuance/06-obtain-credential.js +44 -12
  49. package/lib/module/credential/issuance/06-obtain-credential.js.map +1 -1
  50. package/lib/module/credential/issuance/07-verify-and-parse-credential.js +51 -48
  51. package/lib/module/credential/issuance/07-verify-and-parse-credential.js.map +1 -1
  52. package/lib/module/credential/issuance/README.md +77 -45
  53. package/lib/module/credential/issuance/const.js +1 -1
  54. package/lib/module/credential/issuance/types.js +13 -8
  55. package/lib/module/credential/issuance/types.js.map +1 -1
  56. package/lib/module/credential/presentation/07-evaluate-dcql-query.js +6 -13
  57. package/lib/module/credential/presentation/07-evaluate-dcql-query.js.map +1 -1
  58. package/lib/module/credential/presentation/07-evaluate-input-descriptor.js +10 -11
  59. package/lib/module/credential/presentation/07-evaluate-input-descriptor.js.map +1 -1
  60. package/lib/module/credential/presentation/types.js +1 -1
  61. package/lib/module/credential/presentation/types.js.map +1 -1
  62. package/lib/module/credential/status/README.md +0 -1
  63. package/lib/module/sd-jwt/__test__/index.test.js +11 -16
  64. package/lib/module/sd-jwt/__test__/index.test.js.map +1 -1
  65. package/lib/module/sd-jwt/__test__/types.test.js +5 -2
  66. package/lib/module/sd-jwt/__test__/types.test.js.map +1 -1
  67. package/lib/module/sd-jwt/__test__/utils.test.js +35 -0
  68. package/lib/module/sd-jwt/__test__/utils.test.js.map +1 -0
  69. package/lib/module/sd-jwt/index.js +7 -1
  70. package/lib/module/sd-jwt/index.js.map +1 -1
  71. package/lib/module/sd-jwt/types.js +70 -7
  72. package/lib/module/sd-jwt/types.js.map +1 -1
  73. package/lib/module/sd-jwt/utils.js +57 -0
  74. package/lib/module/sd-jwt/utils.js.map +1 -0
  75. package/lib/module/trust/types.js +18 -13
  76. package/lib/module/trust/types.js.map +1 -1
  77. package/lib/module/utils/par.js +29 -20
  78. package/lib/module/utils/par.js.map +1 -1
  79. package/lib/module/utils/pop.js +1 -1
  80. package/lib/module/utils/pop.js.map +1 -1
  81. package/lib/module/wallet-instance-attestation/types.js +4 -1
  82. package/lib/module/wallet-instance-attestation/types.js.map +1 -1
  83. package/lib/typescript/client/generated/wallet-provider.d.ts +12 -12
  84. package/lib/typescript/credential/issuance/01-start-flow.d.ts +2 -2
  85. package/lib/typescript/credential/issuance/01-start-flow.d.ts.map +1 -1
  86. package/lib/typescript/credential/issuance/03-start-user-authorization.d.ts +7 -6
  87. package/lib/typescript/credential/issuance/03-start-user-authorization.d.ts.map +1 -1
  88. package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts +7 -14
  89. package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts.map +1 -1
  90. package/lib/typescript/credential/issuance/05-authorize-access.d.ts.map +1 -1
  91. package/lib/typescript/credential/issuance/06-obtain-credential.d.ts +10 -5
  92. package/lib/typescript/credential/issuance/06-obtain-credential.d.ts.map +1 -1
  93. package/lib/typescript/credential/issuance/07-verify-and-parse-credential.d.ts +3 -2
  94. package/lib/typescript/credential/issuance/07-verify-and-parse-credential.d.ts.map +1 -1
  95. package/lib/typescript/credential/issuance/const.d.ts +1 -1
  96. package/lib/typescript/credential/issuance/types.d.ts +49 -26
  97. package/lib/typescript/credential/issuance/types.d.ts.map +1 -1
  98. package/lib/typescript/credential/presentation/01-start-flow.d.ts +2 -2
  99. package/lib/typescript/credential/presentation/07-evaluate-dcql-query.d.ts +4 -3
  100. package/lib/typescript/credential/presentation/07-evaluate-dcql-query.d.ts.map +1 -1
  101. package/lib/typescript/credential/presentation/07-evaluate-input-descriptor.d.ts +9 -5
  102. package/lib/typescript/credential/presentation/07-evaluate-input-descriptor.d.ts.map +1 -1
  103. package/lib/typescript/credential/presentation/types.d.ts +3 -4
  104. package/lib/typescript/credential/presentation/types.d.ts.map +1 -1
  105. package/lib/typescript/credential/status/types.d.ts +4 -4
  106. package/lib/typescript/pid/sd-jwt/types.d.ts +7 -7
  107. package/lib/typescript/sd-jwt/__test__/utils.test.d.ts +2 -0
  108. package/lib/typescript/sd-jwt/__test__/utils.test.d.ts.map +1 -0
  109. package/lib/typescript/sd-jwt/index.d.ts +69 -28
  110. package/lib/typescript/sd-jwt/index.d.ts.map +1 -1
  111. package/lib/typescript/sd-jwt/types.d.ts +264 -31
  112. package/lib/typescript/sd-jwt/types.d.ts.map +1 -1
  113. package/lib/typescript/sd-jwt/utils.d.ts +18 -0
  114. package/lib/typescript/sd-jwt/utils.d.ts.map +1 -0
  115. package/lib/typescript/trust/build-chain.d.ts +30 -14
  116. package/lib/typescript/trust/build-chain.d.ts.map +1 -1
  117. package/lib/typescript/trust/types.d.ts +322 -158
  118. package/lib/typescript/trust/types.d.ts.map +1 -1
  119. package/lib/typescript/utils/par.d.ts +29 -13
  120. package/lib/typescript/utils/par.d.ts.map +1 -1
  121. package/lib/typescript/wallet-instance-attestation/types.d.ts +9 -9
  122. package/lib/typescript/wallet-instance-attestation/types.d.ts.map +1 -1
  123. package/package.json +1 -1
  124. package/src/credential/issuance/01-start-flow.ts +2 -2
  125. package/src/credential/issuance/03-start-user-authorization.ts +57 -38
  126. package/src/credential/issuance/04-complete-user-authorization.ts +79 -85
  127. package/src/credential/issuance/05-authorize-access.ts +5 -11
  128. package/src/credential/issuance/06-obtain-credential.ts +56 -23
  129. package/src/credential/issuance/07-verify-and-parse-credential.ts +54 -62
  130. package/src/credential/issuance/README.md +77 -45
  131. package/src/credential/issuance/const.ts +1 -1
  132. package/src/credential/issuance/types.ts +19 -8
  133. package/src/credential/presentation/07-evaluate-dcql-query.ts +16 -17
  134. package/src/credential/presentation/07-evaluate-input-descriptor.ts +19 -16
  135. package/src/credential/presentation/types.ts +1 -2
  136. package/src/credential/status/README.md +0 -1
  137. package/src/sd-jwt/__test__/index.test.ts +8 -29
  138. package/src/sd-jwt/__test__/types.test.ts +6 -2
  139. package/src/sd-jwt/__test__/utils.test.ts +37 -0
  140. package/src/sd-jwt/index.ts +7 -1
  141. package/src/sd-jwt/types.ts +68 -7
  142. package/src/sd-jwt/utils.ts +73 -0
  143. package/src/trust/types.ts +23 -17
  144. package/src/utils/par.ts +37 -21
  145. package/src/utils/pop.ts +1 -1
  146. package/src/wallet-instance-attestation/types.ts +3 -1
@@ -6,55 +6,60 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.startUserAuthorization = void 0;
7
7
  var _misc = require("../../utils/misc");
8
8
  var _par = require("../../utils/par");
9
- var _const = require("./const");
10
9
  var _logging = require("../../utils/logging");
11
10
  /**
12
11
  * Ensures that the credential type requested is supported by the issuer and contained in the
13
12
  * issuer configuration.
14
13
  * @param issuerConf The issuer configuration returned by {@link evaluateIssuerTrust}
15
- * @param credentialType The type of the credential to be requested returned by {@link startFlow}
16
- * @param context.wiaCryptoContext The Wallet Instance's crypto context
17
- * @param context.walletInstanceAttestation The Wallet Instance's attestation
18
- * @param context.redirectUri The redirect URI which is the custom URL scheme that the Wallet Instance is registered to handle
19
- * @param context.appFetch (optional) fetch api implementation. Default: built-in fetch
14
+ * @param credentialId The credential configuration ID to be requested;
20
15
  * @returns The credential definition to be used in the request which includes the format and the type and its type
21
16
  */
22
- const selectCredentialDefinition = (issuerConf, credentialType) => {
17
+ const selectCredentialDefinition = (issuerConf, credentialId) => {
23
18
  const credential_configurations_supported = issuerConf.openid_credential_issuer.credential_configurations_supported;
24
- const [result] = Object.keys(credential_configurations_supported).filter(e => e.includes(credentialType)).map(e => ({
25
- credential_configuration_id: credentialType,
26
- format: credential_configurations_supported[e].format,
19
+ const [result] = Object.keys(credential_configurations_supported).filter(e => e.includes(credentialId)).map(() => ({
20
+ credential_configuration_id: credentialId,
27
21
  type: "openid_credential"
28
22
  }));
29
23
  if (!result) {
30
- _logging.Logger.log(_logging.LogLevel.ERROR, `Requested credential type ${credentialType} is not supported by the issuer according to its configuration ${JSON.stringify(credential_configurations_supported)}`);
31
- throw new Error(`No credential support the type '${credentialType}'`);
24
+ _logging.Logger.log(_logging.LogLevel.ERROR, `Requested credential ${credentialId} is not supported by the issuer according to its configuration ${JSON.stringify(credential_configurations_supported)}`);
25
+ throw new Error(`No credential support the type '${credentialId}'`);
32
26
  }
33
27
  return result;
34
28
  };
35
29
 
36
30
  /**
37
31
  * Ensures that the response mode requested is supported by the issuer and contained in the issuer configuration.
32
+ * When multiple credentials are provided, all of them must support the same response_mode.
38
33
  * @param issuerConf The issuer configuration
39
- * @param credentialType The type of the credential to be requested
34
+ * @param credentialIds The credential configuration IDs to be requested
40
35
  * @returns The response mode to be used in the request, "query" for PersonIdentificationData and "form_post.jwt" for all other types.
41
36
  */
42
- const selectResponseMode = (issuerConf, credentialType) => {
37
+ const selectResponseMode = (issuerConf, credentialIds) => {
43
38
  const responseModeSupported = issuerConf.oauth_authorization_server.response_modes_supported;
44
- const responseMode = credentialType === "PersonIdentificationData" ? "query" : "form_post.jwt";
45
- _logging.Logger.log(_logging.LogLevel.DEBUG, `Selected response mode ${responseMode} for credential type ${credentialType}`);
39
+ const responseModeSet = new Set();
40
+ for (const credentialId of credentialIds) {
41
+ responseModeSet.add(credentialId.match(/PersonIdentificationData/i) ? "query" : "form_post.jwt");
42
+ }
43
+ if (responseModeSet.size !== 1) {
44
+ _logging.Logger.log(_logging.LogLevel.ERROR, `${credentialIds} have incompatible response_mode: ${[...responseModeSet.values()]}`);
45
+ throw new Error("Requested credentials have incompatible response_mode and cannot be requested with the same PAR request");
46
+ }
47
+ const [responseMode] = responseModeSet.values();
48
+ _logging.Logger.log(_logging.LogLevel.DEBUG, `Selected response mode ${responseMode} for credential IDs ${credentialIds}`);
46
49
  if (!responseModeSupported.includes(responseMode)) {
47
50
  _logging.Logger.log(_logging.LogLevel.ERROR, `Requested response mode ${responseMode} is not supported by the issuer according to its configuration ${JSON.stringify(responseModeSupported)}`);
48
- throw new Error(`No response mode support the type '${credentialType}'`);
51
+ throw new Error(`No response mode support for IDs '${credentialIds}'`);
49
52
  }
50
53
  return responseMode;
51
54
  };
52
55
 
53
56
  /**
54
57
  * WARNING: This function must be called after {@link evaluateIssuerTrust} and {@link startFlow}. The next steam is {@link compeUserAuthorizationWithQueryMode} or {@link compeUserAuthorizationWithFormPostJwtMode}
58
+ *
55
59
  * Creates and sends a PAR request to the /as/par endpoint of the authorization server.
56
60
  * This starts the authentication flow to obtain an access token.
57
- * This token enables the Wallet Instance to request a digital credential from the Credential Endpoint of the Credential Issuer.
61
+ * This token enables the Wallet Instance to request a digital credential from the Credential Endpoint of the Credential Issuer; when multiple credential types are passed,
62
+ * it is possible to use the same access token for the issuance of all requested credentials.
58
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
59
64
  * along with the WTE and its proof of possession (WTE-PoP).
60
65
  * Additionally, it includes a request object, which is a signed JWT encapsulating the type of digital credential requested (authorization_details),
@@ -64,11 +69,12 @@ const selectResponseMode = (issuerConf, credentialType) => {
64
69
  * to the Wallet Instance's Token Endpoint to obtain the Access Token, and the redirectUri of the Wallet Instance where the Authorization Response
65
70
  * should be delivered. The redirect is achived by using a custom URL scheme that the Wallet Instance is registered to handle.
66
71
  * @param issuerConf The issuer configuration
67
- * @param credentialType The type of the credential to be requested returned by {@link selectCredentialDefinition}
72
+ * @param credentialIds The credential configuration IDs to be requested
68
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
69
- * @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
74
+ * @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)
70
75
  */
71
- const startUserAuthorization = async (issuerConf, credentialType, ctx) => {
76
+
77
+ const startUserAuthorization = async (issuerConf, credentialIds, ctx) => {
72
78
  const {
73
79
  wiaCryptoContext,
74
80
  walletInstanceAttestation,
@@ -82,13 +88,21 @@ const startUserAuthorization = async (issuerConf, credentialType, ctx) => {
82
88
  }
83
89
  const codeVerifier = (0, _misc.generateRandomAlphaNumericString)(64);
84
90
  const parEndpoint = issuerConf.oauth_authorization_server.pushed_authorization_request_endpoint;
85
- const credentialDefinition = selectCredentialDefinition(issuerConf, credentialType);
86
- const responseMode = selectResponseMode(issuerConf, credentialType);
91
+ const aud = issuerConf.openid_credential_issuer.credential_issuer;
92
+ const credentialDefinition = credentialIds.map(c => selectCredentialDefinition(issuerConf, c));
93
+ const responseMode = selectResponseMode(issuerConf, credentialIds);
87
94
  const getPar = (0, _par.makeParRequest)({
88
95
  wiaCryptoContext,
89
96
  appFetch
90
97
  });
91
- const issuerRequestUri = await getPar(clientId, codeVerifier, redirectUri, responseMode, parEndpoint, walletInstanceAttestation, [credentialDefinition], _const.ASSERTION_TYPE);
98
+ const issuerRequestUri = await getPar(parEndpoint, walletInstanceAttestation, {
99
+ aud,
100
+ clientId,
101
+ codeVerifier,
102
+ redirectUri,
103
+ responseMode,
104
+ authorizationDetails: credentialDefinition
105
+ });
92
106
  return {
93
107
  issuerRequestUri,
94
108
  clientId,
@@ -1 +1 @@
1
- {"version":3,"names":["_misc","require","_par","_const","_logging","selectCredentialDefinition","issuerConf","credentialType","credential_configurations_supported","openid_credential_issuer","result","Object","keys","filter","e","includes","map","credential_configuration_id","format","type","Logger","log","LogLevel","ERROR","JSON","stringify","Error","selectResponseMode","responseModeSupported","oauth_authorization_server","response_modes_supported","responseMode","DEBUG","startUserAuthorization","ctx","wiaCryptoContext","walletInstanceAttestation","redirectUri","appFetch","fetch","clientId","getPublicKey","then","_","kid","codeVerifier","generateRandomAlphaNumericString","parEndpoint","pushed_authorization_request_endpoint","credentialDefinition","getPar","makeParRequest","issuerRequestUri","ASSERTION_TYPE","exports"],"sourceRoot":"../../../../src","sources":["credential/issuance/03-start-user-authorization.ts"],"mappings":";;;;;;AAEA,IAAAA,KAAA,GAAAC,OAAA;AAGA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAkBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMI,0BAA0B,GAAGA,CACjCC,UAAkD,EAClDC,cAAgD,KACxB;EACxB,MAAMC,mCAAmC,GACvCF,UAAU,CAACG,wBAAwB,CAACD,mCAAmC;EAEzE,MAAM,CAACE,MAAM,CAAC,GAAGC,MAAM,CAACC,IAAI,CAACJ,mCAAmC,CAAC,CAC9DK,MAAM,CAAEC,CAAC,IAAKA,CAAC,CAACC,QAAQ,CAACR,cAAc,CAAC,CAAC,CACzCS,GAAG,CAAEF,CAAC,KAAM;IACXG,2BAA2B,EAAEV,cAAc;IAC3CW,MAAM,EAAEV,mCAAmC,CAACM,CAAC,CAAC,CAAEI,MAAM;IACtDC,IAAI,EAAE;EACR,CAAC,CAAC,CAAC;EAEL,IAAI,CAACT,MAAM,EAAE;IACXU,eAAM,CAACC,GAAG,CAC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zE,IAAI,CAACJ,QAAQ,EAAE;IACbpB,eAAM,CAACC,GAAG,CACRC,iBAAQ,CAACC,KAAK,EACb,kCAAiCiB,QAAS,0BAC7C,CAAC;IACD,MAAM,IAAId,KAAK,CAAC,qBAAqB,CAAC;EACxC;EACA,MAAMmB,YAAY,GAAG,IAAAC,sCAAgC,EAAC,EAAE,CAAC;EACzD,MAAMC,WAAW,GACfzC,UAAU,CAACuB,0BAA0B,CAACmB,qCAAqC;EAC7E,MAAMC,oBAAoB,GAAG5C,0BAA0B,CACrDC,UAAU,EACVC,cACF,CAAC;EACD,MAAMwB,YAAY,GAAGJ,kBAAkB,CAACrB,UAAU,EAAEC,cAAc,CAAC;EAEnE,MAAM2C,MAAM,GAAG,IAAAC,mBAAc,EAAC;IAAEhB,gBAAgB;IAAEG;EAAS,CAAC,CAAC;EAC7D,MAAMc,gBAAgB,GAAG,MAAMF,MAAM,CACnCV,QAAQ,EACRK,YAAY,EACZR,WAAW,EACXN,YAAY,EACZgB,WAAW,EACXX,yBAAyB,EACzB,CAACa,oBAAoB,CAAC,EACtBI,qBACF,CAAC;EAED,OAAO;IAAED,gBAAgB;IAAEZ,QAAQ;IAAEK,YAAY;IAAEI;EAAqB,CAAC;AAC3E,CAAC;AAACK,OAAA,CAAArB,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","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,mCAAmC;EAEzE,MAAM,CAACE,MAAM,CAAC,GAAGC,MAAM,CAACC,IAAI,CAACJ,mCAAmC,CAAC,CAC9DK,MAAM,CAAEC,CAAC,IAAKA,CAAC,CAACC,QAAQ,CAACR,YAAY,CAAC,CAAC,CACvCS,GAAG,CAAC,OAAO;IACVC,2BAA2B,EAAEV,YAAY;IACzCW,IAAI,EAAE;EACR,CAAC,CAAC,CAAC;EAEL,IAAI,CAACR,MAAM,EAAE;IACXS,eAAM,CAACC,GAAG,CACRC,iBAAQ,CAACC,KAAK,EACb,wBAAuBf,YAAa,kEAAiEgB,IAAI,CAACC,SAAS,CAAChB,mCAAmC,CAAE,EAC5J,CAAC;IACD,MAAM,IAAIiB,KAAK,CAAE,mCAAkClB,YAAa,GAAE,CAAC;EACrE;EACA,OAAOG,MAAM;AACf,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMgB,kBAAkB,GAAGA,CACzBpB,UAAkD,EAClDqB,aAAuB,KACN;EACjB,MAAMC,qBAAqB,GACzBtB,UAAU,CAACuB,0BAA0B,CAACC,wBAAwB;EAEhE,MAAMC,eAAe,GAAG,IAAIC,GAAG,CAAe,CAAC;EAE/C,KAAK,MAAMzB,YAAY,IAAIoB,aAAa,EAAE;IACxCI,eAAe,CAACE,GAAG,CACjB1B,YAAY,CAAC2B,KAAK,CAAC,2BAA2B,CAAC,GAC3C,OAAO,GACP,eACN,CAAC;EACH;EAEA,IAAIH,e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CAAC,qBAAqB,CAAC;EACxC;EACA,MAAM0B,YAAY,GAAG,IAAAC,sCAAgC,EAAC,EAAE,CAAC;EACzD,MAAMC,WAAW,GACf/C,UAAU,CAACuB,0BAA0B,CAACyB,qCAAqC;EAC7E,MAAMC,GAAG,GAAGjD,UAAU,CAACG,wBAAwB,CAAC+C,iBAAiB;EACjE,MAAMC,oBAAoB,GAAG9B,aAAa,CAACX,GAAG,CAAE0C,CAAC,IAC/CrD,0BAA0B,CAACC,UAAU,EAAEoD,CAAC,CAC1C,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"}
@@ -10,11 +10,11 @@ var _parseUrl = _interopRequireDefault(require("parse-url"));
10
10
  var _errors = require("../../utils/errors");
11
11
  var _ioReactNativeJwt = require("@pagopa/io-react-native-jwt");
12
12
  var _types = require("../presentation/types");
13
- var _uuid = require("uuid");
14
13
  var _types2 = require("./types");
15
14
  var _decoder = require("../../utils/decoder");
16
15
  var _errors2 = require("./errors");
17
16
  var _logging = require("../../utils/logging");
17
+ var _ = require("..");
18
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
19
  /**
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.
@@ -94,71 +94,47 @@ const getRequestedCredentialToBePresented = async function (issuerRequestUri, cl
94
94
  };
95
95
 
96
96
  /**
97
- * WARNING: This function must be called after {@link startUserAuthorization}. The next function to be called is {@link completeUserAuthorizationWithFormPostJwtMode}.
97
+ * WARNING: This function must be called after {@link getRequestedCredentialToBePresented}. The next function to be called is {@link authorizeAccess}.
98
98
  * The interface of the phase to complete User authorization via presentation of existing credentials when the response mode is "form_post.jwt".
99
- * It is used as a first step to complete the user authorization by obtaining the requested credential to be presented from the authorization server.
100
- * The information is obtained by performing a GET request to the authorization endpoint with request_uri and client_id parameters.
101
- * @param issuerRequestUri the URI of the issuer where the request is sent
102
- * @param clientId Identifies the current client across all the requests of the issuing flow returned by {@link startUserAuthorization}
103
- * @param issuerConf The issuer configuration returned by {@link evaluateIssuerTrust}
104
- * @param context.walletInstanceAccestation the Wallet Instance's attestation to be presented
105
- * @param context.pid the PID to be presented
106
- * @param context.wiaCryptoContext The Wallet Instance's crypto context associated with the walletInstanceAttestation parameter
107
- * @param context.pidCryptoContext The PID crypto context associated with the pid parameter
108
- * @param context.appFetch (optional) fetch api implementation. Default: built-in fetch
99
+ * The information is obtained by performing a POST request to the endpoint received in the response_uri field of the requestObject, where the Authorization Response payload is posted.
100
+ * Following this,the redirect_uri from the response is used to obtain the final authorization response.
101
+ * @param requestObject - The request object containing the necessary parameters for authorization.
102
+ * @param pid The `PID` that must be presented for the issuance of credentials.
103
+ * @param appFetch (optional) fetch api implementation. Default: built-in fetch
109
104
  * @throws {ValidationFailed} if an error while validating the response
110
105
  * @returns the authorization response which contains code, state and iss
111
106
  */
112
107
  exports.getRequestedCredentialToBePresented = getRequestedCredentialToBePresented;
113
- const completeUserAuthorizationWithFormPostJwtMode = async (requestObject, ctx) => {
114
- _logging.Logger.log(_logging.LogLevel.DEBUG, `The requeste credential is not a PersonIdentificationData, completing the user authorization with form_post.jwt mode`);
115
- const {
108
+ const completeUserAuthorizationWithFormPostJwtMode = async (requestObject, pid, _ref) => {
109
+ let {
116
110
  wiaCryptoContext,
117
111
  pidCryptoContext,
118
- pid,
119
- walletInstanceAttestation,
120
112
  appFetch = fetch
121
- } = ctx;
122
- const wiaWpToken = await new _ioReactNativeJwt.SignJWT(wiaCryptoContext).setProtectedHeader({
123
- alg: "ES256",
124
- typ: "JWT"
125
- }).setPayload({
126
- vp: walletInstanceAttestation,
127
- jti: (0, _uuid.v4)().toString(),
128
- nonce: requestObject.nonce
129
- }).setIssuedAt().setExpirationTime("5m").setAudience(requestObject.response_uri).sign();
130
- const pidWpToken = await new _ioReactNativeJwt.SignJWT(pidCryptoContext).setProtectedHeader({
131
- alg: "ES256",
132
- typ: "JWT"
133
- }).setPayload({
134
- vp: pid,
135
- jti: (0, _uuid.v4)().toString(),
136
- nonce: requestObject.nonce
137
- }).setIssuedAt().setExpirationTime("5m").setAudience(requestObject.response_uri).sign();
138
- _logging.Logger.log(_logging.LogLevel.DEBUG, `Wallet instance attestation JWT token: ${wiaWpToken}`);
139
-
140
- /* The path parameter refers to the vp_token variable of the authzResponsePayload and must point to the plain credential which
141
- * is cointaned in the `vp` property of the signed jwt token payload
142
- */
143
- const presentationSubmission = {
144
- definition_id: `${(0, _uuid.v4)()}`,
145
- id: `${(0, _uuid.v4)()}`,
146
- descriptor_map: [{
147
- id: "PersonIdentificationData",
148
- path: "$.vp_token[0].vp",
149
- format: "vc+sd-jwt"
150
- }, {
151
- id: "WalletAttestation",
152
- path: "$.vp_token[1].vp",
153
- format: "jwt"
154
- }]
155
- };
156
- _logging.Logger.log(_logging.LogLevel.DEBUG, `Presentation submission: ${JSON.stringify(presentationSubmission)}`);
157
- const authzResponsePayload = (0, _ioReactNativeJwt.encodeBase64)(JSON.stringify({
113
+ } = _ref;
114
+ _logging.Logger.log(_logging.LogLevel.DEBUG, `The requeste credential is not a PersonIdentificationData, completing the user authorization with form_post.jwt mode`);
115
+ if (!requestObject.dcql_query) {
116
+ throw new Error("Invalid request object");
117
+ }
118
+ const dcqlQueryResult = _.Presentation.evaluateDcqlQuery([[pidCryptoContext, pid]], requestObject.dcql_query);
119
+ const credentialsToPresent = dcqlQueryResult.map(_ref2 => {
120
+ let {
121
+ requiredDisclosures,
122
+ ...rest
123
+ } = _ref2;
124
+ return {
125
+ ...rest,
126
+ requestedClaims: requiredDisclosures.map(_ref3 => {
127
+ let [, claimName] = _ref3;
128
+ return claimName;
129
+ })
130
+ };
131
+ });
132
+ const remotePresentations = await _.Presentation.prepareRemotePresentations(credentialsToPresent, requestObject.nonce, requestObject.client_id);
133
+ const authzResponsePayload = await createAuthzResponsePayload({
158
134
  state: requestObject.state,
159
- presentation_submission: presentationSubmission,
160
- vp_token: [pidWpToken, wiaWpToken]
161
- }));
135
+ remotePresentations,
136
+ wiaCryptoContext
137
+ });
162
138
  _logging.Logger.log(_logging.LogLevel.DEBUG, `Authz response payload: ${authzResponsePayload}`);
163
139
 
164
140
  // Note: according to the spec, the response should be encrypted with the public key of the RP however this is not implemented yet
@@ -213,5 +189,47 @@ const parseAuthorizationResponse = authRes => {
213
189
  }
214
190
  return authResParsed.data;
215
191
  };
192
+
193
+ /**
194
+ * Creates the authorization response payload to be sent.
195
+ * This payload includes the state and the VP tokens for the presented credentials.
196
+ * The payload is encoded in Base64.
197
+ * @param state - The state parameter from the request object (optional).
198
+ * @param remotePresentations - An array of remote presentations containing credential IDs and their corresponding VP tokens.
199
+ * @returns The Base64 encoded authorization response payload.
200
+ */
216
201
  exports.parseAuthorizationResponse = parseAuthorizationResponse;
202
+ const createAuthzResponsePayload = async _ref4 => {
203
+ let {
204
+ state,
205
+ remotePresentations,
206
+ wiaCryptoContext
207
+ } = _ref4;
208
+ const {
209
+ kid
210
+ } = await wiaCryptoContext.getPublicKey();
211
+ return new _ioReactNativeJwt.SignJWT(wiaCryptoContext).setProtectedHeader({
212
+ typ: "jwt",
213
+ kid
214
+ }).setPayload({
215
+ /**
216
+ * TODO [SIW-2264]: `state` coming from `requestObject` is marked as `optional`
217
+ * At the moment, it is not entirely clear whether this value can indeed be omitted
218
+ * and, if so, what the consequences of its absence might be.
219
+ */
220
+ ...(state ? {
221
+ state
222
+ } : {}),
223
+ vp_token: remotePresentations.reduce((vp_token, _ref5) => {
224
+ let {
225
+ credentialId,
226
+ vpToken
227
+ } = _ref5;
228
+ return {
229
+ ...vp_token,
230
+ [credentialId]: vpToken
231
+ };
232
+ }, {})
233
+ }).setIssuedAt().setExpirationTime("1h").sign();
234
+ };
217
235
  //# sourceMappingURL=04-complete-user-authorization.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_auth","require","_misc","_parseUrl","_interopRequireDefault","_errors","_ioReactNativeJwt","_types","_uuid","_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","ctx","wiaCryptoContext","pidCryptoContext","pid","walletInstanceAttestation","wiaWpToken","SignJWT","setProtectedHeader","alg","typ","setPayload","vp","jti","uuidv4","nonce","setIssuedAt","setExpirationTime","setAudience","response_uri","sign","pidWpToken","presentationSubmission","definition_id","id","descriptor_map","path","format","JSON","stringify","authzResponsePayload","encodeBase64","state","presentation_submission","vp_token","body","response","resUriRes","headers","reqUri","json","responseUri","ResponseUriResultShape","redirect_uri","getJwtFromFormPost","cbRes","decodedJwt","authRes","authResParsed","AuthorizationResultShape","authErr","AuthorizationErrorShape","AuthorizationError","AuthorizationIdpError","error_description"],"sourceRoot":"../../../../src","sources":["credential/issuance/04-complete-user-authorization.ts"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,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GAAAA,4CAAA;AAOO,MAAM5B,0BAA0B,GACrC2E,OAAgB,IACQ;EACxB,MAAMC,aAAa,GAAGC,8BAAwB,CAAC1D,SAAS,CAACwD,OAAO,CAAC;EACjE,IAAI,CAACC,aAAa,CAACvD,OAAO,EAAE;IAC1B,MAAMyD,OAAO,GAAGC,6BAAuB,CAAC5D,SAAS,CAACwD,OAAO,CAAC;IAC1D,IAAI,CAACG,OAAO,CAACzD,OAAO,EAAE;MACpB3B,eAAM,CAACC,GAAG,CACRC,iBAAQ,CAAC0B,KAAK,EACb,mDAAkDsD,aAAa,CAACrD,KAAK,CAACC,OAAQ,EACjF,CAAC;MACD,MAAM,IAAIwD,2BAAkB,CAACJ,aAAa,CAACrD,KAAK,CAACC,OAAO,CAAC,CAAC,CAAC;IAC7D;;IACA9B,eAAM,CAACC,GAAG,CACRC,iBAAQ,CAAC0B,KAAK,EACb,2CAA0CkC,IAAI,CAACC,SAAS,CAACqB,OAAO,CAAE,EACrE,CAAC;IACD,MAAM,IAAIG,8BAAqB,CAC7BH,OAAO,CAACnD,IAAI,CAACJ,KAAK,EAClBuD,OAAO,CAACnD,IAAI,CAACuD,iBACf,CAAC;EACH;EACA,OAAON,aAAa,CAACjD,IAAI;AAC3B,CAAC;AAACpC,OAAA,CAAAS,0BAAA,GAAAA,0BAAA"}
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,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DC,WAAW,CAAC,CAAC,CACbC,iBAAiB,CAAC,IAAI,CAAC,CACvBC,IAAI,CAAC,CAAC;AACX,CAAC"}
@@ -9,7 +9,6 @@ var _dpop = require("../../utils/dpop");
9
9
  var _uuid = require("uuid");
10
10
  var _pop = require("../../utils/pop");
11
11
  var WalletInstanceAttestation = _interopRequireWildcard(require("../../wallet-instance-attestation"));
12
- var _const = require("./const");
13
12
  var _types = require("./types");
14
13
  var _errors = require("../../utils/errors");
15
14
  var _logging = require("../../utils/logging");
@@ -33,16 +32,14 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
33
32
  * @throws {IssuerResponseError} with a specific code for more context
34
33
  * @return The token response containing the access token along with the token request signed with DPoP which has to be used in the {@link obtainCredential} step.
35
34
  */
36
- const authorizeAccess = async (issuerConf, code, clientId, redirectUri, codeVerifier, context) => {
35
+ const authorizeAccess = async (issuerConf, code, _, redirectUri, codeVerifier, context) => {
37
36
  const {
38
37
  appFetch = fetch,
39
38
  walletInstanceAttestation,
40
39
  wiaCryptoContext,
41
40
  dPopCryptoContext
42
41
  } = context;
43
- const parEndpoint = issuerConf.oauth_authorization_server.pushed_authorization_request_endpoint;
44
- const parUrl = new URL(parEndpoint);
45
- const aud = `${parUrl.protocol}//${parUrl.hostname}`;
42
+ const aud = issuerConf.openid_credential_issuer.credential_issuer;
46
43
  const iss = WalletInstanceAttestation.decode(walletInstanceAttestation).payload.cnf.jwk.kid;
47
44
  const tokenUrl = issuerConf.oauth_authorization_server.token_endpoint;
48
45
  const tokenRequestSignedDPop = await (0, _dpop.createDPopToken)({
@@ -59,12 +56,9 @@ const authorizeAccess = async (issuerConf, code, clientId, redirectUri, codeVeri
59
56
  _logging.Logger.log(_logging.LogLevel.DEBUG, `WIA DPoP token: ${signedWiaPoP}`);
60
57
  const requestBody = {
61
58
  grant_type: "authorization_code",
62
- client_id: clientId,
63
59
  code,
64
- redirect_uri: redirectUri,
65
60
  code_verifier: codeVerifier,
66
- client_assertion_type: _const.ASSERTION_TYPE,
67
- client_assertion: walletInstanceAttestation + "~" + signedWiaPoP
61
+ redirect_uri: redirectUri
68
62
  };
69
63
  const authorizationRequestFormBody = new URLSearchParams(requestBody);
70
64
  _logging.Logger.log(_logging.LogLevel.DEBUG, `Auth form request body: ${authorizationRequestFormBody}`);
@@ -72,7 +66,9 @@ const authorizeAccess = async (issuerConf, code, clientId, redirectUri, codeVeri
72
66
  method: "POST",
73
67
  headers: {
74
68
  "Content-Type": "application/x-www-form-urlencoded",
75
- DPoP: tokenRequestSignedDPop
69
+ DPoP: tokenRequestSignedDPop,
70
+ "OAuth-Client-Attestation": walletInstanceAttestation,
71
+ "OAuth-Client-Attestation-PoP": signedWiaPoP
76
72
  },
77
73
  body: authorizationRequestFormBody.toString()
78
74
  }).then((0, _misc.hasStatusOrThrow)(200, _errors.IssuerResponseError)).then(res => res.json()).then(body => _types.TokenResponse.safeParse(body));
@@ -1 +1 @@
1
- {"version":3,"names":["_misc","require","_dpop","_uuid","_pop","WalletInstanceAttestation","_interopRequireWildcard","_const","_types","_errors","_logging","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","authorizeAccess","issuerConf","code","clientId","redirectUri","codeVerifier","context","appFetch","fetch","walletInstanceAttestation","wiaCryptoContext","dPopCryptoContext","parEndpoint","oauth_authorization_server","pushed_authorization_request_endpoint","parUrl","URL","aud","protocol","hostname","iss","decode","payload","cnf","jwk","kid","tokenUrl","token_endpoint","tokenRequestSignedDPop","createDPopToken","htm","htu","jti","uuidv4","Logger","log","LogLevel","DEBUG","signedWiaPoP","createPopToken","requestBody","grant_type","client_id","redirect_uri","code_verifier","client_assertion_type","ASSERTION_TYPE","client_assertion","authorizationRequestFormBody","URLSearchParams","tokenRes","method","headers","DPoP","body","toString","then","hasStatusOrThrow","IssuerResponseError","res","json","TokenResponse","safeParse","success","ERROR","error","message","ValidationFailed","reason","accessToken","data","exports"],"sourceRoot":"../../../../src","sources":["credential/issuance/05-authorize-access.ts"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAGA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,IAAA,GAAAH,OAAA;AACA,IAAAI,yBAAA,GAAAC,uBAAA,CAAAL,OAAA;AAEA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AAEA,IAAAS,QAAA,GAAAT,OAAA;AAAuD,SAAAU,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,SAAAN,wBAAAU,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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AAK,CAACC,OAAQ,EAC9D,CAAC;IAED,MAAM,IAAIC,wBAAgB,CAAC;MACzBD,OAAO,EAAE,kCAAkC;MAC3CE,MAAM,EAAElB,QAAQ,CAACe,KAAK,CAACC;IACzB,CAAC,CAAC;EACJ;EAEA,OAAO;IAAEG,WAAW,EAAEnB,QAAQ,CAACoB;EAAK,CAAC;AACvC,CAAC;AAACC,OAAA,CAAAvE,eAAA,GAAAA,eAAA"}
1
+ {"version":3,"names":["_misc","require","_dpop","_uuid","_pop","WalletInstanceAttestation","_interopRequireWildcard","_types","_errors","_logging","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","authorizeAccess","issuerConf","code","_","redirectUri","codeVerifier","context","appFetch","fetch","walletInstanceAttestation","wiaCryptoContext","dPopCryptoContext","aud","openid_credential_issuer","credential_issuer","iss","decode","payload","cnf","jwk","kid","tokenUrl","oauth_authorization_server","token_endpoint","tokenRequestSignedDPop","createDPopToken","htm","htu","jti","uuidv4","Logger","log","LogLevel","DEBUG","signedWiaPoP","createPopToken","requestBody","grant_type","code_verifier","redirect_uri","authorizationRequestFormBody","URLSearchParams","tokenRes","method","headers","DPoP","body","toString","then","hasStatusOrThrow","IssuerResponseError","res","json","TokenResponse","safeParse","success","ERROR","error","message","ValidationFailed","reason","accessToken","data","exports"],"sourceRoot":"../../../../src","sources":["credential/issuance/05-authorize-access.ts"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAGA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,IAAA,GAAAH,OAAA;AACA,IAAAI,yBAAA,GAAAC,uBAAA,CAAAL,OAAA;AAEA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AAEA,IAAAQ,QAAA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AAQ,GAAG,MAAMnC,QAAQ,CAACc,QAAQ,EAAE;IACxCsB,MAAM,EAAE,MAAM;IACdC,OAAO,EAAE;MACP,cAAc,EAAE,mCAAmC;MACnDC,IAAI,EAAErB,sBAAsB;MAC5B,0BAA0B,EAAEf,yBAAyB;MACrD,8BAA8B,EAAEyB;IAClC,CAAC;IACDY,IAAI,EAAEN,4BAA4B,CAACO,QAAQ,CAAC;EAC9C,CAAC,CAAC,CACCC,IAAI,CAAC,IAAAC,sBAAgB,EAAC,GAAG,EAAEC,2BAAmB,CAAC,CAAC,CAChDF,IAAI,CAAEG,GAAG,IAAKA,GAAG,CAACC,IAAI,CAAC,CAAC,CAAC,CACzBJ,IAAI,CAAEF,IAAI,IAAKO,oBAAa,CAACC,SAAS,CAACR,IAAI,CAAC,CAAC;EAEhD,IAAI,CAACJ,QAAQ,CAACa,OAAO,EAAE;IACrBzB,eAAM,CAACC,GAAG,CACRC,iBAAQ,CAACwB,KAAK,EACb,qCAAoCd,QAAQ,CAACe,KAAK,CAACC,OAAQ,EAC9D,CAAC;IAED,MAAM,IAAIC,wBAAgB,CAAC;MACzBD,OAAO,EAAE,kCAAkC;MAC3CE,MAAM,EAAElB,QAAQ,CAACe,KAAK,CAACC;IACzB,CAAC,CAAC;EACJ;EAEA,OAAO;IAAEG,WAAW,EAAEnB,QAAQ,CAACoB;EAAK,CAAC;AACvC,CAAC;AAACC,OAAA,CAAA/D,eAAA,GAAAA,eAAA"}
@@ -30,11 +30,11 @@ const createNonceProof = async (nonce, issuer, audience, ctx) => {
30
30
  * @param issuerConf The issuer configuration returned by {@link evaluateIssuerTrust}
31
31
  * @param accessToken The access token response returned by {@link authorizeAccess}
32
32
  * @param clientId The client id returned by {@link startUserAuthorization}
33
- * @param credentialDefinition The credential definition of the credential to be obtained returned by {@link startUserAuthorization}
34
- * @param tokenRequestSignedDPop The DPoP signed token request returned by {@link authorizeAccess}
33
+ * @param credentialDefinition The credential definition of the credential to be obtained returned by {@link authorizeAccess}
35
34
  * @param context.credentialCryptoContext The crypto context used to obtain the credential
36
35
  * @param context.dPopCryptoContext The DPoP crypto context
37
36
  * @param context.appFetch (optional) fetch api implementation. Default: built-in fetch
37
+ * @param operationType Specify the type of credential issuance (used for reissuing)
38
38
  * @returns The credential response containing the credential
39
39
  */
40
40
  exports.createNonceProof = createNonceProof;
@@ -44,18 +44,34 @@ const obtainCredential = async (issuerConf, accessToken, clientId, credentialDef
44
44
  appFetch = fetch,
45
45
  dPopCryptoContext
46
46
  } = context;
47
+ const {
48
+ credential_configuration_id,
49
+ credential_identifier
50
+ } = credentialDefinition;
47
51
  const credentialUrl = issuerConf.openid_credential_issuer.credential_endpoint;
52
+ const issuerUrl = issuerConf.oauth_authorization_server.issuer;
53
+ const nonceUrl = issuerConf.openid_credential_issuer.nonce_endpoint;
54
+
55
+ // Fetch the nonce from the Credential Issuer
56
+ const {
57
+ c_nonce
58
+ } = await appFetch(nonceUrl, {
59
+ method: "POST",
60
+ headers: {
61
+ "Content-Type": "application/json"
62
+ }
63
+ }).then((0, _misc.hasStatusOrThrow)(200)).then(res => res.json()).then(body => _types.NonceResponse.parse(body));
48
64
 
49
65
  /**
50
66
  * JWT proof token to bind the request nonce to the key that will bind the holder User with the Credential
51
67
  * This is presented along with the access token to the Credential Endpoint as proof of possession of the private key used to sign the Access Token.
52
68
  * @see https://openid.net/specs/openid-4-verifiable-credential-issuance-1_0.html#name-proof-types
53
69
  */
54
- const signedNonceProof = await createNonceProof(accessToken.c_nonce, clientId, credentialUrl, credentialCryptoContext);
70
+ const signedNonceProof = await createNonceProof(c_nonce, clientId, issuerUrl, credentialCryptoContext);
55
71
  _logging.Logger.log(_logging.LogLevel.DEBUG, `Signed nonce proof: ${signedNonceProof}`);
56
72
 
57
73
  // Validation of accessTokenResponse.authorization_details if contain credentialDefinition
58
- const containsCredentialDefinition = accessToken.authorization_details.some(c => c.credential_configuration_id === credentialDefinition.credential_configuration_id && c.format === credentialDefinition.format && c.type === credentialDefinition.type);
74
+ const containsCredentialDefinition = accessToken.authorization_details.some(c => c.credential_configuration_id === credential_configuration_id && (credential_identifier ? c.credential_identifiers.includes(credential_identifier) : true));
59
75
  if (!containsCredentialDefinition) {
60
76
  _logging.Logger.log(_logging.LogLevel.ERROR, `Credential definition not found in the access token response ${accessToken.authorization_details}`);
61
77
  throw new _errors.ValidationFailed({
@@ -63,12 +79,20 @@ const obtainCredential = async (issuerConf, accessToken, clientId, credentialDef
63
79
  });
64
80
  }
65
81
 
66
- /** The credential request body */
67
- const credentialRequestFormBody = {
68
- credential_definition: {
69
- type: [credentialDefinition.credential_configuration_id]
70
- },
71
- format: credentialDefinition.format,
82
+ /**
83
+ * The credential request body.
84
+ * We accept both `credential_identifier` (recommended) and `credential_configuration_id`
85
+ * when the Authorization Server does not support `credential_identifier`.
86
+ * @see https://openid.net/specs/openid-4-verifiable-credential-issuance-1_0-15.html#section-3.3.4
87
+ */
88
+ const credentialRequestFormBody = credential_identifier ? {
89
+ credential_identifier: credential_identifier,
90
+ proof: {
91
+ jwt: signedNonceProof,
92
+ proof_type: "jwt"
93
+ }
94
+ } : {
95
+ credential_configuration_id: credential_configuration_id,
72
96
  proof: {
73
97
  jwt: signedNonceProof,
74
98
  proof_type: "jwt"
@@ -102,7 +126,15 @@ const obtainCredential = async (issuerConf, accessToken, clientId, credentialDef
102
126
  });
103
127
  }
104
128
  _logging.Logger.log(_logging.LogLevel.DEBUG, `Credential Response: ${JSON.stringify(credentialRes.data)}`);
105
- return credentialRes.data;
129
+
130
+ // Extract the format corresponding to the credential_configuration_id used
131
+ const issuerCredentialConfig = issuerConf.openid_credential_issuer.credential_configurations_supported[credential_configuration_id];
132
+
133
+ // TODO: [SIW-2264] Handle multiple credentials
134
+ return {
135
+ credential: credentialRes.data.credentials.at(0).credential,
136
+ format: issuerCredentialConfig.format
137
+ };
106
138
  };
107
139
 
108
140
  /**
@@ -1 +1 @@
1
- {"version":3,"names":["_ioReactNativeJwt","require","_misc","_errors","_types","_dpop","_uuid","_logging","createNonceProof","nonce","issuer","audience","ctx","jwk","getPublicKey","SignJWT","setPayload","setProtectedHeader","typ","setAudience","setIssuer","setIssuedAt","setExpirationTime","sign","exports","obtainCredential","issuerConf","accessToken","clientId","credentialDefinition","context","operationType","credentialCryptoContext","appFetch","fetch","dPopCryptoContext","credentialUrl","openid_credential_issuer","credential_endpoint","signedNonceProof","c_nonce","Logger","log","LogLevel","DEBUG","containsCredentialDefinition","authorization_details","some","c","credential_configuration_id","format","type","ERROR","ValidationFailed","message","credentialRequestFormBody","credential_definition","proof","jwt","proof_type","JSON","stringify","tokenRequestSignedDPop","createDPopToken","htm","htu","jti","uuidv4","ath","sha256ToBase64","access_token","credentialRes","method","headers","DPoP","Authorization","token_type","body","then","hasStatusOrThrow","res","json","CredentialResponse","safeParse","catch","handleObtainCredentialError","success","error","reason","data","e","UnexpectedStatusCodeError","ResponseErrorBuilder","IssuerResponseError","handle","code","IssuerResponseErrorCodes","CredentialIssuingNotSynchronous","CredentialInvalidStatus","CredentialRequestFailed","buildFrom"],"sourceRoot":"../../../../src","sources":["credential/issuance/06-obtain-credential.ts"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAOA,IAAAC,KAAA,GAAAD,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AAOA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AAeO,MAAMO,gBAAgB,GAAG,MAAAA,CAC9BC,KAAa,EACbC,MAAc,EACdC,QAAgB,EAChBC,GAAkB,KACE;EACpB,MAAMC,GAAG,GAAG,MAAMD,GAAG,CAACE,YAAY,CAAC,CAAC;EACpC,OAAO,IAAIC,yBAAO,CAACH,GAAG,CAAC,CACpBI,UAAU,CAAC;IACVP;EACF,CAAC,CAAC,CACDQ,kBAAkB,CAAC;IAClBC,GAAG,EAAE,sBAAsB;IAC3BL;EAC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AAuB;IACtD5C,OAAO,EAAE;EACX,CAAC,CAAC,CACDwC,MAAM,CAAC,GAAG,EAAE;IACXC,IAAI,EAAEC,gCAAwB,CAACG,uBAAuB;IACtD7C,OAAO,EAAE;EACX,CAAC,CAAC,CACD8C,SAAS,CAACV,CAAC,CAAC;AACjB,CAAC"}
1
+ {"version":3,"names":["_ioReactNativeJwt","require","_misc","_errors","_types","_dpop","_uuid","_logging","createNonceProof","nonce","issuer","audience","ctx","jwk","getPublicKey","SignJWT","setPayload","setProtectedHeader","typ","setAudience","setIssuer","setIssuedAt","setExpirationTime","sign","exports","obtainCredential","issuerConf","accessToken","clientId","credentialDefinition","context","operationType","credentialCryptoContext","appFetch","fetch","dPopCryptoContext","credential_configuration_id","credential_identifier","credentialUrl","openid_credential_issuer","credential_endpoint","issuerUrl","oauth_authorization_server","nonceUrl","nonce_endpoint","c_nonce","method","headers","then","hasStatusOrThrow","res","json","body","NonceResponse","parse","signedNonceProof","Logger","log","LogLevel","DEBUG","containsCredentialDefinition","authorization_details","some","c","credential_identifiers","includes","ERROR","ValidationFailed","message","credentialRequestFormBody","proof","jwt","proof_type","JSON","stringify","tokenRequestSignedDPop","createDPopToken","htm","htu","jti","uuidv4","ath","sha256ToBase64","access_token","credentialRes","DPoP","Authorization","token_type","CredentialResponse","safeParse","catch","handleObtainCredentialError","success","error","reason","data","issuerCredentialConfig","credential_configurations_supported","credential","credentials","at","format","e","UnexpectedStatusCodeError","ResponseErrorBuilder","IssuerResponseError","handle","code","IssuerResponseErrorCodes","CredentialIssuingNotSynchronous","CredentialInvalidStatus","CredentialRequestFailed","buildFrom"],"sourceRoot":"../../../../src","sources":["credential/issuance/06-obtain-credential.ts"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAOA,IAAAC,KAAA,GAAAD,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AAOA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IA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