@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
@@ -3,16 +3,14 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.sendAuthorizationResponseDcql = exports.sendAuthorizationResponse = exports.sendAuthorizationErrorResponse = exports.prepareRemotePresentations = exports.choosePublicKeyToEncrypt = exports.buildDirectPostJwtBody = exports.buildDirectPostBody = exports.AuthorizationResponse = void 0;
6
+ exports.sendLegacyAuthorizationResponse = exports.sendAuthorizationResponse = exports.sendAuthorizationErrorResponse = exports.choosePublicKeyToEncrypt = exports.buildDirectPostJwtBody = exports.buildDirectPostBody = exports.AuthorizationResponse = void 0;
7
7
  var _ioReactNativeJwt = require("@pagopa/io-react-native-jwt");
8
8
  var _reactNativeUuid = _interopRequireDefault(require("react-native-uuid"));
9
+ var _retrieveRpJwks = require("./04-retrieve-rp-jwks");
9
10
  var _errors = require("./errors");
10
11
  var _misc = require("../../utils/misc");
11
12
  var z = _interopRequireWildcard(require("zod"));
12
- var _jsBase = require("js-base64");
13
- var _mdoc = require("../../mdoc");
14
- var _crypto = require("../../utils/crypto");
15
- var _sdJwt = require("../../sd-jwt");
13
+ var _errors2 = require("../../utils/errors");
16
14
  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); }
17
15
  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; }
18
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -30,25 +28,13 @@ const AuthorizationResponse = z.object({
30
28
  * Selects a public key (with `use = enc`) from the set of JWK keys
31
29
  * offered by the Relying Party (RP) for encryption.
32
30
  *
33
- * Preference is given to EC keys (P-256 or P-384), followed by RSA keys,
34
- * based on compatibility and common usage for encryption.
35
- *
36
31
  * @param rpJwkKeys - The array of JWKs retrieved from the RP entity configuration.
37
32
  * @returns The first suitable public key found in the list.
38
33
  * @throws {NoSuitableKeysFoundInEntityConfiguration} If no suitable encryption key is found.
39
34
  */
40
35
  exports.AuthorizationResponse = AuthorizationResponse;
41
36
  const choosePublicKeyToEncrypt = rpJwkKeys => {
42
- // First try to find RSA keys which are more commonly used for encryption
43
- const encKeys = rpJwkKeys.filter(jwk => jwk.use === "enc");
44
-
45
- // Prioritize EC keys first, then fall back to RSA keys if needed
46
- // io-react-native-jwt support only EC keys with P-256 or P-384 curves
47
- const ecEncKeys = encKeys.filter(jwk => jwk.kty === "EC" && (jwk.crv === "P-256" || jwk.crv === "P-384"));
48
- const rsaEncKeys = encKeys.filter(jwk => jwk.kty === "RSA");
49
-
50
- // Select the first available key based on priority
51
- const encKey = ecEncKeys[0] || rsaEncKeys[0] || encKeys[0];
37
+ const encKey = rpJwkKeys.find(jwk => jwk.use === "enc");
52
38
  if (encKey) {
53
39
  return encKey;
54
40
  }
@@ -57,58 +43,37 @@ const choosePublicKeyToEncrypt = rpJwkKeys => {
57
43
  throw new _errors.NoSuitableKeysFoundInEntityConfiguration("No suitable public key found for encryption.");
58
44
  };
59
45
 
60
- /**
61
- * Builds a URL-encoded form body for a direct POST response without encryption.
62
- *
63
- * @param requestObject - Contains state, nonce, and other relevant info.
64
- * @param payload - Object that contains either the VP token to encrypt and the stringified mapping of the credential disclosures or the error code
65
- * @returns A URL-encoded string suitable for an `application/x-www-form-urlencoded` POST body.
66
- */
67
- exports.choosePublicKeyToEncrypt = choosePublicKeyToEncrypt;
68
- const buildDirectPostBody = async (requestObject, payload) => {
69
- const formUrlEncodedBody = new URLSearchParams({
70
- ...(requestObject.state ? {
71
- state: requestObject.state
72
- } : {}),
73
- ...Object.fromEntries(Object.entries(payload).map(_ref => {
74
- let [key, value] = _ref;
75
- return [key, Array.isArray(value) || typeof value === "object" ? JSON.stringify(value) : value];
76
- }))
77
- });
78
- return formUrlEncodedBody.toString();
79
- };
80
-
81
46
  /**
82
47
  * Builds a URL-encoded form body for a direct POST response using JWT encryption.
83
48
  *
84
49
  * @param jwkKeys - Array of JWKs from the Relying Party for encryption.
85
50
  * @param requestObject - Contains state, nonce, and other relevant info.
86
- * @param payload - Object that contains either the VP token to encrypt and the mapping of the credential disclosures or the error code
87
- * @param generatedNonce - Optional nonce for the `apu` claim in the JWE header, it is used during ISO 18013-7.
88
- * @returns A URL-encoded string for an `application/x-www-form-urlencoded` POST body,
89
- * where `response` contains the encrypted JWE.
51
+ * @param payload - Object that contains the VP token to encrypt and the mapping of the credential disclosures
52
+ * @returns A URL-encoded string for an `application/x-www-form-urlencoded` POST body, where `response` contains the encrypted JWE.
90
53
  */
91
- exports.buildDirectPostBody = buildDirectPostBody;
92
- const buildDirectPostJwtBody = async (jwkKeys, requestObject, payload, generatedNonce) => {
54
+ exports.choosePublicKeyToEncrypt = choosePublicKeyToEncrypt;
55
+ const buildDirectPostJwtBody = async (requestObject, rpConf, payload) => {
93
56
  // Prepare the authorization response payload to be encrypted
94
57
  const authzResponsePayload = JSON.stringify({
95
58
  state: requestObject.state,
96
59
  ...payload
97
60
  });
98
- const encPublicJwk = choosePublicKeyToEncrypt(jwkKeys);
61
+ // Choose a suitable public key for encryption
62
+ const {
63
+ keys
64
+ } = (0, _retrieveRpJwks.getJwksFromConfig)(rpConf);
65
+ const encPublicJwk = choosePublicKeyToEncrypt(keys);
66
+
99
67
  // Encrypt the authorization payload
100
68
  const {
101
- client_metadata
102
- } = requestObject;
69
+ authorization_encrypted_response_alg,
70
+ authorization_encrypted_response_enc
71
+ } = rpConf.openid_credential_verifier;
72
+ const defaultAlg = encPublicJwk.kty === "EC" ? "ECDH-ES" : "RSA-OAEP-256";
103
73
  const encryptedResponse = await new _ioReactNativeJwt.EncryptJwe(authzResponsePayload, {
104
- alg: (client_metadata === null || client_metadata === void 0 ? void 0 : client_metadata.authorization_encrypted_response_alg) || "RSA-OAEP-256",
105
- enc: (client_metadata === null || client_metadata === void 0 ? void 0 : client_metadata.authorization_encrypted_response_enc) || "A256CBC-HS512",
106
- kid: encPublicJwk.kid,
107
- /* ISO 18013-7 */
108
- apv: _jsBase.Base64.encodeURI(requestObject.nonce),
109
- ...(generatedNonce ? {
110
- apu: _jsBase.Base64.encodeURI(generatedNonce)
111
- } : {})
74
+ alg: authorization_encrypted_response_alg || defaultAlg,
75
+ enc: authorization_encrypted_response_enc || "A256CBC-HS512",
76
+ kid: encPublicJwk.kid
112
77
  }).encrypt(encPublicJwk);
113
78
 
114
79
  // Build the x-www-form-urlencoded form body
@@ -122,15 +87,36 @@ const buildDirectPostJwtBody = async (jwkKeys, requestObject, payload, generated
122
87
  };
123
88
 
124
89
  /**
125
- * Type definition for the function that sends the authorization response
126
- * to the Relying Party, completing the presentation flow.
90
+ * Builds a URL-encoded form body for a direct POST response without encryption.
91
+ *
92
+ * @param requestObject - Contains state, nonce, and other relevant info.
93
+ * @param payload - Object that contains either the VP token to encrypt and the stringified mapping of the credential disclosures or the error code
94
+ * @returns A URL-encoded string suitable for an `application/x-www-form-urlencoded` POST body.
127
95
  */
96
+ exports.buildDirectPostJwtBody = buildDirectPostJwtBody;
97
+ const buildDirectPostBody = async (requestObject, payload) => {
98
+ const formUrlEncodedBody = new URLSearchParams({
99
+ ...(requestObject.state && {
100
+ state: requestObject.state
101
+ }),
102
+ ...Object.entries(payload).reduce((acc, _ref) => {
103
+ let [key, value] = _ref;
104
+ return {
105
+ ...acc,
106
+ [key]: Array.isArray(value) || typeof value === "object" ? JSON.stringify(value) : value
107
+ };
108
+ }, {})
109
+ });
110
+ return formUrlEncodedBody.toString();
111
+ };
128
112
 
129
113
  /**
130
114
  * Type definition for the function that sends the authorization response
131
115
  * to the Relying Party, completing the presentation flow.
116
+ * Use with `presentation_definition`.
117
+ * @deprecated Use `sendAuthorizationResponse`
132
118
  */
133
- exports.buildDirectPostJwtBody = buildDirectPostJwtBody;
119
+ exports.buildDirectPostBody = buildDirectPostBody;
134
120
  /**
135
121
  * Sends the authorization response to the Relying Party (RP) using the specified `response_mode`.
136
122
  * This function completes the presentation flow in an OpenID 4 Verifiable Presentations scenario.
@@ -142,175 +128,125 @@ exports.buildDirectPostJwtBody = buildDirectPostJwtBody;
142
128
  * @param context - Contains optional custom fetch implementation.
143
129
  * @returns Parsed and validated authorization response from the Relying Party.
144
130
  */
145
- const sendAuthorizationResponse = async function (requestObject, presentationDefinitionId, jwkKeys, remotePresentation) {
146
- var _presentations$;
131
+ const sendLegacyAuthorizationResponse = async function (requestObject, presentationDefinitionId, remotePresentations, rpConf) {
132
+ var _remotePresentations$;
147
133
  let {
148
134
  appFetch = fetch
149
135
  } = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
150
- const {
151
- generatedNonce,
152
- presentations
153
- } = remotePresentation;
154
136
  /**
155
137
  * 1. Prepare the VP token and presentation submission
156
138
  * If there is only one credential, `vpToken` is a single string.
157
139
  * If there are multiple credential, `vpToken` is an array of string.
158
140
  **/
159
- const vp_token = (presentations === null || presentations === void 0 ? void 0 : presentations.length) === 1 ? (_presentations$ = presentations[0]) === null || _presentations$ === void 0 ? void 0 : _presentations$.vpToken : presentations.map(presentation => presentation.vpToken);
160
- const descriptor_map = presentations.map((presentation, index) => ({
161
- id: presentation.credentialId,
162
- path: (presentations === null || presentations === void 0 ? void 0 : presentations.length) === 1 ? `$` : `$[${index}]`,
163
- format: presentation.format
141
+ const vp_token = (remotePresentations === null || remotePresentations === void 0 ? void 0 : remotePresentations.length) === 1 ? (_remotePresentations$ = remotePresentations[0]) === null || _remotePresentations$ === void 0 ? void 0 : _remotePresentations$.vpToken : remotePresentations.map(remotePresentation => remotePresentation.vpToken);
142
+ const descriptor_map = remotePresentations.map((remotePresentation, index) => ({
143
+ id: remotePresentation.inputDescriptor.id,
144
+ path: remotePresentations.length === 1 ? `$` : `$[${index}]`,
145
+ format: remotePresentation.format
164
146
  }));
165
147
  const presentation_submission = {
166
148
  id: _reactNativeUuid.default.v4(),
167
149
  definition_id: presentationDefinitionId,
168
150
  descriptor_map
169
151
  };
170
-
171
- // 2. Choose the appropriate request body builder based on response mode
172
- const requestBody = requestObject.response_mode === "direct_post.jwt" ? await buildDirectPostJwtBody(jwkKeys, requestObject, {
152
+ const requestBody = await buildDirectPostJwtBody(requestObject, rpConf, {
173
153
  vp_token,
174
154
  presentation_submission
175
- }, generatedNonce) : await buildDirectPostBody(requestObject, {
176
- vp_token,
177
- presentation_submission: presentation_submission
178
155
  });
179
156
 
180
157
  // 3. Send the authorization response via HTTP POST and validate the response
181
- const authResponse = await appFetch(requestObject.response_uri, {
158
+ return await appFetch(requestObject.response_uri, {
182
159
  method: "POST",
183
160
  headers: {
184
161
  "Content-Type": "application/x-www-form-urlencoded"
185
162
  },
186
163
  body: requestBody
187
- }).then((0, _misc.hasStatusOrThrow)(200)).then(res => res.json()).then(AuthorizationResponse.safeParse);
188
-
189
- // Some Relying Parties may return an empty body.
190
- return authResponse.success ? authResponse.data : {};
164
+ }).then((0, _misc.hasStatusOrThrow)(200)).then(res => res.json()).then(AuthorizationResponse.parse);
191
165
  };
192
166
 
193
167
  /**
194
168
  * Type definition for the function that sends the authorization response
195
169
  * to the Relying Party, completing the presentation flow.
170
+ * Use with DCQL queries.
196
171
  */
197
- exports.sendAuthorizationResponse = sendAuthorizationResponse;
198
- /**
199
- * Sends the authorization error response to the Relying Party (RP) using the specified `response_mode`.
200
- * This function completes the presentation flow in an OpenID 4 Verifiable Presentations scenario.
201
- *
202
- * @param requestObject - The request details, including presentation requirements.
203
- * @param error - The response error value
204
- * @param jwkKeys - Array of JWKs from the Relying Party for optional encryption.
205
- * @param context - Contains optional custom fetch implementation.
206
- * @returns Parsed and validated authorization response from the Relying Party.
207
- */
208
- const sendAuthorizationErrorResponse = async function (requestObject, error, jwkKeys) {
172
+ exports.sendLegacyAuthorizationResponse = sendLegacyAuthorizationResponse;
173
+ const sendAuthorizationResponse = async function (requestObject, remotePresentations, rpConf) {
209
174
  let {
210
175
  appFetch = fetch
211
176
  } = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
212
- // 2. Choose the appropriate request body builder based on response mode
213
- const requestBody = requestObject.response_mode === "direct_post.jwt" ? await buildDirectPostJwtBody(jwkKeys, requestObject, {
214
- error
215
- }) : await buildDirectPostBody(requestObject, {
216
- error
177
+ // 1. Prepare the VP token as a JSON object with keys corresponding to the DCQL query credential IDs
178
+ const requestBody = await buildDirectPostJwtBody(requestObject, rpConf, {
179
+ vp_token: remotePresentations.reduce((acc, presentation) => ({
180
+ ...acc,
181
+ [presentation.credentialId]: presentation.vpToken
182
+ }), {})
217
183
  });
218
- // 3. Send the authorization error response via HTTP POST and validate the response
184
+
185
+ // 2. Send the authorization response via HTTP POST and validate the response
219
186
  return await appFetch(requestObject.response_uri, {
220
187
  method: "POST",
221
188
  headers: {
222
189
  "Content-Type": "application/x-www-form-urlencoded"
223
190
  },
224
191
  body: requestBody
225
- }).then((0, _misc.hasStatusOrThrow)(200)).then(res => res.json()).then(AuthorizationResponse.parse);
192
+ }).then((0, _misc.hasStatusOrThrow)(200)).then(res => res.json()).then(AuthorizationResponse.parse).catch(handleAuthorizationResponseError);
226
193
  };
227
- exports.sendAuthorizationErrorResponse = sendAuthorizationErrorResponse;
228
- const sendAuthorizationResponseDcql = async function (requestObject, jwkKeys, remotePresentation) {
194
+
195
+ /**
196
+ * Type definition for the function that sends the authorization response
197
+ * to the Relying Party, completing the presentation flow.
198
+ */
199
+ exports.sendAuthorizationResponse = sendAuthorizationResponse;
200
+ /**
201
+ * Sends the authorization error response to the Relying Party (RP) using the specified `response_mode`.
202
+ * This function completes the presentation flow in an OpenID 4 Verifiable Presentations scenario.
203
+ *
204
+ * @param requestObject - The request details, including presentation requirements.
205
+ * @param error - The response error value, with description
206
+ * @param context - Contains optional custom fetch implementation.
207
+ * @returns Parsed and validated authorization response from the Relying Party.
208
+ */
209
+ const sendAuthorizationErrorResponse = async function (requestObject, _ref2) {
210
+ let {
211
+ error,
212
+ errorDescription
213
+ } = _ref2;
229
214
  let {
230
215
  appFetch = fetch
231
- } = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
232
- const {
233
- generatedNonce,
234
- presentations
235
- } = remotePresentation;
236
- // 1. Prepare the VP token as a JSON object with keys corresponding to the DCQL query credential IDs
237
- const requestBody = await buildDirectPostJwtBody(jwkKeys, requestObject, {
238
- vp_token: presentations.reduce((acc, presentation) => ({
239
- ...acc,
240
- [presentation.credentialId]: presentation.vpToken
241
- }), {})
242
- }, generatedNonce);
243
-
244
- // 2. Send the authorization response via HTTP POST and validate the response
216
+ } = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
217
+ const requestBody = await buildDirectPostBody(requestObject, {
218
+ error,
219
+ error_description: errorDescription
220
+ });
245
221
  return await appFetch(requestObject.response_uri, {
246
222
  method: "POST",
247
223
  headers: {
248
224
  "Content-Type": "application/x-www-form-urlencoded"
249
225
  },
250
226
  body: requestBody
251
- }).then((0, _misc.hasStatusOrThrow)(200)).then(res => res.json()).then(AuthorizationResponse.parse);
227
+ }).then((0, _misc.hasStatusOrThrow)(200, _errors2.RelyingPartyResponseError)).then(res => res.json()).then(AuthorizationResponse.parse);
252
228
  };
253
229
 
254
230
  /**
255
- * Prepares remote presentations for a set of credentials.
256
- *
257
- * For each credential, this function:
258
- * - Validates the credential format (currently supports 'mso_mdoc' and 'vc+sd-jwt').
259
- * - Generates a verifiable presentation token (vpToken) using the appropriate method.
260
- * - For ISO 18013-7, generates a special nonce with minimum entropy of 16.
261
- *
262
- * @param credentials - An array of credential items containing format, credential data, requested claims, and key information.
263
- * @param authRequestObject - The authentication request object containing nonce, clientId, and responseUri.
264
- * @returns A promise that resolves to an object containing an array of presentations and the generated nonce.
265
- * @throws {CredentialNotFoundError} When the credential format is unsupported.
231
+ * Handle the the presentation error by mapping it to a custom exception.
232
+ * If the error is not an instance of {@link UnexpectedStatusCodeError}, it is thrown as is.
233
+ * @param e - The error to be handled
234
+ * @throws {RelyingPartyResponseError} with a specific code for more context
266
235
  */
267
- exports.sendAuthorizationResponseDcql = sendAuthorizationResponseDcql;
268
- const prepareRemotePresentations = async (credentials, authRequestObject) => {
269
- /* In case of ISO 18013-7 we need a nonce, it shall have a minimum entropy of 16 */
270
- const generatedNonce = (0, _misc.generateRandomAlphaNumericString)(16);
271
- const presentations = await Promise.all(credentials.map(async item => {
272
- const {
273
- credentialInputId,
274
- format
275
- } = item;
276
- if (format === "mso_mdoc") {
277
- const {
278
- vp_token
279
- } = await (0, _mdoc.prepareVpTokenMdoc)(authRequestObject.nonce, generatedNonce, authRequestObject.clientId, authRequestObject.responseUri, item.doctype, item.keyTag, [item.credential, item.requestedClaims, (0, _crypto.createCryptoContextFor)(item.keyTag)]);
280
- return {
281
- requestedClaims: [...item.requestedClaims.map(_ref2 => {
282
- let {
283
- name
284
- } = _ref2;
285
- return name;
286
- })],
287
- credentialId: credentialInputId,
288
- vpToken: vp_token,
289
- format: "mso_mdoc"
290
- };
291
- }
292
- if (format === "vc+sd-jwt") {
293
- const {
294
- vp_token
295
- } = await (0, _sdJwt.prepareVpToken)(authRequestObject.nonce, authRequestObject.clientId, [item.credential, item.requestedClaims, (0, _crypto.createCryptoContextFor)(item.keyTag)]);
296
- return {
297
- requestedClaims: [...item.requestedClaims.map(_ref3 => {
298
- let {
299
- name
300
- } = _ref3;
301
- return name;
302
- })],
303
- credentialId: credentialInputId,
304
- vpToken: vp_token,
305
- format: "vc+sd-jwt"
306
- };
307
- }
308
- throw new _errors.CredentialNotFoundError(`${format} format is not supported.`);
309
- }));
310
- return {
311
- presentations,
312
- generatedNonce
313
- };
236
+ exports.sendAuthorizationErrorResponse = sendAuthorizationErrorResponse;
237
+ const handleAuthorizationResponseError = e => {
238
+ if (!(e instanceof _errors2.UnexpectedStatusCodeError)) {
239
+ throw e;
240
+ }
241
+ throw new _errors2.ResponseErrorBuilder(_errors2.RelyingPartyResponseError).handle(400, {
242
+ code: _errors2.RelyingPartyResponseErrorCodes.InvalidAuthorizationResponse,
243
+ message: "The Authorization Response contains invalid parameters or it is malformed"
244
+ }).handle(403, {
245
+ code: _errors2.RelyingPartyResponseErrorCodes.InvalidAuthorizationResponse,
246
+ message: "The Authorization Response was forbidden"
247
+ }).handle("*", {
248
+ code: _errors2.RelyingPartyResponseErrorCodes.RelyingPartyGenericError,
249
+ message: "Unable to successfully send the Authorization Response"
250
+ }).buildFrom(e);
314
251
  };
315
- exports.prepareRemotePresentations = prepareRemotePresentations;
316
252
  //# sourceMappingURL=08-send-authorization-response.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_ioReactNativeJwt","require","_reactNativeUuid","_interopRequireDefault","_errors","_misc","z","_interopRequireWildcard","_jsBase","_mdoc","_crypto","_sdJwt","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","AuthorizationResponse","object","status","string","optional","response_code","redirect_uri","exports","choosePublicKeyToEncrypt","rpJwkKeys","encKeys","filter","jwk","use","ecEncKeys","kty","crv","rsaEncKeys","encKey","NoSuitableKeysFoundInEntityConfiguration","buildDirectPostBody","requestObject","payload","formUrlEncodedBody","URLSearchParams","state","fromEntries","entries","map","_ref","value","Array","isArray","JSON","stringify","toString","buildDirectPostJwtBody","jwkKeys","generatedNonce","authzResponsePayload","encPublicJwk","client_metadata","encryptedResponse","EncryptJwe","alg","authorization_encrypted_response_alg","enc","authorization_encrypted_response_enc","kid","apv","Base64","encodeURI","nonce","apu","encrypt","formBody","response","sendAuthorizationResponse","presentationDefinitionId","remotePresentation","_presentations$","appFetch","fetch","arguments","length","undefined","presentations","vp_token","vpToken","presentation","descriptor_map","index","id","credentialId","path","format","presentation_submission","uuid","v4","definition_id","requestBody","response_mode","authResponse","response_uri","method","headers","body","then","hasStatusOrThrow","res","json","safeParse","success","data","sendAuthorizationErrorResponse","error","parse","sendAuthorizationResponseDcql","reduce","acc","prepareRemotePresentations","credentials","authRequestObject","generateRandomAlphaNumericString","Promise","all","item","credentialInputId","prepareVpTokenMdoc","clientId","responseUri","doctype","keyTag","credential","requestedClaims","createCryptoContextFor","_ref2","name","prepareVpToken","_ref3","CredentialNotFoundError"],"sourceRoot":"../../../../src","sources":["credential/presentation/08-send-authorization-response.ts"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAC,sBAAA,CAAAF,OAAA;AAGA,IAAAG,OAAA,GAAAH,OAAA;AAIA,IAAAI,KAAA,GAAAJ,OAAA;AAOA,IAAAK,CAAA,GAAAC,uBAAA,CAAAN,OAAA;AAEA,IAAAO,OAAA,GAAAP,OAAA;AAEA,IAAAQ,KAAA,GAAAR,OAAA;AAEA,IAAAS,OAAA,GAAAT,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AAA8C,SAAAW,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,SAAAN,wBAAAU,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,k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,CAACO,QAAQ,EAC1B,CACEH,IAAI,CAACO,UAAU,EACfP,IAAI,CAACQ,eAAe,EACpB,IAAAC,8BAAsB,EAACT,IAAI,CAACM,MAAM,CAAC,CAEvC,CAAC;MAED,OAAO;QACLE,eAAe,EAAE,CAAC,GAAGR,IAAI,CAACQ,eAAe,CAACtF,GAAG,CAAC2F,KAAA;UAAA,IAAC;YAAEF;UAAK,CAAC,GAAAE,KAAA;UAAA,OAAKF,IAAI;QAAA,EAAC,CAAC;QAClE5C,YAAY,EAAEkC,iBAAiB;QAC/BvC,OAAO,EAAED,QAAQ;QACjBQ,MAAM,EAAE;MACV,CAAC;IACH;IAEA,MAAM,IAAI6C,+BAAuB,CAAE,GAAE7C,MAAO,2BAA0B,CAAC;EACzE,CAAC,CACH,CAAC;EAED,OAAO;IACLT,aAAa;IACb5B;EACF,CAAC;AACH,CAAC;AAAC/B,OAAA,CAAA6F,0BAAA,GAAAA,0BAAA"}
1
+ {"version":3,"names":["_ioReactNativeJwt","require","_reactNativeUuid","_interopRequireDefault","_retrieveRpJwks","_errors","_misc","z","_interopRequireWildcard","_errors2","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","AuthorizationResponse","object","status","string","optional","response_code","redirect_uri","exports","choosePublicKeyToEncrypt","rpJwkKeys","encKey","find","jwk","use","NoSuitableKeysFoundInEntityConfiguration","buildDirectPostJwtBody","requestObject","rpConf","payload","authzResponsePayload","JSON","stringify","state","keys","getJwksFromConfig","encPublicJwk","authorization_encrypted_response_alg","authorization_encrypted_response_enc","openid_credential_verifier","defaultAlg","kty","encryptedResponse","EncryptJwe","alg","enc","kid","encrypt","formBody","URLSearchParams","response","toString","buildDirectPostBody","formUrlEncodedBody","entries","reduce","acc","_ref","value","Array","isArray","sendLegacyAuthorizationResponse","presentationDefinitionId","remotePresentations","_remotePresentations$","appFetch","fetch","arguments","length","undefined","vp_token","vpToken","map","remotePresentation","descriptor_map","index","id","inputDescriptor","path","format","presentation_submission","uuid","v4","definition_id","requestBody","response_uri","method","headers","body","then","hasStatusOrThrow","res","json","parse","sendAuthorizationResponse","presentation","credentialId","catch","handleAuthorizationResponseError","sendAuthorizationErrorResponse","_ref2","error","errorDescription","error_description","RelyingPartyResponseError","e","UnexpectedStatusCodeError","ResponseErrorBuilder","handle","code","RelyingPartyResponseErrorCodes","InvalidAuthorizationResponse","message","RelyingPartyGenericError","buildFrom"],"sourceRoot":"../../../../src","sources":["credential/presentation/08-send-authorization-response.ts"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,eAAA,GAAAH,OAAA;AAEA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AAOA,IAAAM,CAAA,GAAAC,uBAAA,CAAAP,OAAA;AAGA,IAAAQ,QAAA,GAAAR,OAAA;AAK4B,SAAAS,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,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,IAA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