@pagopa/io-react-native-wallet 0.11.1 → 0.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (217) hide show
  1. package/lib/commonjs/client/generated/wallet-provider.js +126 -0
  2. package/lib/commonjs/client/generated/wallet-provider.js.map +1 -0
  3. package/lib/commonjs/client/index.js +40 -0
  4. package/lib/commonjs/client/index.js.map +1 -0
  5. package/lib/commonjs/credential/issuance/02-evaluate-issuer-trust.js +2 -1
  6. package/lib/commonjs/credential/issuance/02-evaluate-issuer-trust.js.map +1 -1
  7. package/lib/commonjs/credential/issuance/03-start-credential-issuance.js +287 -0
  8. package/lib/commonjs/credential/issuance/03-start-credential-issuance.js.map +1 -0
  9. package/lib/commonjs/credential/issuance/03-start-user-authorization.js +56 -83
  10. package/lib/commonjs/credential/issuance/03-start-user-authorization.js.map +1 -1
  11. package/lib/commonjs/credential/issuance/04-complete-user-authorization.js +88 -0
  12. package/lib/commonjs/credential/issuance/04-complete-user-authorization.js.map +1 -1
  13. package/lib/commonjs/credential/issuance/05-authorize-access.js +56 -33
  14. package/lib/commonjs/credential/issuance/05-authorize-access.js.map +1 -1
  15. package/lib/commonjs/credential/issuance/06-obtain-credential.js +51 -78
  16. package/lib/commonjs/credential/issuance/06-obtain-credential.js.map +1 -1
  17. package/lib/commonjs/credential/issuance/07-verify-and-parse-credential.js +21 -44
  18. package/lib/commonjs/credential/issuance/07-verify-and-parse-credential.js.map +1 -1
  19. package/lib/commonjs/credential/issuance/index.js +7 -0
  20. package/lib/commonjs/credential/issuance/index.js.map +1 -1
  21. package/lib/commonjs/credential/issuance/types.js +28 -0
  22. package/lib/commonjs/credential/issuance/types.js.map +1 -0
  23. package/lib/commonjs/index.js +10 -1
  24. package/lib/commonjs/index.js.map +1 -1
  25. package/lib/commonjs/pid/sd-jwt/converters.js +5 -9
  26. package/lib/commonjs/pid/sd-jwt/converters.js.map +1 -1
  27. package/lib/commonjs/pid/sd-jwt/types.js +3 -3
  28. package/lib/commonjs/pid/sd-jwt/types.js.map +1 -1
  29. package/lib/commonjs/sd-jwt/__test__/converters.test.js +1 -1
  30. package/lib/commonjs/sd-jwt/__test__/converters.test.js.map +1 -1
  31. package/lib/commonjs/sd-jwt/__test__/index.test.js +30 -43
  32. package/lib/commonjs/sd-jwt/__test__/index.test.js.map +1 -1
  33. package/lib/commonjs/sd-jwt/__test__/types.test.js +16 -24
  34. package/lib/commonjs/sd-jwt/__test__/types.test.js.map +1 -1
  35. package/lib/commonjs/sd-jwt/index.js +3 -9
  36. package/lib/commonjs/sd-jwt/index.js.map +1 -1
  37. package/lib/commonjs/sd-jwt/types.js +11 -16
  38. package/lib/commonjs/sd-jwt/types.js.map +1 -1
  39. package/lib/commonjs/trust/types.js +70 -29
  40. package/lib/commonjs/trust/types.js.map +1 -1
  41. package/lib/commonjs/utils/auth.js +44 -0
  42. package/lib/commonjs/utils/auth.js.map +1 -0
  43. package/lib/commonjs/utils/errors.js +104 -1
  44. package/lib/commonjs/utils/errors.js.map +1 -1
  45. package/lib/commonjs/utils/integrity.js +2 -0
  46. package/lib/commonjs/utils/integrity.js.map +1 -0
  47. package/lib/commonjs/utils/misc.js +34 -1
  48. package/lib/commonjs/utils/misc.js.map +1 -1
  49. package/lib/commonjs/utils/par.js +23 -15
  50. package/lib/commonjs/utils/par.js.map +1 -1
  51. package/lib/commonjs/utils/pop.js +33 -0
  52. package/lib/commonjs/utils/pop.js.map +1 -0
  53. package/lib/commonjs/wallet-instance/index.js +29 -0
  54. package/lib/commonjs/wallet-instance/index.js.map +1 -0
  55. package/lib/commonjs/wallet-instance-attestation/issuing.js +62 -65
  56. package/lib/commonjs/wallet-instance-attestation/issuing.js.map +1 -1
  57. package/lib/commonjs/wallet-instance-attestation/types.js +8 -8
  58. package/lib/commonjs/wallet-instance-attestation/types.js.map +1 -1
  59. package/lib/module/client/generated/wallet-provider.js +102 -0
  60. package/lib/module/client/generated/wallet-provider.js.map +1 -0
  61. package/lib/module/client/index.js +33 -0
  62. package/lib/module/client/index.js.map +1 -0
  63. package/lib/module/credential/issuance/02-evaluate-issuer-trust.js +2 -1
  64. package/lib/module/credential/issuance/02-evaluate-issuer-trust.js.map +1 -1
  65. package/lib/module/credential/issuance/03-start-credential-issuance.js +276 -0
  66. package/lib/module/credential/issuance/03-start-credential-issuance.js.map +1 -0
  67. package/lib/module/credential/issuance/03-start-user-authorization.js +56 -80
  68. package/lib/module/credential/issuance/03-start-user-authorization.js.map +1 -1
  69. package/lib/module/credential/issuance/04-complete-user-authorization.js +85 -1
  70. package/lib/module/credential/issuance/04-complete-user-authorization.js.map +1 -1
  71. package/lib/module/credential/issuance/05-authorize-access.js +54 -33
  72. package/lib/module/credential/issuance/05-authorize-access.js.map +1 -1
  73. package/lib/module/credential/issuance/06-obtain-credential.js +50 -75
  74. package/lib/module/credential/issuance/06-obtain-credential.js.map +1 -1
  75. package/lib/module/credential/issuance/07-verify-and-parse-credential.js +21 -44
  76. package/lib/module/credential/issuance/07-verify-and-parse-credential.js.map +1 -1
  77. package/lib/module/credential/issuance/index.js +2 -1
  78. package/lib/module/credential/issuance/index.js.map +1 -1
  79. package/lib/module/credential/issuance/types.js +18 -0
  80. package/lib/module/credential/issuance/types.js.map +1 -0
  81. package/lib/module/index.js +3 -1
  82. package/lib/module/index.js.map +1 -1
  83. package/lib/module/pid/sd-jwt/converters.js +5 -9
  84. package/lib/module/pid/sd-jwt/converters.js.map +1 -1
  85. package/lib/module/pid/sd-jwt/types.js +3 -3
  86. package/lib/module/pid/sd-jwt/types.js.map +1 -1
  87. package/lib/module/sd-jwt/__test__/converters.test.js +1 -1
  88. package/lib/module/sd-jwt/__test__/converters.test.js.map +1 -1
  89. package/lib/module/sd-jwt/__test__/index.test.js +30 -43
  90. package/lib/module/sd-jwt/__test__/index.test.js.map +1 -1
  91. package/lib/module/sd-jwt/__test__/types.test.js +16 -24
  92. package/lib/module/sd-jwt/__test__/types.test.js.map +1 -1
  93. package/lib/module/sd-jwt/index.js +3 -9
  94. package/lib/module/sd-jwt/index.js.map +1 -1
  95. package/lib/module/sd-jwt/types.js +11 -16
  96. package/lib/module/sd-jwt/types.js.map +1 -1
  97. package/lib/module/trust/types.js +70 -29
  98. package/lib/module/trust/types.js.map +1 -1
  99. package/lib/module/utils/auth.js +35 -0
  100. package/lib/module/utils/auth.js.map +1 -0
  101. package/lib/module/utils/errors.js +98 -0
  102. package/lib/module/utils/errors.js.map +1 -1
  103. package/lib/module/utils/integrity.js +2 -0
  104. package/lib/module/utils/integrity.js.map +1 -0
  105. package/lib/module/utils/misc.js +31 -0
  106. package/lib/module/utils/misc.js.map +1 -1
  107. package/lib/module/utils/par.js +24 -16
  108. package/lib/module/utils/par.js.map +1 -1
  109. package/lib/module/utils/pop.js +24 -0
  110. package/lib/module/utils/pop.js.map +1 -0
  111. package/lib/module/wallet-instance/index.js +23 -0
  112. package/lib/module/wallet-instance/index.js.map +1 -0
  113. package/lib/module/wallet-instance-attestation/issuing.js +63 -67
  114. package/lib/module/wallet-instance-attestation/issuing.js.map +1 -1
  115. package/lib/module/wallet-instance-attestation/types.js +8 -8
  116. package/lib/module/wallet-instance-attestation/types.js.map +1 -1
  117. package/lib/typescript/client/generated/wallet-provider.d.ts +264 -0
  118. package/lib/typescript/client/generated/wallet-provider.d.ts.map +1 -0
  119. package/lib/typescript/client/index.d.ts +7 -0
  120. package/lib/typescript/client/index.d.ts.map +1 -0
  121. package/lib/typescript/credential/issuance/01-start-flow.d.ts +1 -0
  122. package/lib/typescript/credential/issuance/01-start-flow.d.ts.map +1 -1
  123. package/lib/typescript/credential/issuance/02-evaluate-issuer-trust.d.ts +2 -1
  124. package/lib/typescript/credential/issuance/02-evaluate-issuer-trust.d.ts.map +1 -1
  125. package/lib/typescript/credential/issuance/03-start-credential-issuance.d.ts +41 -0
  126. package/lib/typescript/credential/issuance/03-start-credential-issuance.d.ts.map +1 -0
  127. package/lib/typescript/credential/issuance/03-start-user-authorization.d.ts +23 -18
  128. package/lib/typescript/credential/issuance/03-start-user-authorization.d.ts.map +1 -1
  129. package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts +24 -12
  130. package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts.map +1 -1
  131. package/lib/typescript/credential/issuance/05-authorize-access.d.ts +22 -16
  132. package/lib/typescript/credential/issuance/05-authorize-access.d.ts.map +1 -1
  133. package/lib/typescript/credential/issuance/06-obtain-credential.d.ts +19 -26
  134. package/lib/typescript/credential/issuance/06-obtain-credential.d.ts.map +1 -1
  135. package/lib/typescript/credential/issuance/07-verify-and-parse-credential.d.ts +10 -15
  136. package/lib/typescript/credential/issuance/07-verify-and-parse-credential.d.ts.map +1 -1
  137. package/lib/typescript/credential/issuance/index.d.ts +3 -4
  138. package/lib/typescript/credential/issuance/index.d.ts.map +1 -1
  139. package/lib/typescript/credential/issuance/types.d.ts +63 -0
  140. package/lib/typescript/credential/issuance/types.d.ts.map +1 -0
  141. package/lib/typescript/credential/presentation/types.d.ts +6 -6
  142. package/lib/typescript/index.d.ts +6 -1
  143. package/lib/typescript/index.d.ts.map +1 -1
  144. package/lib/typescript/pid/sd-jwt/converters.d.ts.map +1 -1
  145. package/lib/typescript/pid/sd-jwt/types.d.ts +36 -36
  146. package/lib/typescript/pid/sd-jwt/types.d.ts.map +1 -1
  147. package/lib/typescript/sd-jwt/index.d.ts +40 -68
  148. package/lib/typescript/sd-jwt/index.d.ts.map +1 -1
  149. package/lib/typescript/sd-jwt/types.d.ts +64 -121
  150. package/lib/typescript/sd-jwt/types.d.ts.map +1 -1
  151. package/lib/typescript/trust/index.d.ts +150 -48
  152. package/lib/typescript/trust/index.d.ts.map +1 -1
  153. package/lib/typescript/trust/types.d.ts +2838 -1740
  154. package/lib/typescript/trust/types.d.ts.map +1 -1
  155. package/lib/typescript/utils/auth.d.ts +52 -0
  156. package/lib/typescript/utils/auth.d.ts.map +1 -0
  157. package/lib/typescript/utils/errors.d.ts +48 -0
  158. package/lib/typescript/utils/errors.d.ts.map +1 -1
  159. package/lib/typescript/utils/integrity.d.ts +21 -0
  160. package/lib/typescript/utils/integrity.d.ts.map +1 -0
  161. package/lib/typescript/utils/misc.d.ts +18 -0
  162. package/lib/typescript/utils/misc.d.ts.map +1 -1
  163. package/lib/typescript/utils/par.d.ts +8 -31
  164. package/lib/typescript/utils/par.d.ts.map +1 -1
  165. package/lib/typescript/utils/pop.d.ts +26 -0
  166. package/lib/typescript/utils/pop.d.ts.map +1 -0
  167. package/lib/typescript/wallet-instance/index.d.ts +7 -0
  168. package/lib/typescript/wallet-instance/index.d.ts.map +1 -0
  169. package/lib/typescript/wallet-instance-attestation/issuing.d.ts +17 -4
  170. package/lib/typescript/wallet-instance-attestation/issuing.d.ts.map +1 -1
  171. package/lib/typescript/wallet-instance-attestation/types.d.ts +64 -64
  172. package/lib/typescript/wallet-instance-attestation/types.d.ts.map +1 -1
  173. package/package.json +9 -5
  174. package/src/client/generated/wallet-provider.ts +173 -0
  175. package/src/client/index.ts +53 -0
  176. package/src/credential/issuance/01-start-flow.ts +1 -0
  177. package/src/credential/issuance/02-evaluate-issuer-trust.ts +2 -1
  178. package/src/credential/issuance/03-start-credential-issuance.ts +407 -0
  179. package/src/credential/issuance/03-start-user-authorization.ts +91 -92
  180. package/src/credential/issuance/04-complete-user-authorization.ts +114 -13
  181. package/src/credential/issuance/05-authorize-access.ts +74 -49
  182. package/src/credential/issuance/06-obtain-credential.ts +77 -111
  183. package/src/credential/issuance/07-verify-and-parse-credential.ts +30 -67
  184. package/src/credential/issuance/index.ts +6 -4
  185. package/src/credential/issuance/types.ts +25 -0
  186. package/src/index.ts +8 -0
  187. package/src/pid/sd-jwt/converters.ts +5 -11
  188. package/src/pid/sd-jwt/types.ts +8 -6
  189. package/src/sd-jwt/__test__/converters.test.ts +1 -1
  190. package/src/sd-jwt/__test__/index.test.ts +45 -74
  191. package/src/sd-jwt/__test__/types.test.ts +21 -33
  192. package/src/sd-jwt/index.ts +3 -12
  193. package/src/sd-jwt/types.ts +17 -22
  194. package/src/trust/types.ts +64 -32
  195. package/src/utils/auth.ts +37 -0
  196. package/src/utils/errors.ts +112 -0
  197. package/src/utils/integrity.ts +23 -0
  198. package/src/utils/misc.ts +43 -0
  199. package/src/utils/par.ts +29 -17
  200. package/src/utils/pop.ts +34 -0
  201. package/src/wallet-instance/index.ts +29 -0
  202. package/src/wallet-instance-attestation/issuing.ts +101 -97
  203. package/src/wallet-instance-attestation/types.ts +12 -8
  204. package/lib/commonjs/credential/issuance/07-confirm-credential.js +0 -6
  205. package/lib/commonjs/credential/issuance/07-confirm-credential.js.map +0 -1
  206. package/lib/commonjs/credential/issuance/08-confirm-credential.js +0 -6
  207. package/lib/commonjs/credential/issuance/08-confirm-credential.js.map +0 -1
  208. package/lib/module/credential/issuance/07-confirm-credential.js +0 -2
  209. package/lib/module/credential/issuance/07-confirm-credential.js.map +0 -1
  210. package/lib/module/credential/issuance/08-confirm-credential.js +0 -2
  211. package/lib/module/credential/issuance/08-confirm-credential.js.map +0 -1
  212. package/lib/typescript/credential/issuance/07-confirm-credential.d.ts +0 -11
  213. package/lib/typescript/credential/issuance/07-confirm-credential.d.ts.map +0 -1
  214. package/lib/typescript/credential/issuance/08-confirm-credential.d.ts +0 -11
  215. package/lib/typescript/credential/issuance/08-confirm-credential.d.ts.map +0 -1
  216. package/src/credential/issuance/07-confirm-credential.ts +0 -14
  217. package/src/credential/issuance/08-confirm-credential.ts +0 -14
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.WalletInstanceAttestationIssuingError = exports.ValidationFailed = exports.PidMetadataError = exports.PidIssuingError = exports.NoSuitableKeysFoundInEntityConfiguration = exports.IoWalletError = exports.ClaimsNotFoundInToken = exports.ClaimsNotFoundBetweenDislosures = exports.AuthRequestDecodeError = void 0;
6
+ exports.WalletProviderResponseError = exports.WalletInstanceRevokedError = exports.WalletInstanceNotFoundError = exports.WalletInstanceAttestationIssuingError = exports.ValidationFailed = exports.PidMetadataError = exports.PidIssuingError = exports.NoSuitableKeysFoundInEntityConfiguration = exports.IoWalletError = exports.ClaimsNotFoundInToken = exports.ClaimsNotFoundBetweenDislosures = exports.AuthorizationIdpError = exports.AuthorizationError = exports.AuthRequestDecodeError = void 0;
7
7
  /**
8
8
  * utility to format a set of attributes into an error message string
9
9
  *
@@ -232,5 +232,108 @@ class PidMetadataError extends Error {
232
232
  super(message);
233
233
  }
234
234
  }
235
+
236
+ /**
237
+ * An error subclass thrown when a Wallet Provider http request fail
238
+ *
239
+ */
235
240
  exports.PidMetadataError = PidMetadataError;
241
+ class WalletProviderResponseError extends IoWalletError {
242
+ static get code() {
243
+ return "ERR_IO_WALLET_PROVIDER_RESPONSE_FAILED";
244
+ }
245
+ code = "ERR_IO_WALLET_PROVIDER_RESPONSE_FAILED";
246
+
247
+ /** The Claim for which the validation failed. */
248
+
249
+ /** Reason code for the validation failure. */
250
+
251
+ /** HTTP status code */
252
+
253
+ constructor(message) {
254
+ let claim = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "unspecified";
255
+ let reason = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "unspecified";
256
+ let statusCode = arguments.length > 3 ? arguments[3] : undefined;
257
+ super(serializeAttrs({
258
+ message,
259
+ claim,
260
+ reason,
261
+ statusCode: statusCode.toString()
262
+ }));
263
+ this.claim = claim;
264
+ this.reason = reason;
265
+ this.statusCode = statusCode;
266
+ }
267
+ }
268
+ exports.WalletProviderResponseError = WalletProviderResponseError;
269
+ class WalletInstanceRevokedError extends IoWalletError {
270
+ static get code() {
271
+ return "ERR_IO_WALLET_INSTANCE_REVOKED";
272
+ }
273
+ code = "ERR_IO_WALLET_INSTANCE_REVOKED";
274
+ constructor(message, claim) {
275
+ let reason = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "unspecified";
276
+ super(serializeAttrs({
277
+ message,
278
+ claim,
279
+ reason
280
+ }));
281
+ this.reason = reason;
282
+ this.claim = claim;
283
+ }
284
+ }
285
+ exports.WalletInstanceRevokedError = WalletInstanceRevokedError;
286
+ class WalletInstanceNotFoundError extends IoWalletError {
287
+ static get code() {
288
+ return "ERR_IO_WALLET_INSTANCE_NOT_FOUND";
289
+ }
290
+ code = "ERR_IO_WALLET_INSTANCE_NOT_FOUND";
291
+ constructor(message, claim) {
292
+ let reason = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "unspecified";
293
+ super(serializeAttrs({
294
+ message,
295
+ claim,
296
+ reason
297
+ }));
298
+ this.reason = reason;
299
+ this.claim = claim;
300
+ }
301
+ }
302
+
303
+ /**
304
+ * An error subclass thrown when an error occurs during the authorization process.
305
+ */
306
+ exports.WalletInstanceNotFoundError = WalletInstanceNotFoundError;
307
+ class AuthorizationError extends IoWalletError {
308
+ static get code() {
309
+ return "ERR_IO_WALLET_AUTHORIZATION_ERROR";
310
+ }
311
+ code = "ERR_IO_WALLET_AUTHORIZATION_ERROR";
312
+ constructor(message) {
313
+ super(message);
314
+ }
315
+ }
316
+
317
+ /**
318
+ * An error subclass thrown when an error occurs during the authorization process with the IDP.
319
+ * It contains the error and error description returned by the IDP.
320
+ */
321
+ exports.AuthorizationError = AuthorizationError;
322
+ class AuthorizationIdpError extends IoWalletError {
323
+ static get code() {
324
+ return "ERR_IO_WALLET_IDENTIFICATION_RESPONSE_ERROR";
325
+ }
326
+ code = "ERR_IO_WALLET_IDENTIFICATION_RESPONSE_PARSING_FAILED";
327
+ constructor(error, errorDescription) {
328
+ super(serializeAttrs(errorDescription ? {
329
+ error,
330
+ errorDescription
331
+ } : {
332
+ error
333
+ }));
334
+ this.error = error;
335
+ this.errorDescription = errorDescription;
336
+ }
337
+ }
338
+ exports.AuthorizationIdpError = AuthorizationIdpError;
236
339
  //# sourceMappingURL=errors.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["serializeAttrs","attrs","Object","entries","map","_ref","k","v","Array","isArray","join","_","IoWalletError","Error","code","constructor","message","_Error$captureStackTr","name","captureStackTrace","call","exports","ValidationFailed","claim","arguments","length","undefined","reason","WalletInstanceAttestationIssuingError","AuthRequestDecodeError","PidIssuingError","ClaimsNotFoundBetweenDislosures","claims","c","ClaimsNotFoundInToken","NoSuitableKeysFoundInEntityConfiguration","scenario","PidMetadataError"],"sourceRoot":"../../../src","sources":["utils/errors.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,cAAc,GAAIC,KAAsC,IAC5DC,MAAM,CAACC,OAAO,CAACF,KAAK,CAAC,CAClBG,GAAG,CAACC,IAAA;EAAA,IAAC,CAACC,CAAC,EAAEC,CAAC,CAAC,GAAAF,IAAA;EAAA,OAAK,CAACC,CAAC,EAAEE,KAAK,CAACC,OAAO,CAACF,CAAC,CAAC,GAAI,IAAGA,CAAC,CAACG,IAAI,CAAC,IAAI,CAAE,GAAE,GAAGH,CAAC,CAAC;AAAA,EAAC,CAChEH,GAAG,CAAEO,CAAC,IAAKA,CAAC,CAACD,IAAI,CAAC,GAAG,CAAC,CAAC,CACvBA,IAAI,CAAC,GAAG,CAAC;;AAEd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAME,aAAa,SAASC,KAAK,CAAC;EACvC;EACA,WAAWC,IAAIA,CAAA,EAAW;IACxB,OAAO,uBAAuB;EAChC;;EAEA;EACAA,IAAI,GAAW,uBAAuB;EAEtCC,WAAWA,CAACC,OAAgB,EAAE;IAAA,IAAAC,qBAAA;IAC5B,KAAK,CAACD,OAAO,CAAC;IACd,IAAI,CAACE,IAAI,GAAG,IAAI,CAACH,WAAW,CAACG,IAAI;IACjC;IACA,CAAAD,qBAAA,GAAAJ,KAAK,CAACM,iBAAiB,cAAAF,qBAAA,uBAAvBA,qBAAA,CAAAG,IAAA,CAAAP,KAAK,EAAqB,IAAI,EAAE,IAAI,CAACE,WAAW,CAAC;EACnD;AACF;AACA;AACA;AACA;AACA;AAHAM,OAAA,CAAAT,aAAA,GAAAA,aAAA;AAIO,MAAMU,gBAAgB,SAASV,aAAa,CAAC;EAClD,WAAWE,IA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AHAK,OAAA,CAAAc,wCAAA,GAAAA,wCAAA;AAIO,MAAME,gBAAgB,SAASxB,KAAK,CAAC;EAC1C,WAAWC,IAAIA,CAAA,EAAyB;IACtC,OAAO,oBAAoB;EAC7B;EAEAC,WAAWA,CAACC,OAAe,EAAE;IAC3B,KAAK,CAACA,OAAO,CAAC;EAChB;AACF;AAACK,OAAA,CAAAgB,gBAAA,GAAAA,gBAAA"}
1
+ {"version":3,"names":["serializeAttrs","attrs","Object","entries","map","_ref","k","v","Array","isArray","join","_","IoWalletError","Error","code","constructor","message","_Error$captureStackTr","name","captureStackTrace","call","exports","ValidationFailed","claim","arguments","length","undefined","reason","WalletInstanceAttestationIssuingError","AuthRequestDecodeError","PidIssuingError","ClaimsNotFoundBetweenDislosures","claims","c","ClaimsNotFoundInToken","NoSuitableKeysFoundInEntityConfiguration","scenario","PidMetadataError","WalletProviderResponseError","statusCode","toString","WalletInstanceRevokedError","WalletInstanceNotFoundError","AuthorizationError","AuthorizationIdpError","error","errorDescription"],"sourceRoot":"../../../src","sources":["utils/errors.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,cAAc,GAAIC,KAAsC,IAC5DC,MAAM,CAACC,OAAO,CAACF,KAAK,CAAC,CAClBG,GAAG,CAACC,IAAA;EAAA,IAAC,CAACC,CAAC,EAAEC,CAAC,CAAC,GAAAF,IAAA;EAAA,OAAK,CAACC,CAAC,EAAEE,KAAK,CAACC,OAAO,CAACF,CAAC,CAAC,GAAI,IAAGA,CAAC,CAACG,IAAI,CAAC,IAAI,CAAE,GAAE,GAAGH,CAAC,CAAC;AAAA,EAAC,CAChEH,GAAG,CAAEO,CAAC,IAAKA,CAAC,CAACD,IAAI,CAAC,GAAG,CAAC,CAAC,CACvBA,IAAI,CAAC,GAAG,CAAC;;AAEd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAME,aAAa,SAASC,KAAK,CAA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AGA,MAAM;IACpB,IAAI,CAACJ,KAAK,GAAGA,KAAK;EACpB;AACF;;AAEA;AACA;AACA;AAFAF,OAAA,CAAAqB,2BAAA,GAAAA,2BAAA;AAGO,MAAMC,kBAAkB,SAAS/B,aAAa,CAAC;EACpD,WAAWE,IAAIA,CAAA,EAAwC;IACrD,OAAO,mCAAmC;EAC5C;EAEAA,IAAI,GAAG,mCAAmC;EAE1CC,WAAWA,CAACC,OAAgB,EAAE;IAC5B,KAAK,CAACA,OAAO,CAAC;EAChB;AACF;;AAEA;AACA;AACA;AACA;AAHAK,OAAA,CAAAsB,kBAAA,GAAAA,kBAAA;AAIO,MAAMC,qBAAqB,SAAShC,aAAa,CAAC;EACvD,WAAWE,IAAIA,CAAA,EAAkD;IAC/D,OAAO,6CAA6C;EACtD;EAEAA,IAAI,GAAG,sDAAsD;EAK7DC,WAAWA,CAAC8B,KAAa,EAAEC,gBAAyB,EAAE;IACpD,KAAK,CACH9C,cAAc,CAAC8C,gBAAgB,GAAG;MAAED,KAAK;MAAEC;IAAiB,CAAC,GAAG;MAAED;IAAM,CAAC,CAC3E,CAAC;IACD,IAAI,CAACA,KAAK,GAAGA,KAAK;IAClB,IAAI,CAACC,gBAAgB,GAAGA,gBAAgB;EAC1C;AACF;AAACzB,OAAA,CAAAuB,qBAAA,GAAAA,qBAAA"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=integrity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["utils/integrity.ts"],"mappings":""}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.hasStatus = void 0;
6
+ exports.until = exports.hasStatus = exports.generateRandomAlphaNumericString = void 0;
7
7
  var _errors = require("./errors");
8
8
  /**
9
9
  * Check if a response is in the expected status, other
@@ -20,4 +20,37 @@ const hasStatus = status => async res => {
20
20
  // extract a type from an async function output
21
21
  // helpful to bind the input of a function to the output of another
22
22
  exports.hasStatus = hasStatus;
23
+ /**
24
+ * TODO [SIW-1310]: replace this function with a cryptographically secure one.
25
+ * @param size - The size of the string to generate
26
+ * @returns A random alphanumeric string of the given size
27
+ */
28
+ const generateRandomAlphaNumericString = size => Array.from(Array(size), () => Math.floor(Math.random() * 36).toString(36)).join("");
29
+
30
+ /**
31
+ * Repeatedly checks a condition function until it returns true,
32
+ * then resolves the returned promise. If the condition function does not return true
33
+ * within the specified timeout, the promise is rejected.
34
+ *
35
+ * @param conditionFunction - A function that returns a boolean value.
36
+ * The promise resolves when this function returns true.
37
+ * @param timeout - An optional timeout in seconds. The promise is rejected if the
38
+ * condition function does not return true within this time.
39
+ * @returns A promise that resolves once the conditionFunction returns true or rejects if timed out.
40
+ */
41
+ exports.generateRandomAlphaNumericString = generateRandomAlphaNumericString;
42
+ const until = (conditionFunction, timeoutSeconds) => new Promise((resolve, reject) => {
43
+ const start = Date.now();
44
+ const poll = () => {
45
+ if (conditionFunction()) {
46
+ resolve();
47
+ } else if (timeoutSeconds !== undefined && Date.now() - start >= timeoutSeconds * 1000) {
48
+ reject(new Error("Timeout exceeded"));
49
+ } else {
50
+ setTimeout(poll, 400);
51
+ }
52
+ };
53
+ poll();
54
+ });
55
+ exports.until = until;
23
56
  //# sourceMappingURL=misc.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_errors","require","hasStatus","status","res","IoWalletError","url","text","exports"],"sourceRoot":"../../../src","sources":["utils/misc.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACA;AACO,MAAMC,SAAS,GACnBC,MAAc,IACf,MAAOC,GAAa,IAAwB;EAC1C,IAAIA,GAAG,CAACD,MAAM,KAAKA,MAAM,EAAE;IACzB,MAAM,IAAIE,qBAAa,CACpB,iCAAgCF,MAAO,SAAQC,GAAG,CAACD,MAAO,UACzDC,GAAG,CAACE,GACL,mBAAkB,MAAMF,GAAG,CAACG,IAAI,CAAC,CAAE,EACtC,CAAC;EACH;EACA,OAAOH,GAAG;AACZ,CAAC;;AAEH;AACA;AAAAI,OAAA,CAAAN,SAAA,GAAAA,SAAA"}
1
+ {"version":3,"names":["_errors","require","hasStatus","status","res","IoWalletError","url","text","exports","generateRandomAlphaNumericString","size","Array","from","Math","floor","random","toString","join","until","conditionFunction","timeoutSeconds","Promise","resolve","reject","start","Date","now","poll","undefined","Error","setTimeout"],"sourceRoot":"../../../src","sources":["utils/misc.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACA;AACO,MAAMC,SAAS,GACnBC,MAAc,IACf,MAAOC,GAAa,IAAwB;EAC1C,IAAIA,GAAG,CAACD,MAAM,KAAKA,MAAM,EAAE;IACzB,MAAM,IAAIE,qBAAa,CACpB,iCAAgCF,MAAO,SAAQC,GAAG,CAACD,MAAO,UACzDC,GAAG,CAACE,GACL,mBAAkB,MAAMF,GAAG,CAACG,IAAI,CAAC,CAAE,EACtC,CAAC;EACH;EACA,OAAOH,GAAG;AACZ,CAAC;;AAEH;AACA;AAAAI,OAAA,CAAAN,SAAA,GAAAA,SAAA;AAOA;AACA;AACA;AACA;AACA;AACO,MAAMO,gCAAgC,GAAIC,IAAY,IAC3DC,KAAK,CAACC,IAAI,CAACD,KAAK,CAACD,IAAI,CAAC,EAAE,MACtBG,IAAI,CAACC,KAAK,CAACD,IAAI,CAACE,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,CAACC,QAAQ,CAAC,EAAE,CAC5C,CAAC,CAACC,IAAI,CAAC,EAAE,CAAC;;AAEZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAVAT,OAAA,CAAAC,gCAAA,GAAAA,gCAAA;AAWO,MAAMS,KAAK,GAAGA,CACnBC,iBAAgC,EAChCC,cAAuB,KAEvB,IAAIC,OAAO,CAAO,CAACC,OAAO,EAAEC,MAAM,KAAK;EACrC,MAAMC,KAAK,GAAGC,IAAI,CAACC,GAAG,CAAC,CAAC;EACxB,MAAMC,IAAI,GAAGA,CAAA,KAAM;IACjB,IAAIR,iBAAiB,CAAC,CAAC,EAAE;MACvBG,OAAO,CAAC,CAAC;IACX,CAAC,MAAM,IACLF,cAAc,KAAKQ,SAAS,IAC5BH,IAAI,CAACC,GAAG,CAAC,CAAC,GAAGF,KAAK,IAAIJ,cAAc,GAAG,IAAI,EAC3C;MACAG,MAAM,CAAC,IAAIM,KAAK,CAAC,kBAAkB,CAAC,CAAC;IACvC,CAAC,MAAM;MACLC,UAAU,CAACH,IAAI,EAAE,GAAG,CAAC;IACvB;EACF,CAAC;EAEDA,IAAI,CAAC,CAAC;AACR,CAAC,CAAC;AAACnB,OAAA,CAAAU,KAAA,GAAAA,KAAA"}
@@ -9,13 +9,12 @@ var _reactNativeUuid = _interopRequireDefault(require("react-native-uuid"));
9
9
  var z = _interopRequireWildcard(require("zod"));
10
10
  var WalletInstanceAttestation = _interopRequireWildcard(require("../wallet-instance-attestation"));
11
11
  var _misc = require("./misc");
12
+ var _pop = require("./pop");
12
13
  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); }
13
14
  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; }
14
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
16
  const AuthorizationDetail = z.object({
16
- credential_definition: z.object({
17
- type: z.string()
18
- }),
17
+ credential_configuration_id: z.string(),
19
18
  format: z.union([z.literal("vc+sd-jwt"), z.literal("vc+mdoc-cbor")]),
20
19
  type: z.literal("openid_credential")
21
20
  });
@@ -31,16 +30,21 @@ const makeParRequest = _ref => {
31
30
  wiaCryptoContext,
32
31
  appFetch = fetch
33
32
  } = _ref;
34
- return async (clientId, codeVerifier, walletProviderBaseUrl, parEndpoint, walletInstanceAttestation, authorizationDetails, assertionType) => {
33
+ return async (clientId, codeVerifier, redirectUri, responseMode, parEndpoint, walletInstanceAttestation, authorizationDetails, assertionType) => {
35
34
  const wiaPublicKey = await wiaCryptoContext.getPublicKey();
36
35
  const parUrl = new URL(parEndpoint);
37
36
  const aud = `${parUrl.protocol}//${parUrl.hostname}`;
38
37
  const iss = WalletInstanceAttestation.decode(walletInstanceAttestation).payload.cnf.jwk.kid;
38
+ const signedWiaPoP = await (0, _pop.createPopToken)({
39
+ jti: `${_reactNativeUuid.default.v4()}`,
40
+ aud,
41
+ iss
42
+ }, wiaCryptoContext);
39
43
 
40
44
  /** A code challenge is provided so that the PAR is bound
41
45
  to the subsequent authorization code request
42
46
  @see https://datatracker.ietf.org/doc/html/rfc9126#name-request */
43
- const codeChallengeMethod = "s256";
47
+ const codeChallengeMethod = "S256";
44
48
  const codeChallenge = await (0, _ioReactNativeJwt.sha256ToBase64)(codeVerifier);
45
49
 
46
50
  /** The PAR request token is signed used the Wallet Instance Attestation key.
@@ -48,20 +52,24 @@ const makeParRequest = _ref => {
48
52
  with the it will ship the Wallet Instance Attestation.
49
53
  The key is matched by its kid */
50
54
  const signedJwtForPar = await new _ioReactNativeJwt.SignJWT(wiaCryptoContext).setProtectedHeader({
55
+ typ: "jwk",
51
56
  kid: wiaPublicKey.kid
52
57
  }).setPayload({
53
- iss,
54
- aud,
55
58
  jti: `${_reactNativeUuid.default.v4()}`,
56
- client_assertion_type: assertionType,
57
- authorization_details: authorizationDetails,
59
+ aud,
58
60
  response_type: "code",
59
- redirect_uri: walletProviderBaseUrl,
60
- state: `${_reactNativeUuid.default.v4()}`,
61
+ response_mode: responseMode,
61
62
  client_id: clientId,
63
+ iss,
64
+ state: (0, _misc.generateRandomAlphaNumericString)(32),
65
+ code_challenge: codeChallenge,
62
66
  code_challenge_method: codeChallengeMethod,
63
- code_challenge: codeChallenge
64
- }).setIssuedAt().setExpirationTime("1h").sign();
67
+ authorization_details: authorizationDetails,
68
+ redirect_uri: redirectUri,
69
+ client_assertion_type: assertionType,
70
+ client_assertion: walletInstanceAttestation + "~" + signedWiaPoP
71
+ }).setIssuedAt() //iat is set to now
72
+ .setExpirationTime("5min").sign();
65
73
 
66
74
  /** The request body for the Pushed Authorization Request */
67
75
  var formBody = new URLSearchParams({
@@ -69,9 +77,9 @@ const makeParRequest = _ref => {
69
77
  client_id: clientId,
70
78
  code_challenge: codeChallenge,
71
79
  code_challenge_method: "S256",
80
+ request: signedJwtForPar,
72
81
  client_assertion_type: assertionType,
73
- client_assertion: walletInstanceAttestation,
74
- request: signedJwtForPar
82
+ client_assertion: walletInstanceAttestation + "~" + signedWiaPoP
75
83
  });
76
84
  return await appFetch(parEndpoint, {
77
85
  method: "POST",
@@ -1 +1 @@
1
- {"version":3,"names":["_ioReactNativeJwt","require","_reactNativeUuid","_interopRequireDefault","z","_interopRequireWildcard","WalletInstanceAttestation","_misc","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","AuthorizationDetail","object","credential_definition","type","string","format","union","literal","exports","AuthorizationDetails","array","makeParRequest","_ref","wiaCryptoContext","appFetch","fetch","clientId","codeVerifier","walletProviderBaseUrl","parEndpoint","walletInstanceAttestation","authorizationDetails","assertionType","wiaPublicKey","getPublicKey","parUrl","URL","aud","protocol","hostname","iss","decode","payload","cnf","jwk","kid","codeChallengeMethod","codeChallenge","sha256ToBase64","signedJwtForPar","SignJWT","setProtectedHeader","setPayload","jti","uuid","v4","client_assertion_type","authorization_details","response_type","redirect_uri","state","client_id","code_challenge_method","code_challenge","setIssuedAt","setExpirationTime","sign","formBody","URLSearchParams","client_assertion","request","method","headers","body","toString","then","hasStatus","res","json","result","request_uri"],"sourceRoot":"../../../src","sources":["utils/par.ts"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAKA,IAAAC,gBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,CAAA,GAAAC,uBAAA,CAAAJ,OAAA;AACA,IAAAK,yBAAA,GAAAD,uBAAA,CAAAJ,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AAAmC,SAAAO,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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AAIC,eAAe,CAAC;MACjCV,aAAa,EAAE,MAAM;MACrBG,SAAS,EAAEnC,QAAQ;MACnBqC,cAAc,EAAEhB,aAAa;MAC7Be,qBAAqB,EAAE,MAAM;MAC7BN,qBAAqB,EAAExB,aAAa;MACpCqC,gBAAgB,EAAEvC,yBAAyB;MAC3CwC,OAAO,EAAErB;IACX,CAAC,CAAC;IAEF,OAAO,MAAMzB,QAAQ,CAACK,WAAW,EAAE;MACjC0C,MAAM,EAAE,MAAM;MACdC,OAAO,EAAE;QACP,cAAc,EAAE;MAClB,CAAC;MACDC,IAAI,EAAEN,QAAQ,CAACO,QAAQ,CAAC;IAC1B,CAAC,CAAC,CACCC,IAAI,CAAC,IAAAC,eAAS,EAAC,GAAG,CAAC,CAAC,CACpBD,IAAI,CAAEE,GAAG,IAAKA,GAAG,CAACC,IAAI,CAAC,CAAC,CAAC,CACzBH,IAAI,CAAEI,MAAM,IAAKA,MAAM,CAACC,WAAW,CAAC;EACzC,CAAC;AAAA;AAAC9D,OAAA,CAAAG,cAAA,GAAAA,cAAA"}
1
+ {"version":3,"names":["_ioReactNativeJwt","require","_reactNativeUuid","_interopRequireDefault","z","_interopRequireWildcard","WalletInstanceAttestation","_misc","_pop","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","AuthorizationDetail","object","credential_configuration_id","string","format","union","literal","type","exports","AuthorizationDetails","array","makeParRequest","_ref","wiaCryptoContext","appFetch","fetch","clientId","codeVerifier","redirectUri","responseMode","parEndpoint","walletInstanceAttestation","authorizationDetails","assertionType","wiaPublicKey","getPublicKey","parUrl","URL","aud","protocol","hostname","iss","decode","payload","cnf","jwk","kid","signedWiaPoP","createPopToken","jti","uuid","v4","codeChallengeMethod","codeChallenge","sha256ToBase64","signedJwtForPar","SignJWT","setProtectedHeader","typ","setPayload","response_type","response_mode","client_id","state","generateRandomAlphaNumericString","code_challenge","code_challenge_method","authorization_details","redirect_uri","client_assertion_type","client_assertion","setIssuedAt","setExpirationTime","sign","formBody","URLSearchParams","request","method","headers","body","toString","then","hasStatus","res","json","result","request_uri"],"sourceRoot":"../../../src","sources":["utils/par.ts"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAKA,IAAAC,gBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,CAAA,GAAAC,uBAAA,CAAAJ,OAAA;AACA,IAAAK,yBAAA,GAAAD,uBAAA,CAAAJ,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,IAAA,GAAAP,OAAA;AAAuC,SAAAQ,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,qBAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAV,GAAA,EAAAW,GAAA,cA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AAA,CACdC,iBAAiB,CAAC,MAAM,CAAC,CACzBC,IAAI,CAAC,CAAC;;IAET;IACA,IAAIC,QAAQ,GAAG,IAAIC,eAAe,CAAC;MACjCf,aAAa,EAAE,MAAM;MACrBE,SAAS,EAAEpC,QAAQ;MACnBuC,cAAc,EAAEZ,aAAa;MAC7Ba,qBAAqB,EAAE,MAAM;MAC7BU,OAAO,EAAErB,eAAe;MACxBc,qBAAqB,EAAEpC,aAAa;MACpCqC,gBAAgB,EAAEvC,yBAAyB,GAAG,GAAG,GAAGgB;IACtD,CAAC,CAAC;IAEF,OAAO,MAAMvB,QAAQ,CAACM,WAAW,EAAE;MACjC+C,MAAM,EAAE,MAAM;MACdC,OAAO,EAAE;QACP,cAAc,EAAE;MAClB,CAAC;MACDC,IAAI,EAAEL,QAAQ,CAACM,QAAQ,CAAC;IAC1B,CAAC,CAAC,CACCC,IAAI,CAAC,IAAAC,eAAS,EAAC,GAAG,CAAC,CAAC,CACpBD,IAAI,CAAEE,GAAG,IAAKA,GAAG,CAACC,IAAI,CAAC,CAAC,CAAC,CACzBH,IAAI,CAAEI,MAAM,IAAKA,MAAM,CAACC,WAAW,CAAC;EACzC,CAAC;AAAA;AAACpE,OAAA,CAAAG,cAAA,GAAAA,cAAA"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createPopToken = exports.PoPPayload = void 0;
7
+ var z = _interopRequireWildcard(require("zod"));
8
+ var _ioReactNativeJwt = require("@pagopa/io-react-native-jwt");
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
+ 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
+ /**
12
+ * Create a signed PoP token
13
+ *
14
+ * @param payload The payload to be included in the token.
15
+ * @param crypto The crypto context that handles the key bound to the DPoP.
16
+ *
17
+ * @returns The signed crypto token.
18
+ */
19
+ const createPopToken = async (payload, crypto) => {
20
+ const kid = await crypto.getPublicKey().then(_ => _.kid);
21
+ return new _ioReactNativeJwt.SignJWT(crypto).setPayload(payload).setProtectedHeader({
22
+ typ: "jwt-client-attestation-pop",
23
+ kid
24
+ }).setIssuedAt().setExpirationTime("5min").sign();
25
+ };
26
+ exports.createPopToken = createPopToken;
27
+ const PoPPayload = z.object({
28
+ jti: z.string(),
29
+ aud: z.string(),
30
+ iss: z.string()
31
+ });
32
+ exports.PoPPayload = PoPPayload;
33
+ //# sourceMappingURL=pop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["z","_interopRequireWildcard","require","_ioReactNativeJwt","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","createPopToken","payload","crypto","kid","getPublicKey","then","_","SignJWT","setPayload","setProtectedHeader","typ","setIssuedAt","setExpirationTime","sign","exports","PoPPayload","object","jti","string","aud","iss"],"sourceRoot":"../../../src","sources":["utils/pop.ts"],"mappings":";;;;;;AAAA,IAAAA,CAAA,GAAAC,uBAAA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ACnBC,MAAqB,KACD;EACpB,MAAMC,GAAG,GAAG,MAAMD,MAAM,CAACE,YAAY,CAAC,CAAC,CAACC,IAAI,CAAEC,CAAC,IAAKA,CAAC,CAACH,GAAG,CAAC;EAC1D,OAAO,IAAII,yBAAO,CAACL,MAAM,CAAC,CACvBM,UAAU,CAACP,OAAO,CAAC,CACnBQ,kBAAkB,CAAC;IAClBC,GAAG,EAAE,4BAA4B;IACjCP;EACF,CAAC,CAAC,CACDQ,WAAW,CAAC,CAAC,CACbC,iBAAiB,CAAC,MAAM,CAAC,CACzBC,IAAI,CAAC,CAAC;AACX,CAAC;AAACC,OAAA,CAAAd,cAAA,GAAAA,cAAA;AAGK,MAAMe,UAAU,GAAGzC,CAAC,CAAC0C,MAAM,CAAC;EACjCC,GAAG,EAAE3C,CAAC,CAAC4C,MAAM,CAAC,CAAC;EACfC,GAAG,EAAE7C,CAAC,CAAC4C,MAAM,CAAC,CAAC;EACfE,GAAG,EAAE9C,CAAC,CAAC4C,MAAM,CAAC;AAChB,CAAC,CAAC;AAACJ,OAAA,CAAAC,UAAA,GAAAA,UAAA"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createWalletInstance = createWalletInstance;
7
+ var _client = require("../client");
8
+ async function createWalletInstance(context) {
9
+ const {
10
+ integrityContext
11
+ } = context;
12
+ const api = (0, _client.getWalletProviderClient)(context);
13
+
14
+ //1. Obtain nonce
15
+ const challenge = await api.get("/nonce").then(response => response.nonce);
16
+ const keyAttestation = await integrityContext.getAttestation(challenge);
17
+ const hardwareKeyTag = integrityContext.getHardwareKeyTag();
18
+
19
+ //2. Create Wallet Instance
20
+ await api.post("/wallet-instances", {
21
+ body: {
22
+ challenge,
23
+ key_attestation: keyAttestation,
24
+ hardware_key_tag: hardwareKeyTag
25
+ }
26
+ });
27
+ return hardwareKeyTag;
28
+ }
29
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_client","require","createWalletInstance","context","integrityContext","api","getWalletProviderClient","challenge","get","then","response","nonce","keyAttestation","getAttestation","hardwareKeyTag","getHardwareKeyTag","post","body","key_attestation","hardware_key_tag"],"sourceRoot":"../../../src","sources":["wallet-instance/index.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAGO,eAAeC,oBAAoBA,CAACC,OAI1C,EAAE;EACD,MAAM;IAAEC;EAAiB,CAAC,GAAGD,OAAO;EAEpC,MAAME,GAAG,GAAG,IAAAC,+BAAuB,EAACH,OAAO,CAAC;;EAE5C;EACA,MAAMI,SAAS,GAAG,MAAMF,GAAG,CAACG,GAAG,CAAC,QAAQ,CAAC,CAACC,IAAI,CAAEC,QAAQ,IAAKA,QAAQ,CAACC,KAAK,CAAC;EAE5E,MAAMC,cAAc,GAAG,MAAMR,gBAAgB,CAACS,cAAc,CAACN,SAAS,CAAC;EACvE,MAAMO,cAAc,GAAGV,gBAAgB,CAACW,iBAAiB,CAAC,CAAC;;EAE3D;EACA,MAAMV,GAAG,CAACW,IAAI,CAAC,mBAAmB,EAAE;IAClCC,IAAI,EAAE;MACJV,SAAS;MACTW,eAAe,EAAEN,cAAc;MAC/BO,gBAAgB,EAAEL;IACpB;EACF,CAAC,CAAC;EAEF,OAAOA,cAAc;AACvB"}
@@ -4,13 +4,22 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getAttestation = void 0;
7
+ exports.getAttestationRequest = getAttestationRequest;
7
8
  var _ioReactNativeJwt = require("@pagopa/io-react-native-jwt");
9
+ var _zod = require("zod");
8
10
  var _jwk = require("../utils/jwk");
9
- var _types = require("./types");
10
- var _reactNativeUuid = _interopRequireDefault(require("react-native-uuid"));
11
+ var _client = require("../client");
11
12
  var _errors = require("../utils/errors");
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
- async function getAttestationRequest(wiaCryptoContext, walletProviderEntityConfiguration) {
13
+ /**
14
+ * Getter for an attestation request. The attestation request is a JWT that will be sent to the Wallet Provider to request a Wallet Instance Attestation.
15
+ *
16
+ * @param challenge - The nonce received from the Wallet Provider which is part of the signed clientData
17
+ * @param wiaCryptoContext - The key pair associated with the WIA. Will be use to prove the ownership of the attestation
18
+ * @param integrityContext - The integrity context which exposes a set of functions to interact with the device integrity service
19
+ * @param walletProviderBaseUrl - Base url for the Wallet Provider
20
+ * @returns A JWT containing the attestation request
21
+ */
22
+ async function getAttestationRequest(challenge, wiaCryptoContext, integrityContext, walletProviderBaseUrl) {
14
23
  const jwk = await wiaCryptoContext.getPublicKey();
15
24
  const parsedJwk = _jwk.JWK.parse(jwk);
16
25
  const keyThumbprint = await (0, _ioReactNativeJwt.thumbprint)(parsedJwk);
@@ -18,50 +27,31 @@ async function getAttestationRequest(wiaCryptoContext, walletProviderEntityConfi
18
27
  ...parsedJwk,
19
28
  kid: keyThumbprint
20
29
  };
30
+ const clientData = {
31
+ challenge,
32
+ jwk_thumbprint: keyThumbprint
33
+ };
34
+ const hardwareKeyTag = integrityContext.getHardwareKeyTag();
35
+ const {
36
+ signature,
37
+ authenticatorData
38
+ } = await integrityContext.getHardwareSignatureWithAuthData(JSON.stringify(clientData));
21
39
  return new _ioReactNativeJwt.SignJWT(wiaCryptoContext).setPayload({
22
40
  iss: keyThumbprint,
23
- aud: walletProviderEntityConfiguration.payload.iss,
24
- jti: `${_reactNativeUuid.default.v4()}`,
25
- nonce: `${_reactNativeUuid.default.v4()}`,
41
+ sub: walletProviderBaseUrl,
42
+ challenge,
43
+ hardware_signature: signature,
44
+ integrity_assertion: authenticatorData,
45
+ hardware_key_tag: hardwareKeyTag,
26
46
  cnf: {
27
47
  jwk: (0, _jwk.fixBase64EncodingOnKey)(publicKey)
28
48
  }
29
49
  }).setProtectedHeader({
30
50
  kid: publicKey.kid,
31
- typ: "wiar+jwt"
51
+ typ: "war+jwt"
32
52
  }).setIssuedAt().setExpirationTime("1h").sign();
33
53
  }
34
54
 
35
- /**
36
- * Validate a Wallet Instance Attestation token.
37
- * Either return true or throw an exception.
38
- *
39
- * @param wia Signed Wallet Instance Attestation token
40
- * @param walletProviderEntityConfiguration Entity Configuration object for the issuing Wallet Provider
41
- * @returns The token is valid
42
- * @throws {WalletInstanceAttestationIssuingError} When the received token fails to validate. This can happen due to invalid signature, expired token or malformed JWT token.
43
- */
44
- async function verifyWalletInstanceAttestation(wia, walletProviderEntityConfiguration) {
45
- const {
46
- payload: {
47
- sub,
48
- metadata: {
49
- wallet_provider: {
50
- jwks: {
51
- keys
52
- }
53
- }
54
- }
55
- }
56
- } = walletProviderEntityConfiguration;
57
- return (0, _ioReactNativeJwt.verify)(wia, keys, {
58
- issuer: sub
59
- }).then(_ => true).catch(ex => {
60
- const reason = ex && ex instanceof Error ? ex.message : "unknown reason";
61
- throw new _errors.WalletInstanceAttestationIssuingError("Unable to validate received wallet instance attestation", reason);
62
- });
63
- }
64
-
65
55
  /**
66
56
  * Request a Wallet Instance Attestation (WIA) to the Wallet provider
67
57
  *
@@ -69,40 +59,47 @@ async function verifyWalletInstanceAttestation(wia, walletProviderEntityConfigur
69
59
  * @param params.appFetch (optional) Http client
70
60
  * @param walletProviderBaseUrl Base url for the Wallet Provider
71
61
  * @returns The retrieved Wallet Instance Attestation token
62
+ * @throws {WalletInstanceRevokedError} The Wallet Instance was revoked
63
+ * @throws {WalletInstanceNotFoundError} The Wallet Instance does not exist
72
64
  */
73
- const getAttestation = _ref => {
65
+ const getAttestation = async _ref => {
74
66
  let {
75
67
  wiaCryptoContext,
68
+ integrityContext,
69
+ walletProviderBaseUrl,
76
70
  appFetch = fetch
77
71
  } = _ref;
78
- return async walletProviderEntityConfiguration => {
79
- const signedAttestationRequest = await getAttestationRequest(wiaCryptoContext, walletProviderEntityConfiguration);
80
- const decodedRequest = (0, _ioReactNativeJwt.decode)(signedAttestationRequest);
81
- const parsedRequest = _types.WalletInstanceAttestationRequestJwt.parse({
82
- payload: decodedRequest.payload,
83
- header: decodedRequest.protectedHeader
84
- });
85
- const publicKey = parsedRequest.payload.cnf.jwk;
86
- await (0, _ioReactNativeJwt.verify)(signedAttestationRequest, publicKey);
87
- const tokenUrl = walletProviderEntityConfiguration.payload.metadata.wallet_provider.token_endpoint;
88
- const requestBody = {
89
- grant_type: "urn:ietf:params:oauth:client-assertion-type:jwt-client-attestation",
72
+ const api = (0, _client.getWalletProviderClient)({
73
+ walletProviderBaseUrl,
74
+ appFetch
75
+ });
76
+
77
+ // 1. Get nonce from backend
78
+ const challenge = await api.get("/nonce").then(response => response.nonce);
79
+
80
+ // 2. Get a signed attestation request
81
+ const signedAttestationRequest = await getAttestationRequest(challenge, wiaCryptoContext, integrityContext, walletProviderBaseUrl);
82
+
83
+ // 3. Request WIA
84
+ const wia = await api.post("/token", {
85
+ body: {
86
+ grant_type: "urn:ietf:params:oauth:grant-type:jwt-bearer",
90
87
  assertion: signedAttestationRequest
91
- };
92
- const response = await appFetch(tokenUrl, {
93
- method: "POST",
94
- headers: {
95
- "Content-Type": "application/json"
96
- },
97
- body: JSON.stringify(requestBody)
98
- });
99
- if (response.status !== 201) {
100
- throw new _errors.WalletInstanceAttestationIssuingError("Unable to obtain wallet instance attestation from wallet provider", `Response code: ${response.status}`);
101
88
  }
102
- const wia = await response.text();
103
- await verifyWalletInstanceAttestation(wia, walletProviderEntityConfiguration);
104
- return wia;
105
- };
89
+ }).then(result => _zod.z.string().parse(result)).catch(handleAttestationCreationError);
90
+ return wia;
106
91
  };
107
92
  exports.getAttestation = getAttestation;
93
+ const handleAttestationCreationError = e => {
94
+ if (!(e instanceof _errors.WalletProviderResponseError)) {
95
+ throw e;
96
+ }
97
+ if (e.statusCode === 403) {
98
+ throw new _errors.WalletInstanceRevokedError("Unable to get an attestation for a revoked Wallet Instance", e.claim, e.reason);
99
+ }
100
+ if (e.statusCode === 404) {
101
+ throw new _errors.WalletInstanceNotFoundError("Unable to get an attestation for a Wallet Instance that does not exist", e.claim, e.reason);
102
+ }
103
+ throw new _errors.WalletInstanceAttestationIssuingError(`Unable to obtain wallet instance attestation [response status code: ${e.statusCode}]`, e.claim, e.reason);
104
+ };
108
105
  //# sourceMappingURL=issuing.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_ioReactNativeJwt","require","_jwk","_types","_reactNativeUuid","_interopRequireDefault","_errors","obj","__esModule","default","getAttestationRequest","wiaCryptoContext","walletProviderEntityConfiguration","jwk","getPublicKey","parsedJwk","JWK","parse","keyThumbprint","thumbprint","publicKey","kid","SignJWT","setPayload","iss","aud","payload","jti","uuid","v4","nonce","cnf","fixBase64EncodingOnKey","setProtectedHeader","typ","setIssuedAt","setExpirationTime","sign","verifyWalletInstanceAttestation","wia","sub","metadata","wallet_provider","jwks","keys","verifyJwt","issuer","then","_","catch","ex","reason","Error","message","WalletInstanceAttestationIssuingError","getAttestation","_ref","appFetch","fetch","signedAttestationRequest","decodedRequest","decodeJwt","parsedRequest","WalletInstanceAttestationRequestJwt","header","protectedHeader","tokenUrl","token_endpoint","requestBody","grant_type","assertion","response","method","headers","body","JSON","stringify","status","text","exports"],"sourceRoot":"../../../src","sources":["wallet-instance-attestation/issuing.ts"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAMA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAAwE,SAAAI,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAGxE,eAAeG,qBAAqBA,CAClCC,gBAA+B,EAC/BC,iCAAoE,EACnD;EACjB,MAAMC,GAAG,GAAG,MAAMF,gBAAgB,CAACG,YAAY,CAAC,CAAC;EACjD,MAAMC,SAAS,GAAGC,QAAG,CAACC,KAAK,CAACJ,GAAG,CAAC;EAChC,MAAMK,aAAa,GAAG,MA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CAAC;IAEjC,MAAMxC,+BAA+B,CACnCC,GAAG,EACH3B,iCACF,CAAC;IAED,OAAO2B,GAAG;EACZ,CAAC;AAAA;AAACwC,OAAA,CAAAxB,cAAA,GAAAA,cAAA"}
1
+ {"version":3,"names":["_ioReactNativeJwt","require","_zod","_jwk","_client","_errors","getAttestationRequest","challenge","wiaCryptoContext","integrityContext","walletProviderBaseUrl","jwk","getPublicKey","parsedJwk","JWK","parse","keyThumbprint","thumbprint","publicKey","kid","clientData","jwk_thumbprint","hardwareKeyTag","getHardwareKeyTag","signature","authenticatorData","getHardwareSignatureWithAuthData","JSON","stringify","SignJWT","setPayload","iss","sub","hardware_signature","integrity_assertion","hardware_key_tag","cnf","fixBase64EncodingOnKey","setProtectedHeader","typ","setIssuedAt","setExpirationTime","sign","getAttestation","_ref","appFetch","fetch","api","getWalletProviderClient","get","then","response","nonce","signedAttestationRequest","wia","post","body","grant_type","assertion","result","z","string","catch","handleAttestationCreationError","exports","e","WalletProviderResponseError","statusCode","WalletInstanceRevokedError","claim","reason","WalletInstanceNotFoundError","WalletInstanceAttestationIssuingError"],"sourceRoot":"../../../src","sources":["wallet-instance-attestation/issuing.ts"],"mappings":";;;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAEA,IAAAI,OAAA,GAAAJ,OAAA;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAeK,qBAAqBA,CACzCC,SAAiB,EACjBC,gBAA+B,EAC/BC,gBAAkC,EAClCC,qBAA6B,EACZ;EACjB,MAAMC,GAAG,GAAG,MAAMH,gBAAgB,CAACI,YAAY,CAAC,CAAC;EACjD,MAAMC,SAAS,GAAGC,QAAG,CAACC,KAAK,CAACJ,GAAG,CAAC;EAChC,MAAMK,aAAa,GAAG,MAAM,IAAAC,4BAAU,EAACJ,SAAS,CAAC;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