@pagopa/io-react-native-wallet 1.7.0 → 2.0.0-next.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 (438) hide show
  1. package/README.md +47 -1
  2. package/lib/commonjs/client/generated/wallet-provider.js +49 -20
  3. package/lib/commonjs/client/generated/wallet-provider.js.map +1 -1
  4. package/lib/commonjs/credential/index.js +5 -1
  5. package/lib/commonjs/credential/index.js.map +1 -1
  6. package/lib/commonjs/credential/issuance/02-evaluate-issuer-trust.js +27 -0
  7. package/lib/commonjs/credential/issuance/02-evaluate-issuer-trust.js.map +1 -0
  8. package/lib/commonjs/credential/issuance/03-start-user-authorization.js +25 -16
  9. package/lib/commonjs/credential/issuance/03-start-user-authorization.js.map +1 -1
  10. package/lib/commonjs/credential/issuance/04-complete-user-authorization.js +30 -18
  11. package/lib/commonjs/credential/issuance/04-complete-user-authorization.js.map +1 -1
  12. package/lib/commonjs/credential/issuance/05-authorize-access.js +17 -12
  13. package/lib/commonjs/credential/issuance/05-authorize-access.js.map +1 -1
  14. package/lib/commonjs/credential/issuance/06-obtain-credential.js +36 -29
  15. package/lib/commonjs/credential/issuance/06-obtain-credential.js.map +1 -1
  16. package/lib/commonjs/credential/issuance/07-verify-and-parse-credential.js +27 -207
  17. package/lib/commonjs/credential/issuance/07-verify-and-parse-credential.js.map +1 -1
  18. package/lib/commonjs/credential/issuance/README.md +23 -20
  19. package/lib/commonjs/credential/issuance/const.js +1 -1
  20. package/lib/commonjs/credential/issuance/const.js.map +1 -1
  21. package/lib/commonjs/credential/issuance/index.js +3 -3
  22. package/lib/commonjs/credential/issuance/index.js.map +1 -1
  23. package/lib/commonjs/credential/presentation/01-start-flow.js +14 -15
  24. package/lib/commonjs/credential/presentation/01-start-flow.js.map +1 -1
  25. package/lib/commonjs/credential/presentation/02-evaluate-rp-trust.js +6 -4
  26. package/lib/commonjs/credential/presentation/02-evaluate-rp-trust.js.map +1 -1
  27. package/lib/commonjs/credential/presentation/03-get-request-object.js +34 -7
  28. package/lib/commonjs/credential/presentation/03-get-request-object.js.map +1 -1
  29. package/lib/commonjs/credential/presentation/04-retrieve-rp-jwks.js +4 -126
  30. package/lib/commonjs/credential/presentation/04-retrieve-rp-jwks.js.map +1 -1
  31. package/lib/commonjs/credential/presentation/05-verify-request-object.js +80 -25
  32. package/lib/commonjs/credential/presentation/05-verify-request-object.js.map +1 -1
  33. package/lib/commonjs/credential/presentation/06-fetch-presentation-definition.js +6 -30
  34. package/lib/commonjs/credential/presentation/06-fetch-presentation-definition.js.map +1 -1
  35. package/lib/commonjs/credential/presentation/07-evaluate-dcql-query.js +97 -117
  36. package/lib/commonjs/credential/presentation/07-evaluate-dcql-query.js.map +1 -1
  37. package/lib/commonjs/credential/presentation/07-evaluate-input-descriptor.js +86 -191
  38. package/lib/commonjs/credential/presentation/07-evaluate-input-descriptor.js.map +1 -1
  39. package/lib/commonjs/credential/presentation/08-send-authorization-response.js +112 -176
  40. package/lib/commonjs/credential/presentation/08-send-authorization-response.js.map +1 -1
  41. package/lib/commonjs/credential/presentation/README.md +74 -79
  42. package/lib/commonjs/credential/presentation/errors.js +42 -21
  43. package/lib/commonjs/credential/presentation/errors.js.map +1 -1
  44. package/lib/commonjs/credential/presentation/index.js +13 -13
  45. package/lib/commonjs/credential/presentation/index.js.map +1 -1
  46. package/lib/commonjs/credential/presentation/types.js +53 -29
  47. package/lib/commonjs/credential/presentation/types.js.map +1 -1
  48. package/lib/commonjs/credential/status/01-start-flow.js +2 -0
  49. package/lib/commonjs/credential/status/01-start-flow.js.map +1 -0
  50. package/lib/commonjs/credential/status/02-status-attestation.js +73 -0
  51. package/lib/commonjs/credential/status/02-status-attestation.js.map +1 -0
  52. package/lib/commonjs/credential/status/03-verify-and-parse-status-attestation.js +55 -0
  53. package/lib/commonjs/credential/status/03-verify-and-parse-status-attestation.js.map +1 -0
  54. package/lib/commonjs/credential/status/README.md +67 -0
  55. package/lib/commonjs/credential/status/index.js +27 -0
  56. package/lib/commonjs/credential/status/index.js.map +1 -0
  57. package/lib/commonjs/credential/status/types.js +48 -0
  58. package/lib/commonjs/credential/status/types.js.map +1 -0
  59. package/lib/commonjs/credential/trustmark/README.md +62 -0
  60. package/lib/commonjs/credential/trustmark/get-credential-trustmark.js +86 -0
  61. package/lib/commonjs/credential/trustmark/get-credential-trustmark.js.map +1 -0
  62. package/lib/commonjs/credential/trustmark/index.js +13 -0
  63. package/lib/commonjs/credential/trustmark/index.js.map +1 -0
  64. package/lib/commonjs/index.js +5 -1
  65. package/lib/commonjs/index.js.map +1 -1
  66. package/lib/commonjs/pid/sd-jwt/types.js +18 -2
  67. package/lib/commonjs/pid/sd-jwt/types.js.map +1 -1
  68. package/lib/commonjs/sd-jwt/__test__/index.test.js +22 -34
  69. package/lib/commonjs/sd-jwt/__test__/index.test.js.map +1 -1
  70. package/lib/commonjs/sd-jwt/__test__/types.test.js +11 -23
  71. package/lib/commonjs/sd-jwt/__test__/types.test.js.map +1 -1
  72. package/lib/commonjs/sd-jwt/index.js +1 -7
  73. package/lib/commonjs/sd-jwt/index.js.map +1 -1
  74. package/lib/commonjs/sd-jwt/types.js +5 -21
  75. package/lib/commonjs/sd-jwt/types.js.map +1 -1
  76. package/lib/commonjs/{entity/trust → trust}/chain.js +49 -55
  77. package/lib/commonjs/trust/chain.js.map +1 -0
  78. package/lib/commonjs/trust/errors.js +110 -0
  79. package/lib/commonjs/trust/errors.js.map +1 -0
  80. package/lib/commonjs/trust/index.js +282 -0
  81. package/lib/commonjs/trust/index.js.map +1 -0
  82. package/lib/commonjs/{entity/trust → trust}/types.js +27 -47
  83. package/lib/commonjs/trust/types.js.map +1 -0
  84. package/lib/commonjs/trust/utils.js +41 -0
  85. package/lib/commonjs/trust/utils.js.map +1 -0
  86. package/lib/commonjs/utils/crypto.js +5 -112
  87. package/lib/commonjs/utils/crypto.js.map +1 -1
  88. package/lib/commonjs/utils/decoder.js +2 -0
  89. package/lib/commonjs/utils/decoder.js.map +1 -1
  90. package/lib/commonjs/utils/error-codes.js +22 -2
  91. package/lib/commonjs/utils/error-codes.js.map +1 -1
  92. package/lib/commonjs/utils/errors.js +72 -4
  93. package/lib/commonjs/utils/errors.js.map +1 -1
  94. package/lib/commonjs/utils/logging.js +68 -0
  95. package/lib/commonjs/utils/logging.js.map +1 -0
  96. package/lib/commonjs/utils/misc.js +2 -0
  97. package/lib/commonjs/utils/misc.js.map +1 -1
  98. package/lib/commonjs/utils/par.js +17 -10
  99. package/lib/commonjs/utils/par.js.map +1 -1
  100. package/lib/commonjs/utils/string.js +1 -12
  101. package/lib/commonjs/utils/string.js.map +1 -1
  102. package/lib/commonjs/wallet-instance/index.js +14 -0
  103. package/lib/commonjs/wallet-instance/index.js.map +1 -1
  104. package/lib/commonjs/wallet-instance-attestation/README.md +8 -3
  105. package/lib/commonjs/wallet-instance-attestation/issuing.js +15 -8
  106. package/lib/commonjs/wallet-instance-attestation/issuing.js.map +1 -1
  107. package/lib/commonjs/wallet-instance-attestation/types.js +16 -20
  108. package/lib/commonjs/wallet-instance-attestation/types.js.map +1 -1
  109. package/lib/module/client/generated/wallet-provider.js +40 -15
  110. package/lib/module/client/generated/wallet-provider.js.map +1 -1
  111. package/lib/module/credential/index.js +3 -1
  112. package/lib/module/credential/index.js.map +1 -1
  113. package/lib/module/credential/issuance/02-evaluate-issuer-trust.js +20 -0
  114. package/lib/module/credential/issuance/02-evaluate-issuer-trust.js.map +1 -0
  115. package/lib/module/credential/issuance/03-start-user-authorization.js +25 -16
  116. package/lib/module/credential/issuance/03-start-user-authorization.js.map +1 -1
  117. package/lib/module/credential/issuance/04-complete-user-authorization.js +30 -18
  118. package/lib/module/credential/issuance/04-complete-user-authorization.js.map +1 -1
  119. package/lib/module/credential/issuance/05-authorize-access.js +17 -11
  120. package/lib/module/credential/issuance/05-authorize-access.js.map +1 -1
  121. package/lib/module/credential/issuance/06-obtain-credential.js +36 -28
  122. package/lib/module/credential/issuance/06-obtain-credential.js.map +1 -1
  123. package/lib/module/credential/issuance/07-verify-and-parse-credential.js +27 -205
  124. package/lib/module/credential/issuance/07-verify-and-parse-credential.js.map +1 -1
  125. package/lib/module/credential/issuance/README.md +23 -20
  126. package/lib/module/credential/issuance/const.js +1 -1
  127. package/lib/module/credential/issuance/const.js.map +1 -1
  128. package/lib/module/credential/issuance/index.js +2 -2
  129. package/lib/module/credential/issuance/index.js.map +1 -1
  130. package/lib/module/credential/presentation/01-start-flow.js +14 -15
  131. package/lib/module/credential/presentation/01-start-flow.js.map +1 -1
  132. package/lib/module/credential/presentation/02-evaluate-rp-trust.js +5 -3
  133. package/lib/module/credential/presentation/02-evaluate-rp-trust.js.map +1 -1
  134. package/lib/module/credential/presentation/03-get-request-object.js +34 -7
  135. package/lib/module/credential/presentation/03-get-request-object.js.map +1 -1
  136. package/lib/module/credential/presentation/04-retrieve-rp-jwks.js +2 -124
  137. package/lib/module/credential/presentation/04-retrieve-rp-jwks.js.map +1 -1
  138. package/lib/module/credential/presentation/05-verify-request-object.js +78 -23
  139. package/lib/module/credential/presentation/05-verify-request-object.js.map +1 -1
  140. package/lib/module/credential/presentation/06-fetch-presentation-definition.js +6 -30
  141. package/lib/module/credential/presentation/06-fetch-presentation-definition.js.map +1 -1
  142. package/lib/module/credential/presentation/07-evaluate-dcql-query.js +97 -118
  143. package/lib/module/credential/presentation/07-evaluate-dcql-query.js.map +1 -1
  144. package/lib/module/credential/presentation/07-evaluate-input-descriptor.js +83 -186
  145. package/lib/module/credential/presentation/07-evaluate-input-descriptor.js.map +1 -1
  146. package/lib/module/credential/presentation/08-send-authorization-response.js +107 -170
  147. package/lib/module/credential/presentation/08-send-authorization-response.js.map +1 -1
  148. package/lib/module/credential/presentation/README.md +74 -79
  149. package/lib/module/credential/presentation/errors.js +30 -17
  150. package/lib/module/credential/presentation/errors.js.map +1 -1
  151. package/lib/module/credential/presentation/index.js +6 -6
  152. package/lib/module/credential/presentation/index.js.map +1 -1
  153. package/lib/module/credential/presentation/types.js +49 -27
  154. package/lib/module/credential/presentation/types.js.map +1 -1
  155. package/lib/module/credential/status/01-start-flow.js +2 -0
  156. package/lib/module/credential/status/01-start-flow.js.map +1 -0
  157. package/lib/module/credential/status/02-status-attestation.js +66 -0
  158. package/lib/module/credential/status/02-status-attestation.js.map +1 -0
  159. package/lib/module/credential/status/03-verify-and-parse-status-attestation.js +49 -0
  160. package/lib/module/credential/status/03-verify-and-parse-status-attestation.js.map +1 -0
  161. package/lib/module/credential/status/README.md +67 -0
  162. package/lib/module/credential/status/index.js +5 -0
  163. package/lib/module/credential/status/index.js.map +1 -0
  164. package/lib/module/credential/status/types.js +40 -0
  165. package/lib/module/credential/status/types.js.map +1 -0
  166. package/lib/module/credential/trustmark/README.md +62 -0
  167. package/lib/module/credential/trustmark/get-credential-trustmark.js +77 -0
  168. package/lib/module/credential/trustmark/get-credential-trustmark.js.map +1 -0
  169. package/lib/module/credential/trustmark/index.js +3 -0
  170. package/lib/module/credential/trustmark/index.js.map +1 -0
  171. package/lib/module/index.js +3 -1
  172. package/lib/module/index.js.map +1 -1
  173. package/lib/module/pid/sd-jwt/types.js +16 -1
  174. package/lib/module/pid/sd-jwt/types.js.map +1 -1
  175. package/lib/module/sd-jwt/__test__/index.test.js +22 -34
  176. package/lib/module/sd-jwt/__test__/index.test.js.map +1 -1
  177. package/lib/module/sd-jwt/__test__/types.test.js +11 -23
  178. package/lib/module/sd-jwt/__test__/types.test.js.map +1 -1
  179. package/lib/module/sd-jwt/index.js +1 -7
  180. package/lib/module/sd-jwt/index.js.map +1 -1
  181. package/lib/module/sd-jwt/types.js +4 -19
  182. package/lib/module/sd-jwt/types.js.map +1 -1
  183. package/lib/module/trust/chain.js +108 -0
  184. package/lib/module/trust/chain.js.map +1 -0
  185. package/lib/module/trust/errors.js +94 -0
  186. package/lib/module/trust/errors.js.map +1 -0
  187. package/lib/module/trust/index.js +263 -0
  188. package/lib/module/trust/index.js.map +1 -0
  189. package/lib/module/{entity/trust → trust}/types.js +25 -46
  190. package/lib/module/trust/types.js.map +1 -0
  191. package/lib/module/trust/utils.js +33 -0
  192. package/lib/module/trust/utils.js.map +1 -0
  193. package/lib/module/utils/crypto.js +4 -107
  194. package/lib/module/utils/crypto.js.map +1 -1
  195. package/lib/module/utils/decoder.js +3 -0
  196. package/lib/module/utils/decoder.js.map +1 -1
  197. package/lib/module/utils/error-codes.js +20 -1
  198. package/lib/module/utils/error-codes.js.map +1 -1
  199. package/lib/module/utils/errors.js +61 -4
  200. package/lib/module/utils/errors.js.map +1 -1
  201. package/lib/module/utils/logging.js +62 -0
  202. package/lib/module/utils/logging.js.map +1 -0
  203. package/lib/module/utils/misc.js +2 -0
  204. package/lib/module/utils/misc.js.map +1 -1
  205. package/lib/module/utils/par.js +17 -9
  206. package/lib/module/utils/par.js.map +1 -1
  207. package/lib/module/utils/string.js +0 -10
  208. package/lib/module/utils/string.js.map +1 -1
  209. package/lib/module/wallet-instance/index.js +13 -0
  210. package/lib/module/wallet-instance/index.js.map +1 -1
  211. package/lib/module/wallet-instance-attestation/README.md +8 -3
  212. package/lib/module/wallet-instance-attestation/index.js +2 -2
  213. package/lib/module/wallet-instance-attestation/index.js.map +1 -1
  214. package/lib/module/wallet-instance-attestation/issuing.js +16 -9
  215. package/lib/module/wallet-instance-attestation/issuing.js.map +1 -1
  216. package/lib/module/wallet-instance-attestation/types.js +14 -18
  217. package/lib/module/wallet-instance-attestation/types.js.map +1 -1
  218. package/lib/typescript/client/generated/wallet-provider.d.ts +206 -51
  219. package/lib/typescript/client/generated/wallet-provider.d.ts.map +1 -1
  220. package/lib/typescript/credential/index.d.ts +3 -1
  221. package/lib/typescript/credential/index.d.ts.map +1 -1
  222. package/lib/typescript/credential/issuance/01-start-flow.d.ts +1 -1
  223. package/lib/typescript/credential/issuance/02-evaluate-issuer-trust.d.ts +19 -0
  224. package/lib/typescript/credential/issuance/02-evaluate-issuer-trust.d.ts.map +1 -0
  225. package/lib/typescript/credential/issuance/03-start-user-authorization.d.ts +3 -3
  226. package/lib/typescript/credential/issuance/03-start-user-authorization.d.ts.map +1 -1
  227. package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts +9 -9
  228. package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts.map +1 -1
  229. package/lib/typescript/credential/issuance/05-authorize-access.d.ts +3 -3
  230. package/lib/typescript/credential/issuance/05-authorize-access.d.ts.map +1 -1
  231. package/lib/typescript/credential/issuance/06-obtain-credential.d.ts +4 -4
  232. package/lib/typescript/credential/issuance/06-obtain-credential.d.ts.map +1 -1
  233. package/lib/typescript/credential/issuance/07-verify-and-parse-credential.d.ts +3 -15
  234. package/lib/typescript/credential/issuance/07-verify-and-parse-credential.d.ts.map +1 -1
  235. package/lib/typescript/credential/issuance/const.d.ts +1 -1
  236. package/lib/typescript/credential/issuance/const.d.ts.map +1 -1
  237. package/lib/typescript/credential/issuance/index.d.ts +3 -3
  238. package/lib/typescript/credential/issuance/index.d.ts.map +1 -1
  239. package/lib/typescript/credential/issuance/types.d.ts +8 -3
  240. package/lib/typescript/credential/issuance/types.d.ts.map +1 -1
  241. package/lib/typescript/credential/presentation/01-start-flow.d.ts +28 -9
  242. package/lib/typescript/credential/presentation/01-start-flow.d.ts.map +1 -1
  243. package/lib/typescript/credential/presentation/02-evaluate-rp-trust.d.ts +2 -1
  244. package/lib/typescript/credential/presentation/02-evaluate-rp-trust.d.ts.map +1 -1
  245. package/lib/typescript/credential/presentation/03-get-request-object.d.ts +7 -5
  246. package/lib/typescript/credential/presentation/03-get-request-object.d.ts.map +1 -1
  247. package/lib/typescript/credential/presentation/04-retrieve-rp-jwks.d.ts +4 -30
  248. package/lib/typescript/credential/presentation/04-retrieve-rp-jwks.d.ts.map +1 -1
  249. package/lib/typescript/credential/presentation/05-verify-request-object.d.ts +17 -4
  250. package/lib/typescript/credential/presentation/05-verify-request-object.d.ts.map +1 -1
  251. package/lib/typescript/credential/presentation/06-fetch-presentation-definition.d.ts +4 -9
  252. package/lib/typescript/credential/presentation/06-fetch-presentation-definition.d.ts.map +1 -1
  253. package/lib/typescript/credential/presentation/07-evaluate-dcql-query.d.ts +13 -12
  254. package/lib/typescript/credential/presentation/07-evaluate-dcql-query.d.ts.map +1 -1
  255. package/lib/typescript/credential/presentation/07-evaluate-input-descriptor.d.ts +40 -42
  256. package/lib/typescript/credential/presentation/07-evaluate-input-descriptor.d.ts.map +1 -1
  257. package/lib/typescript/credential/presentation/08-send-authorization-response.d.ts +30 -43
  258. package/lib/typescript/credential/presentation/08-send-authorization-response.d.ts.map +1 -1
  259. package/lib/typescript/credential/presentation/errors.d.ts +25 -10
  260. package/lib/typescript/credential/presentation/errors.d.ts.map +1 -1
  261. package/lib/typescript/credential/presentation/index.d.ts +7 -8
  262. package/lib/typescript/credential/presentation/index.d.ts.map +1 -1
  263. package/lib/typescript/credential/presentation/types.d.ts +137 -307
  264. package/lib/typescript/credential/presentation/types.d.ts.map +1 -1
  265. package/lib/typescript/credential/status/01-start-flow.d.ts +10 -0
  266. package/lib/typescript/credential/status/01-start-flow.d.ts.map +1 -0
  267. package/lib/typescript/credential/status/02-status-attestation.d.ts +19 -0
  268. package/lib/typescript/credential/status/02-status-attestation.d.ts.map +1 -0
  269. package/lib/typescript/credential/status/03-verify-and-parse-status-attestation.d.ts +24 -0
  270. package/lib/typescript/credential/status/03-verify-and-parse-status-attestation.d.ts.map +1 -0
  271. package/lib/typescript/credential/status/index.d.ts +7 -0
  272. package/lib/typescript/credential/status/index.d.ts.map +1 -0
  273. package/lib/typescript/credential/status/types.d.ts +305 -0
  274. package/lib/typescript/credential/status/types.d.ts.map +1 -0
  275. package/lib/typescript/credential/trustmark/get-credential-trustmark.d.ts +52 -0
  276. package/lib/typescript/credential/trustmark/get-credential-trustmark.d.ts.map +1 -0
  277. package/lib/typescript/credential/trustmark/index.d.ts +4 -0
  278. package/lib/typescript/credential/trustmark/index.d.ts.map +1 -0
  279. package/lib/typescript/index.d.ts +3 -1
  280. package/lib/typescript/index.d.ts.map +1 -1
  281. package/lib/typescript/pid/sd-jwt/types.d.ts +103 -25
  282. package/lib/typescript/pid/sd-jwt/types.d.ts.map +1 -1
  283. package/lib/typescript/sd-jwt/index.d.ts +30 -82
  284. package/lib/typescript/sd-jwt/index.d.ts.map +1 -1
  285. package/lib/typescript/sd-jwt/types.d.ts +29 -134
  286. package/lib/typescript/sd-jwt/types.d.ts.map +1 -1
  287. package/lib/typescript/{entity/trust → trust}/chain.d.ts +5 -10
  288. package/lib/typescript/trust/chain.d.ts.map +1 -0
  289. package/lib/typescript/trust/errors.d.ts +80 -0
  290. package/lib/typescript/trust/errors.d.ts.map +1 -0
  291. package/lib/typescript/{entity/trust → trust}/index.d.ts +211 -186
  292. package/lib/typescript/trust/index.d.ts.map +1 -0
  293. package/lib/typescript/{entity/trust → trust}/types.d.ts +1533 -1120
  294. package/lib/typescript/{entity/trust → trust}/types.d.ts.map +1 -1
  295. package/lib/typescript/trust/utils.d.ts +12 -0
  296. package/lib/typescript/trust/utils.d.ts.map +1 -0
  297. package/lib/typescript/utils/crypto.d.ts +0 -32
  298. package/lib/typescript/utils/crypto.d.ts.map +1 -1
  299. package/lib/typescript/utils/decoder.d.ts.map +1 -1
  300. package/lib/typescript/utils/error-codes.d.ts +20 -0
  301. package/lib/typescript/utils/error-codes.d.ts.map +1 -1
  302. package/lib/typescript/utils/errors.d.ts +55 -10
  303. package/lib/typescript/utils/errors.d.ts.map +1 -1
  304. package/lib/typescript/utils/logging.d.ts +35 -0
  305. package/lib/typescript/utils/logging.d.ts.map +1 -0
  306. package/lib/typescript/utils/misc.d.ts.map +1 -1
  307. package/lib/typescript/utils/par.d.ts +8 -1
  308. package/lib/typescript/utils/par.d.ts.map +1 -1
  309. package/lib/typescript/utils/string.d.ts +0 -7
  310. package/lib/typescript/utils/string.d.ts.map +1 -1
  311. package/lib/typescript/wallet-instance/index.d.ts +8 -0
  312. package/lib/typescript/wallet-instance/index.d.ts.map +1 -1
  313. package/lib/typescript/wallet-instance-attestation/index.d.ts +1 -2
  314. package/lib/typescript/wallet-instance-attestation/index.d.ts.map +1 -1
  315. package/lib/typescript/wallet-instance-attestation/issuing.d.ts +4 -2
  316. package/lib/typescript/wallet-instance-attestation/issuing.d.ts.map +1 -1
  317. package/lib/typescript/wallet-instance-attestation/types.d.ts +78 -120
  318. package/lib/typescript/wallet-instance-attestation/types.d.ts.map +1 -1
  319. package/package.json +8 -9
  320. package/src/client/generated/wallet-provider.ts +52 -17
  321. package/src/credential/index.ts +4 -1
  322. package/src/credential/issuance/01-start-flow.ts +1 -1
  323. package/src/credential/issuance/02-evaluate-issuer-trust.ts +32 -0
  324. package/src/credential/issuance/03-start-user-authorization.ts +48 -22
  325. package/src/credential/issuance/04-complete-user-authorization.ts +74 -18
  326. package/src/credential/issuance/05-authorize-access.ts +29 -11
  327. package/src/credential/issuance/06-obtain-credential.ts +61 -36
  328. package/src/credential/issuance/07-verify-and-parse-credential.ts +37 -264
  329. package/src/credential/issuance/README.md +23 -20
  330. package/src/credential/issuance/const.ts +1 -1
  331. package/src/credential/issuance/index.ts +6 -3
  332. package/src/credential/presentation/01-start-flow.ts +19 -22
  333. package/src/credential/presentation/02-evaluate-rp-trust.ts +5 -4
  334. package/src/credential/presentation/03-get-request-object.ts +36 -8
  335. package/src/credential/presentation/04-retrieve-rp-jwks.ts +6 -148
  336. package/src/credential/presentation/05-verify-request-object.ts +115 -30
  337. package/src/credential/presentation/06-fetch-presentation-definition.ts +5 -35
  338. package/src/credential/presentation/07-evaluate-dcql-query.ts +132 -161
  339. package/src/credential/presentation/07-evaluate-input-descriptor.ts +136 -254
  340. package/src/credential/presentation/08-send-authorization-response.ts +178 -260
  341. package/src/credential/presentation/README.md +74 -79
  342. package/src/credential/presentation/errors.ts +38 -15
  343. package/src/credential/presentation/index.ts +18 -19
  344. package/src/credential/presentation/types.ts +67 -64
  345. package/src/credential/status/01-start-flow.ts +9 -0
  346. package/src/credential/status/02-status-attestation.ts +105 -0
  347. package/src/credential/status/03-verify-and-parse-status-attestation.ts +70 -0
  348. package/src/credential/status/README.md +67 -0
  349. package/src/credential/status/index.ts +22 -0
  350. package/src/credential/status/types.ts +43 -0
  351. package/src/credential/trustmark/README.md +62 -0
  352. package/src/credential/trustmark/get-credential-trustmark.ts +139 -0
  353. package/src/credential/trustmark/index.ts +8 -0
  354. package/src/index.ts +4 -0
  355. package/src/pid/sd-jwt/types.ts +18 -1
  356. package/src/sd-jwt/__test__/index.test.ts +36 -55
  357. package/src/sd-jwt/__test__/types.test.ts +16 -29
  358. package/src/sd-jwt/index.ts +1 -5
  359. package/src/sd-jwt/types.ts +2 -19
  360. package/src/trust/chain.ts +151 -0
  361. package/src/trust/errors.ts +105 -0
  362. package/src/{entity/trust → trust}/index.ts +198 -23
  363. package/src/{entity/trust → trust}/types.ts +24 -37
  364. package/src/trust/utils.ts +35 -0
  365. package/src/utils/crypto.ts +4 -106
  366. package/src/utils/decoder.ts +6 -1
  367. package/src/utils/error-codes.ts +23 -0
  368. package/src/utils/errors.ts +119 -15
  369. package/src/utils/logging.ts +68 -0
  370. package/src/utils/misc.ts +5 -0
  371. package/src/utils/par.ts +19 -6
  372. package/src/utils/string.ts +0 -10
  373. package/src/wallet-instance/index.ts +30 -1
  374. package/src/wallet-instance-attestation/README.md +8 -3
  375. package/src/wallet-instance-attestation/index.ts +2 -2
  376. package/src/wallet-instance-attestation/issuing.ts +33 -12
  377. package/src/wallet-instance-attestation/types.ts +18 -22
  378. package/lib/commonjs/credential/issuance/02-get-issuer-config.js +0 -48
  379. package/lib/commonjs/credential/issuance/02-get-issuer-config.js.map +0 -1
  380. package/lib/commonjs/entity/openid-connect/issuer/index.js +0 -25
  381. package/lib/commonjs/entity/openid-connect/issuer/index.js.map +0 -1
  382. package/lib/commonjs/entity/openid-connect/issuer/types.js +0 -64
  383. package/lib/commonjs/entity/openid-connect/issuer/types.js.map +0 -1
  384. package/lib/commonjs/entity/trust/chain.js.map +0 -1
  385. package/lib/commonjs/entity/trust/index.js +0 -148
  386. package/lib/commonjs/entity/trust/index.js.map +0 -1
  387. package/lib/commonjs/entity/trust/types.js.map +0 -1
  388. package/lib/commonjs/mdoc/converters.js +0 -26
  389. package/lib/commonjs/mdoc/converters.js.map +0 -1
  390. package/lib/commonjs/mdoc/index.js +0 -68
  391. package/lib/commonjs/mdoc/index.js.map +0 -1
  392. package/lib/commonjs/utils/credential/issuance/07-verify-and-parse-credentials-inputs.js +0 -469
  393. package/lib/commonjs/utils/credential/issuance/07-verify-and-parse-credentials-inputs.js.map +0 -1
  394. package/lib/commonjs/utils/credential/issuance/07-verify-and-parse-credentials-utils.js +0 -90
  395. package/lib/commonjs/utils/credential/issuance/07-verify-and-parse-credentials-utils.js.map +0 -1
  396. package/lib/module/credential/issuance/02-get-issuer-config.js +0 -42
  397. package/lib/module/credential/issuance/02-get-issuer-config.js.map +0 -1
  398. package/lib/module/entity/openid-connect/issuer/index.js +0 -20
  399. package/lib/module/entity/openid-connect/issuer/index.js.map +0 -1
  400. package/lib/module/entity/openid-connect/issuer/types.js +0 -48
  401. package/lib/module/entity/openid-connect/issuer/types.js.map +0 -1
  402. package/lib/module/entity/trust/chain.js +0 -113
  403. package/lib/module/entity/trust/chain.js.map +0 -1
  404. package/lib/module/entity/trust/index.js +0 -131
  405. package/lib/module/entity/trust/index.js.map +0 -1
  406. package/lib/module/entity/trust/types.js.map +0 -1
  407. package/lib/module/mdoc/converters.js +0 -20
  408. package/lib/module/mdoc/converters.js.map +0 -1
  409. package/lib/module/mdoc/index.js +0 -60
  410. package/lib/module/mdoc/index.js.map +0 -1
  411. package/lib/module/utils/credential/issuance/07-verify-and-parse-credentials-inputs.js +0 -462
  412. package/lib/module/utils/credential/issuance/07-verify-and-parse-credentials-inputs.js.map +0 -1
  413. package/lib/module/utils/credential/issuance/07-verify-and-parse-credentials-utils.js +0 -83
  414. package/lib/module/utils/credential/issuance/07-verify-and-parse-credentials-utils.js.map +0 -1
  415. package/lib/typescript/credential/issuance/02-get-issuer-config.d.ts +0 -32
  416. package/lib/typescript/credential/issuance/02-get-issuer-config.d.ts.map +0 -1
  417. package/lib/typescript/entity/openid-connect/issuer/index.d.ts +0 -12
  418. package/lib/typescript/entity/openid-connect/issuer/index.d.ts.map +0 -1
  419. package/lib/typescript/entity/openid-connect/issuer/types.d.ts +0 -777
  420. package/lib/typescript/entity/openid-connect/issuer/types.d.ts.map +0 -1
  421. package/lib/typescript/entity/trust/chain.d.ts.map +0 -1
  422. package/lib/typescript/entity/trust/index.d.ts.map +0 -1
  423. package/lib/typescript/mdoc/converters.d.ts +0 -8
  424. package/lib/typescript/mdoc/converters.d.ts.map +0 -1
  425. package/lib/typescript/mdoc/index.d.ts +0 -10
  426. package/lib/typescript/mdoc/index.d.ts.map +0 -1
  427. package/lib/typescript/utils/credential/issuance/07-verify-and-parse-credentials-inputs.d.ts +0 -3
  428. package/lib/typescript/utils/credential/issuance/07-verify-and-parse-credentials-inputs.d.ts.map +0 -1
  429. package/lib/typescript/utils/credential/issuance/07-verify-and-parse-credentials-utils.d.ts +0 -42
  430. package/lib/typescript/utils/credential/issuance/07-verify-and-parse-credentials-utils.d.ts.map +0 -1
  431. package/src/credential/issuance/02-get-issuer-config.ts +0 -67
  432. package/src/entity/openid-connect/issuer/index.ts +0 -27
  433. package/src/entity/openid-connect/issuer/types.ts +0 -76
  434. package/src/entity/trust/chain.ts +0 -154
  435. package/src/mdoc/converters.ts +0 -26
  436. package/src/mdoc/index.ts +0 -95
  437. package/src/utils/credential/issuance/07-verify-and-parse-credentials-inputs.ts +0 -615
  438. package/src/utils/credential/issuance/07-verify-and-parse-credentials-utils.ts +0 -171
@@ -1,10 +1,7 @@
1
1
  import { getPublicKey, sign, generate, deleteKey } from "@pagopa/io-react-native-crypto";
2
- import uuid from "react-native-uuid";
2
+ import { v4 as uuidv4 } from "uuid";
3
3
  import { thumbprint } from "@pagopa/io-react-native-jwt";
4
- import { X509, KEYUTIL, RSAKey, KJUR } from "jsrsasign";
5
- import { JWK } from "./jwk";
6
- import { removePadding } from "@pagopa/io-react-native-jwt";
7
- import { Buffer } from "buffer";
4
+ import { fixBase64EncodingOnKey } from "./jwk";
8
5
 
9
6
  /**
10
7
  * Create a CryptoContext bound to a key pair.
@@ -21,7 +18,7 @@ export const createCryptoContextFor = keytag => {
21
18
  * @returns The public key.
22
19
  */
23
20
  async getPublicKey() {
24
- return getPublicKey(keytag).then(fixBase64WithLeadingZero).then(async jwk => ({
21
+ return getPublicKey(keytag).then(fixBase64EncodingOnKey).then(async jwk => ({
25
22
  ...jwk,
26
23
  // Keys in the TEE are not stored with their KID, which is supposed to be assigned when they are included in JWK sets.
27
24
  // (that is, KID is not a propoerty of the key itself, but it's property used to identify a key in a set).
@@ -42,58 +39,6 @@ export const createCryptoContextFor = keytag => {
42
39
  };
43
40
  };
44
41
 
45
- /**
46
- * This function takes a JSON Web Key (JWK) and returns a new JWK with its base64-url properties (x, y, e, n) processed.
47
- * Each property is passed through the `removeLeadingZeroAndParseb64u` function if it exists, which fixes any unwanted leading zeros.
48
- *
49
- * @param key - The input JSON Web Key that may contain properties with potential leading zero issues.
50
- * @returns A new JSON Web Key with the processed properties.
51
- */
52
- const fixBase64WithLeadingZero = key => {
53
- const {
54
- x,
55
- y,
56
- e,
57
- n,
58
- ...pk
59
- } = key;
60
- return {
61
- ...pk,
62
- ...(x ? {
63
- x: removeLeadingZeroAndParseb64u(x)
64
- } : {}),
65
- ...(y ? {
66
- y: removeLeadingZeroAndParseb64u(y)
67
- } : {}),
68
- ...(e ? {
69
- e: removeLeadingZeroAndParseb64u(e)
70
- } : {}),
71
- ...(n ? {
72
- n: removeLeadingZeroAndParseb64u(n)
73
- } : {})
74
- };
75
- };
76
-
77
- /**
78
- * This function processes a base64-encoded string to remove any unwanted leading zeros.
79
- * It converts the input base64 string into a buffer, then to a hex string, checks for a leading "00",
80
- * and removes it if present. The result is then converted back to a base64-url.
81
- *
82
- * @param input - The base64 encoded string to process.
83
- * @returns A new base64-url encoded string with any leading zero removed.
84
- */
85
- const removeLeadingZeroAndParseb64u = input => {
86
- // Decode base64 input into a Buffer
87
- const buffer = Buffer.from(input, "base64");
88
- const hex = buffer.toString("hex");
89
- // If the hex string starts with "00", remove the first two characters
90
- const fixedHex = hex.startsWith("00") ? hex.slice(2) : hex;
91
- const newBuffer = Buffer.from(fixedHex, "hex");
92
-
93
- // removePadding convert base64 string to base64-url
94
- return removePadding(newBuffer.toString("base64"));
95
- };
96
-
97
42
  /**
98
43
  * Executes the input function injecting an ephemeral crypto context.
99
44
  * An ephemeral crypto context is a context which is bound to a key
@@ -104,57 +49,9 @@ const removeLeadingZeroAndParseb64u = input => {
104
49
  */
105
50
  export const withEphemeralKey = async fn => {
106
51
  // Use an ephemeral key to be destroyed after use
107
- const keytag = `ephemeral-${uuid.v4()}`;
52
+ const keytag = `ephemeral-${uuidv4()}`;
108
53
  await generate(keytag);
109
54
  const ephemeralContext = createCryptoContextFor(keytag);
110
55
  return fn(ephemeralContext).finally(() => deleteKey(keytag));
111
56
  };
112
-
113
- /**
114
- * Converts a certificate string to PEM format.
115
- *
116
- * @param certificate - The certificate string.
117
- * @returns The PEM-formatted certificate.
118
- */
119
- export const convertCertToPem = certificate => `-----BEGIN CERTIFICATE-----\n${certificate}\n-----END CERTIFICATE-----`;
120
-
121
- /**
122
- * Parses the public key from a PEM-formatted certificate.
123
- *
124
- * @param pemCert - The PEM-formatted certificate.
125
- * @returns The public key object.
126
- * @throws Will throw an error if the public key is unsupported.
127
- */
128
- export const parsePublicKey = pemCert => {
129
- const x509 = new X509();
130
- x509.readCertPEM(pemCert);
131
- const publicKey = x509.getPublicKey();
132
- if (publicKey instanceof RSAKey || publicKey instanceof KJUR.crypto.ECDSA) {
133
- return publicKey;
134
- }
135
- return undefined;
136
- };
137
-
138
- /**
139
- * Retrieves the signing JWK from the public key.
140
- *
141
- * @param publicKey - The public key object.
142
- * @returns The signing JWK.
143
- */
144
- export const getSigningJwk = publicKey => ({
145
- ...JWK.parse(KEYUTIL.getJWKFromKey(publicKey)),
146
- use: "sig"
147
- });
148
-
149
- /**
150
- * This function takes two {@link PublicKey} and evaluates and compares their thumbprints
151
- * @param key1 The first key
152
- * @param key2 The second key
153
- * @returns true if the keys' thumbprints are equal, false otherwise
154
- */
155
- export const compareKeysByThumbprint = async (key1, key2) => {
156
- //Parallel for optimization
157
- const [thumbprint1, thumbprint2] = await Promise.all([thumbprint(key1), thumbprint(key2)]);
158
- return thumbprint1 === thumbprint2;
159
- };
160
57
  //# sourceMappingURL=crypto.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["getPublicKey","sign","generate","deleteKey","uuid","thumbprint","X509","KEYUTIL","RSAKey","KJUR","JWK","removePadding","Buffer","createCryptoContextFor","keytag","then","fixBase64WithLeadingZero","jwk","kid","getSignature","value","key","x","y","e","n","pk","removeLeadingZeroAndParseb64u","input","buffer","from","hex","toString","fixedHex","startsWith","slice","newBuffer","withEphemeralKey","fn","v4","ephemeralContext","finally","convertCertToPem","certificate","parsePublicKey","pemCert","x509","readCertPEM","publicKey","crypto","ECDSA","undefined","getSigningJwk","parse","getJWKFromKey","use","compareKeysByThumbprint","key1","key2","thumbprint1","thumbprint2","Promise","all"],"sourceRoot":"../../../src","sources":["utils/crypto.ts"],"mappings":"AAAA,SACEA,YAAY,EACZC,IAAI,EACJC,QAAQ,EACRC,SAAS,QAEJ,gCAAgC;AACvC,OAAOC,IAAI,MAAM,mBAAmB;AACpC,SAASC,UAAU,QAA4B,6BAA6B;AAC5E,SAASC,IAAI,EAAEC,OAAO,EAAEC,MAAM,EAAEC,IAAI,QAAQ,WAAW;AACvD,SAASC,GAAG,QAAQ,OAAO;AAC3B,SAASC,aAAa,QAAQ,6BAA6B;AAC3D,SAASC,MAAM,QAAQ,QAAQ;;AAE/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,sBAAsB,GAAIC,MAAc,IAAoB;EACvE,OAAO;IACL;AACJ;AACA;AACA;AACA;IACI,MAAMd,YAAYA,CAAA,EAAG;MACnB,OAAOA,YAAY,CAACc,MAAM,CAAC,CACxBC,I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2C,KAAK,CAAC9C,OAAO,CAAC+C,aAAa,CAACN,SAAS,CAAC,CAAC;EAC9CO,GAAG,EAAE;AACP,CAAC,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,uBAAuB,GAAG,MAAAA,CACrCC,IAAe,EACfC,IAAe,KACZ;EACH;EACA,MAAM,CAACC,WAAW,EAAEC,WAAW,CAAC,GAAG,MAAMC,OAAO,CAACC,GAAG,CAAC,CACnDzD,UAAU,CAACoD,IAAI,CAAC,EAChBpD,UAAU,CAACqD,IAAI,CAAC,CACjB,CAAC;EACF,OAAOC,WAAW,KAAKC,WAAW;AACpC,CAAC"}
1
+ {"version":3,"names":["getPublicKey","sign","generate","deleteKey","v4","uuidv4","thumbprint","fixBase64EncodingOnKey","createCryptoContextFor","keytag","then","jwk","kid","getSignature","value","withEphemeralKey","fn","ephemeralContext","finally"],"sourceRoot":"../../../src","sources":["utils/crypto.ts"],"mappings":"AAAA,SACEA,YAAY,EACZC,IAAI,EACJC,QAAQ,EACRC,SAAS,QACJ,gCAAgC;AACvC,SAASC,EAAE,IAAIC,MAAM,QAAQ,MAAM;AACnC,SAASC,UAAU,QAA4B,6BAA6B;AAC5E,SAASC,sBAAsB,QAAQ,OAAO;;AAE9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,sBAAsB,GAAIC,MAAc,IAAoB;EACvE,OAAO;IACL;AACJ;AACA;AACA;AACA;IACI,MAAMT,YAAYA,CAAA,EAAG;MACnB,OAAOA,YAAY,CAACS,MAAM,CAAC,CACxBC,IAAI,CAACH,sBAAsB,CAAC,CAC5BG,IAAI,CAAC,MAAOC,GAAG,KAAM;QACpB,GAAGA,GAAG;QACN;QACA;QACA;QACA;QACAC,GAAG,EAAE,MAAMN,UAAU,CAACK,GAAG;MAC3B,CAAC,CAAC,CAAC;IACP,CAAC;IACD;AACJ;AACA;AACA;AACA;AACA;IACI,MAAME,YAAYA,CAACC,KAAa,EAAE;MAChC,OAAOb,IAAI,CAACa,KAAK,EAAEL,MAAM,CAAC;IAC5B;EACF,CAAC;AACH,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMM,gBAAgB,GAAG,MAC9BC,EAAmD,IACpC;EACf;EACA,MAAMP,MAAM,GAAI,aAAYJ,MAAM,CAAC,CAAE,EAAC;EACtC,MAAMH,QAAQ,CAACO,MAAM,CAAC;EACtB,MAAMQ,gBAAgB,GAAGT,sBAAsB,CAACC,MAAM,CAAC;EACvD,OAAOO,EAAE,CAACC,gBAAgB,CAAC,CAACC,OAAO,CAAC,MAAMf,SAAS,CAACM,MAAM,CAAC,CAAC;AAC9D,CAAC"}
@@ -1,5 +1,7 @@
1
1
  import { decode as decodeJwt } from "@pagopa/io-react-native-jwt";
2
2
  import { ValidationFailed } from "./errors";
3
+ import { LogLevel, Logger } from "./logging";
4
+
3
5
  /*
4
6
  * Decode a form_post.jwt and return the final JWT.
5
7
  * The formData here is in form_post.jwt format as defined in
@@ -43,6 +45,7 @@ export const getJwtFromFormPost = async formData => {
43
45
  };
44
46
  }
45
47
  }
48
+ Logger.log(LogLevel.ERROR, `Unable to obtain JWT from form_post.jwt. Form data: ${formData}`);
46
49
  throw new ValidationFailed({
47
50
  message: `Unable to obtain JWT from form_post.jwt. Form data: ${formData}`
48
51
  });
@@ -1 +1 @@
1
- {"version":3,"names":["decode","decodeJwt","ValidationFailed","getJwtFromFormPost","formData","formPostRegex","lineExpressionRegex","match","exec","responseJwt","jwt","replace","decodedJwt","message"],"sourceRoot":"../../../src","sources":["utils/decoder.ts"],"mappings":"AAAA,SAASA,MAAM,IAAIC,SAAS,QAAQ,6BAA6B;AACjE,SAASC,gBAAgB,QAAQ,UAAU;AAG3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,kBAAkB,GAAG,MAChCC,QAAgB,IAC0C;EAC1D,MAAMC,aAAa,GAAG,iDAAiD;EACvE,MAAMC,mBAAmB,GAAG,sBAAsB;EAElD,MAAMC,KAAK,GAAGF,aAAa,CAACG,IAAI,CAACJ,QAAQ,CAAC;EAC1C,IAAIG,KAAK,IAAIA,KAAK,CAAC,CAAC,CAAC,EAAE;IACrB,MAAME,WAAW,GAAGF,KAAK,CAAC,CAAC,CAAC;IAE5B,IAAIE,WAAW,EAAE;MACf,MAAMC,GAAG,GAAGD,WAAW,CAACE,OAAO,CAACL,mBAAmB,EAAE,EAAE,CAAC;MACxD,MAAMM,UAAU,GAAGX,SAAS,CAACS,GAAG,CAAC;MACjC,OAAO;QAAEA,GAAG;QAAEE;MAAW,CAAC;IAC5B;EACF;EAEA,MAAM,IAAIV,gBAAgB,CAAC;IACzBW,OAAO,EAAG,uDAAsDT,QAAS;EAC3E,CAAC,CAAC;AACJ,CAAC"}
1
+ {"version":3,"names":["decode","decodeJwt","ValidationFailed","LogLevel","Logger","getJwtFromFormPost","formData","formPostRegex","lineExpressionRegex","match","exec","responseJwt","jwt","replace","decodedJwt","log","ERROR","message"],"sourceRoot":"../../../src","sources":["utils/decoder.ts"],"mappings":"AAAA,SAASA,MAAM,IAAIC,SAAS,QAAQ,6BAA6B;AAEjE,SAASC,gBAAgB,QAAQ,UAAU;AAC3C,SAASC,QAAQ,EAAEC,MAAM,QAAQ,WAAW;;AAE5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,kBAAkB,GAAG,MAChCC,QAAgB,IAC0C;EAC1D,MAAMC,aAAa,GAAG,iDAAiD;EACvE,MAAMC,mBAAmB,GAAG,sBAAsB;EAElD,MAAMC,KAAK,GAAGF,aAAa,CAACG,IAAI,CAACJ,QAAQ,CAAC;EAC1C,IAAIG,KAAK,IAAIA,KAAK,CAAC,CAAC,CAAC,EAAE;IACrB,MAAME,WAAW,GAAGF,KAAK,CAAC,CAAC,CAAC;IAE5B,IAAIE,WAAW,EAAE;MACf,MAAMC,GAAG,GAAGD,WAAW,CAACE,OAAO,CAACL,mBAAmB,EAAE,EAAE,CAAC;MACxD,MAAMM,UAAU,GAAGb,SAAS,CAACW,GAAG,CAAC;MACjC,OAAO;QAAEA,GAAG;QAAEE;MAAW,CAAC;IAC5B;EACF;EAEAV,MAAM,CAACW,GAAG,CACRZ,QAAQ,CAACa,KAAK,EACb,uDAAsDV,QAAS,EAClE,CAAC;EACD,MAAM,IAAIJ,gBAAgB,CAAC;IACzBe,OAAO,EAAG,uDAAsDX,QAAS;EAC3E,CAAC,CAAC;AACJ,CAAC"}
@@ -1,9 +1,21 @@
1
1
  export const IssuerResponseErrorCodes = {
2
2
  IssuerGenericError: "ERR_ISSUER_GENERIC_ERROR",
3
+ /**
4
+ * Error code thrown when a credential cannot be issued immediately because it follows the async flow.
5
+ */
6
+ CredentialIssuingNotSynchronous: "ERR_CREDENTIAL_ISSUING_NOT_SYNCHRONOUS",
3
7
  /**
4
8
  * Error code thrown when an error occurs while requesting a credential.
5
9
  */
6
- CredentialRequestFailed: "ERR_CREDENTIAL_REQUEST_FAILED"
10
+ CredentialRequestFailed: "ERR_CREDENTIAL_REQUEST_FAILED",
11
+ /**
12
+ * Error code thrown when a credential status is invalid, either during issuance or when requesting a status attestation.
13
+ */
14
+ CredentialInvalidStatus: "ERR_CREDENTIAL_INVALID_STATUS",
15
+ /**
16
+ * Error code thrown when an error occurs while obtaining a status attestation for a credential.
17
+ */
18
+ StatusAttestationRequestFailed: "ERR_STATUS_ATTESTATION_REQUEST_FAILED"
7
19
  };
8
20
  export const WalletProviderResponseErrorCodes = {
9
21
  WalletProviderGenericError: "ERR_IO_WALLET_PROVIDER_GENERIC_ERROR",
@@ -28,4 +40,11 @@ export const WalletProviderResponseErrorCodes = {
28
40
  */
29
41
  WalletInstanceNotFound: "ERR_IO_WALLET_INSTANCE_NOT_FOUND"
30
42
  };
43
+ export const RelyingPartyResponseErrorCodes = {
44
+ RelyingPartyGenericError: "ERR_RP_GENERIC_ERROR",
45
+ /**
46
+ * An error code thrown then the Relying Party rejects the Wallet's Authorization Response.
47
+ */
48
+ InvalidAuthorizationResponse: "ERR_RP_INVALID_AUTHORIZATION_RESPONSE"
49
+ };
31
50
  //# sourceMappingURL=error-codes.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["IssuerResponseErrorCodes","IssuerGenericError","CredentialRequestFailed","WalletProviderResponseErrorCodes","WalletProviderGenericError","WalletInstanceCreationFailed","WalletInstanceAttestationIssuingFailed","WalletInstanceIntegrityFailed","WalletInstanceRevoked","WalletInstanceNotFound"],"sourceRoot":"../../../src","sources":["utils/error-codes.ts"],"mappings":"AAAA,OAAO,MAAMA,wBAAwB,GAAG;EACtCC,kBAAkB,EAAE,0BAA0B;EAC9C;AACF;AACA;EACEC,uBAAuB,EAAE;AAC3B,CAAU;AAEV,OAAO,MAAMC,gCAAgC,GAAG;EAC9CC,0BAA0B,EAAE,sCAAsC;EAClE;AACF;AACA;EACEC,4BAA4B,EAAE,wCAAwC;EACtE;AACF;AACA;EACEC,sCAAsC,EACpC,mDAAmD;EACrD;AACF;AACA;EACEC,6BAA6B,EAAE,yCAAyC;EACxE;AACF;AACA;EACEC,qBAAqB,EAAE,gCAAgC;EACvD;AACF;AACA;EACEC,sBAAsB,EAAE;AAC1B,CAAU"}
1
+ {"version":3,"names":["IssuerResponseErrorCodes","IssuerGenericError","CredentialIssuingNotSynchronous","CredentialRequestFailed","CredentialInvalidStatus","StatusAttestationRequestFailed","WalletProviderResponseErrorCodes","WalletProviderGenericError","WalletInstanceCreationFailed","WalletInstanceAttestationIssuingFailed","WalletInstanceIntegrityFailed","WalletInstanceRevoked","WalletInstanceNotFound","RelyingPartyResponseErrorCodes","RelyingPartyGenericError","InvalidAuthorizationResponse"],"sourceRoot":"../../../src","sources":["utils/error-codes.ts"],"mappings":"AAAA,OAAO,MAAMA,wBAAwB,GAAG;EACtCC,kBAAkB,EAAE,0BAA0B;EAC9C;AACF;AACA;EACEC,+BAA+B,EAAE,wCAAwC;EACzE;AACF;AACA;EACEC,uBAAuB,EAAE,+BAA+B;EACxD;AACF;AACA;EACEC,uBAAuB,EAAE,+BAA+B;EACxD;AACF;AACA;EACEC,8BAA8B,EAAE;AAClC,CAAU;AAEV,OAAO,MAAMC,gCAAgC,GAAG;EAC9CC,0BAA0B,EAAE,sCAAsC;EAClE;AACF;AACA;EACEC,4BAA4B,EAAE,wCAAwC;EACtE;AACF;AACA;EACEC,sCAAsC,EACpC,mDAAmD;EACrD;AACF;AACA;EACEC,6BAA6B,EAAE,yCAAyC;EACxE;AACF;AACA;EACEC,qBAAqB,EAAE,gCAAgC;EACvD;AACF;AACA;EACEC,sBAAsB,EAAE;AAC1B,CAAU;AAEV,OAAO,MAAMC,8BAA8B,GAAG;EAC5CC,wBAAwB,EAAE,sBAAsB;EAChD;AACF;AACA;EACEC,4BAA4B,EAAE;AAChC,CAAU"}
@@ -1,5 +1,5 @@
1
- import { IssuerResponseErrorCodes, WalletProviderResponseErrorCodes } from "./error-codes";
2
- export { IssuerResponseErrorCodes, WalletProviderResponseErrorCodes };
1
+ import { IssuerResponseErrorCodes, WalletProviderResponseErrorCodes, RelyingPartyResponseErrorCodes } from "./error-codes";
2
+ export { IssuerResponseErrorCodes, WalletProviderResponseErrorCodes, RelyingPartyResponseErrorCodes };
3
3
 
4
4
  // An error reason that supports both a string and a generic JSON object
5
5
 
@@ -94,8 +94,6 @@ export class UnexpectedStatusCodeError extends IoWalletError {
94
94
  /**
95
95
  * An error subclass thrown when an Issuer HTTP request fails.
96
96
  * The specific error can be found in the `code` property.
97
- *
98
- * The class is generic over the error code to narrow down the reason.
99
97
  */
100
98
  export class IssuerResponseError extends UnexpectedStatusCodeError {
101
99
  constructor(params) {
@@ -116,6 +114,65 @@ export class WalletProviderResponseError extends UnexpectedStatusCodeError {
116
114
  }
117
115
  }
118
116
 
117
+ /**
118
+ * An error subclass thrown when a Relying Party HTTP request fails.
119
+ * The specific error can be found in the `code` property.
120
+ */
121
+ export class RelyingPartyResponseError extends UnexpectedStatusCodeError {
122
+ constructor(params) {
123
+ super(params);
124
+ this.code = params.code ?? RelyingPartyResponseErrorCodes.RelyingPartyGenericError;
125
+ }
126
+ }
127
+ /**
128
+ * Function to extract the error message from the Entity Configuration's supported error codes.
129
+ * @param errorCode The error code to map to a meaningful message
130
+ * @param issuerConf The entity configuration for credentials
131
+ * @param credentialType The type of credential the error belongs to
132
+ * @returns A localized error {@link LocalizedIssuanceError} or undefined
133
+ * @throws {IoWalletError} When no credential config is found
134
+ */
135
+ export function extractErrorMessageFromIssuerConf(errorCode, _ref5) {
136
+ let {
137
+ issuerConf,
138
+ credentialType
139
+ } = _ref5;
140
+ const credentialConfiguration = issuerConf.openid_credential_issuer.credential_configurations_supported[credentialType];
141
+ if (!credentialConfiguration) {
142
+ throw new IoWalletError(`No configuration found for ${credentialType} in the provided EC`);
143
+ }
144
+ const {
145
+ issuance_errors_supported
146
+ } = credentialConfiguration;
147
+ if (!(issuance_errors_supported !== null && issuance_errors_supported !== void 0 && issuance_errors_supported[errorCode])) {
148
+ return undefined;
149
+ }
150
+ const localesList = issuance_errors_supported[errorCode].display;
151
+ return localesList.reduce((acc, _ref6) => {
152
+ let {
153
+ locale,
154
+ ...rest
155
+ } = _ref6;
156
+ return {
157
+ ...acc,
158
+ [locale]: rest
159
+ };
160
+ }, {});
161
+ }
162
+
163
+ /**
164
+ * Factory function to create a type guard for specific error classes.
165
+ *
166
+ * @param errorClass The error class to create the type guard for
167
+ * @returns A type guard that checks if the error is an instance of the given class and has the expected code
168
+ */
169
+ const makeErrorTypeGuard = ErrorClass => (error, code) => error instanceof ErrorClass && error.code === (code ?? error.code);
170
+ export const isIssuerResponseError = makeErrorTypeGuard(IssuerResponseError);
171
+ export const isWalletProviderResponseError = makeErrorTypeGuard(WalletProviderResponseError);
172
+ export const isRelyingPartyResponseError = makeErrorTypeGuard(RelyingPartyResponseError);
173
+
174
+ // Mapping type between error classes and their allowed codes
175
+
119
176
  /**
120
177
  * Builder class used to create specialized errors from type {@link UnexpectedStatusCodeError} that handles multiple status codes.
121
178
  *
@@ -1 +1 @@
1
- {"version":3,"names":["IssuerResponseErrorCodes","WalletProviderResponseErrorCodes","serializeAttrs","attrs","Object","entries","filter","_ref","v","undefined","map","_ref2","k","Array","isArray","join","JSON","stringify","_","IoWalletError","Error","code","constructor","message","name","ValidationFailed","_ref3","claim","reason","UnexpectedStatusCodeError","_ref4","statusCode","IssuerResponseError","params","IssuerGenericError","WalletProviderResponseError","WalletProviderGenericError","ResponseErrorBuilder","errorCases","ErrorClass","handle","status","buildFrom","originalError"],"sourceRoot":"../../../src","sources":["utils/errors.ts"],"mappings":"AACA,SACEA,wBAAwB,EACxBC,gCAAgC,QAG3B,eAAe;AAEtB,SAASD,wBAAwB,EAAEC,gCAAgC;;AAEnE;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,cAAc,GACzBC,KAA8E,IAE9EC,MAAM,CAACC,OAAO,CAACF,KAAK,CAAC,CAClBG,MAAM,CAACC,IAAA;EAAA,IAAC,GAAGC,CAAC,CAAC,GAAAD,IAAA;EAAA,OAAKC,CAAC,KAAKC,SAAS;AAAA,EAAC,CAClCC,GAAG,CAACC,KAAA,IAAY;EAAA,IAAX,CAACC,CAAC,EAAEJ,CAAC,CAAC,GAAAG,KAAA;EACV,IAAIE,KAAK,CAACC,OAAO,CAACN,CAAC,CAAC,EAAE,OAAO,CAACI,CAAC,EAAG,IAAGJ,CAAC,CAACO,IAAI,CAAC,IAAI,CAAE,GAAE,CAAC;EACrD,IAAI,OAAOP,CAAC,KAAK,QAAQ,EAAE,OAAO,CAACI,CAAC,EAAEI,IAAI,CAACC,SAAS,CAACT,CAAC,CAAC,CAAC;EACxD,OAAO,CAACI,CAA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,MAAMC,mBAAmB,SAASH,yBAAyB,CAAC;EAGjEP,WAAWA,CAACW,MAKX,EAAE;IACD,KAAK,CAACA,MAAM,CAAC;IACb,IAAI,CAACZ,IAAI,GAAGY,MAAM,CAACZ,IAAI,IAAIrB,wBAAwB,CAACkC,kBAAkB;EACxE;AACF;;AAEA;AACA;AACA;AACA;AACA,OAAO,MAAMC,2BAA2B,SAASN,yBAAyB,CAAC;EAIzEP,WAAWA,CAACW,MAKX,EAAE;IACD,KAAK,CAACA,MAAM,CAAC;IACb,IAAI,CAACL,MAAM,GAAGK,MAAM,CAACL,MAAM;IAC3B,IAAI,CAACP,IAAI,GACPY,MAAM,CAACZ,IAAI,IACXpB,gCAAgC,CAACmC,0BAA0B;EAC/D;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,oBAAoB,CAA6C;EACpEC,UAAU,GAEd,CAAC,CAAC;EAENhB,WAAWA,CAASiB,UAAa,EAAE;IAAA,KAAfA,UAAa,GAAbA,UAAa;EAAG;EAEpCC,MAAMA,CAACC,MAAoB,EAAER,MAAoB,EAAE;IACjD,IAAI,CAACK,UAAU,CAACG,MAAM,CAAC,GAAGR,MAAM;IAChC,OAAO,IAAI;EACb;EAEAS,SAASA,CAACC,aAAwC,EAAE;IAClD,MAAMV,MAAM,GACV,IAAI,CAACK,UAAU,CAACK,aAAa,CAACZ,UAAU,CAAC,IAAI,IAAI,CAACO,UAAU,CAAC,GAAG,CAAC;IAEnE,IAAIL,MAAM,EAAE;MACV,OAAO,IAAI,IAAI,CAACM,UAAU,CAAC;QAAE,GAAGI,aAAa;QAAE,GAAGV;MAAO,CAAC,CAAC;IAC7D;IAEA,OAAOU,aAAa;EACtB;AACF"}
1
+ {"version":3,"names":["IssuerResponseErrorCodes","WalletProviderResponseErrorCodes","RelyingPartyResponseErrorCodes","serializeAttrs","attrs","Object","entries","filter","_ref","v","undefined","map","_ref2","k","Array","isArray","join","JSON","stringify","_","IoWalletError","Error","code","constructor","message","name","ValidationFailed","_ref3","claim","reason","UnexpectedStatusCodeError","_ref4","statusCode","IssuerResponseError","params","IssuerGenericError","WalletProviderResponseError","WalletProviderGenericError","RelyingPartyResponseError","RelyingPartyGenericError","extractErrorMessageFromIssuerConf","errorCode","_ref5","issuerConf","credentialType","credentialConfiguration","openid_credential_issuer","credential_configurations_supported","issuance_errors_supported","localesList","display","reduce","acc","_ref6","locale","rest","makeErrorTypeGuard","ErrorClass","error","isIssuerResponseError","isWalletProviderResponseError","isRelyingPartyResponseError","ResponseErrorBuilder","errorCases","handle","status","buildFrom","originalError"],"sourceRoot":"../../../src","sources":["utils/errors.ts"],"mappings":"AAEA,SACEA,wBAAwB,EACxBC,gCAAgC,EAChCC,8BAA8B,QAIzB,eAAe;AAEtB,SACEF,wBAAwB,EACxBC,gCAAgC,EAChCC,8BAA8B;;AAGhC;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,cAAc,GACzBC,KAA8E,IAE9EC,MAAM,CAACC,OAAO,CAACF,KAAK,CAAC,CAClBG,MAAM,CAACC,IAAA;EAAA,IAAC,GAAGC,CAAC,CAAC,GAAAD,IAAA;EAAA,OAAKC,CAAC,KAAKC,SAAS;AAAA,EAAC,CAClCC,GAAG,CAACC,KAAA,IAAY;EAAA,IAAX,CAACC,CAAC,EAAEJ,CAAC,CAAC,GAAAG,KAAA;EACV,IAAIE,KAAK,CAACC,OAAO,CAACN,CAAC,CAAC,EAAE,OAAO,CAACI,CAAC,EAAG,IAAGJ,CAAC,CAACO,IAAI,CAAC,IAAI,CAAE,GAAE,CAAC;EACrD,IAAI,OAAOP,CAAC,KAAK,QAAQ,EAAE,OAAO,CAACI,CAAC,EAAEI,IAAI,CAACC,SAAS,CAACT,CAAC,CAAC,CAAC;EACxD,OAAO,CAACI,CAAC,EAAEJ,CAAC,CAAC;AACf,CAAC,CAAC,CACDE,GAAG,CAAEQ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IAEA,OAAOiC,aAAa;EACtB;AACF"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Logger interface which can be provided to the Logger class as a custom implementation.
3
+ */
4
+
5
+ /**
6
+ * Supported debug levels.
7
+ */
8
+ export let LogLevel = /*#__PURE__*/function (LogLevel) {
9
+ LogLevel[LogLevel["DEBUG"] = 0] = "DEBUG";
10
+ LogLevel[LogLevel["INFO"] = 1] = "INFO";
11
+ LogLevel[LogLevel["WARN"] = 2] = "WARN";
12
+ LogLevel[LogLevel["ERROR"] = 3] = "ERROR";
13
+ return LogLevel;
14
+ }({});
15
+
16
+ /**
17
+ * Logger singleton class which provides a simple logging interface with an init function to set the logging context and
18
+ * a static log function to log messages based on the debug level.
19
+ * This can be used as follows:
20
+ * const logger = Logger.getInstance();
21
+ * logger.initLogging(yourLoggingContext);
22
+ * logger.log(LogLevel.DEBUG, "Debug message");
23
+ */
24
+ export class Logger {
25
+ static instance = null;
26
+ // Private constructor to prevent direct instantiation
27
+ constructor() {}
28
+
29
+ // Public static method to get the Logger instance
30
+ static getInstance() {
31
+ if (Logger.instance === null) {
32
+ Logger.instance = new Logger();
33
+ }
34
+ return Logger.instance;
35
+ }
36
+
37
+ // Method to initialize the logging context
38
+ initLogging(loggingCtx) {
39
+ Logger.loggingContext = loggingCtx;
40
+ }
41
+
42
+ // Method to log based on the level which wraps the null check for the logging context
43
+ static log(level, msg) {
44
+ if (Logger.loggingContext) {
45
+ switch (level) {
46
+ case LogLevel.DEBUG:
47
+ Logger.loggingContext.logDebug(msg);
48
+ break;
49
+ case LogLevel.INFO:
50
+ Logger.loggingContext.logInfo(msg);
51
+ break;
52
+ case LogLevel.WARN:
53
+ Logger.loggingContext.logWarn(msg);
54
+ break;
55
+ case LogLevel.ERROR:
56
+ Logger.loggingContext.logError(msg);
57
+ break;
58
+ }
59
+ }
60
+ }
61
+ }
62
+ //# sourceMappingURL=logging.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["LogLevel","Logger","instance","constructor","getInstance","initLogging","loggingCtx","loggingContext","log","level","msg","DEBUG","logDebug","INFO","logInfo","WARN","logWarn","ERROR","logError"],"sourceRoot":"../../../src","sources":["utils/logging.ts"],"mappings":"AAAA;AACA;AACA;;AAQA;AACA;AACA;AACA,WAAYA,QAAQ,0BAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAAA,OAARA,QAAQ;AAAA;;AAOpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,MAAM,CAAC;EAClB,OAAeC,QAAQ,GAAkB,IAAI;EAG7C;EACQC,WAAWA,CAAA,EAAG,CAAC;;EAEvB;EACA,OAAcC,WAAWA,CAAA,EAAW;IAClC,IAAIH,MAAM,CAACC,QAAQ,KAAK,IAAI,EAAE;MAC5BD,MAAM,CAACC,QAAQ,GAAG,IAAID,MAAM,CAAC,CAAC;IAChC;IACA,OAAOA,MAAM,CAACC,QAAQ;EACxB;;EAEA;EACOG,WAAWA,CAACC,UAA0B,EAAQ;IACnDL,MAAM,CAACM,cAAc,GAAGD,UAAU;EACpC;;EAEA;EACA,OAAcE,GAAGA,CAACC,KAAe,EAAEC,GAAW,EAAQ;IACpD,IAAIT,MAAM,CAACM,cAAc,EAAE;MACzB,QAAQE,KAAK;QACX,KAAKT,QAAQ,CAACW,KAAK;UACjBV,MAAM,CAACM,cAAc,CAACK,QAAQ,CAACF,GAAG,CAAC;UACnC;QACF,KAAKV,QAAQ,CAACa,IAAI;UAChBZ,MAAM,CAACM,cAAc,CAACO,OAAO,CAACJ,GAAG,CAAC;UAClC;QACF,KAAKV,QAAQ,CAACe,IAAI;UAChBd,MAAM,CAACM,cAAc,CAACS,OAAO,CAACN,GAAG,CAAC;UAClC;QACF,KAAKV,QAAQ,CAACiB,KAAK;UACjBhB,MAAM,CAACM,cAAc,CAACW,QAAQ,CAACR,GAAG,CAAC;UACnC;MACJ;IACF;EACF;AACF"}
@@ -1,5 +1,6 @@
1
1
  import { IoWalletError, UnexpectedStatusCodeError } from "./errors";
2
2
  import { sha256 } from "js-sha256";
3
+ import { LogLevel, Logger } from "./logging";
3
4
 
4
5
  /**
5
6
  * Check if a response is in the expected status, otherwise throw an error
@@ -11,6 +12,7 @@ import { sha256 } from "js-sha256";
11
12
  export const hasStatusOrThrow = (status, customError) => async res => {
12
13
  if (res.status !== status) {
13
14
  const ErrorClass = customError ?? UnexpectedStatusCodeError;
15
+ Logger.log(LogLevel.ERROR, `Http request failed. Expected ${status}, got ${res.status}, url: ${res.url}`);
14
16
  throw new ErrorClass({
15
17
  message: `Http request failed. Expected ${status}, got ${res.status}, url: ${res.url}`,
16
18
  statusCode: res.status,
@@ -1 +1 @@
1
- {"version":3,"names":["IoWalletError","UnexpectedStatusCodeError","sha256","hasStatusOrThrow","status","customError","res","ErrorClass","message","url","statusCode","reason","parseRawHttpResponse","response","_response$headers$get","headers","get","includes","json","text","generateRandomAlphaNumericString","size","Array","from","Math","floor","random","toString","join","getCredentialHashWithouDiscloures","credential","tildeIndex","indexOf","slice","safeJsonParse","withDefault","JSON","parse","_"],"sourceRoot":"../../../src","sources":["utils/misc.ts"],"mappings":"AAAA,SAASA,aAAa,EAAEC,yBAAyB,QAAQ,UAAU;AACnE,SAASC,MAAM,QAAQ,WAAW;;AAElC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,gBAAgB,GAC3BA,CAACC,MAAc,EAAEC,WAA8C,KAC/D,MAAOC,GAAa,IAAwB;EAC1C,IAAIA,GAAG,CAACF,MAAM,KAAKA,MAAM,EAAE;IACzB,MAAMG,UAAU,GAAGF,WAAW,IAAIJ,yBAAyB;IAC3D,MAAM,IAAIM,UAAU,CAAC;MACnBC,OAAO,EAAG,iCAAgCJ,MAAO,SAAQE,GAAG,CAACF,MAAO,UAASE,GAAG,CAACG,GAAI,EAAC;MACtFC,UAAU,EAAEJ,GAAG,CAACF,M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AOH,WAAW,IAAI,IAAI;EAC5B;AACF,CAAC"}
1
+ {"version":3,"names":["IoWalletError","UnexpectedStatusCodeError","sha256","LogLevel","Logger","hasStatusOrThrow","status","customError","res","ErrorClass","log","ERROR","url","message","statusCode","reason","parseRawHttpResponse","response","_response$headers$get","headers","get","includes","json","text","generateRandomAlphaNumericString","size","Array","from","Math","floor","random","toString","join","getCredentialHashWithouDiscloures","credential","tildeIndex","indexOf","slice","safeJsonParse","withDefault","JSON","parse","_"],"sourceRoot":"../../../src","sources":["utils/misc.ts"],"mappings":"AAAA,SAASA,aAAa,EAAEC,yBAAyB,QAAQ,UAAU;AACnE,SAASC,MAAM,QAAQ,WAAW;AAClC,SAASC,QAAQ,EAAEC,MAAM,QAAQ,WAAW;;AAE5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,gBAAgB,GAC3BA,CAACC,MAAc,EAAEC,WAA8C,KAC/D,MAAOC,GAAa,IAAwB;EAC1C,IAAIA,GAAG,CAACF,MAAM,KAAKA,MAAM,EAAE;IACzB,MAAMG,UAAU,GAAGF,WAAW,IAAIN,yBAAyB;IAC3DG,MAAM,CAACM,GAAG,CACRP,QAAQ,CAACQ,KAAK,EACb,iCAAgCL,MAAO,SAAQE,GAAG,CAACF,MAAO,UAASE,GAAG,CAACI,GAAI,EAC9E,CAAC;IACD,MAAM,IAAIH,UAAU,CAAC;MACnBI,OAAO,EAAG,iCAAgCP,MAAO,SAAQE,GAAG,CAACF,MAAO,UAASE,GAAG,CAACI,GAAI,EAAC;MACtFE,UAAU,EAAEN,GAAG,CAACF,MAAM;MACtBS,MAAM,EAAE,MAAMC,oBAAoB,CAACR,GAAG,CAAC,CAAE;IAC3C,CAAC,CAAC;EACJ;;EACA,OAAOA,GAAG;AACZ,CAAC;;AAEH;AACA;AACA;AACA,OAAO,MAAMQ,oBAAoB,GAC/BC,QAAkB;EAAA,IAAAC,qBAAA;EAAA,OAElB,CAAAA,qBAAA,GAAAD,QAAQ,CAACE,OAAO,CAACC,GAAG,CAAC,cAAc,CAAC,cAAAF,qBAAA,eAApCA,qBAAA,CAAsCG,QAAQ,CAAC,kBAAkB,CAAC,GAC7DJ,QAAQ,CAACK,IAAI,CAAC,CAAC,GAChBL,QAAQ,CAACM,IAAI,CAAC,CAAC;AAAA;;AAErB;AACA;AAOA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,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,OAAO,MAAMC,iCAAiC,GAAG,MAC/CC,UAAkB,IACE;EACpB,MAAMC,UAAU,GAAGD,UAAU,CAACE,OAAO,CAAC,GAAG,CAAC;EAC1C,IAAID,UAAU,KAAK,CAAC,CAAC,EAAE;IACrB,MAAM,IAAInC,aAAa,CAAC,2BAA2B,CAAC;EACtD;EACA,OAAOE,MAAM,CAACgC,UAAU,CAACG,KAAK,CAAC,CAAC,EAAEF,UAAU,CAAC,CAAC;AAChD,CAAC;AAED,OAAO,MAAMG,aAAa,GAAGA,CAAIf,IAAY,EAAEgB,WAAe,KAAe;EAC3E,IAAI;IACF,OAAOC,IAAI,CAACC,KAAK,CAAClB,IAAI,CAAC;EACzB,CAAC,CAAC,OAAOmB,CAAC,EAAE;IACV,OAAOH,WAAW,IAAI,IAAI;EAC5B;AACF,CAAC"}
@@ -1,12 +1,14 @@
1
1
  import { sha256ToBase64, SignJWT } from "@pagopa/io-react-native-jwt";
2
- import uuid from "react-native-uuid";
2
+ import { v4 as uuidv4 } from "uuid";
3
3
  import * as z from "zod";
4
4
  import * as WalletInstanceAttestation from "../wallet-instance-attestation";
5
5
  import { generateRandomAlphaNumericString, hasStatusOrThrow } from "./misc";
6
6
  import { createPopToken } from "./pop";
7
7
  import { IssuerResponseError } from "./errors";
8
+ import { LogLevel, Logger } from "./logging";
8
9
  export const AuthorizationDetail = z.object({
9
10
  credential_configuration_id: z.string(),
11
+ format: z.union([z.literal("vc+sd-jwt"), z.literal("vc+mdoc-cbor")]),
10
12
  type: z.literal("openid_credential")
11
13
  });
12
14
  export const AuthorizationDetails = z.array(AuthorizationDetail);
@@ -19,13 +21,13 @@ export const makeParRequest = _ref => {
19
21
  wiaCryptoContext,
20
22
  appFetch
21
23
  } = _ref;
22
- return async (clientId, codeVerifier, redirectUri, responseMode, parEndpoint, walletInstanceAttestation, authorizationDetails) => {
24
+ return async (clientId, codeVerifier, redirectUri, responseMode, parEndpoint, walletInstanceAttestation, authorizationDetails, assertionType) => {
23
25
  const wiaPublicKey = await wiaCryptoContext.getPublicKey();
24
26
  const parUrl = new URL(parEndpoint);
25
27
  const aud = `${parUrl.protocol}//${parUrl.hostname}`;
26
28
  const iss = WalletInstanceAttestation.decode(walletInstanceAttestation).payload.cnf.jwk.kid;
27
29
  const signedWiaPoP = await createPopToken({
28
- jti: `${uuid.v4()}`,
30
+ jti: `${uuidv4()}`,
29
31
  aud,
30
32
  iss
31
33
  }, wiaCryptoContext);
@@ -44,7 +46,7 @@ export const makeParRequest = _ref => {
44
46
  typ: "jwk",
45
47
  kid: wiaPublicKey.kid
46
48
  }).setPayload({
47
- jti: `${uuid.v4()}`,
49
+ jti: `${uuidv4()}`,
48
50
  aud,
49
51
  response_type: "code",
50
52
  response_mode: responseMode,
@@ -54,21 +56,27 @@ export const makeParRequest = _ref => {
54
56
  code_challenge: codeChallenge,
55
57
  code_challenge_method: codeChallengeMethod,
56
58
  authorization_details: authorizationDetails,
57
- redirect_uri: redirectUri
59
+ redirect_uri: redirectUri,
60
+ client_assertion_type: assertionType,
61
+ client_assertion: walletInstanceAttestation + "~" + signedWiaPoP
58
62
  }).setIssuedAt() //iat is set to now
59
63
  .setExpirationTime("5min").sign();
60
64
 
61
65
  /** The request body for the Pushed Authorization Request */
62
66
  var formBody = new URLSearchParams({
67
+ response_type: "code",
63
68
  client_id: clientId,
64
- request: signedJwtForPar
69
+ code_challenge: codeChallenge,
70
+ code_challenge_method: "S256",
71
+ request: signedJwtForPar,
72
+ client_assertion_type: assertionType,
73
+ client_assertion: walletInstanceAttestation + "~" + signedWiaPoP
65
74
  });
75
+ Logger.log(LogLevel.DEBUG, `Sending to PAR endpoint ${parEndpoint}: ${formBody}`);
66
76
  return await appFetch(parEndpoint, {
67
77
  method: "POST",
68
78
  headers: {
69
- "Content-Type": "application/x-www-form-urlencoded",
70
- "OAuth-Client-Attestation": walletInstanceAttestation,
71
- "OAuth-Client-Attestation-PoP": signedWiaPoP
79
+ "Content-Type": "application/x-www-form-urlencoded"
72
80
  },
73
81
  body: formBody.toString()
74
82
  }).then(hasStatusOrThrow(201, IssuerResponseError)).then(res => res.json()).then(result => result.request_uri);
@@ -1 +1 @@
1
- {"version":3,"names":["sha256ToBase64","SignJWT","uuid","z","WalletInstanceAttestation","generateRandomAlphaNumericString","hasStatusOrThrow","createPopToken","IssuerResponseError","AuthorizationDetail","object","credential_configuration_id","string","type","literal","AuthorizationDetails","array","makeParRequest","_ref","wiaCryptoContext","appFetch","clientId","codeVerifier","redirectUri","responseMode","parEndpoint","walletInstanceAttestation","authorizationDetails","wiaPublicKey","getPublicKey","parUrl","URL","aud","protocol","hostname","iss","decode","payload","cnf","jwk","kid","signedWiaPoP","jti","v4","codeChallengeMethod","codeChallenge","signedJwtForPar","setProtectedHeader","typ","setPayload","response_type","response_mode","client_id","state","code_challenge","code_challenge_method","authorization_details","redirect_uri","setIssuedAt","setExpirationTime","sign","formBody","URLSearchParams","request","method","headers","body","toString","then","res","json","result","request_uri"],"sourceRoot":"../../../src","sources":["utils/par.ts"],"mappings":"AAAA,SACEA,cAAc,EAEdC,OAAO,QACF,6BAA6B;AACpC,OAAOC,IAAI,MAAM,mBAAmB;AACpC,OAAO,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AAKA,MAAM,CAACC,WAAW,CAAC;EACzC,CAAC;AAAA"}
1
+ {"version":3,"names":["sha256ToBase64","SignJWT","v4","uuidv4","z","WalletInstanceAttestation","generateRandomAlphaNumericString","hasStatusOrThrow","createPopToken","IssuerResponseError","LogLevel","Logger","AuthorizationDetail","object","credential_configuration_id","string","format","union","literal","type","AuthorizationDetails","array","makeParRequest","_ref","wiaCryptoContext","appFetch","clientId","codeVerifier","redirectUri","responseMode","parEndpoint","walletInstanceAttestation","authorizationDetails","assertionType","wiaPublicKey","getPublicKey","parUrl","URL","aud","protocol","hostname","iss","decode","payload","cnf","jwk","kid","signedWiaPoP","jti","codeChallengeMethod","codeChallenge","signedJwtForPar","setProtectedHeader","typ","setPayload","response_type","response_mode","client_id","state","code_challenge","code_challenge_method","authorization_details","redirect_uri","client_assertion_type","client_assertion","setIssuedAt","setExpirationTime","sign","formBody","URLSearchParams","request","log","DEBUG","method","headers","body","toString","then","res","json","result","request_uri"],"sourceRoot":"../../../src","sources":["utils/par.ts"],"mappings":"AAAA,SACEA,cAAc,EAEdC,OAAO,QACF,6BAA6B;AACpC,SAASC,EAAE,IAAIC,MAAM,QAAQ,MAAM;AACnC,OAAO,KAAKC,CAAC,MAAM,KAAK;AACxB,OAAO,KAAKC,yBAAyB,MAAM,gCAAgC;AAC3E,SAASC,gCAAgC,EAAEC,gBAAgB,QAAQ,QAAQ;AAC3E,SAASC,cAAc,QAAQ,OAAO;AACtC,SAASC,mBAAmB,QAAQ,UAAU;AAC9C,SAASC,QAAQ,EAAEC,MAAM,QAAQ,WAAW;AAG5C,OAAO,MAAMC,mBAAmB,GAAGR,CAAC,CAACS,MAAM,CAAC;EAC1CC,2BAA2B,EAAEV,CAAC,CAACW,MAAM,CAAC,CAAC;EACvCC,MAAM,EAAEZ,CAAC,CAACa,KAAK,CAAC,CAACb,CAAC,CAACc,OAAO,CAAC,WAAW,CAAC,EAAEd,CAAC,CAACc,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC;EAC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AAKA,MAAM,CAACC,WAAW,CAAC;EACzC,CAAC;AAAA"}
@@ -40,14 +40,4 @@ export const obfuscateString = function (value) {
40
40
  });
41
41
  return chars.join("");
42
42
  };
43
-
44
- /**
45
- * Converts a base64 string to a Base64 URL-encoded string.
46
- *
47
- * @param byteString - The input string in base64 format.
48
- * @returns The Base64 URL-encoded string.
49
- */
50
- export const base64ToBase64Url = base64 => {
51
- return base64.replace(/\+/g, "-").replace(/\//g, "_").replace(/[=]+$/, "");
52
- };
53
43
  //# sourceMappingURL=string.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["obfuscateString","value","percentage","arguments","length","undefined","obfuscatedChar","safePercentage","Math","max","min","charsToObfuscate","floor","chars","split","positions","Array","from","_","i","sort","random","slice","forEach","pos","join","base64ToBase64Url","base64","replace"],"sourceRoot":"../../../src","sources":["utils/string.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,eAAe,GAAG,SAAAA,CAC7BC,KAAa,EAGF;EAAA,IAFXC,UAAkB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;EAAA,IACvBG,cAAsB,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,GAAG;EAE5B,IAAI,CAACF,KAAK,EAAE;IACV,OAAO,EAAE;EACX;;EAEA;EACA,MAAMM,cAAc,GAAGC,IAAI,CAACC,GAAG,CAAC,CAAC,EAAED,IAAI,CAACE,GAAG,CAAC,GAAG,EAAER,UAAU,CAAC,CAAC;;EAE7D;EACA,MAAMS,gBAAgB,GAAGH,IAAI,CAACI,KAAK,CAAEX,KAAK,CAACG,MAAM,GAAGG,cAAc,GAAI,GAAG,CAAC;;EAE1E;EACA,MAAMM,KAAK,GAAGZ,KAAK,CAACa,KAAK,CAAC,EAAE,CAAC;;EAE7B;EACA,MAAMC,SAAS,GAAGC,KAAK,CAACC,IAAI,CAAC;IAAEb,MAAM,EAAEH,KAAK,CAACG;EAAO,CAAC,EAAE,CAACc,CAAC,EAAEC,CAAC,KAAKA,CAAC,CAAC,CAChEC,IAAI,CAAC,MAAMZ,IAAI,CAACa,MAAM,CAAC,CAAC,GAAG,GAAG,CAAC,CAC/BC,KAAK,CAAC,CAAC,EAAEX,gBAAgB,CAAC;;EAE7B;EACAI,SAAS,CAACQ,OAAO,CAAEC,GAAG,IAAK;IACzBX,KAAK,CAACW,GAAG,CAAC,GAAGlB,cAAc;EAC7B,CAAC,CAAC;EAEF,OAAOO,KAAK,CAACY,IAAI,CAAC,EAAE,CAAC;AACvB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,iBAAiB,GAAIC,MAAc,IAAa;EAC3D,OAAOA,MAAM,CAACC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAACA,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAACA,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC;AAC5E,CAAC"}
1
+ {"version":3,"names":["obfuscateString","value","percentage","arguments","length","undefined","obfuscatedChar","safePercentage","Math","max","min","charsToObfuscate","floor","chars","split","positions","Array","from","_","i","sort","random","slice","forEach","pos","join"],"sourceRoot":"../../../src","sources":["utils/string.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,eAAe,GAAG,SAAAA,CAC7BC,KAAa,EAGF;EAAA,IAFXC,UAAkB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;EAAA,IACvBG,cAAsB,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,GAAG;EAE5B,IAAI,CAACF,KAAK,EAAE;IACV,OAAO,EAAE;EACX;;EAEA;EACA,MAAMM,cAAc,GAAGC,IAAI,CAACC,GAAG,CAAC,CAAC,EAAED,IAAI,CAACE,GAAG,CAAC,GAAG,EAAER,UAAU,CAAC,CAAC;;EAE7D;EACA,MAAMS,gBAAgB,GAAGH,IAAI,CAACI,KAAK,CAAEX,KAAK,CAACG,MAAM,GAAGG,cAAc,GAAI,GAAG,CAAC;;EAE1E;EACA,MAAMM,KAAK,GAAGZ,KAAK,CAACa,KAAK,CAAC,EAAE,CAAC;;EAE7B;EACA,MAAMC,SAAS,GAAGC,KAAK,CAACC,IAAI,CAAC;IAAEb,MAAM,EAAEH,KAAK,CAACG;EAAO,CAAC,EAAE,CAACc,CAAC,EAAEC,CAAC,KAAKA,CAAC,CAAC,CAChEC,IAAI,CAAC,MAAMZ,IAAI,CAACa,MAAM,CAAC,CAAC,GAAG,GAAG,CAAC,CAC/BC,KAAK,CAAC,CAAC,EAAEX,gBAAgB,CAAC;;EAE7B;EACAI,SAAS,CAACQ,OAAO,CAAEC,GAAG,IAAK;IACzBX,KAAK,CAACW,GAAG,CAAC,GAAGlB,cAAc;EAC7B,CAAC,CAAC;EAEF,OAAOO,KAAK,CAACY,IAAI,CAAC,EAAE,CAAC;AACvB,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { getWalletProviderClient } from "../client";
2
2
  import { ResponseErrorBuilder, WalletProviderResponseError, WalletProviderResponseErrorCodes } from "../utils/errors";
3
+ import { LogLevel, Logger } from "../utils/logging";
3
4
  export async function createWalletInstance(context) {
4
5
  const {
5
6
  integrityContext
@@ -8,8 +9,10 @@ export async function createWalletInstance(context) {
8
9
 
9
10
  //1. Obtain nonce
10
11
  const challenge = await api.get("/nonce").then(response => response.nonce);
12
+ Logger.log(LogLevel.DEBUG, `Challenge obtained from ${context.walletProviderBaseUrl}: ${challenge}`);
11
13
  const keyAttestation = await integrityContext.getAttestation(challenge);
12
14
  const hardwareKeyTag = integrityContext.getHardwareKeyTag();
15
+ Logger.log(LogLevel.DEBUG, `Key attestation: ${keyAttestation}\nAssociated hardware key tag: ${hardwareKeyTag}`);
13
16
 
14
17
  //2. Create Wallet Instance
15
18
  await api.post("/wallet-instances", {
@@ -22,6 +25,7 @@ export async function createWalletInstance(context) {
22
25
  return hardwareKeyTag;
23
26
  }
24
27
  const handleCreateWalletInstanceError = e => {
28
+ Logger.log(LogLevel.ERROR, `An error occurred while calling /wallet-instances endpoint: ${e}`);
25
29
  if (!(e instanceof WalletProviderResponseError)) {
26
30
  throw e;
27
31
  }
@@ -63,4 +67,13 @@ export async function getWalletInstanceStatus(context) {
63
67
  }
64
68
  });
65
69
  }
70
+
71
+ /**
72
+ * Get the status of the current Wallet Instance.
73
+ * @returns Details on the status of the current Wallet Instance
74
+ */
75
+ export async function getCurrentWalletInstanceStatus(context) {
76
+ const api = getWalletProviderClient(context);
77
+ return api.get("/wallet-instances/current/status");
78
+ }
66
79
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["getWalletProviderClient","ResponseErrorBuilder","WalletProviderResponseError","WalletProviderResponseErrorCodes","createWalletInstance","context","integrityContext","api","challenge","get","then","response","nonce","keyAttestation","getAttestation","hardwareKeyTag","getHardwareKeyTag","post","body","key_attestation","hardware_key_tag","catch","handleCreateWalletInstanceError","e","handle","code","WalletInstanceIntegrityFailed","message","WalletInstanceCreationFailed","buildFrom","revokeWalletInstance","put","path","id","status","getWalletInstanceStatus"],"sourceRoot":"../../../src","sources":["wallet-instance/index.ts"],"mappings":"AAAA,SAASA,uBAAuB,QAAQ,WAAW;AACnD,SACEC,oBAAoB,EACpBC,2BAA2B,EAC3BC,gCAAgC,QAC3B,iBAAiB;AAIxB,OAAO,eAAeC,oBAAoBA,CAACC,OAI1C,EAAE;EACD,MAAM;IAAEC;EAAiB,CAAC,GAAGD,OAAO;EAEpC,MAAME,GAAG,GAAGP,uBAAuB,CAACK,OAAO,CAAC;;EAE5C;EACA,MAAMG,SAAS,GAAG,MAAMD,GAAG,CAACE,GAAG,CAAC,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AAC9B,OAI7C,EAA+B;EAC9B,MAAME,GAAG,GAAGP,uBAAuB,CAACK,OAAO,CAAC;EAE5C,OAAOE,GAAG,CAACE,GAAG,CAAC,+BAA+B,EAAE;IAC9CuB,IAAI,EAAE;MAAEC,EAAE,EAAE5B,OAAO,CAAC4B;IAAG;EACzB,CAAC,CAAC;AACJ"}
1
+ {"version":3,"names":["getWalletProviderClient","ResponseErrorBuilder","WalletProviderResponseError","WalletProviderResponseErrorCodes","LogLevel","Logger","createWalletInstance","context","integrityContext","api","challenge","get","then","response","nonce","log","DEBUG","walletProviderBaseUrl","keyAttestation","getAttestation","hardwareKeyTag","getHardwareKeyTag","post","body","key_attestation","hardware_key_tag","catch","handleCreateWalletInstanceError","e","ERROR","handle","code","WalletInstanceIntegrityFailed","message","WalletInstanceCreationFailed","buildFrom","revokeWalletInstance","put","path","id","status","getWalletInstanceStatus","getCurrentWalletInstanceStatus"],"sourceRoot":"../../../src","sources":["wallet-instance/index.ts"],"mappings":"AAAA,SAASA,uBAAuB,QAAQ,WAAW;AACnD,SACEC,oBAAoB,EACpBC,2BAA2B,EAC3BC,gCAAgC,QAC3B,iBAAiB;AAGxB,SAASC,QAAQ,EAAEC,MAAM,QAAQ,kBAAkB;AAEnD,OAAO,eAAeC,oBAAoBA,CAACC,OAI1C,EAAE;EACD,MAAM;IAAEC;EAAiB,CAAC,GAAGD,OAAO;EACpC,MAAME,GAAG,GAAGT,uBAAuB,CAACO,OAAO,CAAC;;EAE5C;EACA,MAAMG,SAAS,GAAG,MAAMD,GAAG,CAACE,GAAG,CAAC,QAAQ,CAAC,CAACC,IAAI,CAAEC,QAAQ,IAAKA,QAAQ,CAACC,KAAK,CAAC;EAE5ET,MAAM,CAACU,GAAG,CACRX,QAAQ,CAACY,KAAK,EACb,2BAA0BT,OAAO,CAACU,qBAAsB,KAAIP,SAAU,EACzE,CAAC;EAED,MAAMQ,cAAc,GAAG,MAAMV,gBAAgB,CAACW,cAAc,CAACT,SAAS,CAAC;EA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