@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,112 +1,107 @@
1
1
  # Credential Presentation
2
2
 
3
+ This flow is used for remote presentation, allowing a user with a valid Wallet Instance to remotely present credentials to a Relying Party (Verifier). The presentation flow adheres to the [IT Wallet 0.9.x specification](https://italia.github.io/eid-wallet-it-docs/v0.9.3/en/relying-party-solution.html).
4
+
5
+ The Relying Party provides the Wallet with a Request Object that contains the requested credentials and claims. The Wallet validates the Request Object and asks the user for consent. Then the Wallet creates an encrypted Authorization Response that contains the Verifiable Presentation with the requested data (`vp_token`) and sends it to the Relying Party.
6
+
3
7
  ## Sequence Diagram
4
8
 
5
9
  ```mermaid
6
10
  sequenceDiagram
7
- autonumber
8
- participant I as Individual using EUDI Wallet
9
- participant O as Organisational Wallet (Verifier)
10
- participant A as Organisational Wallet (Issuer)
11
-
12
- O->>+I: QR-CODE: Authorisation request (`request_uri`)
13
- I->>+O: GET: Request object, resolved from the `request_uri`
14
- O->>+I: Respond with the Request object
15
- I->>+O: GET: /.well-known/jar-issuer/jwk
16
- O->>+I: Respond with the public key
17
-
18
- I->>+O: POST: VP token response
19
- O->>+A: GET: /.well-known/jwt-vc-issuer/jwk
20
- A->>+O: Respond with the public key
21
- O->>+I: Redirect: Authorisation response
11
+ autonumber
12
+ participant I as User (Wallet Instance)
13
+ participant O as Relying Party (Verifier)
14
+
15
+ O->>+I: QR-CODE: Authorization Request (`request_uri`)
16
+ I->>+O: GET: Verifier's Entity Configuration
17
+ O->>+I: Respond with metadata (including public keys)
18
+ I->>+O: GET: Request Object, resolved from `request_uri`
19
+ O->>+I: Respond with the Request Object
20
+ I->>+I: Validate Request Object and give consent
21
+ I->>+O: POST: Authorization Response with encrypted VP token
22
+ O->>+I: Respond with optional `redirect_uri`
22
23
  ```
23
24
 
24
25
  ## Mapped results
25
26
 
27
+ | Error | Description|
28
+ | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
29
+ | `InvalidRequestObject` | The Request Object is not valid, for instance it is malformed or its signature cannot be verified. |
30
+ | `DcqlError` | The DCQL query cannot be evaluated because it contains errors. |
31
+ | `CredentialsNotFoundError` | The presentation cannot be completed because the Wallet does not contain all requested credentials. The missing credentials can be found in `details`. |
32
+ | `RelyingPartyResponseError` | Error in the Relying Party's response. See the next table for more details. |
33
+
34
+ #### RelyingPartyResponseError
35
+ The following HTTP errors are mapped to a `RelyingPartyResponseError` with specific codes.
36
+
37
+ | HTTP Status | Error Code | Description |
38
+ | ------------ | --------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
39
+ | `400`, `403` | `ERR_RP_INVALID_AUTHORIZATION_RESPONSE` | The Relying Party rejected the Authorization Response sent by the Wallet because it was deemed invalid. |
40
+ | `*` | `ERR_RP_GENERIC_ERROR` | This is a generic error code to map unexpected errors that occurred when interacting with the Relying Party. |
41
+
42
+
26
43
  ## Examples
27
44
 
28
45
  <details>
29
46
  <summary>Remote Presentation flow</summary>
30
47
 
48
+ **Note:** To successfully complete a remote presentation, the Wallet Instance must be in a valid state with a valid Wallet Instance Attestation.
49
+
31
50
  ```ts
32
- // Scan e retrive qr-code, decode it and get its parameters
33
- const {requestUri, clientId} = ...
34
-
35
- // Retrieve the integrity key tag from the store and create its context
36
- const integrityKeyTag = "example"; // Let's assume this is the key tag used to create the wallet instance
37
- const integrityContext = getIntegrityContext(integrityKeyTag);
38
-
39
- // Let's assume the key esists befor starting the presentation process
40
- const wiaCryptoContext = createCryptoContextFor(WIA_KEYTAG);
41
-
42
- const { WALLET_PROVIDER_BASE_URL, WALLET_EAA_PROVIDER_BASE_URL, REDIRECT_URI } =
43
- env; // Let's assume these are the environment variables
44
-
45
- /**
46
- * Obtains a new Wallet Instance Attestation.
47
- * WARNING: The integrity context must be the same used when creating the Wallet Instance with the same keytag.
48
- */
49
- const walletInstanceAttestation =
50
- await WalletInstanceAttestation.getAttestation({
51
- wiaCryptoContext,
52
- integrityContext,
53
- walletProviderBaseUrl: WALLET_PROVIDER_BASE_URL,
54
- appFetch,
55
- });
51
+ // Retrieve and scan the qr-code, decode it and get its parameters
52
+ const qrCodeParams = decodeQrCode(qrCode)
56
53
 
57
54
  // Start the issuance flow
58
- const { requestURI, clientId } = Credential.Presentation.startFlowFromQR(requestUri, clientId);
55
+ const {
56
+ request_uri,
57
+ client_id,
58
+ request_uri_method,
59
+ state
60
+ } = Credential.Presentation.startFlowFromQR(qrCodeParams);
59
61
 
60
- // If use trust federation: Evaluate issuer trust
61
- const { rpConf } = await Credential.Presentation.evaluateRelyingPartyTrust(clientId);
62
+ // Get the Relying Party's Entity Configuration and evaluate trust
63
+ const { rpConf } = await Credential.Presentation.evaluateRelyingPartyTrust(client_id);
62
64
 
65
+ // Get the Request Object from the RP
63
66
  const { requestObjectEncodedJwt } =
64
- await Credential.Presentation.getRequestObject(requestURI, {
65
- appFetch: appFetch
66
- });
67
-
68
- // Retrieve RP JWK
69
- // If use trust federation: Fetch Jwks from rpConf
70
- const jwks = await Credential.Presentation.fetchJwksFromConfig(rpConf);
67
+ await Credential.Presentation.getRequestObject(request_uri);
71
68
 
72
- // If not use trust: Fetch Jwks from request object
73
- const jwks = await Credential.Presentation.fetchJwksFromRequestObject(
69
+ // Validate the Request Object
70
+ const { requestObject } = await Credential.Presentation.verifyRequestObject(
74
71
  requestObjectEncodedJwt,
75
- { context: { appFetch } }
72
+ { clientId: client_id, rpConf }
76
73
  );
77
74
 
78
- // Verify signature Request Object
79
- const { requestObject } =
80
- await Credential.Presentation.verifyRequestObjectSignature(
81
- requestObjectEncodedJwt,
82
- jwks.keys
83
- );
75
+ // All the credentials that might be requested by the Relying Party
76
+ const credentialsSdJwt = [
77
+ ["credential1_keytag", "eyJraWQiOiItRl82VWdhOG4zVmVnalkyVTdZVUhLMXpMb2FELU5QVGM2M1JNSVNuTGF3IiwidHlwIjoidmMrc2Qtand0IiwiYWxnIjoiRVMyNTYifQ.eyJfc2"],
78
+ ["credential2_keytag", "eyJ0eXAiOiJ2YytzZC1qd3QiLCJhbGciOiJFUzI1NiIsImtpZCI6Ii1GXzZVZ2E4bjNWZWdqWTJVN1lVSEsxekxvYUQtTlBUYzYzUk1JU25MYXcifQ.ew0KIC"]
79
+ ];
84
80
 
85
-
86
- const { presentationDefinition } = await Credential.Presentation.fetchPresentDefinition(
87
- requestObject,
88
- {
89
- appFetch: appFetch,
90
- },
91
- rpConf // If trust federation is used
81
+ const result = Credential.Presentation.evaluateDcqlQuery(
82
+ credentialsSdJwt,
83
+ requestObject.dcql_query as DcqlQuery
92
84
  );
93
85
 
94
- // For each credential, find it and evaluate input descriptor and disclosures
95
- const { requiredDisclosures } = Credential.Presentation.evaluateInputDescriptionForSdJwt4VC(
96
- inputDescriptor,
97
- credential.payload,
98
- disclosures
99
- );
86
+ const credentialsToPresent = result.map(
87
+ ({ requiredDisclosures, ...rest }) => ({
88
+ ...rest,
89
+ requestedClaims: requiredDisclosures.map(([, claimName]) => claimName),
90
+ })
91
+ );
100
92
 
101
- // After confirm disclosures in app
102
- const authResponse = Credential.Presentation.sendAuthorizationResponse(
103
- requestObject,
104
- presentationDefinition,
105
- jwks,
106
- [credential, disclosuresRequested, { appFetch: appFetch }]
93
+ const remotePresentations =
94
+ await Credential.Presentation.prepareRemotePresentations(
95
+ credentialsToPresent,
96
+ requestObject.nonce,
97
+ requestObject.client_id
107
98
  );
108
99
 
109
-
100
+ const authResponse = await Credential.Presentation.sendAuthorizationResponse(
101
+ requestObject,
102
+ remotePresentations,
103
+ rpConf
104
+ );
110
105
  ```
111
106
 
112
- </details>
107
+ </details>
@@ -3,8 +3,16 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.UnverifiedEntityError = exports.NoSuitableKeysFoundInEntityConfiguration = exports.MissingDataError = exports.CredentialNotFoundError = exports.AuthRequestDecodeError = void 0;
6
+ exports.CredentialsNotFoundError = exports.AuthRequestDecodeError = void 0;
7
+ Object.defineProperty(exports, "DcqlError", {
8
+ enumerable: true,
9
+ get: function () {
10
+ return _dcql.DcqlError;
11
+ }
12
+ });
13
+ exports.NoSuitableKeysFoundInEntityConfiguration = exports.MissingDataError = exports.InvalidRequestObjectError = exports.InvalidQRCodeError = void 0;
7
14
  var _errors = require("../../utils/errors");
15
+ var _dcql = require("dcql");
8
16
  /**
9
17
  * An error subclass thrown when auth request decode fail
10
18
  *
@@ -47,19 +55,34 @@ class NoSuitableKeysFoundInEntityConfiguration extends _errors.IoWalletError {
47
55
  }
48
56
 
49
57
  /**
50
- * When the entity is unverified because the Relying Party is not trusted.
58
+ * When a QR code is not valid.
51
59
  *
52
60
  */
53
61
  exports.NoSuitableKeysFoundInEntityConfiguration = NoSuitableKeysFoundInEntityConfiguration;
54
- class UnverifiedEntityError extends _errors.IoWalletError {
55
- code = "ERR_UNVERIFIED_RP_ENTITY";
62
+ class InvalidQRCodeError extends _errors.IoWalletError {
63
+ code = "ERR_INVALID_QR_CODE";
64
+
65
+ /** Detailed reason for the QR code validation failure. */
56
66
 
57
- /**
58
- * @param reason A description of why the entity cannot be verified.
59
- */
60
67
  constructor(reason) {
61
- const message = `Unverified entity: ${reason}.`;
68
+ super("Invalid QR code");
69
+ this.reason = reason;
70
+ }
71
+ }
72
+
73
+ /**
74
+ * When the Request Object sent by the Relying Party is not valid
75
+ */
76
+ exports.InvalidQRCodeError = InvalidQRCodeError;
77
+ class InvalidRequestObjectError extends _errors.IoWalletError {
78
+ code = "ERR_INVALID_REQUEST_OBJECT";
79
+
80
+ /** Detailed reason for the Request Object validation failure. */
81
+
82
+ constructor(message) {
83
+ let reason = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "unspecified";
62
84
  super(message);
85
+ this.reason = reason;
63
86
  }
64
87
  }
65
88
 
@@ -67,7 +90,7 @@ class UnverifiedEntityError extends _errors.IoWalletError {
67
90
  * When some required data is missing to continue because certain attributes are not contained inside the wallet.
68
91
  *
69
92
  */
70
- exports.UnverifiedEntityError = UnverifiedEntityError;
93
+ exports.InvalidRequestObjectError = InvalidRequestObjectError;
71
94
  class MissingDataError extends _errors.IoWalletError {
72
95
  code = "ERR_MISSING_DATA";
73
96
 
@@ -79,22 +102,20 @@ class MissingDataError extends _errors.IoWalletError {
79
102
  super(message);
80
103
  }
81
104
  }
82
-
105
+ exports.MissingDataError = MissingDataError;
83
106
  /**
84
- * When a credential is not found in the wallet.
85
- *
107
+ * Error thrown when one or more credentials cannot be found in the wallet
108
+ * and the presentation request cannot be satisfied.
86
109
  */
87
- exports.MissingDataError = MissingDataError;
88
- class CredentialNotFoundError extends _errors.IoWalletError {
89
- code = "ERR_CREDENTIAL_NOT_FOUND";
90
-
110
+ class CredentialsNotFoundError extends _errors.IoWalletError {
111
+ code = "ERR_CREDENTIALS_NOT_FOUND";
91
112
  /**
92
- * @param credentialId The ID of the credential that was not found.
113
+ * @param details The details of the credentials that could not be found.
93
114
  */
94
- constructor(credentialId) {
95
- const message = `Credential not found: ${credentialId}.`;
96
- super(message);
115
+ constructor(details) {
116
+ super("One or more credentials cannot be found in the wallet");
117
+ this.details = details;
97
118
  }
98
119
  }
99
- exports.CredentialNotFoundError = CredentialNotFoundError;
120
+ exports.CredentialsNotFoundError = CredentialsNotFoundError;
100
121
  //# sourceMappingURL=errors.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_errors","require","AuthRequestDecodeError","IoWalletError","code","constructor","message","claim","arguments","length","undefined","reason","serializeAttrs","exports","NoSuitableKeysFoundInEntityConfiguration","scenario","UnverifiedEntityError","MissingDataError","missingAttributes","CredentialNotFoundError","credentialId"],"sourceRoot":"../../../../src","sources":["credential/presentation/errors.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACO,MAAMC,sBAAsB,SAASC,qBAAa,CAAC;EACxDC,IAAI,GAAG,oDAAoD;;EAE3D;;EAGA;;EAGAC,WAAWA,CACTC,OAAe,EAGf;IAAA,IAFAC,KAAa,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,aAAa;IAAA,IAC7BG,MAAc,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,aAAa;IAE9B,KAAK,CAAC,IAAAI,sBAAc,EAAC;MAAEN,OAAO;MAAEC,KAAK;MAAEI;IAAO,CAAC,CAAC,CAAC;IACjD,IAAI,CAACJ,KAAK,GAAGA,KAAK;IAClB,IAAI,CAACI,MAAM,GAAGA,MAAM;EACtB;AACF;;AAEA;AACA;AACA;AACA;AAHAE,OAAA,CAAAX,sBAAA,GAAAA,sBAAA;AAIO,MAAMY,wCAAwC,SAASX,qBAAa,CAAC;EAC1EC,IAAI,GAAG,gCAAgC;;EAEvC;AACF;AACA;EACEC,WAAWA,CAACU,QAAgB,EAAE;IAC5B,MAAMT,OAAO,GAAI,0DAAyDS,QAAS,IAAG;IACtF,KAAK,CAACT,OAAO,CAAC;EAChB;AACF;;AAEA;AACA;AACA;AACA;AAHAO,OAAA,CAAAC,wCAAA,GAAAA,wCAAA;AAIO,MAAME,qBAAqB,SAASb,qBAAa,CAAC;EACvDC,IAAI,GAAG,0BAA0B;;EAEjC;AACF;AACA;EACEC,WAAWA,CAACM,MAAc,EAAE;IAC1B,MAAML,OAAO,GAAI,sBAAqBK,MAAO,GAAE;IAC/C,KAAK,CAACL,OAAO,CAAC;EAChB;AACF;;AAEA;AACA;AACA;AACA;AAHAO,OAAA,CAAAG,qBAAA,GAAAA,qBAAA;AAIO,MAAMC,gBAAgB,SAASd,qBAAa,CAAC;EAClDC,IAAI,GAAG,kBAAkB;;EAEzB;AACF;AACA;EACEC,WAAWA,CAACa,iBAAyB,EAAE;IACrC,MAAMZ,OAAO,GAAI,kCAAiCY,iBAAkB,GAAE;IACtE,KAAK,CAACZ,OAAO,CAAC;EAChB;AACF;;AAEA;AACA;AACA;AACA;AAHAO,OAAA,CAAAI,gBAAA,GAAAA,gBAAA;AAIO,MAAME,uBAAuB,SAAShB,qBAAa,CAAC;EACzDC,IAAI,GAAG,0BAA0B;;EAEjC;AACF;AACA;EACEC,WAAWA,CAACe,YAAoB,EAAE;IAChC,MAAMd,OAAO,GAAI,yBAAwBc,YAAa,GAAE;IACxD,KAAK,CAACd,OAAO,CAAC;EAChB;AACF;AAACO,OAAA,CAAAM,uBAAA,GAAAA,uBAAA"}
1
+ {"version":3,"names":["_errors","require","_dcql","AuthRequestDecodeError","IoWalletError","code","constructor","message","claim","arguments","length","undefined","reason","serializeAttrs","exports","NoSuitableKeysFoundInEntityConfiguration","scenario","InvalidQRCodeError","InvalidRequestObjectError","MissingDataError","missingAttributes","CredentialsNotFoundError","details"],"sourceRoot":"../../../../src","sources":["credential/presentation/errors.ts"],"mappings":";;;;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAEA;AACA;AACA;AACA;AACO,MAAME,sBAAsB,SAASC,qBAAa,CAAC;EACxDC,IAAI,GAAG,oDAAoD;;EAE3D;;EAGA;;EAGAC,WAAWA,CACTC,OAAe,EAGf;IAAA,IAFAC,KAAa,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,aAAa;IAAA,IAC7BG,MAAc,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,aAAa;IAE9B,KAAK,CAAC,IAAAI,sBAAc,EAAC;MAAEN,OAAO;MAAEC,KAAK;MAAEI;IAAO,CAAC,CAAC,CAAC;IACjD,IAAI,CAACJ,KAAK,GAAGA,KAAK;IAClB,IAAI,CAACI,MAAM,GAAGA,MAAM;EACtB;AACF;;AAEA;AACA;AACA;AACA;AAHAE,OAAA,CAAAX,sBAAA,GAAAA,sBAAA;AAIO,MAAMY,wCAAwC,SAASX,qBAAa,CAAC;EAC1EC,IAAI,GAAG,gCAAgC;;EAEvC;AACF;AACA;EACEC,WAAWA,CAACU,QAAgB,EAAE;IAC5B,MAAMT,OAAO,GAAI,0DAAyDS,QAAS,IAAG;IACtF,KAAK,CAACT,OAAO,CAAC;EAChB;AACF;;AAEA;AACA;AACA;AACA;AAHAO,OAAA,CAAAC,wCAAA,GAAAA,wCAAA;AAIO,MAAME,kBAAkB,SAASb,qBAAa,CAAC;EACpDC,IAAI,GAAG,qBAAqB;;EAE5B;;EAGAC,WAAWA,CAACM,MAAc,EAAE;IAC1B,KAAK,CAAC,iBAAiB,CAAC;IACxB,IAAI,CAACA,MAAM,GAAGA,MAAM;EACtB;AACF;;AAEA;AACA;AACA;AAFAE,OAAA,CAAAG,kBAAA,GAAAA,kBAAA;AAGO,MAAMC,yBAAyB,SAASd,qBAAa,CAAC;EAC3DC,IAAI,GAAG,4BAA4B;;EAEnC;;EAGAC,WAAWA,CAACC,OAAe,EAA0B;IAAA,IAAxBK,MAAM,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,aAAa;IACjD,KAAK,CAACF,OAAO,CAAC;IACd,IAAI,CAACK,MAAM,GAAGA,MAAM;EACtB;AACF;;AAEA;AACA;AACA;AACA;AAHAE,OAAA,CAAAI,yBAAA,GAAAA,yBAAA;AAIO,MAAMC,gBAAgB,SAASf,qBAAa,CAAC;EAClDC,IAAI,GAAG,kBAAkB;;EAEzB;AACF;AACA;EACEC,WAAWA,CAACc,iBAAyB,EAAE;IACrC,MAAMb,OAAO,GAAI,kCAAiCa,iBAAkB,GAAE;IACtE,KAAK,CAACb,OAAO,CAAC;EAChB;AACF;AAACO,OAAA,CAAAK,gBAAA,GAAAA,gBAAA;AAQD;AACA;AACA;AACA;AACO,MAAME,wBAAwB,SAASjB,qBAAa,CAAC;EAC1DC,IAAI,GAAG,2BAA2B;EAGlC;AACF;AACA;EACEC,WAAWA,CAACgB,OAAyB,EAAE;IACrC,KAAK,CAAC,uDAAuD,CAAC;IAC9D,IAAI,CAACA,OAAO,GAAGA,OAAO;EACxB;AACF;AAACR,OAAA,CAAAO,wBAAA,GAAAA,wBAAA"}
@@ -22,34 +22,34 @@ Object.defineProperty(exports, "evaluateRelyingPartyTrust", {
22
22
  return _evaluateRpTrust.evaluateRelyingPartyTrust;
23
23
  }
24
24
  });
25
- Object.defineProperty(exports, "fetchJwksFromConfig", {
25
+ Object.defineProperty(exports, "fetchPresentDefinition", {
26
26
  enumerable: true,
27
27
  get: function () {
28
- return _retrieveRpJwks.fetchJwksFromConfig;
28
+ return _fetchPresentationDefinition.fetchPresentDefinition;
29
29
  }
30
30
  });
31
- Object.defineProperty(exports, "fetchJwksFromRequestObject", {
31
+ Object.defineProperty(exports, "getJwksFromConfig", {
32
32
  enumerable: true,
33
33
  get: function () {
34
- return _retrieveRpJwks.fetchJwksFromRequestObject;
34
+ return _retrieveRpJwks.getJwksFromConfig;
35
35
  }
36
36
  });
37
- Object.defineProperty(exports, "fetchPresentDefinition", {
37
+ Object.defineProperty(exports, "getRequestObject", {
38
38
  enumerable: true,
39
39
  get: function () {
40
- return _fetchPresentationDefinition.fetchPresentDefinition;
40
+ return _getRequestObject.getRequestObject;
41
41
  }
42
42
  });
43
- Object.defineProperty(exports, "getRequestObject", {
43
+ Object.defineProperty(exports, "prepareLegacyRemotePresentations", {
44
44
  enumerable: true,
45
45
  get: function () {
46
- return _getRequestObject.getRequestObject;
46
+ return _evaluateInputDescriptor.prepareLegacyRemotePresentations;
47
47
  }
48
48
  });
49
49
  Object.defineProperty(exports, "prepareRemotePresentations", {
50
50
  enumerable: true,
51
51
  get: function () {
52
- return _sendAuthorizationResponse.prepareRemotePresentations;
52
+ return _evaluateDcqlQuery.prepareRemotePresentations;
53
53
  }
54
54
  });
55
55
  Object.defineProperty(exports, "sendAuthorizationErrorResponse", {
@@ -64,10 +64,10 @@ Object.defineProperty(exports, "sendAuthorizationResponse", {
64
64
  return _sendAuthorizationResponse.sendAuthorizationResponse;
65
65
  }
66
66
  });
67
- Object.defineProperty(exports, "sendAuthorizationResponseDcql", {
67
+ Object.defineProperty(exports, "sendLegacyAuthorizationResponse", {
68
68
  enumerable: true,
69
69
  get: function () {
70
- return _sendAuthorizationResponse.sendAuthorizationResponseDcql;
70
+ return _sendAuthorizationResponse.sendLegacyAuthorizationResponse;
71
71
  }
72
72
  });
73
73
  Object.defineProperty(exports, "startFlowFromQR", {
@@ -76,10 +76,10 @@ Object.defineProperty(exports, "startFlowFromQR", {
76
76
  return _startFlow.startFlowFromQR;
77
77
  }
78
78
  });
79
- Object.defineProperty(exports, "verifyRequestObjectSignature", {
79
+ Object.defineProperty(exports, "verifyRequestObject", {
80
80
  enumerable: true,
81
81
  get: function () {
82
- return _verifyRequestObject.verifyRequestObjectSignature;
82
+ return _verifyRequestObject.verifyRequestObject;
83
83
  }
84
84
  });
85
85
  var _startFlow = require("./01-start-flow");
@@ -1 +1 @@
1
- {"version":3,"names":["_startFlow","require","_evaluateRpTrust","_getRequestObject","_retrieveRpJwks","_verifyRequestObject","_fetchPresentationDefinition","_evaluateInputDescriptor","_evaluateDcqlQuery","_sendAuthorizationResponse","Errors","_interopRequireWildcard","exports","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set"],"sourceRoot":"../../../../src","sources":["credential/presentation/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA;AAIA,IAAAE,iBAAA,GAAAF,OAAA;AAIA,IAAAG,eAAA,GAAAH,OAAA;AAKA,IAAAI,oBAAA,GAAAJ,OAAA;AAIA,IAAAK,4BAAA,GAAAL,OAAA;AAIA,IAAAM,wBAAA,GAAAN,OAAA;AAIA,IAAAO,kBAAA,GAAAP,OAAA;AAIA,IAAAQ,0BAAA,GAAAR,OAAA;AASA,IAAAS,MAAA,GAAAC,uBAAA,CAAAV,OAAA;AAAmCW,OAAA,CAAAF,MAAA,GAAAA,MAAA;AAAA,SAAAG,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAH,wBAAAO,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CAAAL,GAAA,SAAAM,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAX,GAAA,QAAAW,GAAA,kBAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAd,GAAA,EAAAW,GAAA,SAAAI,IAAA,GAAAR,qBAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAV,GAAA,EAAAW,GAAA,cAAAI,IAAA,KAAAA,IAAA,CAAAV,GAAA,IAAAU,IAAA,CAAAC,GAAA,KAAAR,MAAA,CAAAC,cAAA,CAAAH,MAAA,EAAAK,GAAA,EAAAI,IAAA,YAAAT,MAAA,CAAAK,GAAA,IAAAX,GAAA,CAAAW,GAAA,SAAAL,MAAA,CAAAJ,OAAA,GAAAF,GAAA,MAAAG,KAAA,IAAAA,KAAA,CAAAa,GAAA,CAAAhB,GAAA,EAAAM,MAAA,YAAAA,MAAA"}
1
+ {"version":3,"names":["_startFlow","require","_evaluateRpTrust","_getRequestObject","_retrieveRpJwks","_verifyRequestObject","_fetchPresentationDefinition","_evaluateInputDescriptor","_evaluateDcqlQuery","_sendAuthorizationResponse","Errors","_interopRequireWildcard","exports","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set"],"sourceRoot":"../../../../src","sources":["credential/presentation/index.ts"],"mappings":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,CAAAE,wBAAA,CAAAV,GAAA,EAAAW,GAAA,cAAAI,IAAA,KAAAA,IAAA,CAAAV,GAAA,IAAAU,IAAA,CAAAC,GAAA,KAAAR,MAAA,CAAAC,cAAA,CAAAH,MAAA,EAAAK,GAAA,EAAAI,IAAA,YAAAT,MAAA,CAAAK,GAAA,IAAAX,GAAA,CAAAW,GAAA,SAAAL,MAAA,CAAAJ,OAAA,GAAAF,GAAA,MAAAG,KAAA,IAAAA,KAAA,CAAAa,GAAA,CAAAhB,GAAA,EAAAM,MAAA,YAAAA,MAAA"}
@@ -3,10 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.RequestObject = exports.PresentationDefinition = exports.InputDescriptor = exports.ErrorResponse = exports.DirectAuthorizationBodyPayload = void 0;
6
+ exports.WalletMetadata = exports.RequestObjectWalletCapabilities = exports.RequestObject = exports.PresentationDefinition = exports.InputDescriptor = exports.ErrorResponse = exports.DirectAuthorizationBodyPayload = void 0;
7
7
  var _types = require("../../sd-jwt/types");
8
8
  var z = _interopRequireWildcard(require("zod"));
9
- var _jwk = require("../../utils/jwk");
10
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); }
11
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; }
12
11
  /**
@@ -15,6 +14,13 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
15
14
 
16
15
  /**
17
16
  * A object that associate the information needed to multiple remote presentation
17
+ * Used with `presentation_definition`
18
+ * @deprecated Use `RemotePresentation`
19
+ */
20
+
21
+ /**
22
+ * A object that associate the information needed to multiple remote presentation
23
+ * Used with DCQL queries
18
24
  */
19
25
 
20
26
  const Fields = z.object({
@@ -82,52 +88,70 @@ const PresentationDefinition = z.object({
82
88
  });
83
89
  exports.PresentationDefinition = PresentationDefinition;
84
90
  const RequestObject = z.object({
85
- iss: z.string().optional(),
86
- //optional by RFC 7519, mandatory for Potential
87
- iat: _types.UnixTime.optional(),
88
- exp: _types.UnixTime.optional(),
91
+ iss: z.string(),
92
+ iat: _types.UnixTime,
93
+ exp: _types.UnixTime,
89
94
  state: z.string().optional(),
90
95
  nonce: z.string(),
91
96
  response_uri: z.string(),
97
+ response_uri_method: z.string().optional(),
92
98
  response_type: z.literal("vp_token"),
93
- response_mode: z.enum(["direct_post.jwt", "direct_post"]),
99
+ response_mode: z.literal("direct_post.jwt"),
94
100
  client_id: z.string(),
95
- client_id_scheme: z.string().optional(),
96
- // previous z.literal("entity_id"),
97
- client_metadata: z.object({
98
- authorization_encrypted_response_alg: z.string().optional(),
99
- authorization_encrypted_response_enc: z.string().optional(),
100
- jwks_uri: z.string().optional(),
101
- jwks: _jwk.JWKS.optional()
102
- }).optional(),
103
- // previous z.literal("entity_id"),
104
101
  dcql_query: z.record(z.string(), z.any()).optional(),
105
102
  // Validation happens within the `dcql` library, no need to duplicate it here
106
103
  scope: z.string().optional(),
107
104
  presentation_definition: PresentationDefinition.optional()
108
105
  });
106
+ exports.RequestObject = RequestObject;
107
+ const WalletMetadata = z.object({
108
+ presentation_definition_uri_supported: z.boolean().optional(),
109
+ client_id_schemes_supported: z.array(z.string()).optional(),
110
+ request_object_signing_alg_values_supported: z.array(z.string()).optional(),
111
+ vp_formats_supported: z.record(z.string(),
112
+ // TODO [SIW-2110]: use explicit credential format?
113
+ z.object({
114
+ "sd-jwt_alg_values": z.array(z.string()).optional() // alg_values_supported?
115
+ }))
116
+ // TODO [SIW-2110]: include other metadata?
117
+ });
118
+
119
+ /**
120
+ * Wallet capabilities that must be submitted to get the Request Object
121
+ * via POST request when the `request_uri_method` is `post`.
122
+ */
123
+ exports.WalletMetadata = WalletMetadata;
124
+ const RequestObjectWalletCapabilities = z.object({
125
+ wallet_metadata: WalletMetadata,
126
+ wallet_nonce: z.string().optional()
127
+ });
109
128
 
110
129
  /**
111
130
  * This type models the possible error responses the OpenID4VP protocol allows for a presentation of a credential.
112
- * See https://openid.github.io/OpenID4VP/openid-4-verifiable-presentations-wg-draft.html#name-error-response for more information.
131
+ * When the Wallet encounters one of these errors, it will notify the Relying Party through the `response_uri` endpoint.
132
+ * See https://italia.github.io/eid-wallet-it-docs/versione-corrente/en/pid-eaa-presentation.html#authorization-response-errors for more information.
113
133
  */
114
- exports.RequestObject = RequestObject;
115
- const ErrorResponse = z.enum(["invalid_scope", "invalid_request", "invalid_client", "access_denied"]);
134
+ exports.RequestObjectWalletCapabilities = RequestObjectWalletCapabilities;
135
+ const ErrorResponse = z.enum(["invalid_request_object", "invalid_request_uri", "vp_formats_not_supported", "invalid_request", "access_denied", "invalid_client"]);
116
136
 
117
137
  /**
118
- * Type that defines the possible payload formats accepted by {@link buildDirectPostJwtBody} and {@link buildDirectPostBody}
138
+ * @deprecated Use `DirectAuthorizationBodyPayload`
119
139
  */
120
140
  exports.ErrorResponse = ErrorResponse;
141
+ const LegacyDirectAuthorizationBodyPayload = z.object({
142
+ vp_token: z.union([z.string(), z.array(z.string())]).optional(),
143
+ presentation_submission: z.record(z.string(), z.unknown())
144
+ });
145
+
146
+ /**
147
+ * Authorization Response payload sent to the Relying Party.
148
+ */
149
+
121
150
  const DirectAuthorizationBodyPayload = z.union([z.object({
122
- vp_token: z.union([z.string(),
123
- // Presentation Definition with one credential
124
- z.array(z.string()),
125
- // Presentation Definition with more credential
126
- z.record(z.string(), z.string()) // DCQL query
127
- ]).optional(),
128
- presentation_submission: z.record(z.string(), z.unknown()).optional()
151
+ vp_token: z.record(z.string(), z.string())
129
152
  }), z.object({
130
- error: ErrorResponse
131
- })]);
153
+ error: ErrorResponse,
154
+ error_description: z.string()
155
+ }), LegacyDirectAuthorizationBodyPayload]);
132
156
  exports.DirectAuthorizationBodyPayload = DirectAuthorizationBodyPayload;
133
157
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_types","require","z","_interopRequireWildcard","_jwk","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","Fields","object","path","array","string","min","id","optional","purpose","name","filter","any","boolean","intent_to_retain","Constraints","fields","limit_disclosure","enum","InputDescriptor","format","record","constraints","group","exports","SubmissionRequirement","rule","from","from_nested","count","number","PresentationDefinition","input_descriptors","submission_requirements","RequestObject","iss","iat","UnixTime","exp","state","nonce","response_uri","response_type","literal","response_mode","client_id","client_id_scheme","client_metadata","authorization_encrypted_response_alg","authorization_encrypted_response_enc","jwks_uri","jwks","JWKS","dcql_query","scope","presentation_definition","ErrorResponse","DirectAuthorizationBodyPayload","union","vp_token","presentation_submission","unknown","error"],"sourceRoot":"../../../../src","sources":["credential/presentation/types.ts"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,CAAA,GAAAC,uBAAA,CAAAF,OAAA;AACA,IAAAG,IAAA,GAAAH,OAAA;AAAuC,SAAAI,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,C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6C,MAAM,CAAC7C,CAAC,CAAC6B,MAAM,CAAC,CAAC,EAAE7B,CAAC,CAACqF,OAAO,CAAC,CAAC,CAAC,CAACrD,QAAQ,CAAC;AACtE,CAAC,CAAC,EACFhC,CAAC,CAAC0B,MAAM,CAAC;EAAE4D,KAAK,EAAEN;AAAc,CAAC,CAAC,CACnC,CAAC;AAAChC,OAAA,CAAAiC,8BAAA,GAAAA,8BAAA"}
1
+ {"version":3,"names":["_types","require","z","_interopRequireWildcard","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","Fields","object","path","array","string","min","id","optional","purpose","name","filter","any","boolean","intent_to_retain","Constraints","fields","limit_disclosure","enum","InputDescriptor","format","record","constraints","group","exports","SubmissionRequirement","rule","from","from_nested","count","number","PresentationDefinition","input_descriptors","submission_requirements","RequestObject","iss","iat","UnixTime","exp","state","nonce","response_uri","response_uri_method","response_type","literal","response_mode","client_id","dcql_query","scope","presentation_definition","WalletMetadata","presentation_definition_uri_supported","client_id_schemes_supported","request_object_signing_alg_values_supported","vp_formats_supported","RequestObjectWalletCapabilities","wallet_metadata","wallet_nonce","ErrorResponse","LegacyDirectAuthorizationBodyPayload","vp_token","union","presentation_submission","unknown","DirectAuthorizationBodyPayload","error","error_description"],"sourceRoot":"../../../../src","sources":["credential/presentation/types.ts"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,CAAA,GAAAC,uBAAA,CAAAF,OAAA;AAAyB,SAAAG,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAF,wBAAAM,GAAA,EAAAJ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AAC,CAACoF,KAAK,CAAC,CAACpF,CAAC,CAAC4B,MAAM,CAAC,CAAC,EAAE5B,CAAC,CAAC2B,KAAK,CAAC3B,CAAC,CAAC4B,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAACG,QAAQ,CAAC,CAAC;EAC/DsD,uBAAuB,EAAErF,CAAC,CAAC4C,MAAM,CAAC5C,CAAC,CAAC4B,MAAM,CAAC,CAAC,EAAE5B,CAAC,CAACsF,OAAO,CAAC,CAAC;AAC3D,CAAC,CAAC;;AAEF;AACA;AACA;;AAIO,MAAMC,8BAA8B,GAAGvF,CAAC,CAACoF,KAAK,CAAC,CACpDpF,CAAC,CAACyB,MAAM,CAAC;EACP0D,QAAQ,EAAEnF,CAAC,CAAC4C,MAAM,CAAC5C,CAAC,CAAC4B,MAAM,CAAC,CAAC,EAAE5B,CAAC,CAAC4B,MAAM,CAAC,CAAC;AAC3C,CAAC,CAAC,EACF5B,CAAC,CAACyB,MAAM,CAAC;EAAE+D,KAAK,EAAEP,aAAa;EAAEQ,iBAAiB,EAAEzF,CAAC,CAAC4B,MAAM,CAAC;AAAE,CAAC,CAAC,EACjEsD,oCAAoC,CACrC,CAAC;AAACnC,OAAA,CAAAwC,8BAAA,GAAAA,8BAAA"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=01-start-flow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../../src","sources":["credential/status/01-start-flow.ts"],"mappings":""}
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.statusAttestation = void 0;
7
+ var _misc = require("../../utils/misc");
8
+ var _ioReactNativeJwt = require("@pagopa/io-react-native-jwt");
9
+ var _uuid = require("uuid");
10
+ var _types = require("./types");
11
+ var _errors = require("../../utils/errors");
12
+ var _logging = require("../../utils/logging");
13
+ /**
14
+ * WARNING: This function must be called after {@link startFlow}.
15
+ * Verify the status of the credential attestation.
16
+ * @param issuerConf - The issuer's configuration
17
+ * @param credential - The credential to be verified
18
+ * @param credentialCryptoContext - The credential's crypto context
19
+ * @param context.appFetch (optional) fetch api implementation. Default: built-in fetch
20
+ * @throws {IssuerResponseError} with a specific code for more context
21
+ * @returns The credential status attestation
22
+ */
23
+ const statusAttestation = async function (issuerConf, credential, credentialCryptoContext) {
24
+ let appFetch = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : fetch;
25
+ const jwk = await credentialCryptoContext.getPublicKey();
26
+ const credentialHash = await (0, _misc.getCredentialHashWithouDiscloures)(credential);
27
+ const statusAttUrl = issuerConf.openid_credential_issuer.status_attestation_endpoint;
28
+ const credentialPop = await new _ioReactNativeJwt.SignJWT(credentialCryptoContext).setPayload({
29
+ aud: statusAttUrl,
30
+ jti: (0, _uuid.v4)().toString(),
31
+ credential_hash: credentialHash,
32
+ credential_hash_alg: "S256"
33
+ }).setProtectedHeader({
34
+ alg: "ES256",
35
+ typ: "status-attestation-request+jwt",
36
+ kid: jwk.kid
37
+ }).setIssuedAt().setExpirationTime("5m").sign();
38
+ const body = {
39
+ credential_pop: credentialPop
40
+ };
41
+ _logging.Logger.log(_logging.LogLevel.DEBUG, `Credential pop: ${credentialPop}`);
42
+ const result = await appFetch(statusAttUrl, {
43
+ method: "POST",
44
+ headers: {
45
+ "Content-Type": "application/json"
46
+ },
47
+ body: JSON.stringify(body)
48
+ }).then((0, _misc.hasStatusOrThrow)(201)).then(raw => raw.json()).then(json => _types.StatusAttestationResponse.parse(json)).catch(handleStatusAttestationError);
49
+ return {
50
+ statusAttestation: result.status_attestation
51
+ };
52
+ };
53
+
54
+ /**
55
+ * Handle the status attestation error by mapping it to a custom exception.
56
+ * If the error is not an instance of {@link UnexpectedStatusCodeError}, it is thrown as is.
57
+ * @param e - The error to be handled
58
+ * @throws {IssuerResponseError} with a specific code for more context
59
+ */
60
+ exports.statusAttestation = statusAttestation;
61
+ const handleStatusAttestationError = e => {
62
+ if (!(e instanceof _errors.UnexpectedStatusCodeError)) {
63
+ throw e;
64
+ }
65
+ throw new _errors.ResponseErrorBuilder(_errors.IssuerResponseError).handle(404, {
66
+ code: _errors.IssuerResponseErrorCodes.CredentialInvalidStatus,
67
+ message: "Invalid status found for the given credential"
68
+ }).handle("*", {
69
+ code: _errors.IssuerResponseErrorCodes.StatusAttestationRequestFailed,
70
+ message: `Unable to obtain the status attestation for the given credential`
71
+ }).buildFrom(e);
72
+ };
73
+ //# sourceMappingURL=02-status-attestation.js.map