@pagopa/io-react-native-wallet 0.28.1 → 0.29.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 (168) hide show
  1. package/README.md +43 -0
  2. package/lib/commonjs/credential/issuance/03-start-user-authorization.js +5 -0
  3. package/lib/commonjs/credential/issuance/03-start-user-authorization.js.map +1 -1
  4. package/lib/commonjs/credential/issuance/04-complete-user-authorization.js +17 -3
  5. package/lib/commonjs/credential/issuance/04-complete-user-authorization.js.map +1 -1
  6. package/lib/commonjs/credential/issuance/05-authorize-access.js +5 -0
  7. package/lib/commonjs/credential/issuance/05-authorize-access.js.map +1 -1
  8. package/lib/commonjs/credential/issuance/06-obtain-credential.js +13 -2
  9. package/lib/commonjs/credential/issuance/06-obtain-credential.js.map +1 -1
  10. package/lib/commonjs/credential/issuance/07-verify-and-parse-credential.js +10 -0
  11. package/lib/commonjs/credential/issuance/07-verify-and-parse-credential.js.map +1 -1
  12. package/lib/commonjs/credential/presentation/01-start-flow.js +14 -14
  13. package/lib/commonjs/credential/presentation/01-start-flow.js.map +1 -1
  14. package/lib/commonjs/credential/presentation/02-evaluate-rp-trust.js +4 -2
  15. package/lib/commonjs/credential/presentation/02-evaluate-rp-trust.js.map +1 -1
  16. package/lib/commonjs/credential/presentation/03-get-request-object.js +2 -2
  17. package/lib/commonjs/credential/presentation/03-get-request-object.js.map +1 -1
  18. package/lib/commonjs/credential/presentation/05-verify-request-object.js +11 -4
  19. package/lib/commonjs/credential/presentation/05-verify-request-object.js.map +1 -1
  20. package/lib/commonjs/credential/presentation/07-evaluate-dcql-query.js +54 -14
  21. package/lib/commonjs/credential/presentation/07-evaluate-dcql-query.js.map +1 -1
  22. package/lib/commonjs/credential/presentation/07-evaluate-input-descriptor.js +26 -7
  23. package/lib/commonjs/credential/presentation/07-evaluate-input-descriptor.js.map +1 -1
  24. package/lib/commonjs/credential/presentation/08-send-authorization-response.js +4 -4
  25. package/lib/commonjs/credential/presentation/08-send-authorization-response.js.map +1 -1
  26. package/lib/commonjs/credential/presentation/README.md +96 -2
  27. package/lib/commonjs/credential/presentation/errors.js +16 -19
  28. package/lib/commonjs/credential/presentation/errors.js.map +1 -1
  29. package/lib/commonjs/credential/presentation/index.js +27 -2
  30. package/lib/commonjs/credential/presentation/index.js.map +1 -1
  31. package/lib/commonjs/credential/presentation/types.js +1 -1
  32. package/lib/commonjs/credential/presentation/types.js.map +1 -1
  33. package/lib/commonjs/credential/status/02-status-attestation.js +2 -0
  34. package/lib/commonjs/credential/status/02-status-attestation.js.map +1 -1
  35. package/lib/commonjs/credential/status/03-verify-and-parse-status-attestation.js +3 -0
  36. package/lib/commonjs/credential/status/03-verify-and-parse-status-attestation.js.map +1 -1
  37. package/lib/commonjs/credential/trustmark/get-credential-trustmark.js +5 -0
  38. package/lib/commonjs/credential/trustmark/get-credential-trustmark.js.map +1 -1
  39. package/lib/commonjs/index.js +3 -1
  40. package/lib/commonjs/index.js.map +1 -1
  41. package/lib/commonjs/utils/decoder.js +2 -0
  42. package/lib/commonjs/utils/decoder.js.map +1 -1
  43. package/lib/commonjs/utils/logging.js +68 -0
  44. package/lib/commonjs/utils/logging.js.map +1 -0
  45. package/lib/commonjs/utils/misc.js +2 -0
  46. package/lib/commonjs/utils/misc.js.map +1 -1
  47. package/lib/commonjs/utils/par.js +2 -0
  48. package/lib/commonjs/utils/par.js.map +1 -1
  49. package/lib/commonjs/wallet-instance/index.js +4 -0
  50. package/lib/commonjs/wallet-instance/index.js.map +1 -1
  51. package/lib/commonjs/wallet-instance-attestation/issuing.js +5 -0
  52. package/lib/commonjs/wallet-instance-attestation/issuing.js.map +1 -1
  53. package/lib/module/credential/issuance/03-start-user-authorization.js +5 -0
  54. package/lib/module/credential/issuance/03-start-user-authorization.js.map +1 -1
  55. package/lib/module/credential/issuance/04-complete-user-authorization.js +17 -3
  56. package/lib/module/credential/issuance/04-complete-user-authorization.js.map +1 -1
  57. package/lib/module/credential/issuance/05-authorize-access.js +5 -0
  58. package/lib/module/credential/issuance/05-authorize-access.js.map +1 -1
  59. package/lib/module/credential/issuance/06-obtain-credential.js +13 -2
  60. package/lib/module/credential/issuance/06-obtain-credential.js.map +1 -1
  61. package/lib/module/credential/issuance/07-verify-and-parse-credential.js +10 -0
  62. package/lib/module/credential/issuance/07-verify-and-parse-credential.js.map +1 -1
  63. package/lib/module/credential/presentation/01-start-flow.js +14 -14
  64. package/lib/module/credential/presentation/01-start-flow.js.map +1 -1
  65. package/lib/module/credential/presentation/02-evaluate-rp-trust.js +4 -2
  66. package/lib/module/credential/presentation/02-evaluate-rp-trust.js.map +1 -1
  67. package/lib/module/credential/presentation/03-get-request-object.js +2 -2
  68. package/lib/module/credential/presentation/03-get-request-object.js.map +1 -1
  69. package/lib/module/credential/presentation/05-verify-request-object.js +11 -4
  70. package/lib/module/credential/presentation/05-verify-request-object.js.map +1 -1
  71. package/lib/module/credential/presentation/07-evaluate-dcql-query.js +55 -14
  72. package/lib/module/credential/presentation/07-evaluate-dcql-query.js.map +1 -1
  73. package/lib/module/credential/presentation/07-evaluate-input-descriptor.js +25 -6
  74. package/lib/module/credential/presentation/07-evaluate-input-descriptor.js.map +1 -1
  75. package/lib/module/credential/presentation/08-send-authorization-response.js +4 -4
  76. package/lib/module/credential/presentation/08-send-authorization-response.js.map +1 -1
  77. package/lib/module/credential/presentation/README.md +96 -2
  78. package/lib/module/credential/presentation/errors.js +13 -16
  79. package/lib/module/credential/presentation/errors.js.map +1 -1
  80. package/lib/module/credential/presentation/index.js +4 -3
  81. package/lib/module/credential/presentation/index.js.map +1 -1
  82. package/lib/module/credential/presentation/types.js +1 -1
  83. package/lib/module/credential/presentation/types.js.map +1 -1
  84. package/lib/module/credential/status/02-status-attestation.js +2 -0
  85. package/lib/module/credential/status/02-status-attestation.js.map +1 -1
  86. package/lib/module/credential/status/03-verify-and-parse-status-attestation.js +3 -0
  87. package/lib/module/credential/status/03-verify-and-parse-status-attestation.js.map +1 -1
  88. package/lib/module/credential/trustmark/get-credential-trustmark.js +5 -0
  89. package/lib/module/credential/trustmark/get-credential-trustmark.js.map +1 -1
  90. package/lib/module/index.js +2 -1
  91. package/lib/module/index.js.map +1 -1
  92. package/lib/module/utils/decoder.js +2 -0
  93. package/lib/module/utils/decoder.js.map +1 -1
  94. package/lib/module/utils/logging.js +62 -0
  95. package/lib/module/utils/logging.js.map +1 -0
  96. package/lib/module/utils/misc.js +2 -0
  97. package/lib/module/utils/misc.js.map +1 -1
  98. package/lib/module/utils/par.js +2 -0
  99. package/lib/module/utils/par.js.map +1 -1
  100. package/lib/module/wallet-instance/index.js +4 -0
  101. package/lib/module/wallet-instance/index.js.map +1 -1
  102. package/lib/module/wallet-instance-attestation/issuing.js +5 -0
  103. package/lib/module/wallet-instance-attestation/issuing.js.map +1 -1
  104. package/lib/typescript/credential/issuance/03-start-user-authorization.d.ts.map +1 -1
  105. package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts +2 -2
  106. package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts.map +1 -1
  107. package/lib/typescript/credential/issuance/05-authorize-access.d.ts.map +1 -1
  108. package/lib/typescript/credential/issuance/06-obtain-credential.d.ts +1 -1
  109. package/lib/typescript/credential/issuance/06-obtain-credential.d.ts.map +1 -1
  110. package/lib/typescript/credential/issuance/07-verify-and-parse-credential.d.ts.map +1 -1
  111. package/lib/typescript/credential/presentation/01-start-flow.d.ts +17 -19
  112. package/lib/typescript/credential/presentation/01-start-flow.d.ts.map +1 -1
  113. package/lib/typescript/credential/presentation/02-evaluate-rp-trust.d.ts +1 -0
  114. package/lib/typescript/credential/presentation/02-evaluate-rp-trust.d.ts.map +1 -1
  115. package/lib/typescript/credential/presentation/03-get-request-object.d.ts +1 -4
  116. package/lib/typescript/credential/presentation/03-get-request-object.d.ts.map +1 -1
  117. package/lib/typescript/credential/presentation/05-verify-request-object.d.ts +4 -2
  118. package/lib/typescript/credential/presentation/05-verify-request-object.d.ts.map +1 -1
  119. package/lib/typescript/credential/presentation/07-evaluate-dcql-query.d.ts +13 -5
  120. package/lib/typescript/credential/presentation/07-evaluate-dcql-query.d.ts.map +1 -1
  121. package/lib/typescript/credential/presentation/07-evaluate-input-descriptor.d.ts +7 -2
  122. package/lib/typescript/credential/presentation/07-evaluate-input-descriptor.d.ts.map +1 -1
  123. package/lib/typescript/credential/presentation/08-send-authorization-response.d.ts +3 -3
  124. package/lib/typescript/credential/presentation/08-send-authorization-response.d.ts.map +1 -1
  125. package/lib/typescript/credential/presentation/errors.d.ts +14 -9
  126. package/lib/typescript/credential/presentation/errors.d.ts.map +1 -1
  127. package/lib/typescript/credential/presentation/index.d.ts +5 -4
  128. package/lib/typescript/credential/presentation/index.d.ts.map +1 -1
  129. package/lib/typescript/credential/presentation/types.d.ts +3 -3
  130. package/lib/typescript/credential/status/02-status-attestation.d.ts.map +1 -1
  131. package/lib/typescript/credential/status/03-verify-and-parse-status-attestation.d.ts.map +1 -1
  132. package/lib/typescript/credential/trustmark/get-credential-trustmark.d.ts.map +1 -1
  133. package/lib/typescript/index.d.ts +2 -1
  134. package/lib/typescript/index.d.ts.map +1 -1
  135. package/lib/typescript/utils/decoder.d.ts.map +1 -1
  136. package/lib/typescript/utils/logging.d.ts +35 -0
  137. package/lib/typescript/utils/logging.d.ts.map +1 -0
  138. package/lib/typescript/utils/misc.d.ts.map +1 -1
  139. package/lib/typescript/utils/par.d.ts.map +1 -1
  140. package/lib/typescript/wallet-instance/index.d.ts.map +1 -1
  141. package/lib/typescript/wallet-instance-attestation/issuing.d.ts.map +1 -1
  142. package/package.json +3 -3
  143. package/src/credential/issuance/03-start-user-authorization.ts +18 -0
  144. package/src/credential/issuance/04-complete-user-authorization.ts +57 -3
  145. package/src/credential/issuance/05-authorize-access.ts +16 -0
  146. package/src/credential/issuance/06-obtain-credential.ts +31 -2
  147. package/src/credential/issuance/07-verify-and-parse-credential.ts +27 -1
  148. package/src/credential/presentation/01-start-flow.ts +18 -20
  149. package/src/credential/presentation/02-evaluate-rp-trust.ts +3 -2
  150. package/src/credential/presentation/03-get-request-object.ts +4 -6
  151. package/src/credential/presentation/05-verify-request-object.ts +17 -6
  152. package/src/credential/presentation/07-evaluate-dcql-query.ts +60 -17
  153. package/src/credential/presentation/07-evaluate-input-descriptor.ts +53 -39
  154. package/src/credential/presentation/08-send-authorization-response.ts +9 -7
  155. package/src/credential/presentation/README.md +96 -2
  156. package/src/credential/presentation/errors.ts +21 -14
  157. package/src/credential/presentation/index.ts +22 -4
  158. package/src/credential/presentation/types.ts +1 -1
  159. package/src/credential/status/02-status-attestation.ts +3 -0
  160. package/src/credential/status/03-verify-and-parse-status-attestation.ts +10 -0
  161. package/src/credential/trustmark/get-credential-trustmark.ts +19 -0
  162. package/src/index.ts +2 -0
  163. package/src/utils/decoder.ts +5 -0
  164. package/src/utils/logging.ts +68 -0
  165. package/src/utils/misc.ts +5 -0
  166. package/src/utils/par.ts +6 -0
  167. package/src/wallet-instance/index.ts +17 -1
  168. package/src/wallet-instance-attestation/issuing.ts +19 -0
package/README.md CHANGED
@@ -96,6 +96,45 @@ The suggested library to manage integrity is [io-react-native-integrity](https:/
96
96
 
97
97
  </details>
98
98
 
99
+ <details>
100
+ <summary>LoggingContext (logging)</summary>
101
+
102
+ In order to log useful information while implementing the flows, the library supports custom logging logic by providing a `loggingContext` to the static `Logger` class:
103
+
104
+ ```ts
105
+ export interface LoggingContext {
106
+ logDebug: (msg: string) => void;
107
+ logInfo: (msg: string) => void;
108
+ logWarn: (msg: string) => void;
109
+ logError: (msg: string) => void;
110
+ }
111
+ ```
112
+
113
+ An example of a custom logging context:
114
+
115
+ ```ts
116
+ import { Logging } from "@pagopa/io-react-native-wallet";
117
+
118
+ const loggingContext: Logging.LoggingContext = {
119
+ logDebug(msg: string) {
120
+ console.log("debug", msg);
121
+ },
122
+ logInfo(msg: string) {
123
+ console.log("info", msg);
124
+ },
125
+ logWarn(msg: string) {
126
+ console.log("warn", msg);
127
+ },
128
+ logError(msg: string) {
129
+ console.log("error", msg);
130
+ },
131
+ };
132
+
133
+ Logging.Logger.getInstance().initLogging(loggingContext);
134
+ ```
135
+
136
+ </details>
137
+
99
138
  <details>
100
139
  <summary>appFetch (making HTTP requests)</summary>
101
140
 
@@ -120,6 +159,10 @@ Different flows are provided to perform common operations. Each flow is a set of
120
159
 
121
160
  An example app is provided in [example](./example) folder which demostrates how to implemente these flows. To run it, follow the instructions in the [README](./example/README.md).
122
161
 
162
+ ### Debug logging server
163
+
164
+ A debug logging server can be used with the example app to receive logs from the app. To run it, follow the instructions in the [README](./debug-logging-server/README.md).
165
+
123
166
  ### Ecosystem
124
167
 
125
168
  `io-react-native-wallet` is designed to be used in [io-app](https://github.com/pagopa/io-app) and its ecosystem. There are a few libraries that can be used to implement the context required to implement the flows defined by this package.
@@ -7,6 +7,7 @@ exports.startUserAuthorization = void 0;
7
7
  var _misc = require("../../utils/misc");
8
8
  var _par = require("../../utils/par");
9
9
  var _const = require("./const");
10
+ var _logging = require("../../utils/logging");
10
11
  /**
11
12
  * Ensures that the credential type requested is supported by the issuer and contained in the
12
13
  * issuer configuration.
@@ -26,6 +27,7 @@ const selectCredentialDefinition = (issuerConf, credentialType) => {
26
27
  type: "openid_credential"
27
28
  }));
28
29
  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)}`);
29
31
  throw new Error(`No credential support the type '${credentialType}'`);
30
32
  }
31
33
  return result;
@@ -40,7 +42,9 @@ const selectCredentialDefinition = (issuerConf, credentialType) => {
40
42
  const selectResponseMode = (issuerConf, credentialType) => {
41
43
  const responseModeSupported = issuerConf.oauth_authorization_server.response_modes_supported;
42
44
  const responseMode = credentialType === "PersonIdentificationData" ? "query" : "form_post.jwt";
45
+ _logging.Logger.log(_logging.LogLevel.DEBUG, `Selected response mode ${responseMode} for credential type ${credentialType}`);
43
46
  if (!responseModeSupported.includes(responseMode)) {
47
+ _logging.Logger.log(_logging.LogLevel.ERROR, `Requested response mode ${responseMode} is not supported by the issuer according to its configuration ${JSON.stringify(responseModeSupported)}`);
44
48
  throw new Error(`No response mode support the type '${credentialType}'`);
45
49
  }
46
50
  return responseMode;
@@ -73,6 +77,7 @@ const startUserAuthorization = async (issuerConf, credentialType, ctx) => {
73
77
  } = ctx;
74
78
  const clientId = await wiaCryptoContext.getPublicKey().then(_ => _.kid);
75
79
  if (!clientId) {
80
+ _logging.Logger.log(_logging.LogLevel.ERROR, `Public key associated with kid ${clientId} not found in the device`);
76
81
  throw new Error("No public key found");
77
82
  }
78
83
  const codeVerifier = (0, _misc.generateRandomAlphaNumericString)(64);
@@ -1 +1 @@
1
- {"version":3,"names":["_misc","require","_par","_const","selectCredentialDefinition","issuerConf","credentialType","credential_configurations_supported","openid_credential_issuer","result","Object","keys","filter","e","includes","map","credential_configuration_id","format","type","Error","selectResponseMode","responseModeSupported","oauth_authorization_server","response_modes_supported","responseMode","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;AAkBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMG,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,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EAAE,CAAC;EACzD,MAAMC,WAAW,GACflC,UAAU,CAACiB,0BAA0B,CAACkB,qCAAqC;EAC7E,MAAMC,oBAAoB,GAAGrC,0BAA0B,CACrDC,UAAU,EACVC,cACF,CAAC;EACD,MAAMkB,YAAY,GAAGJ,kBAAkB,CAACf,UAAU,EAAEC,cAAc,CAAC;EAEnE,MAAMoC,MAAM,GAAG,IAAAC,mBAAc,EAAC;IAAEhB,gBAAgB;IAAEG;EAAS,CAAC,CAAC;EAC7D,MAAMc,gBAAgB,GAAG,MAAMF,MAAM,CACnCV,QAAQ,EACRK,YAAY,EACZR,WAAW,EACXL,YAAY,EACZe,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","_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;AAC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Q;IAAEK,YAAY;IAAEI;EAAqB,CAAC;AAC3E,CAAC;AAACK,OAAA,CAAArB,sBAAA,GAAAA,sBAAA"}
@@ -14,6 +14,7 @@ var _uuid = require("uuid");
14
14
  var _types2 = require("./types");
15
15
  var _decoder = require("../../utils/decoder");
16
16
  var _errors2 = require("./errors");
17
+ var _logging = require("../../utils/logging");
17
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
19
  /**
19
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.
@@ -25,16 +26,18 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
25
26
  * @param issuerRequestUri the URI of the issuer where the request is sent
26
27
  * @param clientId Identifies the current client across all the requests of the issuing flow returned by {@link startUserAuthorization}
27
28
  * @param issuerConf The issuer configuration returned by {@link evaluateIssuerTrust}
28
- * @param idpHint Unique identifier of the IDP selected by the user
29
+ * @param idpHint Unique identifier of the IDP selected by the user (optional)
29
30
  * @returns An object containing the authorization URL
30
31
  */
31
32
  const buildAuthorizationUrl = async (issuerRequestUri, clientId, issuerConf, idpHint) => {
32
33
  const authzRequestEndpoint = issuerConf.oauth_authorization_server.authorization_endpoint;
33
34
  const params = new URLSearchParams({
34
35
  client_id: clientId,
35
- request_uri: issuerRequestUri,
36
- idphint: idpHint
36
+ request_uri: issuerRequestUri
37
37
  });
38
+ if (idpHint) {
39
+ params.append("idphint", idpHint);
40
+ }
38
41
  const authUrl = `${authzRequestEndpoint}?${params}`;
39
42
  return {
40
43
  authUrl
@@ -50,6 +53,7 @@ const buildAuthorizationUrl = async (issuerRequestUri, clientId, issuerConf, idp
50
53
  */
51
54
  exports.buildAuthorizationUrl = buildAuthorizationUrl;
52
55
  const completeUserAuthorizationWithQueryMode = async authRedirectUrl => {
56
+ _logging.Logger.log(_logging.LogLevel.DEBUG, `The requeste credential is a PersonIdentificationData, completing the user authorization with query mode`);
53
57
  const query = (0, _parseUrl.default)(authRedirectUrl).query;
54
58
  return parseAuthorizationResponse(query);
55
59
  };
@@ -69,15 +73,18 @@ const completeUserAuthorizationWithQueryMode = async authRedirectUrl => {
69
73
  exports.completeUserAuthorizationWithQueryMode = completeUserAuthorizationWithQueryMode;
70
74
  const getRequestedCredentialToBePresented = async function (issuerRequestUri, clientId, issuerConf) {
71
75
  let appFetch = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : fetch;
76
+ _logging.Logger.log(_logging.LogLevel.DEBUG, `The requeste credential is not a PersonIdentificationData, requesting the credential to be presented`);
72
77
  const authzRequestEndpoint = issuerConf.oauth_authorization_server.authorization_endpoint;
73
78
  const params = new URLSearchParams({
74
79
  client_id: clientId,
75
80
  request_uri: issuerRequestUri
76
81
  });
82
+ _logging.Logger.log(_logging.LogLevel.DEBUG, `Requesting the request object to ${authzRequestEndpoint}?${params.toString()}`);
77
83
  const requestObject = await appFetch(`${authzRequestEndpoint}?${params.toString()}`, {
78
84
  method: "GET"
79
85
  }).then((0, _misc.hasStatusOrThrow)(200, _errors.IssuerResponseError)).then(res => res.text()).then(jws => (0, _ioReactNativeJwt.decode)(jws)).then(reqObj => _types.RequestObject.safeParse(reqObj.payload));
80
86
  if (!requestObject.success) {
87
+ _logging.Logger.log(_logging.LogLevel.ERROR, `Error while validating the response object: ${requestObject.error.message}`);
81
88
  throw new _errors.ValidationFailed({
82
89
  message: "Request Object validation failed",
83
90
  reason: requestObject.error.message
@@ -104,6 +111,7 @@ const getRequestedCredentialToBePresented = async function (issuerRequestUri, cl
104
111
  */
105
112
  exports.getRequestedCredentialToBePresented = getRequestedCredentialToBePresented;
106
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`);
107
115
  const {
108
116
  wiaCryptoContext,
109
117
  pidCryptoContext,
@@ -127,6 +135,7 @@ const completeUserAuthorizationWithFormPostJwtMode = async (requestObject, ctx)
127
135
  jti: (0, _uuid.v4)().toString(),
128
136
  nonce: requestObject.nonce
129
137
  }).setIssuedAt().setExpirationTime("5m").setAudience(requestObject.response_uri).sign();
138
+ _logging.Logger.log(_logging.LogLevel.DEBUG, `Wallet instance attestation JWT token: ${wiaWpToken}`);
130
139
 
131
140
  /* The path parameter refers to the vp_token variable of the authzResponsePayload and must point to the plain credential which
132
141
  * is cointaned in the `vp` property of the signed jwt token payload
@@ -144,11 +153,13 @@ const completeUserAuthorizationWithFormPostJwtMode = async (requestObject, ctx)
144
153
  format: "jwt"
145
154
  }]
146
155
  };
156
+ _logging.Logger.log(_logging.LogLevel.DEBUG, `Presentation submission: ${JSON.stringify(presentationSubmission)}`);
147
157
  const authzResponsePayload = (0, _ioReactNativeJwt.encodeBase64)(JSON.stringify({
148
158
  state: requestObject.state,
149
159
  presentation_submission: presentationSubmission,
150
160
  vp_token: [pidWpToken, wiaWpToken]
151
161
  }));
162
+ _logging.Logger.log(_logging.LogLevel.DEBUG, `Authz response payload: ${authzResponsePayload}`);
152
163
 
153
164
  // Note: according to the spec, the response should be encrypted with the public key of the RP however this is not implemented yet
154
165
  // https://openid.net/specs/openid-4-verifiable-presentations-1_0.html#name-signed-and-encrypted-response
@@ -171,6 +182,7 @@ const completeUserAuthorizationWithFormPostJwtMode = async (requestObject, ctx)
171
182
  }).then((0, _misc.hasStatusOrThrow)(200, _errors.IssuerResponseError)).then(reqUri => reqUri.json());
172
183
  const responseUri = _types2.ResponseUriResultShape.safeParse(resUriRes);
173
184
  if (!responseUri.success) {
185
+ _logging.Logger.log(_logging.LogLevel.ERROR, `Error while validating the response uri: ${responseUri.error.message}`);
174
186
  throw new _errors.ValidationFailed({
175
187
  message: "Response Uri validation failed",
176
188
  reason: responseUri.error.message
@@ -192,9 +204,11 @@ const parseAuthorizationResponse = authRes => {
192
204
  if (!authResParsed.success) {
193
205
  const authErr = _auth.AuthorizationErrorShape.safeParse(authRes);
194
206
  if (!authErr.success) {
207
+ _logging.Logger.log(_logging.LogLevel.ERROR, `Error while parsing the authorization response: ${authResParsed.error.message}`);
195
208
  throw new _errors2.AuthorizationError(authResParsed.error.message); // an error occured while parsing the result and the error
196
209
  }
197
210
 
211
+ _logging.Logger.log(_logging.LogLevel.ERROR, `Error while authorizating with the idp: ${JSON.stringify(authErr)}`);
198
212
  throw new _errors2.AuthorizationIdpError(authErr.data.error, authErr.data.error_description);
199
213
  }
200
214
  return authResParsed.data;
@@ -1 +1 @@
1
- {"version":3,"names":["_auth","require","_misc","_parseUrl","_interopRequireDefault","_errors","_ioReactNativeJwt","_types","_uuid","_types2","_decoder","_errors2","obj","__esModule","default","buildAuthorizationUrl","issuerRequestUri","clientId","issuerConf","idpHint","authzRequestEndpoint","oauth_authorization_server","authorization_endpoint","params","URLSearchParams","client_id","request_uri","idphint","authUrl","exports","completeUserAuthorizationWithQueryMode","authRedirectUrl","query","parseUrl","parseAuthorizationResponse","getRequestedCredentialToBePresented","appFetch","arguments","length","undefined","fetch","requestObject","toString","method","then","hasStatusOrThrow","IssuerResponseError","res","text","jws","decode","reqObj","RequestObject","safeParse","payload","success","ValidationFailed","message","reason","error","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","authzResponsePayload","encodeBase64","JSON","stringify","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,OAAA;AAKA,IAAAC,KAAA,GA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G,GAAG,IAAKA,GAAG,CAACC,IAAI,CAAC,CAAC,CAAC,CACzBJ,IAAI,CAAC6D,2BAAkB,CAAC,CACxB7D,IAAI,CAAE8D,KAAK,IAAKxE,0BAA0B,CAACwE,KAAK,CAACC,UAAU,CAACrD,OAAO,CAAC,CAAC;AAC1E,CAAC;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AANAzB,OAAA,CAAAgC,4CAAA,GAAAA,4CAAA;AAOO,MAAM3B,0BAA0B,GACrC0E,OAAgB,IACQ;EACxB,MAAMC,aAAa,GAAGC,8BAAwB,CAACzD,SAAS,CAACuD,OAAO,CAAC;EACjE,IAAI,CAACC,aAAa,CAACtD,OAAO,EAAE;IAC1B,MAAMwD,OAAO,GAAGC,6BAAuB,CAAC3D,SAAS,CAACuD,OAAO,CAAC;IAC1D,IAAI,CAACG,OAAO,CAACxD,OAAO,EAAE;MACpB,MAAM,IAAI0D,2BAAkB,CAACJ,aAAa,CAAClD,KAAK,CAACF,OAAO,CAAC,CAAC,CAAC;IAC7D;;IACA,MAAM,IAAIyD,8BAAqB,CAC7BH,OAAO,CAACnD,IAAI,CAACD,KAAK,EAClBoD,OAAO,CAACnD,IAAI,CAACuD,iBACf,CAAC;EACH;EACA,OAAON,aAAa,CAACjD,IAAI;AAC3B,CAAC;AAAC/B,OAAA,CAAAK,0BAAA,GAAAA,0BAAA"}
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,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AAEA,IAAAE,SAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAEA,IAAAK,iBAAA,GAAAL,OAAA;AAMA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,KAAA,GAAAP,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AACA,IAAAS,QAAA,GAAAT,OAAA;AACA,IAAAU,QAAA,GAAAV,OAAA;AACA,IAAAW,QAAA,GAAAX,OAAA;AAAuD,SAAAG,uBAAAS,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAEvD;AACA;AACA;;AAgCA;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;E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,KAAK,EAClBuD,OAAO,CAACnD,IAAI,CAACuD,iBACf,CAAC;EACH;EACA,OAAON,aAAa,CAACjD,IAAI;AAC3B,CAAC;AAACpC,OAAA,CAAAS,0BAAA,GAAAA,0BAAA"}
@@ -12,6 +12,7 @@ var WalletInstanceAttestation = _interopRequireWildcard(require("../../wallet-in
12
12
  var _const = require("./const");
13
13
  var _types = require("./types");
14
14
  var _errors = require("../../utils/errors");
15
+ var _logging = require("../../utils/logging");
15
16
  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); }
16
17
  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; }
17
18
  /**
@@ -49,11 +50,13 @@ const authorizeAccess = async (issuerConf, code, clientId, redirectUri, codeVeri
49
50
  htu: tokenUrl,
50
51
  jti: `${(0, _uuid.v4)()}`
51
52
  }, dPopCryptoContext);
53
+ _logging.Logger.log(_logging.LogLevel.DEBUG, `Token request DPoP: ${tokenRequestSignedDPop}`);
52
54
  const signedWiaPoP = await (0, _pop.createPopToken)({
53
55
  jti: `${(0, _uuid.v4)()}`,
54
56
  aud,
55
57
  iss
56
58
  }, wiaCryptoContext);
59
+ _logging.Logger.log(_logging.LogLevel.DEBUG, `WIA DPoP token: ${signedWiaPoP}`);
57
60
  const requestBody = {
58
61
  grant_type: "authorization_code",
59
62
  client_id: clientId,
@@ -64,6 +67,7 @@ const authorizeAccess = async (issuerConf, code, clientId, redirectUri, codeVeri
64
67
  client_assertion: walletInstanceAttestation + "~" + signedWiaPoP
65
68
  };
66
69
  const authorizationRequestFormBody = new URLSearchParams(requestBody);
70
+ _logging.Logger.log(_logging.LogLevel.DEBUG, `Auth form request body: ${authorizationRequestFormBody}`);
67
71
  const tokenRes = await appFetch(tokenUrl, {
68
72
  method: "POST",
69
73
  headers: {
@@ -73,6 +77,7 @@ const authorizeAccess = async (issuerConf, code, clientId, redirectUri, codeVeri
73
77
  body: authorizationRequestFormBody.toString()
74
78
  }).then((0, _misc.hasStatusOrThrow)(200, _errors.IssuerResponseError)).then(res => res.json()).then(body => _types.TokenResponse.safeParse(body));
75
79
  if (!tokenRes.success) {
80
+ _logging.Logger.log(_logging.LogLevel.ERROR, `Token Response validation failed: ${tokenRes.error.message}`);
76
81
  throw new _errors.ValidationFailed({
77
82
  message: "Token Response validation failed",
78
83
  reason: tokenRes.error.message
@@ -1 +1 @@
1
- {"version":3,"names":["_misc","require","_dpop","_uuid","_pop","WalletInstanceAttestation","_interopRequireWildcard","_const","_types","_errors","_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","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","ValidationFailed","message","reason","error","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;AAA2E,SAAAS,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,SAAAL,wBAAAS,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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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,K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AQ,CAACC,KAAK,EACb,2BAA0BW,4BAA6B,EAC1D,CAAC;EAED,MAAME,QAAQ,GAAG,MAAM3C,QAAQ,CAACmB,QAAQ,EAAE;IACxCyB,MAAM,EAAE,MAAM;IACdC,OAAO,EAAE;MACP,cAAc,EAAE,mCAAmC;MACnDC,IAAI,EAAEzB;IACR,CAAC;IACD0B,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;IACrB7B,eAAM,CAACC,GAAG,CACRC,iBAAQ,CAAC4B,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,CAAAvE,eAAA,GAAAA,eAAA"}
@@ -10,6 +10,7 @@ var _errors = require("../../utils/errors");
10
10
  var _types = require("./types");
11
11
  var _dpop = require("../../utils/dpop");
12
12
  var _uuid = require("uuid");
13
+ var _logging = require("../../utils/logging");
13
14
  const createNonceProof = async (nonce, issuer, audience, ctx) => {
14
15
  const jwk = await ctx.getPublicKey();
15
16
  return new _ioReactNativeJwt.SignJWT(ctx).setPayload({
@@ -37,7 +38,7 @@ const createNonceProof = async (nonce, issuer, audience, ctx) => {
37
38
  * @returns The credential response containing the credential
38
39
  */
39
40
  exports.createNonceProof = createNonceProof;
40
- const obtainCredential = async (issuerConf, accessToken, clientId, credentialDefinition, context) => {
41
+ const obtainCredential = async (issuerConf, accessToken, clientId, credentialDefinition, context, operationType) => {
41
42
  const {
42
43
  credentialCryptoContext,
43
44
  appFetch = fetch,
@@ -51,10 +52,12 @@ const obtainCredential = async (issuerConf, accessToken, clientId, credentialDef
51
52
  * @see https://openid.net/specs/openid-4-verifiable-credential-issuance-1_0.html#name-proof-types
52
53
  */
53
54
  const signedNonceProof = await createNonceProof(accessToken.c_nonce, clientId, credentialUrl, credentialCryptoContext);
55
+ _logging.Logger.log(_logging.LogLevel.DEBUG, `Signed nonce proof: ${signedNonceProof}`);
54
56
 
55
57
  // Validation of accessTokenResponse.authorization_details if contain credentialDefinition
56
58
  const containsCredentialDefinition = accessToken.authorization_details.some(c => c.credential_configuration_id === credentialDefinition.credential_configuration_id && c.format === credentialDefinition.format && c.type === credentialDefinition.type);
57
59
  if (!containsCredentialDefinition) {
60
+ _logging.Logger.log(_logging.LogLevel.ERROR, `Credential definition not found in the access token response ${accessToken.authorization_details}`);
58
61
  throw new _errors.ValidationFailed({
59
62
  message: "The access token response does not contain the requested credential"
60
63
  });
@@ -71,27 +74,34 @@ const obtainCredential = async (issuerConf, accessToken, clientId, credentialDef
71
74
  proof_type: "jwt"
72
75
  }
73
76
  };
77
+ _logging.Logger.log(_logging.LogLevel.DEBUG, `Credential request body: ${JSON.stringify(credentialRequestFormBody)}`);
74
78
  const tokenRequestSignedDPop = await (0, _dpop.createDPopToken)({
75
79
  htm: "POST",
76
80
  htu: credentialUrl,
77
81
  jti: `${(0, _uuid.v4)()}`,
78
82
  ath: await (0, _ioReactNativeJwt.sha256ToBase64)(accessToken.access_token)
79
83
  }, dPopCryptoContext);
84
+ _logging.Logger.log(_logging.LogLevel.DEBUG, `Token request DPoP: ${tokenRequestSignedDPop}`);
80
85
  const credentialRes = await appFetch(credentialUrl, {
81
86
  method: "POST",
82
87
  headers: {
83
88
  "Content-Type": "application/json",
84
89
  DPoP: tokenRequestSignedDPop,
85
- Authorization: `${accessToken.token_type} ${accessToken.access_token}`
90
+ Authorization: `${accessToken.token_type} ${accessToken.access_token}`,
91
+ ...(operationType === "reissuing" && {
92
+ operationType
93
+ })
86
94
  },
87
95
  body: JSON.stringify(credentialRequestFormBody)
88
96
  }).then((0, _misc.hasStatusOrThrow)(200)).then(res => res.json()).then(body => _types.CredentialResponse.safeParse(body)).catch(handleObtainCredentialError);
89
97
  if (!credentialRes.success) {
98
+ _logging.Logger.log(_logging.LogLevel.ERROR, `Credential Response validation failed: ${credentialRes.error.message}`);
90
99
  throw new _errors.ValidationFailed({
91
100
  message: "Credential Response validation failed",
92
101
  reason: credentialRes.error.message
93
102
  });
94
103
  }
104
+ _logging.Logger.log(_logging.LogLevel.DEBUG, `Credential Response: ${JSON.stringify(credentialRes.data)}`);
95
105
  return credentialRes.data;
96
106
  };
97
107
 
@@ -103,6 +113,7 @@ const obtainCredential = async (issuerConf, accessToken, clientId, credentialDef
103
113
  */
104
114
  exports.obtainCredential = obtainCredential;
105
115
  const handleObtainCredentialError = e => {
116
+ _logging.Logger.log(_logging.LogLevel.ERROR, `Error occurred while obtaining credential: ${e}`);
106
117
  if (!(e instanceof _errors.UnexpectedStatusCodeError)) {
107
118
  throw e;
108
119
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_ioReactNativeJwt","require","_misc","_errors","_types","_dpop","_uuid","createNonceProof","nonce","issuer","audience","ctx","jwk","getPublicKey","SignJWT","setPayload","setProtectedHeader","typ","setAudience","setIssuer","setIssuedAt","setExpirationTime","sign","exports","obtainCredential","issuerConf","accessToken","clientId","credentialDefinition","context","credentialCryptoContext","appFetch","fetch","dPopCryptoContext","credentialUrl","openid_credential_issuer","credential_endpoint","signedNonceProof","c_nonce","containsCredentialDefinition","authorization_details","some","c","credential_configuration_id","format","type","ValidationFailed","message","credentialRequestFormBody","credential_definition","proof","jwt","proof_type","tokenRequestSignedDPop","createDPopToken","htm","htu","jti","uuidv4","ath","sha256ToBase64","access_token","credentialRes","method","headers","DPoP","Authorization","token_type","body","JSON","stringify","then","hasStatusOrThrow","res","json","CredentialResponse","safeParse","catch","handleObtainCredentialError","success","reason","error","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;AAcO,MAAMM,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;EACF,CAAC,CAAC,CACDM,WAAW,CAACR,QAAQ,CAAC,CACrBS,SAAS,CAACV,MAAM,CAAC,CACjBW,WAAW,CAAC,CAAC,CACbC,iBAAiB,CAAC,MAAM,CAAC,CACzBC,IAAI,CAAC,CAAC;AACX,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAfAC,OAAA,CAAAhB,gBAAA,GAAAA,gBAAA;AAgBO,MAAMiB,gBAAkC,GAAG,MAAAA,CAChDC,UAAU,EACVC,WAAW,EACXC,QAAQ,EACRC,oBAAoB,EACpBC,OAAO,KACJ;EACH,MA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,CAACE,uBAAuB;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","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,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IACX;IACA;IACAC,IAAI,EAAEC,gCAAwB,CAACC,+BAA+B;IAC9D3C,OAAO,EACL;EACJ,CAAC,CAAC,CACDwC,MAAM,CAAC,GAAG,EAAE;IACXC,IAAI,EAAEC,gCAAwB,CAACE,uBAAuB;IACtD5C,OAAO,EAAE;EACX,CAAC,CAAC,CACDwC,MAAM,CAAC,GAAG,EAAE;IACXC,IAAI,EAAEC,gCAAwB,CAACE,uBAAuB;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"}
@@ -8,6 +8,7 @@ var _errors = require("../../utils/errors");
8
8
  var _types = require("../../sd-jwt/types");
9
9
  var _sdJwt = require("../../sd-jwt");
10
10
  var _converters = require("../../sd-jwt/converters");
11
+ var _logging = require("../../utils/logging");
11
12
  // The credential as a collection of attributes in plain value
12
13
 
13
14
  // handy alias
@@ -21,14 +22,17 @@ const parseCredentialSdJwt = function (credentials_supported, _ref) {
21
22
  let includeUndefinedAttributes = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
22
23
  const credentialSubject = credentials_supported[sdJwt.payload.vct];
23
24
  if (!credentialSubject) {
25
+ _logging.Logger.log(_logging.LogLevel.ERROR, `Credential type not supported by the issuer: ${sdJwt.payload.vct}`);
24
26
  throw new _errors.IoWalletError("Credential type not supported by the issuer");
25
27
  }
26
28
  if (credentialSubject.format !== sdJwt.header.typ) {
29
+ _logging.Logger.log(_logging.LogLevel.ERROR, `Received credential is of an unknwown type. Expected one of [${credentialSubject.format}], received '${sdJwt.header.typ}'`);
27
30
  throw new _errors.IoWalletError(`Received credential is of an unknwown type. Expected one of [${credentialSubject.format}], received '${sdJwt.header.typ}', `);
28
31
  }
29
32
 
30
33
  // transfrom a record { key: value } in an iterable of pairs [key, value]
31
34
  if (!credentialSubject.claims) {
35
+ _logging.Logger.log(_logging.LogLevel.ERROR, "Missing claims in the credential subject");
32
36
  throw new _errors.IoWalletError("Missing claims in the credential subject"); // TODO [SIW-1268]: should not be optional
33
37
  }
34
38
 
@@ -46,6 +50,7 @@ const parseCredentialSdJwt = function (credentials_supported, _ref) {
46
50
  const missing = attrsNotInDisclosures.map(_ => _[0 /* key */]).join(", ");
47
51
  const received = disclosures.map(_ => _[1 /* name */]).join(", ");
48
52
  if (!ignoreMissingAttributes) {
53
+ _logging.Logger.log(_logging.LogLevel.ERROR, `Some attributes are missing in the credential. Missing: [${missing}], received: [${received}]`);
49
54
  throw new _errors.IoWalletError(`Some attributes are missing in the credential. Missing: [${missing}], received: [${received}]`);
50
55
  }
51
56
  }
@@ -124,6 +129,7 @@ async function verifyCredentialSdJwt(rawCredential, issuerKeys, holderBindingCon
124
129
  cnf
125
130
  } = decodedCredential.sdJwt.payload;
126
131
  if (!cnf.jwk.kid || cnf.jwk.kid !== holderBindingKey.kid) {
132
+ _logging.Logger.log(_logging.LogLevel.ERROR, `Failed to verify holder binding, expected kid: ${holderBindingKey.kid}, got: ${decodedCredential.sdJwt.payload.cnf.jwk.kid}`);
127
133
  throw new _errors.IoWalletError(`Failed to verify holder binding, expected kid: ${holderBindingKey.kid}, got: ${decodedCredential.sdJwt.payload.cnf.jwk.kid}`);
128
134
  }
129
135
  return decodedCredential;
@@ -138,8 +144,10 @@ const verifyAndParseCredentialSdJwt = async (issuerConf, credential, _, _ref8) =
138
144
  includeUndefinedAttributes
139
145
  } = _ref8;
140
146
  const decoded = await verifyCredentialSdJwt(credential, issuerConf.openid_credential_issuer.jwks.keys, credentialCryptoContext);
147
+ _logging.Logger.log(_logging.LogLevel.DEBUG, `Decoded credential: ${JSON.stringify(decoded)}`);
141
148
  const parsedCredential = parseCredentialSdJwt(issuerConf.openid_credential_issuer.credential_configurations_supported, decoded, ignoreMissingAttributes, includeUndefinedAttributes);
142
149
  const maybeIssuedAt = (0, _converters.getValueFromDisclosures)(decoded.disclosures, "iat");
150
+ _logging.Logger.log(_logging.LogLevel.DEBUG, `Parsed credential: ${JSON.stringify(parsedCredential)}\nIssued at: ${maybeIssuedAt}`);
143
151
  return {
144
152
  parsedCredential,
145
153
  expiration: new Date(decoded.sdJwt.payload.exp * 1000),
@@ -162,8 +170,10 @@ const verifyAndParseCredentialSdJwt = async (issuerConf, credential, _, _ref8) =
162
170
  */
163
171
  const verifyAndParseCredential = async (issuerConf, credential, format, context) => {
164
172
  if (format === "vc+sd-jwt") {
173
+ _logging.Logger.log(_logging.LogLevel.DEBUG, "Parsing credential in vc+sd-jwt format");
165
174
  return verifyAndParseCredentialSdJwt(issuerConf, credential, format, context);
166
175
  }
176
+ _logging.Logger.log(_logging.LogLevel.ERROR, `Unsupported credential format: ${format}`);
167
177
  throw new _errors.IoWalletError(`Unsupported credential format: ${format}`);
168
178
  };
169
179
  exports.verifyAndParseCredential = verifyAndParseCredential;
@@ -1 +1 @@
1
- {"version":3,"names":["_errors","require","_types","_sdJwt","_converters","parseCredentialSdJwt","credentials_supported","_ref","sdJwt","disclosures","ignoreMissingAttributes","arguments","length","undefined","includeUndefinedAttributes","credentialSubject","payload","vct","IoWalletError","format","header","typ","claims","attrDefinitions","Object","entries","attrsNotInDisclosures","filter","_ref2","attrKey","some","_ref3","name","missing","map","_","join","received","definedValues","fromEntries","_ref4","_disclosures$find","definition","value","find","_ref5","display","reduce","names","_ref6","locale","undefinedValues","keys","includes","_ref7","key","verifyCredentialSdJwt","rawCredential","issuerKeys","holderBindingContext","decodedCredential","holderBindingKey","Promise","all","verifySdJwt","SdJwt4VC","getPublicKey","cnf","jwk","kid","verifyAndParseCredentialSdJwt","issuerConf","credential","_ref8","credentialCryptoContext","decoded","openid_credential_issuer","jwks","parsedCredential","credential_configurations_supported","maybeIssuedAt","getValueFromDisclosures","expiration","Date","exp","issuedAt","verifyAndParseCredential","context","exports"],"sourceRoot":"../../../../src","sources":["credential/issuance/07-verify-and-parse-cred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E,OACF,CAAC;EACH;EAEA,MAAM,IAAIrE,qBAAa,CAAE,kCAAiCC,MAAO,EAAC,CAAC;AACrE,CAAC;AAACqE,OAAA,CAAAF,wBAAA,GAAAA,wBAAA"}
1
+ {"version":3,"names":["_errors","require","_types","_sdJwt","_converters","_logging","parseCredentialSdJwt","credentials_supported","_ref","sdJwt","disclosures","ignoreMissingAttributes","arguments","length","undefined","includeUndefinedAttributes","credentialSubject","payload","vct","Logger","log","LogLevel","ERROR","IoWalletError","format","header","typ","claims","attrDefinitions","Object","entries","attrsNotInDisclosures","filter","_ref2","attrKey","some","_ref3","name","missing","map","_","join","received","definedValues","fromEntries","_ref4","_disclosures$find","definition","value","find","_ref5","display","reduce","names","_ref6","locale","undefinedValues","keys","includes","_ref7","key","verifyCredentialSdJwt","rawCredential","issuerKeys","holderBindingContext","decodedCredential","holderBindingKey","Promise","all","verifySdJwt","SdJwt4VC","getPublicKey","cnf","jwk","kid","verifyAndParseCredentialSdJwt","issuerConf","credential","_ref8","credentialCryptoContext","decoded","openid_credential_issuer","jwks","DEBUG","JSON","stringify","parsedCredential","credential_configurations_supported","maybeIssuedAt","getValueFromDisclosures","expiration","Date","exp","issuedAt","verifyAndParseCredential","context","exports"],"sourceRoot":"../../../../src","sources":["credential/issuance/07-verify-and-parse-credential.ts"],"mappings":";;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAGA,IAAAI,QAAA,GAAAJ,OAAA;AAuBA;;AAkBA;;AAKA,MAAMK,oBAAoB,GAAG,SAAAA,CAE3BC,qBAAgI,EAAAC,IAAA,EAI3G;EAAA,IAHrB;IAAEC,KAAK;IAAEC;EAAoC,CAAC,GAAAF,IAAA;EAAA,IAC9CG,uBAAgC,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,KAA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,CAACX,OAAO,CAACvE,KAAK,CAACQ,OAAO,CAAC2E,GAAG,GAAG,IAAI,CAAC;IACtDC,QAAQ,EACN,OAAOL,aAAa,KAAK,QAAQ,GAC7B,IAAIG,IAAI,CAACH,aAAa,GAAG,IAAI,CAAC,GAC9B1E;EACR,CAAC;AACH,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMgF,wBAAkD,GAAG,MAAAA,CAChElB,UAAU,EACVC,UAAU,EACVrD,MAAM,EACNuE,OAAO,KACJ;EACH,IAAIvE,MAAM,KAAK,WAAW,EAAE;IAC1BL,eAAM,CAACC,GAAG,CAACC,iBAAQ,CAAC8D,KAAK,EAAE,wCAAwC,CAAC;IACpE,OAAOR,6BAA6B,CAClCC,UAAU,EACVC,UAAU,EACVrD,MAAM,EACNuE,OACF,CAAC;EACH;EAEA5E,eAAM,CAACC,GAAG,CAACC,iBAAQ,CAACC,KAAK,EAAG,kCAAiCE,MAAO,EAAC,CAAC;EACtE,MAAM,IAAID,qBAAa,CAAE,kCAAiCC,MAAO,EAAC,CAAC;AACrE,CAAC;AAACwE,OAAA,CAAAF,wBAAA,GAAAA,wBAAA"}
@@ -5,13 +5,13 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.startFlowFromQR = void 0;
7
7
  var z = _interopRequireWildcard(require("zod"));
8
- var _errors = require("../../utils/errors");
8
+ var _errors = require("./errors");
9
9
  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); }
10
10
  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; }
11
11
  const PresentationParams = z.object({
12
- clientId: z.string().nonempty(),
13
- requestUri: z.string().url(),
14
- requestUriMethod: z.enum(["get", "post"]),
12
+ client_id: z.string().nonempty(),
13
+ request_uri: z.string().url(),
14
+ request_uri_method: z.enum(["get", "post"]),
15
15
  state: z.string().optional()
16
16
  });
17
17
 
@@ -19,27 +19,27 @@ const PresentationParams = z.object({
19
19
  * The beginning of the presentation flow.
20
20
  * To be implemented accordind to the user touchpoint
21
21
  *
22
- * @param params Presentation parameters, depending on the starting touchoint
22
+ * @param params Presentation parameters, depending on the starting touchpoint
23
23
  * @returns The url for the Relying Party to connect with
24
24
  */
25
25
 
26
26
  /**
27
- * Start a presentation flow by decoding an incoming QR-code
27
+ * Start a presentation flow by validating the required parameters.
28
+ * Parameters are extracted from a url encoded in a QR code or in a deep link.
28
29
  *
29
- * @param params The encoded QR-code content
30
+ * @param params The parameters to be validated
30
31
  * @returns The url for the Relying Party to connect with
31
- * @throws If the provided qr code fails to be decoded
32
+ * @throws If the provided parameters are not valid
32
33
  */
33
34
  const startFlowFromQR = params => {
34
- const result = PresentationParams.safeParse(params);
35
+ const result = PresentationParams.safeParse({
36
+ ...params,
37
+ request_uri_method: params.request_uri_method ?? "get"
38
+ });
35
39
  if (result.success) {
36
40
  return result.data;
37
- } else {
38
- throw new _errors.ValidationFailed({
39
- message: "Invalid parameters provided",
40
- reason: result.error.message
41
- });
42
41
  }
42
+ throw new _errors.InvalidQRCodeError(result.error.message);
43
43
  };
44
44
  exports.startFlowFromQR = startFlowFromQR;
45
45
  //# sourceMappingURL=01-start-flow.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["z","_interopRequireWildcard","require","_errors","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","PresentationParams","object","clientId","string","nonempty","requestUri","url","requestUriMethod","enum","state","optional","startFlowFromQR","params","result","safeParse","success","data","ValidationFailed","message","reason","error","exports"],"sourceRoot":"../../../../src","sources":["credential/presentation/01-start-flow.ts"],"mappings":";;;;;;AAAA,IAAAA,CAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAAsD,SAAAE,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,wB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","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","PresentationParams","object","client_id","string","nonempty","request_uri","url","request_uri_method","enum","state","optional","startFlowFromQR","params","result","safeParse","success","data","InvalidQRCodeError","error","message","exports"],"sourceRoot":"../../../../src","sources":["credential/presentation/01-start-flow.ts"],"mappings":";;;;;;AAAA,IAAAA,CAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAA8C,SAAAE,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,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