@pagopa/io-react-native-wallet 1.7.1 → 2.0.0-next.1

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 (443) 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/trust/README.md +147 -0
  77. package/lib/commonjs/trust/chain.js +153 -0
  78. package/lib/commonjs/trust/chain.js.map +1 -0
  79. package/lib/commonjs/trust/errors.js +133 -0
  80. package/lib/commonjs/trust/errors.js.map +1 -0
  81. package/lib/commonjs/trust/index.js +288 -0
  82. package/lib/commonjs/trust/index.js.map +1 -0
  83. package/lib/commonjs/{entity/trust → trust}/types.js +27 -47
  84. package/lib/commonjs/trust/types.js.map +1 -0
  85. package/lib/commonjs/trust/utils.js +70 -0
  86. package/lib/commonjs/trust/utils.js.map +1 -0
  87. package/lib/commonjs/utils/crypto.js +5 -112
  88. package/lib/commonjs/utils/crypto.js.map +1 -1
  89. package/lib/commonjs/utils/decoder.js +2 -0
  90. package/lib/commonjs/utils/decoder.js.map +1 -1
  91. package/lib/commonjs/utils/error-codes.js +22 -2
  92. package/lib/commonjs/utils/error-codes.js.map +1 -1
  93. package/lib/commonjs/utils/errors.js +72 -4
  94. package/lib/commonjs/utils/errors.js.map +1 -1
  95. package/lib/commonjs/utils/logging.js +68 -0
  96. package/lib/commonjs/utils/logging.js.map +1 -0
  97. package/lib/commonjs/utils/misc.js +2 -0
  98. package/lib/commonjs/utils/misc.js.map +1 -1
  99. package/lib/commonjs/utils/par.js +17 -10
  100. package/lib/commonjs/utils/par.js.map +1 -1
  101. package/lib/commonjs/utils/string.js +1 -12
  102. package/lib/commonjs/utils/string.js.map +1 -1
  103. package/lib/commonjs/wallet-instance/index.js +14 -0
  104. package/lib/commonjs/wallet-instance/index.js.map +1 -1
  105. package/lib/commonjs/wallet-instance-attestation/README.md +8 -3
  106. package/lib/commonjs/wallet-instance-attestation/issuing.js +15 -8
  107. package/lib/commonjs/wallet-instance-attestation/issuing.js.map +1 -1
  108. package/lib/commonjs/wallet-instance-attestation/types.js +16 -20
  109. package/lib/commonjs/wallet-instance-attestation/types.js.map +1 -1
  110. package/lib/module/client/generated/wallet-provider.js +40 -15
  111. package/lib/module/client/generated/wallet-provider.js.map +1 -1
  112. package/lib/module/credential/index.js +3 -1
  113. package/lib/module/credential/index.js.map +1 -1
  114. package/lib/module/credential/issuance/02-evaluate-issuer-trust.js +20 -0
  115. package/lib/module/credential/issuance/02-evaluate-issuer-trust.js.map +1 -0
  116. package/lib/module/credential/issuance/03-start-user-authorization.js +25 -16
  117. package/lib/module/credential/issuance/03-start-user-authorization.js.map +1 -1
  118. package/lib/module/credential/issuance/04-complete-user-authorization.js +30 -18
  119. package/lib/module/credential/issuance/04-complete-user-authorization.js.map +1 -1
  120. package/lib/module/credential/issuance/05-authorize-access.js +17 -11
  121. package/lib/module/credential/issuance/05-authorize-access.js.map +1 -1
  122. package/lib/module/credential/issuance/06-obtain-credential.js +36 -28
  123. package/lib/module/credential/issuance/06-obtain-credential.js.map +1 -1
  124. package/lib/module/credential/issuance/07-verify-and-parse-credential.js +27 -205
  125. package/lib/module/credential/issuance/07-verify-and-parse-credential.js.map +1 -1
  126. package/lib/module/credential/issuance/README.md +23 -20
  127. package/lib/module/credential/issuance/const.js +1 -1
  128. package/lib/module/credential/issuance/const.js.map +1 -1
  129. package/lib/module/credential/issuance/index.js +2 -2
  130. package/lib/module/credential/issuance/index.js.map +1 -1
  131. package/lib/module/credential/presentation/01-start-flow.js +14 -15
  132. package/lib/module/credential/presentation/01-start-flow.js.map +1 -1
  133. package/lib/module/credential/presentation/02-evaluate-rp-trust.js +5 -3
  134. package/lib/module/credential/presentation/02-evaluate-rp-trust.js.map +1 -1
  135. package/lib/module/credential/presentation/03-get-request-object.js +34 -7
  136. package/lib/module/credential/presentation/03-get-request-object.js.map +1 -1
  137. package/lib/module/credential/presentation/04-retrieve-rp-jwks.js +2 -124
  138. package/lib/module/credential/presentation/04-retrieve-rp-jwks.js.map +1 -1
  139. package/lib/module/credential/presentation/05-verify-request-object.js +78 -23
  140. package/lib/module/credential/presentation/05-verify-request-object.js.map +1 -1
  141. package/lib/module/credential/presentation/06-fetch-presentation-definition.js +6 -30
  142. package/lib/module/credential/presentation/06-fetch-presentation-definition.js.map +1 -1
  143. package/lib/module/credential/presentation/07-evaluate-dcql-query.js +97 -118
  144. package/lib/module/credential/presentation/07-evaluate-dcql-query.js.map +1 -1
  145. package/lib/module/credential/presentation/07-evaluate-input-descriptor.js +83 -186
  146. package/lib/module/credential/presentation/07-evaluate-input-descriptor.js.map +1 -1
  147. package/lib/module/credential/presentation/08-send-authorization-response.js +107 -170
  148. package/lib/module/credential/presentation/08-send-authorization-response.js.map +1 -1
  149. package/lib/module/credential/presentation/README.md +74 -79
  150. package/lib/module/credential/presentation/errors.js +30 -17
  151. package/lib/module/credential/presentation/errors.js.map +1 -1
  152. package/lib/module/credential/presentation/index.js +6 -6
  153. package/lib/module/credential/presentation/index.js.map +1 -1
  154. package/lib/module/credential/presentation/types.js +49 -27
  155. package/lib/module/credential/presentation/types.js.map +1 -1
  156. package/lib/module/credential/status/01-start-flow.js +2 -0
  157. package/lib/module/credential/status/01-start-flow.js.map +1 -0
  158. package/lib/module/credential/status/02-status-attestation.js +66 -0
  159. package/lib/module/credential/status/02-status-attestation.js.map +1 -0
  160. package/lib/module/credential/status/03-verify-and-parse-status-attestation.js +49 -0
  161. package/lib/module/credential/status/03-verify-and-parse-status-attestation.js.map +1 -0
  162. package/lib/module/credential/status/README.md +67 -0
  163. package/lib/module/credential/status/index.js +5 -0
  164. package/lib/module/credential/status/index.js.map +1 -0
  165. package/lib/module/credential/status/types.js +40 -0
  166. package/lib/module/credential/status/types.js.map +1 -0
  167. package/lib/module/credential/trustmark/README.md +62 -0
  168. package/lib/module/credential/trustmark/get-credential-trustmark.js +77 -0
  169. package/lib/module/credential/trustmark/get-credential-trustmark.js.map +1 -0
  170. package/lib/module/credential/trustmark/index.js +3 -0
  171. package/lib/module/credential/trustmark/index.js.map +1 -0
  172. package/lib/module/index.js +3 -1
  173. package/lib/module/index.js.map +1 -1
  174. package/lib/module/pid/sd-jwt/types.js +16 -1
  175. package/lib/module/pid/sd-jwt/types.js.map +1 -1
  176. package/lib/module/sd-jwt/__test__/index.test.js +22 -34
  177. package/lib/module/sd-jwt/__test__/index.test.js.map +1 -1
  178. package/lib/module/sd-jwt/__test__/types.test.js +11 -23
  179. package/lib/module/sd-jwt/__test__/types.test.js.map +1 -1
  180. package/lib/module/sd-jwt/index.js +1 -7
  181. package/lib/module/sd-jwt/index.js.map +1 -1
  182. package/lib/module/sd-jwt/types.js +4 -19
  183. package/lib/module/sd-jwt/types.js.map +1 -1
  184. package/lib/module/trust/README.md +147 -0
  185. package/lib/module/trust/chain.js +145 -0
  186. package/lib/module/trust/chain.js.map +1 -0
  187. package/lib/module/trust/errors.js +115 -0
  188. package/lib/module/trust/errors.js.map +1 -0
  189. package/lib/module/trust/index.js +269 -0
  190. package/lib/module/trust/index.js.map +1 -0
  191. package/lib/module/{entity/trust → trust}/types.js +25 -46
  192. package/lib/module/trust/types.js.map +1 -0
  193. package/lib/module/trust/utils.js +60 -0
  194. package/lib/module/trust/utils.js.map +1 -0
  195. package/lib/module/utils/crypto.js +4 -107
  196. package/lib/module/utils/crypto.js.map +1 -1
  197. package/lib/module/utils/decoder.js +3 -0
  198. package/lib/module/utils/decoder.js.map +1 -1
  199. package/lib/module/utils/error-codes.js +20 -1
  200. package/lib/module/utils/error-codes.js.map +1 -1
  201. package/lib/module/utils/errors.js +61 -4
  202. package/lib/module/utils/errors.js.map +1 -1
  203. package/lib/module/utils/logging.js +62 -0
  204. package/lib/module/utils/logging.js.map +1 -0
  205. package/lib/module/utils/misc.js +2 -0
  206. package/lib/module/utils/misc.js.map +1 -1
  207. package/lib/module/utils/par.js +17 -9
  208. package/lib/module/utils/par.js.map +1 -1
  209. package/lib/module/utils/string.js +0 -10
  210. package/lib/module/utils/string.js.map +1 -1
  211. package/lib/module/wallet-instance/index.js +13 -0
  212. package/lib/module/wallet-instance/index.js.map +1 -1
  213. package/lib/module/wallet-instance-attestation/README.md +8 -3
  214. package/lib/module/wallet-instance-attestation/index.js +2 -2
  215. package/lib/module/wallet-instance-attestation/index.js.map +1 -1
  216. package/lib/module/wallet-instance-attestation/issuing.js +16 -9
  217. package/lib/module/wallet-instance-attestation/issuing.js.map +1 -1
  218. package/lib/module/wallet-instance-attestation/types.js +14 -18
  219. package/lib/module/wallet-instance-attestation/types.js.map +1 -1
  220. package/lib/typescript/client/generated/wallet-provider.d.ts +206 -51
  221. package/lib/typescript/client/generated/wallet-provider.d.ts.map +1 -1
  222. package/lib/typescript/credential/index.d.ts +3 -1
  223. package/lib/typescript/credential/index.d.ts.map +1 -1
  224. package/lib/typescript/credential/issuance/01-start-flow.d.ts +1 -1
  225. package/lib/typescript/credential/issuance/02-evaluate-issuer-trust.d.ts +19 -0
  226. package/lib/typescript/credential/issuance/02-evaluate-issuer-trust.d.ts.map +1 -0
  227. package/lib/typescript/credential/issuance/03-start-user-authorization.d.ts +3 -3
  228. package/lib/typescript/credential/issuance/03-start-user-authorization.d.ts.map +1 -1
  229. package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts +9 -9
  230. package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts.map +1 -1
  231. package/lib/typescript/credential/issuance/05-authorize-access.d.ts +3 -3
  232. package/lib/typescript/credential/issuance/05-authorize-access.d.ts.map +1 -1
  233. package/lib/typescript/credential/issuance/06-obtain-credential.d.ts +4 -4
  234. package/lib/typescript/credential/issuance/06-obtain-credential.d.ts.map +1 -1
  235. package/lib/typescript/credential/issuance/07-verify-and-parse-credential.d.ts +3 -15
  236. package/lib/typescript/credential/issuance/07-verify-and-parse-credential.d.ts.map +1 -1
  237. package/lib/typescript/credential/issuance/const.d.ts +1 -1
  238. package/lib/typescript/credential/issuance/const.d.ts.map +1 -1
  239. package/lib/typescript/credential/issuance/index.d.ts +3 -3
  240. package/lib/typescript/credential/issuance/index.d.ts.map +1 -1
  241. package/lib/typescript/credential/issuance/types.d.ts +8 -3
  242. package/lib/typescript/credential/issuance/types.d.ts.map +1 -1
  243. package/lib/typescript/credential/presentation/01-start-flow.d.ts +28 -9
  244. package/lib/typescript/credential/presentation/01-start-flow.d.ts.map +1 -1
  245. package/lib/typescript/credential/presentation/02-evaluate-rp-trust.d.ts +2 -1
  246. package/lib/typescript/credential/presentation/02-evaluate-rp-trust.d.ts.map +1 -1
  247. package/lib/typescript/credential/presentation/03-get-request-object.d.ts +7 -5
  248. package/lib/typescript/credential/presentation/03-get-request-object.d.ts.map +1 -1
  249. package/lib/typescript/credential/presentation/04-retrieve-rp-jwks.d.ts +4 -30
  250. package/lib/typescript/credential/presentation/04-retrieve-rp-jwks.d.ts.map +1 -1
  251. package/lib/typescript/credential/presentation/05-verify-request-object.d.ts +17 -4
  252. package/lib/typescript/credential/presentation/05-verify-request-object.d.ts.map +1 -1
  253. package/lib/typescript/credential/presentation/06-fetch-presentation-definition.d.ts +4 -9
  254. package/lib/typescript/credential/presentation/06-fetch-presentation-definition.d.ts.map +1 -1
  255. package/lib/typescript/credential/presentation/07-evaluate-dcql-query.d.ts +13 -12
  256. package/lib/typescript/credential/presentation/07-evaluate-dcql-query.d.ts.map +1 -1
  257. package/lib/typescript/credential/presentation/07-evaluate-input-descriptor.d.ts +40 -42
  258. package/lib/typescript/credential/presentation/07-evaluate-input-descriptor.d.ts.map +1 -1
  259. package/lib/typescript/credential/presentation/08-send-authorization-response.d.ts +30 -43
  260. package/lib/typescript/credential/presentation/08-send-authorization-response.d.ts.map +1 -1
  261. package/lib/typescript/credential/presentation/errors.d.ts +25 -10
  262. package/lib/typescript/credential/presentation/errors.d.ts.map +1 -1
  263. package/lib/typescript/credential/presentation/index.d.ts +7 -8
  264. package/lib/typescript/credential/presentation/index.d.ts.map +1 -1
  265. package/lib/typescript/credential/presentation/types.d.ts +137 -307
  266. package/lib/typescript/credential/presentation/types.d.ts.map +1 -1
  267. package/lib/typescript/credential/status/01-start-flow.d.ts +10 -0
  268. package/lib/typescript/credential/status/01-start-flow.d.ts.map +1 -0
  269. package/lib/typescript/credential/status/02-status-attestation.d.ts +19 -0
  270. package/lib/typescript/credential/status/02-status-attestation.d.ts.map +1 -0
  271. package/lib/typescript/credential/status/03-verify-and-parse-status-attestation.d.ts +24 -0
  272. package/lib/typescript/credential/status/03-verify-and-parse-status-attestation.d.ts.map +1 -0
  273. package/lib/typescript/credential/status/index.d.ts +7 -0
  274. package/lib/typescript/credential/status/index.d.ts.map +1 -0
  275. package/lib/typescript/credential/status/types.d.ts +305 -0
  276. package/lib/typescript/credential/status/types.d.ts.map +1 -0
  277. package/lib/typescript/credential/trustmark/get-credential-trustmark.d.ts +52 -0
  278. package/lib/typescript/credential/trustmark/get-credential-trustmark.d.ts.map +1 -0
  279. package/lib/typescript/credential/trustmark/index.d.ts +4 -0
  280. package/lib/typescript/credential/trustmark/index.d.ts.map +1 -0
  281. package/lib/typescript/index.d.ts +3 -1
  282. package/lib/typescript/index.d.ts.map +1 -1
  283. package/lib/typescript/pid/sd-jwt/types.d.ts +103 -25
  284. package/lib/typescript/pid/sd-jwt/types.d.ts.map +1 -1
  285. package/lib/typescript/sd-jwt/index.d.ts +20 -72
  286. package/lib/typescript/sd-jwt/index.d.ts.map +1 -1
  287. package/lib/typescript/sd-jwt/types.d.ts +24 -129
  288. package/lib/typescript/sd-jwt/types.d.ts.map +1 -1
  289. package/lib/typescript/trust/chain.d.ts +23 -0
  290. package/lib/typescript/trust/chain.d.ts.map +1 -0
  291. package/lib/typescript/trust/errors.d.ts +102 -0
  292. package/lib/typescript/trust/errors.d.ts.map +1 -0
  293. package/lib/typescript/{entity/trust → trust}/index.d.ts +308 -281
  294. package/lib/typescript/trust/index.d.ts.map +1 -0
  295. package/lib/typescript/{entity/trust → trust}/types.d.ts +1714 -1301
  296. package/lib/typescript/{entity/trust → trust}/types.d.ts.map +1 -1
  297. package/lib/typescript/trust/utils.d.ts +22 -0
  298. package/lib/typescript/trust/utils.d.ts.map +1 -0
  299. package/lib/typescript/utils/crypto.d.ts +0 -32
  300. package/lib/typescript/utils/crypto.d.ts.map +1 -1
  301. package/lib/typescript/utils/decoder.d.ts.map +1 -1
  302. package/lib/typescript/utils/error-codes.d.ts +20 -0
  303. package/lib/typescript/utils/error-codes.d.ts.map +1 -1
  304. package/lib/typescript/utils/errors.d.ts +55 -10
  305. package/lib/typescript/utils/errors.d.ts.map +1 -1
  306. package/lib/typescript/utils/logging.d.ts +35 -0
  307. package/lib/typescript/utils/logging.d.ts.map +1 -0
  308. package/lib/typescript/utils/misc.d.ts.map +1 -1
  309. package/lib/typescript/utils/par.d.ts +8 -1
  310. package/lib/typescript/utils/par.d.ts.map +1 -1
  311. package/lib/typescript/utils/string.d.ts +0 -7
  312. package/lib/typescript/utils/string.d.ts.map +1 -1
  313. package/lib/typescript/wallet-instance/index.d.ts +8 -0
  314. package/lib/typescript/wallet-instance/index.d.ts.map +1 -1
  315. package/lib/typescript/wallet-instance-attestation/index.d.ts +1 -2
  316. package/lib/typescript/wallet-instance-attestation/index.d.ts.map +1 -1
  317. package/lib/typescript/wallet-instance-attestation/issuing.d.ts +4 -2
  318. package/lib/typescript/wallet-instance-attestation/issuing.d.ts.map +1 -1
  319. package/lib/typescript/wallet-instance-attestation/types.d.ts +60 -102
  320. package/lib/typescript/wallet-instance-attestation/types.d.ts.map +1 -1
  321. package/package.json +9 -10
  322. package/src/client/generated/wallet-provider.ts +52 -17
  323. package/src/credential/index.ts +4 -1
  324. package/src/credential/issuance/01-start-flow.ts +1 -1
  325. package/src/credential/issuance/02-evaluate-issuer-trust.ts +32 -0
  326. package/src/credential/issuance/03-start-user-authorization.ts +48 -22
  327. package/src/credential/issuance/04-complete-user-authorization.ts +74 -18
  328. package/src/credential/issuance/05-authorize-access.ts +29 -11
  329. package/src/credential/issuance/06-obtain-credential.ts +61 -36
  330. package/src/credential/issuance/07-verify-and-parse-credential.ts +37 -264
  331. package/src/credential/issuance/README.md +23 -20
  332. package/src/credential/issuance/const.ts +1 -1
  333. package/src/credential/issuance/index.ts +6 -3
  334. package/src/credential/presentation/01-start-flow.ts +19 -22
  335. package/src/credential/presentation/02-evaluate-rp-trust.ts +5 -4
  336. package/src/credential/presentation/03-get-request-object.ts +36 -8
  337. package/src/credential/presentation/04-retrieve-rp-jwks.ts +6 -148
  338. package/src/credential/presentation/05-verify-request-object.ts +115 -30
  339. package/src/credential/presentation/06-fetch-presentation-definition.ts +5 -35
  340. package/src/credential/presentation/07-evaluate-dcql-query.ts +132 -161
  341. package/src/credential/presentation/07-evaluate-input-descriptor.ts +136 -254
  342. package/src/credential/presentation/08-send-authorization-response.ts +178 -260
  343. package/src/credential/presentation/README.md +74 -79
  344. package/src/credential/presentation/errors.ts +38 -15
  345. package/src/credential/presentation/index.ts +18 -19
  346. package/src/credential/presentation/types.ts +67 -64
  347. package/src/credential/status/01-start-flow.ts +9 -0
  348. package/src/credential/status/02-status-attestation.ts +105 -0
  349. package/src/credential/status/03-verify-and-parse-status-attestation.ts +70 -0
  350. package/src/credential/status/README.md +67 -0
  351. package/src/credential/status/index.ts +22 -0
  352. package/src/credential/status/types.ts +43 -0
  353. package/src/credential/trustmark/README.md +62 -0
  354. package/src/credential/trustmark/get-credential-trustmark.ts +139 -0
  355. package/src/credential/trustmark/index.ts +8 -0
  356. package/src/index.ts +4 -0
  357. package/src/pid/sd-jwt/types.ts +18 -1
  358. package/src/sd-jwt/__test__/index.test.ts +36 -55
  359. package/src/sd-jwt/__test__/types.test.ts +16 -29
  360. package/src/sd-jwt/index.ts +1 -5
  361. package/src/sd-jwt/types.ts +2 -19
  362. package/src/trust/README.md +147 -0
  363. package/src/trust/chain.ts +227 -0
  364. package/src/trust/errors.ts +136 -0
  365. package/src/{entity/trust → trust}/index.ts +207 -25
  366. package/src/{entity/trust → trust}/types.ts +24 -37
  367. package/src/trust/utils.ts +70 -0
  368. package/src/utils/crypto.ts +4 -106
  369. package/src/utils/decoder.ts +6 -1
  370. package/src/utils/error-codes.ts +23 -0
  371. package/src/utils/errors.ts +119 -15
  372. package/src/utils/logging.ts +68 -0
  373. package/src/utils/misc.ts +5 -0
  374. package/src/utils/par.ts +19 -6
  375. package/src/utils/string.ts +0 -10
  376. package/src/wallet-instance/index.ts +30 -1
  377. package/src/wallet-instance-attestation/README.md +8 -3
  378. package/src/wallet-instance-attestation/index.ts +2 -2
  379. package/src/wallet-instance-attestation/issuing.ts +33 -12
  380. package/src/wallet-instance-attestation/types.ts +18 -22
  381. package/lib/commonjs/credential/issuance/02-get-issuer-config.js +0 -48
  382. package/lib/commonjs/credential/issuance/02-get-issuer-config.js.map +0 -1
  383. package/lib/commonjs/entity/openid-connect/issuer/index.js +0 -25
  384. package/lib/commonjs/entity/openid-connect/issuer/index.js.map +0 -1
  385. package/lib/commonjs/entity/openid-connect/issuer/types.js +0 -64
  386. package/lib/commonjs/entity/openid-connect/issuer/types.js.map +0 -1
  387. package/lib/commonjs/entity/trust/chain.js +0 -122
  388. package/lib/commonjs/entity/trust/chain.js.map +0 -1
  389. package/lib/commonjs/entity/trust/index.js +0 -148
  390. package/lib/commonjs/entity/trust/index.js.map +0 -1
  391. package/lib/commonjs/entity/trust/types.js.map +0 -1
  392. package/lib/commonjs/mdoc/converters.js +0 -26
  393. package/lib/commonjs/mdoc/converters.js.map +0 -1
  394. package/lib/commonjs/mdoc/index.js +0 -68
  395. package/lib/commonjs/mdoc/index.js.map +0 -1
  396. package/lib/commonjs/utils/credential/issuance/07-verify-and-parse-credentials-inputs.js +0 -469
  397. package/lib/commonjs/utils/credential/issuance/07-verify-and-parse-credentials-inputs.js.map +0 -1
  398. package/lib/commonjs/utils/credential/issuance/07-verify-and-parse-credentials-utils.js +0 -90
  399. package/lib/commonjs/utils/credential/issuance/07-verify-and-parse-credentials-utils.js.map +0 -1
  400. package/lib/module/credential/issuance/02-get-issuer-config.js +0 -42
  401. package/lib/module/credential/issuance/02-get-issuer-config.js.map +0 -1
  402. package/lib/module/entity/openid-connect/issuer/index.js +0 -20
  403. package/lib/module/entity/openid-connect/issuer/index.js.map +0 -1
  404. package/lib/module/entity/openid-connect/issuer/types.js +0 -48
  405. package/lib/module/entity/openid-connect/issuer/types.js.map +0 -1
  406. package/lib/module/entity/trust/chain.js +0 -113
  407. package/lib/module/entity/trust/chain.js.map +0 -1
  408. package/lib/module/entity/trust/index.js +0 -131
  409. package/lib/module/entity/trust/index.js.map +0 -1
  410. package/lib/module/entity/trust/types.js.map +0 -1
  411. package/lib/module/mdoc/converters.js +0 -20
  412. package/lib/module/mdoc/converters.js.map +0 -1
  413. package/lib/module/mdoc/index.js +0 -60
  414. package/lib/module/mdoc/index.js.map +0 -1
  415. package/lib/module/utils/credential/issuance/07-verify-and-parse-credentials-inputs.js +0 -462
  416. package/lib/module/utils/credential/issuance/07-verify-and-parse-credentials-inputs.js.map +0 -1
  417. package/lib/module/utils/credential/issuance/07-verify-and-parse-credentials-utils.js +0 -83
  418. package/lib/module/utils/credential/issuance/07-verify-and-parse-credentials-utils.js.map +0 -1
  419. package/lib/typescript/credential/issuance/02-get-issuer-config.d.ts +0 -32
  420. package/lib/typescript/credential/issuance/02-get-issuer-config.d.ts.map +0 -1
  421. package/lib/typescript/entity/openid-connect/issuer/index.d.ts +0 -12
  422. package/lib/typescript/entity/openid-connect/issuer/index.d.ts.map +0 -1
  423. package/lib/typescript/entity/openid-connect/issuer/types.d.ts +0 -777
  424. package/lib/typescript/entity/openid-connect/issuer/types.d.ts.map +0 -1
  425. package/lib/typescript/entity/trust/chain.d.ts +0 -26
  426. package/lib/typescript/entity/trust/chain.d.ts.map +0 -1
  427. package/lib/typescript/entity/trust/index.d.ts.map +0 -1
  428. package/lib/typescript/mdoc/converters.d.ts +0 -8
  429. package/lib/typescript/mdoc/converters.d.ts.map +0 -1
  430. package/lib/typescript/mdoc/index.d.ts +0 -10
  431. package/lib/typescript/mdoc/index.d.ts.map +0 -1
  432. package/lib/typescript/utils/credential/issuance/07-verify-and-parse-credentials-inputs.d.ts +0 -3
  433. package/lib/typescript/utils/credential/issuance/07-verify-and-parse-credentials-inputs.d.ts.map +0 -1
  434. package/lib/typescript/utils/credential/issuance/07-verify-and-parse-credentials-utils.d.ts +0 -42
  435. package/lib/typescript/utils/credential/issuance/07-verify-and-parse-credentials-utils.d.ts.map +0 -1
  436. package/src/credential/issuance/02-get-issuer-config.ts +0 -67
  437. package/src/entity/openid-connect/issuer/index.ts +0 -27
  438. package/src/entity/openid-connect/issuer/types.ts +0 -76
  439. package/src/entity/trust/chain.ts +0 -154
  440. package/src/mdoc/converters.ts +0 -26
  441. package/src/mdoc/index.ts +0 -95
  442. package/src/utils/credential/issuance/07-verify-and-parse-credentials-inputs.ts +0 -615
  443. package/src/utils/credential/issuance/07-verify-and-parse-credentials-utils.ts +0 -171
@@ -1,25 +1,28 @@
1
- import { DcqlQuery, DcqlError, DcqlCredentialSetError } from "dcql";
1
+ import { DcqlQuery, DcqlError } from "dcql";
2
2
  import { isValiError } from "valibot";
3
- import { decode } from "../../sd-jwt";
4
- import { ValidationFailed } from "../../utils/errors";
5
- import { CredentialNotFoundError } from "./errors";
6
- import { CBOR } from "@pagopa/io-react-native-cbor";
3
+ import { decode, prepareVpToken } from "../../sd-jwt";
4
+ import { createCryptoContextFor } from "../../utils/crypto";
5
+ import { CredentialsNotFoundError } from "./errors";
7
6
 
8
7
  /**
9
8
  * The purpose for the credential request by the RP.
10
9
  */
11
10
 
12
11
  /**
13
- * Convert a credential in SD-JWT format to an object with claims
12
+ * Convert a credential in JWT format to an object with claims
14
13
  * for correct parsing by the `dcql` library.
15
14
  */
16
- const mapCredentialSdJwtToObj = credentials => credentials.map(_ref => {
17
- let [,, jwt] = _ref;
15
+ const mapCredentialToObject = jwt => {
18
16
  const {
19
17
  sdJwt,
20
18
  disclosures
21
19
  } = decode(jwt);
22
20
  const credentialFormat = sdJwt.header.typ;
21
+
22
+ // TODO [SIW-2082]: support MDOC credentials
23
+ if (credentialFormat !== "vc+sd-jwt") {
24
+ throw new Error(`Unsupported credential format: ${credentialFormat}`);
25
+ }
23
26
  return {
24
27
  vct: sdJwt.payload.vct,
25
28
  credential_format: credentialFormat,
@@ -28,63 +31,74 @@ const mapCredentialSdJwtToObj = credentials => credentials.map(_ref => {
28
31
  [disclosure.decoded[1]]: disclosure.decoded
29
32
  }), {})
30
33
  };
34
+ };
35
+
36
+ /**
37
+ * Extract only successful matches from the DCQL query result.
38
+ */
39
+ const getDcqlQueryMatches = result => Object.entries(result.credential_matches).filter(_ref => {
40
+ let [, match] = _ref;
41
+ return match.success === true;
31
42
  });
32
43
 
33
44
  /**
34
- * Convert a credential in Mdoc format to an object with claims
35
- * for correct parsing by the `dcql` library.
45
+ * Extract only failed matches from the DCQL query result.
46
+ */
47
+ const getDcqlQueryFailedMatches = result => Object.entries(result.credential_matches).filter(_ref2 => {
48
+ let [, match] = _ref2;
49
+ return match.success === false;
50
+ });
51
+
52
+ /**
53
+ * Extract missing credentials from the DCQL query result.
54
+ * Note: here we are assuming a failed match is a missing credential,
55
+ * but there might be other reasons for its failure.
36
56
  */
37
- const mapCredentialsMdocToObj = async credentialsMdoc => {
38
- return await Promise.all(credentialsMdoc === null || credentialsMdoc === void 0 ? void 0 : credentialsMdoc.map(async _ref2 => {
39
- let [type, _, credential] = _ref2;
40
- const issuerSigned = credential ? await CBOR.decodeIssuerSigned(credential) : undefined;
41
- if (!issuerSigned) {
42
- throw new CredentialNotFoundError("mso_mdoc credential is not present.");
57
+ const extractMissingCredentials = (queryResult, originalQuery) => {
58
+ return getDcqlQueryFailedMatches(queryResult).map(_ref3 => {
59
+ var _credential$meta;
60
+ let [id] = _ref3;
61
+ const credential = originalQuery.credentials.find(c => c.id === id);
62
+ if ((credential === null || credential === void 0 ? void 0 : credential.format) !== "vc+sd-jwt") {
63
+ throw new Error("Unsupported format"); // TODO [SIW-2082]: support MDOC credentials
43
64
  }
44
- const namespaces = Object.entries(issuerSigned.nameSpaces).reduce((acc, _ref3) => {
45
- let [ns, nsClaims] = _ref3;
46
- const flattenNsClaims = Object.entries(nsClaims).reduce((ac, _ref4) => {
47
- let [, el] = _ref4;
48
- return {
49
- ...ac,
50
- [el.elementIdentifier]: el.elementValue
51
- };
52
- }, {});
53
- return {
54
- ...acc,
55
- [ns]: flattenNsClaims
56
- };
57
- }, {});
65
+
58
66
  return {
59
- credential_format: "mso_mdoc",
60
- doctype: type,
61
- namespaces
67
+ id,
68
+ vctValues: (_credential$meta = credential.meta) === null || _credential$meta === void 0 ? void 0 : _credential$meta.vct_values
62
69
  };
63
- }));
70
+ });
64
71
  };
65
-
66
- /**
67
- * Extract only successful matches from the DCQL query result.
68
- */
69
- const getDcqlQueryMatches = result => Object.entries(result.credential_matches).filter(_ref5 => {
70
- let [, match] = _ref5;
71
- return match.success === true;
72
- });
73
- export const evaluateDcqlQuery = async (query, credentialsSdJwt, credentialsMdoc) => {
74
- const credentials = [];
75
- credentials.push(...mapCredentialSdJwtToObj(credentialsSdJwt));
76
- credentials.push(...(await mapCredentialsMdocToObj(credentialsMdoc)));
72
+ export const evaluateDcqlQuery = (credentialsSdJwt, query) => {
73
+ const credentials = credentialsSdJwt.map(_ref4 => {
74
+ let [, credential] = _ref4;
75
+ return mapCredentialToObject(credential);
76
+ });
77
77
  try {
78
78
  // Validate the query
79
79
  const parsedQuery = DcqlQuery.parse(query);
80
80
  DcqlQuery.validate(parsedQuery);
81
81
  const queryResult = DcqlQuery.query(parsedQuery, credentials);
82
82
  if (!queryResult.canBeSatisfied) {
83
- throw new Error("No credential can satisfy the provided DCQL query");
83
+ throw new CredentialsNotFoundError(extractMissingCredentials(queryResult, parsedQuery));
84
84
  }
85
- return getDcqlQueryMatches(queryResult).map(_ref6 => {
85
+
86
+ // Build an object vct:credentialJwt to map matched credentials to their JWT
87
+ const credentialsSdJwtByVct = credentials.reduce((acc, c, i) => ({
88
+ ...acc,
89
+ [c.vct]: credentialsSdJwt[i]
90
+ }), {});
91
+ return getDcqlQueryMatches(queryResult).map(_ref5 => {
86
92
  var _queryResult$credenti;
87
- let [id, match] = _ref6;
93
+ let [id, match] = _ref5;
94
+ if (match.output.credential_format !== "vc+sd-jwt") {
95
+ throw new Error("Unsupported format"); // TODO [SIW-2082]: support MDOC credentials
96
+ }
97
+
98
+ const {
99
+ vct,
100
+ claims
101
+ } = match.output;
88
102
  const purposes = (_queryResult$credenti = queryResult.credential_sets) === null || _queryResult$credenti === void 0 || (_queryResult$credenti = _queryResult$credenti.filter(set => {
89
103
  var _set$matching_options;
90
104
  return (_set$matching_options = set.matching_options) === null || _set$matching_options === void 0 ? void 0 : _set$matching_options.flat().includes(id);
@@ -95,81 +109,46 @@ export const evaluateDcqlQuery = async (query, credentialsSdJwt, credentialsMdoc
95
109
  required: Boolean(credentialSet.required)
96
110
  };
97
111
  });
98
- if (match.output.credential_format === "vc+sd-jwt") {
99
- const {
100
- vct,
101
- claims
102
- } = match.output;
103
- const [, keyTag, credential] = credentialsSdJwt.find(_ref7 => {
104
- let [type] = _ref7;
105
- return type === vct;
106
- });
107
- const requiredDisclosures = Object.values(claims);
108
- return {
109
- id,
110
- vct,
111
- keyTag,
112
- format: match.output.credential_format,
113
- credential,
114
- requiredDisclosures,
115
- // When it is a match but no credential_sets are found, the credential is required by default
116
- // See https://openid.net/specs/openid-4-verifiable-presentations-1_0-24.html#section-6.3.1.2-2.1
117
- purposes: purposes ?? [{
118
- required: true
119
- }]
120
- };
121
- }
122
- if (match.output.credential_format === "mso_mdoc") {
123
- const {
124
- doctype,
125
- namespaces
126
- } = match.output;
127
- const [, keyTag, credential] = credentialsMdoc.find(_ref8 => {
128
- let [type] = _ref8;
129
- return type === doctype;
130
- });
131
- const requiredDisclosures = Object.entries(namespaces).reduce((acc, _ref9) => {
132
- let [ns, nsClaims] = _ref9;
133
- return [...acc, ...Object.entries(nsClaims).map(_ref10 => {
134
- let [claimName] = _ref10;
135
- return {
136
- namespace: ns,
137
- name: claimName,
138
- value: nsClaims[claimName]
139
- };
140
- })];
141
- }, []);
142
- return {
143
- id,
144
- keyTag,
145
- format: match.output.credential_format,
146
- credential,
147
- requiredDisclosures,
148
- // When it is a match but no credential_sets are found, the credential is required by default
149
- // See https://openid.net/specs/openid-4-verifiable-presentations-1_0-24.html#section-6.3.1.2-2.1
150
- purposes: purposes ?? [{
151
- required: true
152
- }],
153
- doctype
154
- };
155
- }
156
- throw new Error(`Unsupported credential format: ${match.output.credential_format}`);
112
+ const [keyTag, credential] = credentialsSdJwtByVct[vct];
113
+ const requiredDisclosures = Object.values(claims);
114
+ return {
115
+ id,
116
+ vct,
117
+ keyTag,
118
+ credential,
119
+ requiredDisclosures,
120
+ // When it is a match but no credential_sets are found, the credential is required by default
121
+ // See https://openid.net/specs/openid-4-verifiable-presentations-1_0-24.html#section-6.3.1.2-2.1
122
+ purposes: purposes ?? [{
123
+ required: true
124
+ }]
125
+ };
157
126
  });
158
127
  } catch (error) {
159
- // Invalid DCQL query structure
128
+ // Invalid DCQL query structure. Remap to `DcqlError` for consistency.
160
129
  if (isValiError(error)) {
161
- throw new ValidationFailed({
162
- message: "Invalid DCQL query",
163
- reason: error.issues.map(issue => issue.message).join(", ")
130
+ throw new DcqlError({
131
+ message: "Failed to parse the provided DCQL query",
132
+ code: "PARSE_ERROR",
133
+ cause: error.issues
164
134
  });
165
135
  }
166
- if (error instanceof DcqlError) {
167
- // TODO [SIW-2110]: handle invalid DQCL query or let the error propagate
168
- }
169
- if (error instanceof DcqlCredentialSetError) {
170
- // TODO [SIW-2110]: handle missing credentials or let the error propagate
171
- }
136
+
137
+ // Let other errors propagate so they can be caught with `err instanceof DcqlError`
172
138
  throw error;
173
139
  }
174
140
  };
141
+ export const prepareRemotePresentations = async (credentials, nonce, clientId) => {
142
+ return Promise.all(credentials.map(async item => {
143
+ const {
144
+ vp_token
145
+ } = await prepareVpToken(nonce, clientId, [item.credential, item.requestedClaims, createCryptoContextFor(item.keyTag)]);
146
+ return {
147
+ credentialId: item.id,
148
+ requestedClaims: item.requestedClaims,
149
+ vpToken: vp_token,
150
+ format: "vc+sd-jwt"
151
+ };
152
+ }));
153
+ };
175
154
  //# sourceMappingURL=07-evaluate-dcql-query.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["DcqlQuery","DcqlError","DcqlCredentialSetError","isValiError","decode","ValidationFailed","CredentialNotFoundError","CBOR","mapCredentialSdJwtToObj","credentials","map","_ref","jwt","sdJwt","disclosures","credentialFormat","header","typ","vct","payload","credential_format","claims","reduce","acc","disclosure","decoded","mapCredentialsMdocToObj","credentialsMdoc","Promise","all","_ref2","type","_","credential","issuerSigned","decodeIssuerSigned","undefined","namespaces","Object","entries","nameSpaces","_ref3","ns","nsClaims","flattenNsClaims","ac","_ref4","el","elementIdentifier","elementValue","doctype","getDcqlQueryMatches","result","credential_matches","filter","_ref5","match","success","evaluateDcqlQuery","query","credentialsSdJwt","push","parsedQuery","parse","validate","queryResult","canBeSatisfied","Error","_ref6","_queryResult$credenti","id","purposes","credential_sets","set","_set$matching_options","matching_options","flat","includes","credentialSet","_credentialSet$purpos","description","purpose","toString","required","Boolean","output","keyTag","find","_ref7","requiredDisclosures","values","format","_ref8","_ref9","_ref10","claimName","namespace","name","value","error","message","reason","issues","issue","join"],"sourceRoot":"../../../../src","sources":["credential/presentation/07-evaluate-dcql-query.ts"],"mappings":"AAAA,SACEA,SAAS,EACTC,SAAS,EACTC,sBAAsB,QAGjB,MAAM;AACb,SAASC,WAAW,QAAQ,SAAS;AACrC,SAASC,MAAM,QAAQ,cAAc;AAErC,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,uBAAuB,QAAQ,UAAU;AAElD,SAASC,IAAI,QAAQ,8BAA8B;;AAEnD;AACA;AACA;;AAiCA;AACA;AACA;AACA;AACA,MAAMC,uBAAuB,GAAIC,WAAuC,IACtEA,WAAW,CAACC,GAAG,CAACC,IAAA,IAAe;EAAA,IAAd,IAAKC,GAAG,CAAC,GAAAD,IAAA;EACxB,MAAM;IAAEE,KAAK;IAAEC;EAAY,CAAC,GAAGV,MAAM,CAACQ,GAAG,CAAC;EAC1C,MAAMG,gBAAgB,GAAGF,KAAK,CAACG,MAAM,CAACC,GAAG;EAEzC,OAAO;IACLC,GAAG,EAAEL,KAAK,CAACM,OAAO,CAACD,GAAG;IACtBE,iBAAiB,EAAEL,gBAAgB;IACnCM,MAAM,EAAEP,WAAW,CAACQ,MAAM,CACxB,CAACC,GAAG,EAAEC,UAAU,MAAM;MACpB,GAAGD,GAAG;MACN,CAACC,UAAU,CAACC,OAAO,CAAC,CAAC,CAAC,GAAGD,UAAU,CAACC;IACtC,CAAC,CAAC,EACF,CAAC,CACH;EACF,CAAC;AACH,CAAC,CAAC;;AAEJ;AACA;AACA;AACA;AACA,MAAMC,uBAAuB,GAAG,MAC9BC,eAA2C,IACxC;EACH,OAAO,MAAMC,OAAO,CAACC,GAAG,CACtBF,eAAe,aAAfA,eAAe,uBAAfA,eAAe,CAAEjB,GAAG,CAAC,MAAAoB,KAAA,IAAiC;IAAA,IAA1B,CAACC,IAAI,EAAEC,CAAC,EAAEC,UAA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AQ,CAAC,CAACjC,GAAG,CAACoF,MAAA;YAAA,IAAC,CAACC,SAAS,CAAC,GAAAD,MAAA;YAAA,OAAM;cAChDE,SAAS,EAAEtD,EAAE;cACbuD,IAAI,EAAEF,SAAS;cACfG,KAAK,EAAEvD,QAAQ,CAACoD,SAAS;YAC3B,CAAC;UAAA,CAAC,CAAC,CACJ;QAAA,GACD,EACF,CAAC;QAED,OAAO;UACLzB,EAAE;UACFgB,MAAM;UACNK,MAAM,EAAEnC,KAAK,CAAC6B,MAAM,CAACjE,iBAAiB;UACtCa,UAAU;UACVwD,mBAAmB;UACnB;UACA;UACAlB,QAAQ,EAAEA,QAAQ,IAAI,CAAC;YAAEY,QAAQ,EAAE;UAAK,CAAC,CAAC;UAC1CjC;QACF,CAAC;MACH;MAEA,MAAM,IAAIiB,KAAK,CACZ,kCAAiCX,KAAK,CAAC6B,MAAM,CAACjE,iBAAkB,EACnE,CAAC;IACH,CAAC,CAAC;EACJ,CAAC,CAAC,OAAO+E,KAAK,EAAE;IACd;IACA,IAAIhG,WAAW,CAACgG,KAAK,CAAC,EAAE;MACtB,MAAM,IAAI9F,gBAAgB,CAAC;QACzB+F,OAAO,EAAE,oBAAoB;QAC7BC,MAAM,EAAEF,KAAK,CAACG,MAAM,CAAC5F,GAAG,CAAE6F,KAAK,IAAKA,KAAK,CAACH,OAAO,CAAC,CAACI,IAAI,CAAC,IAAI;MAC9D,CAAC,CAAC;IACJ;IAEA,IAAIL,KAAK,YAAYlG,SAAS,EAAE;MAC9B;IAAA;IAEF,IAAIkG,KAAK,YAAYjG,sBAAsB,EAAE;MAC3C;IAAA;IAEF,MAAMiG,KAAK;EACb;AACF,CAAC"}
1
+ {"version":3,"names":["DcqlQuery","DcqlError","isValiError","decode","prepareVpToken","createCryptoContextFor","CredentialsNotFoundError","mapCredentialToObject","jwt","sdJwt","disclosures","credentialFormat","header","typ","Error","vct","payload","credential_format","claims","reduce","acc","disclosure","decoded","getDcqlQueryMatches","result","Object","entries","credential_matches","filter","_ref","match","success","getDcqlQueryFailedMatches","_ref2","extractMissingCredentials","queryResult","originalQuery","map","_ref3","_credential$meta","id","credential","credentials","find","c","format","vctValues","meta","vct_values","evaluateDcqlQuery","credentialsSdJwt","query","_ref4","parsedQuery","parse","validate","canBeSatisfied","credentialsSdJwtByVct","i","_ref5","_queryResult$credenti","output","purposes","credential_sets","set","_set$matching_options","matching_options","flat","includes","credentialSet","_credentialSet$purpos","description","purpose","toString","required","Boolean","keyTag","requiredDisclosures","values","error","message","code","cause","issues","prepareRemotePresentations","nonce","clientId","Promise","all","item","vp_token","requestedClaims","credentialId","vpToken"],"sourceRoot":"../../../../src","sources":["credential/presentation/07-evaluate-dcql-query.ts"],"mappings":"AAAA,SAASA,SAAS,EAAEC,SAAS,QAAyB,MAAM;AAC5D,SAASC,WAAW,QAAQ,SAAS;AACrC,SAASC,MAAM,EAAEC,cAAc,QAAQ,cAAc;AAErD,SAASC,sBAAsB,QAAQ,oBAAoB;AAE3D,SAASC,wBAAwB,QAA6B,UAAU;;AAExE;AACA;AACA;;AAuCA;AACA;AACA;AACA;AACA,MAAMC,qBAAqB,GAAIC,GAAW,IAAK;EAC7C,MAAM;IAAEC,KAAK;IAAEC;EAAY,CAAC,GAAGP,MAAM,CAACK,GAAG,CAAC;EAC1C,MAAMG,gBAAgB,GAAGF,KAAK,CAACG,MAAM,CAACC,GAAG;;EAEzC;EACA,IAAIF,gBAAgB,KAAK,WAAW,EAAE;IACpC,MAAM,IAAIG,KAAK,CAAE,kCAAiCH,gBAAiB,EAAC,CAAC;EACvE;EAEA,OAAO;IACLI,GAAG,EAAEN,KAAK,CAACO,OAAO,CAACD,GAAG;IACtBE,iBAAiB,EAAEN,gBAAgB;IACnCO,MAAM,EAAER,WAAW,CAACS,MAAM,CACxB,CAACC,GAAG,EAAEC,UAAU,MAAM;MACpB,GAAGD,GAAG;MACN,CAACC,UAAU,CAACC,OAAO,CAAC,CAAC,CAAC,GAAGD,UAAU,CAACC;IACtC,CAA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