@pagopa/io-react-native-wallet 3.1.2 → 3.3.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 (360) hide show
  1. package/lib/commonjs/credential/issuance/README.md +44 -17
  2. package/lib/commonjs/credential/issuance/common/02-start-user-authorization.js +4 -3
  3. package/lib/commonjs/credential/issuance/common/02-start-user-authorization.js.map +1 -1
  4. package/lib/commonjs/credential/issuance/common/06-verify-and-parse-credential.sdjwt.js +37 -8
  5. package/lib/commonjs/credential/issuance/common/06-verify-and-parse-credential.sdjwt.js.map +1 -1
  6. package/lib/commonjs/credential/issuance/mrtd-pop/02-init-challenge.js +46 -38
  7. package/lib/commonjs/credential/issuance/mrtd-pop/02-init-challenge.js.map +1 -1
  8. package/lib/commonjs/credential/issuance/mrtd-pop/03-validate-challenge.js +58 -51
  9. package/lib/commonjs/credential/issuance/mrtd-pop/03-validate-challenge.js.map +1 -1
  10. package/lib/commonjs/credential/issuance/mrtd-pop/index.js +21 -5
  11. package/lib/commonjs/credential/issuance/mrtd-pop/index.js.map +1 -1
  12. package/lib/commonjs/credential/issuance/v1.0.0/02-start-user-authorization.js +3 -3
  13. package/lib/commonjs/credential/issuance/v1.0.0/02-start-user-authorization.js.map +1 -1
  14. package/lib/commonjs/credential/issuance/v1.0.0/03-complete-user-authorization.js +5 -2
  15. package/lib/commonjs/credential/issuance/v1.0.0/03-complete-user-authorization.js.map +1 -1
  16. package/lib/commonjs/credential/issuance/v1.0.0/05-obtain-credential.js +5 -1
  17. package/lib/commonjs/credential/issuance/v1.0.0/05-obtain-credential.js.map +1 -1
  18. package/lib/commonjs/credential/issuance/v1.0.0/index.js +2 -1
  19. package/lib/commonjs/credential/issuance/v1.0.0/index.js.map +1 -1
  20. package/lib/commonjs/credential/issuance/v1.0.0/mappers.js +1 -1
  21. package/lib/commonjs/credential/issuance/v1.0.0/mappers.js.map +1 -1
  22. package/lib/commonjs/credential/issuance/v1.3.3/01-evaluate-issuer-trust.js +0 -2
  23. package/lib/commonjs/credential/issuance/v1.3.3/01-evaluate-issuer-trust.js.map +1 -1
  24. package/lib/commonjs/credential/issuance/v1.3.3/02-start-user-authorization.js +20 -16
  25. package/lib/commonjs/credential/issuance/v1.3.3/02-start-user-authorization.js.map +1 -1
  26. package/lib/commonjs/credential/issuance/v1.3.3/03-complete-user-authorization.js +1 -1
  27. package/lib/commonjs/credential/issuance/v1.3.3/03-complete-user-authorization.js.map +1 -1
  28. package/lib/commonjs/credential/issuance/v1.3.3/04-authorize-access.js +20 -19
  29. package/lib/commonjs/credential/issuance/v1.3.3/04-authorize-access.js.map +1 -1
  30. package/lib/commonjs/credential/issuance/v1.3.3/05-obtain-credential.js +150 -57
  31. package/lib/commonjs/credential/issuance/v1.3.3/05-obtain-credential.js.map +1 -1
  32. package/lib/commonjs/credential/issuance/v1.3.3/06-verify-and-parse-credential.js +4 -1
  33. package/lib/commonjs/credential/issuance/v1.3.3/06-verify-and-parse-credential.js.map +1 -1
  34. package/lib/commonjs/credential/issuance/v1.3.3/index.js +2 -1
  35. package/lib/commonjs/credential/issuance/v1.3.3/index.js.map +1 -1
  36. package/lib/commonjs/credential/issuance/v1.3.3/mappers.js +1 -1
  37. package/lib/commonjs/credential/issuance/v1.3.3/mappers.js.map +1 -1
  38. package/lib/commonjs/credential/presentation/api/types.js.map +1 -1
  39. package/lib/commonjs/credential/presentation/{v1.3.3/utils.mdoc.js → common/utils/mdoc.js} +2 -2
  40. package/lib/commonjs/credential/presentation/common/utils/mdoc.js.map +1 -0
  41. package/lib/commonjs/credential/presentation/v1.0.0/05-verify-request-object.js +18 -12
  42. package/lib/commonjs/credential/presentation/v1.0.0/05-verify-request-object.js.map +1 -1
  43. package/lib/commonjs/credential/presentation/v1.0.0/07-send-authorization-response.js +3 -0
  44. package/lib/commonjs/credential/presentation/v1.0.0/07-send-authorization-response.js.map +1 -1
  45. package/lib/commonjs/credential/presentation/v1.0.0/index.js +0 -2
  46. package/lib/commonjs/credential/presentation/v1.0.0/index.js.map +1 -1
  47. package/lib/commonjs/credential/presentation/v1.0.0/mappers.js +23 -13
  48. package/lib/commonjs/credential/presentation/v1.0.0/mappers.js.map +1 -1
  49. package/lib/commonjs/credential/presentation/v1.0.0/types.js +25 -17
  50. package/lib/commonjs/credential/presentation/v1.0.0/types.js.map +1 -1
  51. package/lib/commonjs/credential/presentation/v1.3.3/05-verify-request-object.js +29 -6
  52. package/lib/commonjs/credential/presentation/v1.3.3/05-verify-request-object.js.map +1 -1
  53. package/lib/commonjs/credential/presentation/v1.3.3/06-evaluate-dcql-query.js +2 -2
  54. package/lib/commonjs/credential/presentation/v1.3.3/06-evaluate-dcql-query.js.map +1 -1
  55. package/lib/commonjs/credential/presentation/v1.3.3/07-send-authorization-response.js +9 -6
  56. package/lib/commonjs/credential/presentation/v1.3.3/07-send-authorization-response.js.map +1 -1
  57. package/lib/commonjs/credential/presentation/v1.3.3/mappers.js +25 -13
  58. package/lib/commonjs/credential/presentation/v1.3.3/mappers.js.map +1 -1
  59. package/lib/commonjs/credential/presentation/v1.3.3/types.js +6 -3
  60. package/lib/commonjs/credential/presentation/v1.3.3/types.js.map +1 -1
  61. package/lib/commonjs/credential/status/README.md +3 -2
  62. package/lib/commonjs/credential/status/v1.3.3/01-status-list.js +27 -5
  63. package/lib/commonjs/credential/status/v1.3.3/01-status-list.js.map +1 -1
  64. package/lib/commonjs/credential/status/v1.3.3/02-verify-and-parse-status-list.js +17 -6
  65. package/lib/commonjs/credential/status/v1.3.3/02-verify-and-parse-status-list.js.map +1 -1
  66. package/lib/commonjs/credentials-catalogue/api/DigitalCredentialsCatalogue.js +26 -1
  67. package/lib/commonjs/credentials-catalogue/api/DigitalCredentialsCatalogue.js.map +1 -1
  68. package/lib/commonjs/credentials-catalogue/v1.3.3/fetch-and-parse-catalogue.js +4 -0
  69. package/lib/commonjs/credentials-catalogue/v1.3.3/fetch-and-parse-catalogue.js.map +1 -1
  70. package/lib/commonjs/credentials-catalogue/v1.3.3/fetch-translations.js +5 -3
  71. package/lib/commonjs/credentials-catalogue/v1.3.3/fetch-translations.js.map +1 -1
  72. package/lib/commonjs/credentials-catalogue/v1.3.3/mappers.js +9 -1
  73. package/lib/commonjs/credentials-catalogue/v1.3.3/mappers.js.map +1 -1
  74. package/lib/commonjs/credentials-catalogue/v1.3.3/types.js +49 -1
  75. package/lib/commonjs/credentials-catalogue/v1.3.3/types.js.map +1 -1
  76. package/lib/commonjs/mdoc/index.js +3 -24
  77. package/lib/commonjs/mdoc/index.js.map +1 -1
  78. package/lib/commonjs/sd-jwt/__test__/types.test.js +2 -14
  79. package/lib/commonjs/sd-jwt/__test__/types.test.js.map +1 -1
  80. package/lib/commonjs/sd-jwt/__test__/utils.test.js +0 -12
  81. package/lib/commonjs/sd-jwt/__test__/utils.test.js.map +1 -1
  82. package/lib/commonjs/sd-jwt/types.js +1 -14
  83. package/lib/commonjs/sd-jwt/types.js.map +1 -1
  84. package/lib/commonjs/utils/callbacks.js +45 -7
  85. package/lib/commonjs/utils/callbacks.js.map +1 -1
  86. package/lib/commonjs/utils/crypto.js +58 -5
  87. package/lib/commonjs/utils/crypto.js.map +1 -1
  88. package/lib/commonjs/utils/x509.js +34 -0
  89. package/lib/commonjs/utils/x509.js.map +1 -0
  90. package/lib/commonjs/wallet-instance-attestation/api/types.js +0 -2
  91. package/lib/commonjs/wallet-instance-attestation/api/types.js.map +1 -1
  92. package/lib/commonjs/wallet-instance-attestation/v1.3.3/mappers.js +1 -14
  93. package/lib/commonjs/wallet-instance-attestation/v1.3.3/mappers.js.map +1 -1
  94. package/lib/commonjs/wallet-instance-attestation/v1.3.3/types.js +2 -7
  95. package/lib/commonjs/wallet-instance-attestation/v1.3.3/types.js.map +1 -1
  96. package/lib/commonjs/wallet-unit-attestation/api/types.js +0 -11
  97. package/lib/commonjs/wallet-unit-attestation/api/types.js.map +1 -1
  98. package/lib/module/credential/issuance/README.md +44 -17
  99. package/lib/module/credential/issuance/common/02-start-user-authorization.js +4 -3
  100. package/lib/module/credential/issuance/common/02-start-user-authorization.js.map +1 -1
  101. package/lib/module/credential/issuance/common/06-verify-and-parse-credential.sdjwt.js +39 -10
  102. package/lib/module/credential/issuance/common/06-verify-and-parse-credential.sdjwt.js.map +1 -1
  103. package/lib/module/credential/issuance/mrtd-pop/02-init-challenge.js +47 -34
  104. package/lib/module/credential/issuance/mrtd-pop/02-init-challenge.js.map +1 -1
  105. package/lib/module/credential/issuance/mrtd-pop/03-validate-challenge.js +58 -47
  106. package/lib/module/credential/issuance/mrtd-pop/03-validate-challenge.js.map +1 -1
  107. package/lib/module/credential/issuance/mrtd-pop/index.js +20 -5
  108. package/lib/module/credential/issuance/mrtd-pop/index.js.map +1 -1
  109. package/lib/module/credential/issuance/v1.0.0/02-start-user-authorization.js +1 -1
  110. package/lib/module/credential/issuance/v1.0.0/02-start-user-authorization.js.map +1 -1
  111. package/lib/module/credential/issuance/v1.0.0/03-complete-user-authorization.js +6 -3
  112. package/lib/module/credential/issuance/v1.0.0/03-complete-user-authorization.js.map +1 -1
  113. package/lib/module/credential/issuance/v1.0.0/05-obtain-credential.js +4 -1
  114. package/lib/module/credential/issuance/v1.0.0/05-obtain-credential.js.map +1 -1
  115. package/lib/module/credential/issuance/v1.0.0/index.js +4 -3
  116. package/lib/module/credential/issuance/v1.0.0/index.js.map +1 -1
  117. package/lib/module/credential/issuance/v1.0.0/mappers.js +1 -1
  118. package/lib/module/credential/issuance/v1.0.0/mappers.js.map +1 -1
  119. package/lib/module/credential/issuance/v1.3.3/01-evaluate-issuer-trust.js +0 -2
  120. package/lib/module/credential/issuance/v1.3.3/01-evaluate-issuer-trust.js.map +1 -1
  121. package/lib/module/credential/issuance/v1.3.3/02-start-user-authorization.js +20 -16
  122. package/lib/module/credential/issuance/v1.3.3/02-start-user-authorization.js.map +1 -1
  123. package/lib/module/credential/issuance/v1.3.3/03-complete-user-authorization.js +1 -1
  124. package/lib/module/credential/issuance/v1.3.3/03-complete-user-authorization.js.map +1 -1
  125. package/lib/module/credential/issuance/v1.3.3/04-authorize-access.js +22 -19
  126. package/lib/module/credential/issuance/v1.3.3/04-authorize-access.js.map +1 -1
  127. package/lib/module/credential/issuance/v1.3.3/05-obtain-credential.js +147 -55
  128. package/lib/module/credential/issuance/v1.3.3/05-obtain-credential.js.map +1 -1
  129. package/lib/module/credential/issuance/v1.3.3/06-verify-and-parse-credential.js +4 -1
  130. package/lib/module/credential/issuance/v1.3.3/06-verify-and-parse-credential.js.map +1 -1
  131. package/lib/module/credential/issuance/v1.3.3/index.js +4 -3
  132. package/lib/module/credential/issuance/v1.3.3/index.js.map +1 -1
  133. package/lib/module/credential/issuance/v1.3.3/mappers.js +1 -1
  134. package/lib/module/credential/issuance/v1.3.3/mappers.js.map +1 -1
  135. package/lib/module/credential/presentation/api/types.js.map +1 -1
  136. package/lib/module/credential/presentation/{v1.3.3/utils.mdoc.js → common/utils/mdoc.js} +2 -2
  137. package/lib/module/credential/presentation/common/utils/mdoc.js.map +1 -0
  138. package/lib/module/credential/presentation/v1.0.0/05-verify-request-object.js +13 -7
  139. package/lib/module/credential/presentation/v1.0.0/05-verify-request-object.js.map +1 -1
  140. package/lib/module/credential/presentation/v1.0.0/07-send-authorization-response.js +4 -1
  141. package/lib/module/credential/presentation/v1.0.0/07-send-authorization-response.js.map +1 -1
  142. package/lib/module/credential/presentation/v1.0.0/index.js +0 -2
  143. package/lib/module/credential/presentation/v1.0.0/index.js.map +1 -1
  144. package/lib/module/credential/presentation/v1.0.0/mappers.js +23 -13
  145. package/lib/module/credential/presentation/v1.0.0/mappers.js.map +1 -1
  146. package/lib/module/credential/presentation/v1.0.0/types.js +23 -15
  147. package/lib/module/credential/presentation/v1.0.0/types.js.map +1 -1
  148. package/lib/module/credential/presentation/v1.3.3/05-verify-request-object.js +28 -6
  149. package/lib/module/credential/presentation/v1.3.3/05-verify-request-object.js.map +1 -1
  150. package/lib/module/credential/presentation/v1.3.3/06-evaluate-dcql-query.js +2 -3
  151. package/lib/module/credential/presentation/v1.3.3/06-evaluate-dcql-query.js.map +1 -1
  152. package/lib/module/credential/presentation/v1.3.3/07-send-authorization-response.js +9 -6
  153. package/lib/module/credential/presentation/v1.3.3/07-send-authorization-response.js.map +1 -1
  154. package/lib/module/credential/presentation/v1.3.3/mappers.js +25 -13
  155. package/lib/module/credential/presentation/v1.3.3/mappers.js.map +1 -1
  156. package/lib/module/credential/presentation/v1.3.3/types.js +5 -2
  157. package/lib/module/credential/presentation/v1.3.3/types.js.map +1 -1
  158. package/lib/module/credential/status/README.md +3 -2
  159. package/lib/module/credential/status/v1.3.3/01-status-list.js +27 -5
  160. package/lib/module/credential/status/v1.3.3/01-status-list.js.map +1 -1
  161. package/lib/module/credential/status/v1.3.3/02-verify-and-parse-status-list.js +17 -6
  162. package/lib/module/credential/status/v1.3.3/02-verify-and-parse-status-list.js.map +1 -1
  163. package/lib/module/credentials-catalogue/api/DigitalCredentialsCatalogue.js +24 -0
  164. package/lib/module/credentials-catalogue/api/DigitalCredentialsCatalogue.js.map +1 -1
  165. package/lib/module/credentials-catalogue/v1.3.3/fetch-and-parse-catalogue.js +5 -1
  166. package/lib/module/credentials-catalogue/v1.3.3/fetch-and-parse-catalogue.js.map +1 -1
  167. package/lib/module/credentials-catalogue/v1.3.3/fetch-translations.js +5 -3
  168. package/lib/module/credentials-catalogue/v1.3.3/fetch-translations.js.map +1 -1
  169. package/lib/module/credentials-catalogue/v1.3.3/mappers.js +9 -1
  170. package/lib/module/credentials-catalogue/v1.3.3/mappers.js.map +1 -1
  171. package/lib/module/credentials-catalogue/v1.3.3/types.js +47 -0
  172. package/lib/module/credentials-catalogue/v1.3.3/types.js.map +1 -1
  173. package/lib/module/mdoc/index.js +3 -24
  174. package/lib/module/mdoc/index.js.map +1 -1
  175. package/lib/module/sd-jwt/__test__/types.test.js +2 -14
  176. package/lib/module/sd-jwt/__test__/types.test.js.map +1 -1
  177. package/lib/module/sd-jwt/__test__/utils.test.js +0 -12
  178. package/lib/module/sd-jwt/__test__/utils.test.js.map +1 -1
  179. package/lib/module/sd-jwt/types.js +1 -14
  180. package/lib/module/sd-jwt/types.js.map +1 -1
  181. package/lib/module/utils/callbacks.js +45 -8
  182. package/lib/module/utils/callbacks.js.map +1 -1
  183. package/lib/module/utils/crypto.js +57 -6
  184. package/lib/module/utils/crypto.js.map +1 -1
  185. package/lib/module/utils/x509.js +28 -0
  186. package/lib/module/utils/x509.js.map +1 -0
  187. package/lib/module/wallet-instance-attestation/api/types.js +0 -2
  188. package/lib/module/wallet-instance-attestation/api/types.js.map +1 -1
  189. package/lib/module/wallet-instance-attestation/v1.3.3/mappers.js +1 -14
  190. package/lib/module/wallet-instance-attestation/v1.3.3/mappers.js.map +1 -1
  191. package/lib/module/wallet-instance-attestation/v1.3.3/types.js +2 -7
  192. package/lib/module/wallet-instance-attestation/v1.3.3/types.js.map +1 -1
  193. package/lib/module/wallet-unit-attestation/api/types.js +0 -11
  194. package/lib/module/wallet-unit-attestation/api/types.js.map +1 -1
  195. package/lib/typescript/credential/issuance/api/05-obtain-credential.d.ts +20 -0
  196. package/lib/typescript/credential/issuance/api/05-obtain-credential.d.ts.map +1 -1
  197. package/lib/typescript/credential/issuance/api/06-verify-and-parse-credential.d.ts +4 -0
  198. package/lib/typescript/credential/issuance/api/06-verify-and-parse-credential.d.ts.map +1 -1
  199. package/lib/typescript/credential/issuance/common/02-start-user-authorization.d.ts.map +1 -1
  200. package/lib/typescript/credential/issuance/common/06-verify-and-parse-credential.sdjwt.d.ts.map +1 -1
  201. package/lib/typescript/credential/issuance/mrtd-pop/02-init-challenge.d.ts +12 -1
  202. package/lib/typescript/credential/issuance/mrtd-pop/02-init-challenge.d.ts.map +1 -1
  203. package/lib/typescript/credential/issuance/mrtd-pop/03-validate-challenge.d.ts +12 -1
  204. package/lib/typescript/credential/issuance/mrtd-pop/03-validate-challenge.d.ts.map +1 -1
  205. package/lib/typescript/credential/issuance/mrtd-pop/index.d.ts +2 -1
  206. package/lib/typescript/credential/issuance/mrtd-pop/index.d.ts.map +1 -1
  207. package/lib/typescript/credential/issuance/v1.0.0/03-complete-user-authorization.d.ts.map +1 -1
  208. package/lib/typescript/credential/issuance/v1.0.0/05-obtain-credential.d.ts +1 -0
  209. package/lib/typescript/credential/issuance/v1.0.0/05-obtain-credential.d.ts.map +1 -1
  210. package/lib/typescript/credential/issuance/v1.0.0/index.d.ts.map +1 -1
  211. package/lib/typescript/credential/issuance/v1.0.0/mappers.d.ts.map +1 -1
  212. package/lib/typescript/credential/issuance/v1.3.3/01-evaluate-issuer-trust.d.ts.map +1 -1
  213. package/lib/typescript/credential/issuance/v1.3.3/02-start-user-authorization.d.ts.map +1 -1
  214. package/lib/typescript/credential/issuance/v1.3.3/04-authorize-access.d.ts.map +1 -1
  215. package/lib/typescript/credential/issuance/v1.3.3/05-obtain-credential.d.ts +23 -2
  216. package/lib/typescript/credential/issuance/v1.3.3/05-obtain-credential.d.ts.map +1 -1
  217. package/lib/typescript/credential/issuance/v1.3.3/06-verify-and-parse-credential.d.ts.map +1 -1
  218. package/lib/typescript/credential/issuance/v1.3.3/index.d.ts.map +1 -1
  219. package/lib/typescript/credential/issuance/v1.3.3/mappers.d.ts.map +1 -1
  220. package/lib/typescript/credential/presentation/api/04-verify-certificate-chain.d.ts +9 -2
  221. package/lib/typescript/credential/presentation/api/04-verify-certificate-chain.d.ts.map +1 -1
  222. package/lib/typescript/credential/presentation/api/05-verify-request-object.d.ts +2 -2
  223. package/lib/typescript/credential/presentation/api/05-verify-request-object.d.ts.map +1 -1
  224. package/lib/typescript/credential/presentation/api/07-send-authorization-response.d.ts +2 -2
  225. package/lib/typescript/credential/presentation/api/07-send-authorization-response.d.ts.map +1 -1
  226. package/lib/typescript/credential/presentation/api/types.d.ts +18 -0
  227. package/lib/typescript/credential/presentation/api/types.d.ts.map +1 -1
  228. package/lib/typescript/credential/presentation/{v1.3.3/utils.mdoc.d.ts → common/utils/mdoc.d.ts} +2 -2
  229. package/lib/typescript/credential/presentation/common/utils/mdoc.d.ts.map +1 -0
  230. package/lib/typescript/credential/presentation/v1.0.0/05-verify-request-object.d.ts.map +1 -1
  231. package/lib/typescript/credential/presentation/v1.0.0/07-send-authorization-response.d.ts.map +1 -1
  232. package/lib/typescript/credential/presentation/v1.0.0/index.d.ts.map +1 -1
  233. package/lib/typescript/credential/presentation/v1.0.0/mappers.d.ts +21 -13
  234. package/lib/typescript/credential/presentation/v1.0.0/mappers.d.ts.map +1 -1
  235. package/lib/typescript/credential/presentation/v1.0.0/types.d.ts +23 -15
  236. package/lib/typescript/credential/presentation/v1.0.0/types.d.ts.map +1 -1
  237. package/lib/typescript/credential/presentation/v1.3.3/05-verify-request-object.d.ts.map +1 -1
  238. package/lib/typescript/credential/presentation/v1.3.3/06-evaluate-dcql-query.d.ts.map +1 -1
  239. package/lib/typescript/credential/presentation/v1.3.3/07-send-authorization-response.d.ts.map +1 -1
  240. package/lib/typescript/credential/presentation/v1.3.3/mappers.d.ts +89 -79
  241. package/lib/typescript/credential/presentation/v1.3.3/mappers.d.ts.map +1 -1
  242. package/lib/typescript/credential/presentation/v1.3.3/types.d.ts +87 -79
  243. package/lib/typescript/credential/presentation/v1.3.3/types.d.ts.map +1 -1
  244. package/lib/typescript/credential/status/api/status-list.d.ts +8 -4
  245. package/lib/typescript/credential/status/api/status-list.d.ts.map +1 -1
  246. package/lib/typescript/credential/status/v1.3.3/01-status-list.d.ts.map +1 -1
  247. package/lib/typescript/credential/status/v1.3.3/02-verify-and-parse-status-list.d.ts.map +1 -1
  248. package/lib/typescript/credentials-catalogue/api/DigitalCredentialsCatalogue.d.ts +73 -0
  249. package/lib/typescript/credentials-catalogue/api/DigitalCredentialsCatalogue.d.ts.map +1 -1
  250. package/lib/typescript/credentials-catalogue/api/index.d.ts +6 -5
  251. package/lib/typescript/credentials-catalogue/api/index.d.ts.map +1 -1
  252. package/lib/typescript/credentials-catalogue/v1.0.0/mappers.d.ts +25 -0
  253. package/lib/typescript/credentials-catalogue/v1.0.0/mappers.d.ts.map +1 -1
  254. package/lib/typescript/credentials-catalogue/v1.3.3/fetch-and-parse-catalogue.d.ts.map +1 -1
  255. package/lib/typescript/credentials-catalogue/v1.3.3/fetch-translations.d.ts.map +1 -1
  256. package/lib/typescript/credentials-catalogue/v1.3.3/mappers.d.ts +51 -0
  257. package/lib/typescript/credentials-catalogue/v1.3.3/mappers.d.ts.map +1 -1
  258. package/lib/typescript/credentials-catalogue/v1.3.3/types.d.ts +33 -0
  259. package/lib/typescript/credentials-catalogue/v1.3.3/types.d.ts.map +1 -1
  260. package/lib/typescript/mdoc/index.d.ts +1 -1
  261. package/lib/typescript/mdoc/index.d.ts.map +1 -1
  262. package/lib/typescript/mdoc/utils.d.ts +0 -24
  263. package/lib/typescript/mdoc/utils.d.ts.map +1 -1
  264. package/lib/typescript/sd-jwt/types.d.ts +0 -12
  265. package/lib/typescript/sd-jwt/types.d.ts.map +1 -1
  266. package/lib/typescript/utils/callbacks.d.ts +7 -0
  267. package/lib/typescript/utils/callbacks.d.ts.map +1 -1
  268. package/lib/typescript/utils/crypto.d.ts +32 -15
  269. package/lib/typescript/utils/crypto.d.ts.map +1 -1
  270. package/lib/typescript/utils/x509.d.ts +10 -0
  271. package/lib/typescript/utils/x509.d.ts.map +1 -0
  272. package/lib/typescript/wallet-instance-attestation/api/types.d.ts +0 -2
  273. package/lib/typescript/wallet-instance-attestation/api/types.d.ts.map +1 -1
  274. package/lib/typescript/wallet-instance-attestation/v1.0.0/mappers.d.ts +0 -2
  275. package/lib/typescript/wallet-instance-attestation/v1.0.0/mappers.d.ts.map +1 -1
  276. package/lib/typescript/wallet-instance-attestation/v1.3.3/mappers.d.ts +2 -9
  277. package/lib/typescript/wallet-instance-attestation/v1.3.3/mappers.d.ts.map +1 -1
  278. package/lib/typescript/wallet-instance-attestation/v1.3.3/types.d.ts +2 -7
  279. package/lib/typescript/wallet-instance-attestation/v1.3.3/types.d.ts.map +1 -1
  280. package/lib/typescript/wallet-unit-attestation/api/types.d.ts +0 -11
  281. package/lib/typescript/wallet-unit-attestation/api/types.d.ts.map +1 -1
  282. package/lib/typescript/wallet-unit-attestation/v1.3.3/mappers.d.ts +0 -22
  283. package/lib/typescript/wallet-unit-attestation/v1.3.3/mappers.d.ts.map +1 -1
  284. package/lib/typescript/wallet-unit-attestation/v1.3.3/types.d.ts +0 -11
  285. package/lib/typescript/wallet-unit-attestation/v1.3.3/types.d.ts.map +1 -1
  286. package/package.json +6 -6
  287. package/src/credential/issuance/README.md +44 -17
  288. package/src/credential/issuance/api/05-obtain-credential.ts +24 -0
  289. package/src/credential/issuance/api/06-verify-and-parse-credential.ts +4 -0
  290. package/src/credential/issuance/common/02-start-user-authorization.ts +6 -3
  291. package/src/credential/issuance/common/06-verify-and-parse-credential.sdjwt.ts +42 -9
  292. package/src/credential/issuance/mrtd-pop/02-init-challenge.ts +69 -45
  293. package/src/credential/issuance/mrtd-pop/03-validate-challenge.ts +84 -62
  294. package/src/credential/issuance/mrtd-pop/index.ts +13 -5
  295. package/src/credential/issuance/v1.0.0/02-start-user-authorization.ts +1 -1
  296. package/src/credential/issuance/v1.0.0/03-complete-user-authorization.ts +8 -3
  297. package/src/credential/issuance/v1.0.0/05-obtain-credential.ts +6 -0
  298. package/src/credential/issuance/v1.0.0/index.ts +7 -3
  299. package/src/credential/issuance/v1.0.0/mappers.ts +4 -1
  300. package/src/credential/issuance/v1.3.3/01-evaluate-issuer-trust.ts +0 -2
  301. package/src/credential/issuance/v1.3.3/02-start-user-authorization.ts +24 -20
  302. package/src/credential/issuance/v1.3.3/03-complete-user-authorization.ts +1 -1
  303. package/src/credential/issuance/v1.3.3/04-authorize-access.ts +28 -23
  304. package/src/credential/issuance/v1.3.3/05-obtain-credential.ts +182 -87
  305. package/src/credential/issuance/v1.3.3/06-verify-and-parse-credential.ts +2 -1
  306. package/src/credential/issuance/v1.3.3/index.ts +7 -3
  307. package/src/credential/issuance/v1.3.3/mappers.ts +4 -1
  308. package/src/credential/presentation/api/04-verify-certificate-chain.ts +9 -2
  309. package/src/credential/presentation/api/05-verify-request-object.ts +2 -2
  310. package/src/credential/presentation/api/07-send-authorization-response.ts +2 -2
  311. package/src/credential/presentation/api/types.ts +16 -0
  312. package/src/credential/presentation/{v1.3.3/utils.mdoc.ts → common/utils/mdoc.ts} +2 -2
  313. package/src/credential/presentation/v1.0.0/05-verify-request-object.ts +21 -10
  314. package/src/credential/presentation/v1.0.0/07-send-authorization-response.ts +7 -0
  315. package/src/credential/presentation/v1.0.0/index.ts +0 -2
  316. package/src/credential/presentation/v1.0.0/mappers.ts +17 -17
  317. package/src/credential/presentation/v1.0.0/types.ts +23 -15
  318. package/src/credential/presentation/v1.3.3/05-verify-request-object.ts +63 -10
  319. package/src/credential/presentation/v1.3.3/06-evaluate-dcql-query.ts +3 -3
  320. package/src/credential/presentation/v1.3.3/07-send-authorization-response.ts +13 -4
  321. package/src/credential/presentation/v1.3.3/mappers.ts +19 -17
  322. package/src/credential/presentation/v1.3.3/types.ts +9 -3
  323. package/src/credential/status/README.md +3 -2
  324. package/src/credential/status/api/status-list.ts +10 -7
  325. package/src/credential/status/v1.3.3/01-status-list.ts +21 -7
  326. package/src/credential/status/v1.3.3/02-verify-and-parse-status-list.ts +19 -5
  327. package/src/credentials-catalogue/api/DigitalCredentialsCatalogue.ts +32 -0
  328. package/src/credentials-catalogue/api/index.ts +6 -3
  329. package/src/credentials-catalogue/v1.3.3/fetch-and-parse-catalogue.ts +6 -0
  330. package/src/credentials-catalogue/v1.3.3/fetch-translations.ts +6 -3
  331. package/src/credentials-catalogue/v1.3.3/mappers.ts +17 -1
  332. package/src/credentials-catalogue/v1.3.3/types.ts +51 -0
  333. package/src/mdoc/index.ts +5 -41
  334. package/src/sd-jwt/__test__/types.test.ts +1 -13
  335. package/src/sd-jwt/__test__/utils.test.ts +0 -12
  336. package/src/sd-jwt/types.ts +0 -13
  337. package/src/utils/callbacks.ts +57 -9
  338. package/src/utils/crypto.ts +86 -15
  339. package/src/utils/x509.ts +43 -0
  340. package/src/wallet-instance-attestation/api/types.ts +0 -2
  341. package/src/wallet-instance-attestation/v1.3.3/mappers.ts +3 -11
  342. package/src/wallet-instance-attestation/v1.3.3/types.ts +2 -7
  343. package/src/wallet-unit-attestation/api/types.ts +0 -11
  344. package/lib/commonjs/credential/issuance/common/authorization.js +0 -56
  345. package/lib/commonjs/credential/issuance/common/authorization.js.map +0 -1
  346. package/lib/commonjs/credential/presentation/v1.0.0/04-verify-certificate-chain.js +0 -12
  347. package/lib/commonjs/credential/presentation/v1.0.0/04-verify-certificate-chain.js.map +0 -1
  348. package/lib/commonjs/credential/presentation/v1.3.3/utils.mdoc.js.map +0 -1
  349. package/lib/module/credential/issuance/common/authorization.js +0 -48
  350. package/lib/module/credential/issuance/common/authorization.js.map +0 -1
  351. package/lib/module/credential/presentation/v1.0.0/04-verify-certificate-chain.js +0 -5
  352. package/lib/module/credential/presentation/v1.0.0/04-verify-certificate-chain.js.map +0 -1
  353. package/lib/module/credential/presentation/v1.3.3/utils.mdoc.js.map +0 -1
  354. package/lib/typescript/credential/issuance/common/authorization.d.ts +0 -21
  355. package/lib/typescript/credential/issuance/common/authorization.d.ts.map +0 -1
  356. package/lib/typescript/credential/presentation/v1.0.0/04-verify-certificate-chain.d.ts +0 -3
  357. package/lib/typescript/credential/presentation/v1.0.0/04-verify-certificate-chain.d.ts.map +0 -1
  358. package/lib/typescript/credential/presentation/v1.3.3/utils.mdoc.d.ts.map +0 -1
  359. package/src/credential/issuance/common/authorization.ts +0 -89
  360. package/src/credential/presentation/v1.0.0/04-verify-certificate-chain.ts +0 -10
@@ -41,17 +41,6 @@ export declare const mapToDecodedWalletUnitAttestation: (input: {
41
41
  uri: string;
42
42
  };
43
43
  };
44
- eudi_wallet_info: {
45
- general_info: {
46
- wallet_provider_name: string;
47
- wallet_solution_id: string;
48
- wallet_solution_version: string;
49
- };
50
- key_storage_info: {
51
- keys_exportable: boolean;
52
- storage_type: string;
53
- };
54
- };
55
44
  iss: string;
56
45
  iat: number;
57
46
  exp: number;
@@ -89,17 +78,6 @@ export declare const mapToDecodedWalletUnitAttestation: (input: {
89
78
  uri: string;
90
79
  };
91
80
  };
92
- eudi_wallet_info: {
93
- general_info: {
94
- wallet_provider_name: string;
95
- wallet_solution_id: string;
96
- wallet_solution_version: string;
97
- };
98
- key_storage_info: {
99
- keys_exportable: boolean;
100
- storage_type: string;
101
- };
102
- };
103
81
  iss: string;
104
82
  iat: number;
105
83
  exp: number;
@@ -1 +1 @@
1
- {"version":3,"file":"mappers.d.ts","sourceRoot":"","sources":["../../../../src/wallet-unit-attestation/v1.3.3/mappers.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAK5C,CAAC"}
1
+ {"version":3,"file":"mappers.d.ts","sourceRoot":"","sources":["../../../../src/wallet-unit-attestation/v1.3.3/mappers.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAK5C,CAAC"}
@@ -46,17 +46,6 @@ export declare const WalletUnitAttestationJwt: z.ZodObject<{
46
46
  uri: z.ZodString;
47
47
  }, z.core.$strip>;
48
48
  }, z.core.$strip>;
49
- eudi_wallet_info: z.ZodObject<{
50
- general_info: z.ZodObject<{
51
- wallet_provider_name: z.ZodString;
52
- wallet_solution_id: z.ZodString;
53
- wallet_solution_version: z.ZodString;
54
- }, z.core.$strip>;
55
- key_storage_info: z.ZodObject<{
56
- keys_exportable: z.ZodBoolean;
57
- storage_type: z.ZodString;
58
- }, z.core.$strip>;
59
- }, z.core.$strip>;
60
49
  iss: z.ZodString;
61
50
  iat: z.ZodNumber;
62
51
  exp: z.ZodNumber;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/wallet-unit-attestation/v1.3.3/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAIzB,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAChF,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAQnC,CAAC;AAEH,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CACjD,OAAO,6BAA6B,CACrC,CAAC;AACF,eAAO,MAAM,6BAA6B;;iBAExC,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/wallet-unit-attestation/v1.3.3/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAIzB,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAChF,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAQnC,CAAC;AAEH,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CACjD,OAAO,6BAA6B,CACrC,CAAC;AACF,eAAO,MAAM,6BAA6B;;iBAExC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pagopa/io-react-native-wallet",
3
- "version": "3.1.2",
3
+ "version": "3.3.0",
4
4
  "description": "Provide data structures, helpers and API for IO Wallet",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -140,11 +140,11 @@
140
140
  ]
141
141
  },
142
142
  "dependencies": {
143
- "@pagopa/io-wallet-oauth2": "1.2.1",
144
- "@pagopa/io-wallet-oid4vci": "1.2.1",
145
- "@pagopa/io-wallet-oid4vp": "1.2.1",
146
- "@pagopa/io-wallet-oid-federation": "1.2.1",
147
- "@pagopa/io-wallet-utils": "1.2.1",
143
+ "@pagopa/io-wallet-oauth2": "1.4.0",
144
+ "@pagopa/io-wallet-oid4vci": "1.4.0",
145
+ "@pagopa/io-wallet-oid4vp": "1.4.0",
146
+ "@pagopa/io-wallet-oid-federation": "1.4.0",
147
+ "@pagopa/io-wallet-utils": "1.4.0",
148
148
  "@sd-jwt/core": "^0.19.0",
149
149
  "@sd-jwt/crypto-nodejs": "^0.19.0",
150
150
  "@sd-jwt/jwt-status-list": "^0.19.0",
@@ -8,6 +8,8 @@ Credentials instead require a simpler authorization flow and they require other
8
8
 
9
9
  The supported credentials are defined in the entity configuration of the issuer which is evaluted and parsed in the `evaluateIssuerTrust` step. Available credentials are identified with a unique `credential_configuration_id`, that must be used when requesting authorization. The Authorization Server returns an array of **credential identifiers** that map to the `credential_configuration_id` provided: to obtain the credential, one of the credential identifiers (or all of them) must be requested to the credential endpoint.
10
10
 
11
+ In the newest versions of IT-Wallet specifications it is mandatory that the cryptographic keys bound to each credential are stored in a WSCD and attested in a **Wallet Unit Attestation**, that must be sent to the Issuer when requesting a credential.
12
+
11
13
  ## Sequence Diagram
12
14
 
13
15
  ```mermaid
@@ -20,8 +22,9 @@ graph TD;
20
22
  C4.1[completeUserAuthorizationWithFormPostJwtMode]
21
23
  E4[completeUserAuthorizationWithQueryMode]
22
24
  5[authorizeAccess]
23
- 6[obtainCredential]
24
- 7[verifyAndParseCredential]
25
+ 6[WalletUnitAttestation.getAttestation]
26
+ 7[obtainCredential]
27
+ 8[verifyAndParseCredential]
25
28
  credSel{Is credential an eID?}
26
29
  proofSel{Requires MRTD PoP?}
27
30
  M1[continueUserAuthorizationWithMRTDPoPChallenge]
@@ -44,6 +47,7 @@ graph TD;
44
47
  E4 --> 5
45
48
  5 --> 6
46
49
  6 --> 7
50
+ 7 --> 8
47
51
 
48
52
  M1 --> M2
49
53
  M2 --> M3
@@ -92,6 +96,10 @@ When the credential is different than an eID, the flow requires the user to pres
92
96
 
93
97
  The expected result from the authentication process is in `form_post.jwt` format as defined in [JWT Secured Authorization Response Mode for OAuth 2.0 (JARM)](https://openid.net/specs/oauth-v2-jarm.html#name-response-mode-form_postjwt).
94
98
 
99
+ ## Batch issuance
100
+
101
+ To obtain a batch of credentials the Issuance module exposes a dedicated method—`obtainCredentialsBatch`—that returns a list of credentials of the same type with different cryptographic data. For this reason the caller must generate multiple keys and attest them in a single Wallet Unit Attestation.
102
+
95
103
  ## Examples
96
104
 
97
105
  <details>
@@ -119,12 +127,28 @@ const { WALLET_PROVIDER_BASE_URL, WALLET_EAA_PROVIDER_BASE_URL, REDIRECT_URI } =
119
127
  * WARNING: The integrity context must be the same used when creating the Wallet Instance with the same keytag.
120
128
  */
121
129
  const walletInstanceAttestation =
122
- await WalletInstanceAttestation.getAttestation({
123
- wiaCryptoContext,
124
- integrityContext,
125
- walletProviderBaseUrl: WALLET_PROVIDER_BASE_URL,
126
- appFetch,
127
- });
130
+ await wallet.WalletInstanceAttestation.getAttestation(
131
+ {
132
+ walletProviderBaseUrl: WALLET_PROVIDER_BASE_URL,
133
+ walletSolutionId: "exampleId",
134
+ walletSolutionVersion: "1.2.3",
135
+ },
136
+ {
137
+ wiaCryptoContext,
138
+ integrityContext,
139
+ appFetch,
140
+ }
141
+ );
142
+
143
+ const credentialKeyTag = uuidv4().toString();
144
+ let walletUnitAttestation: string | undefined;
145
+
146
+ // Obtains a Wallet Unit Attestation if supported
147
+ if (wallet.WalletUnitAttestation.isSupported) {
148
+ walletUnitAttestation = await wallet.WalletUnitAttestation.getAttestation(); // See the Wallet Unit Attestation README for more details
149
+ } else {
150
+ await generate(credentialKeyTag); // Let's assume this function generates a new hardware-backed key pair
151
+ }
128
152
 
129
153
  const pid = {
130
154
  credential: "example",
@@ -133,9 +157,6 @@ const pid = {
133
157
  credentialType: "PersonIdentificationData";
134
158
  };
135
159
 
136
- // Create credential crypto context
137
- const credentialKeyTag = uuidv4().toString();
138
- await generate(credentialKeyTag); // Let's assume this function generates a new hardware-backed key pair
139
160
  const credentialCryptoContext = createCryptoContextFor(credentialKeyTag);
140
161
 
141
162
  // Evaluate issuer trust
@@ -271,12 +292,18 @@ const { WALLET_PROVIDER_BASE_URL, WALLET_EID_PROVIDER_BASE_URL, REDIRECT_URI } =
271
292
  * WARNING: The integrity context must be the same used when creating the Wallet Instance with the same keytag.
272
293
  */
273
294
  const walletInstanceAttestation =
274
- await WalletInstanceAttestation.getAttestation({
275
- wiaCryptoContext,
276
- integrityContext,
277
- walletProviderBaseUrl: WALLET_PROVIDER_BASE_URL,
278
- appFetch,
279
- });
295
+ await wallet.WalletInstanceAttestation.getAttestation(
296
+ {
297
+ walletProviderBaseUrl: WALLET_PROVIDER_BASE_URL,
298
+ walletSolutionId: "exampleId",
299
+ walletSolutionVersion: "1.2.3",
300
+ },
301
+ {
302
+ wiaCryptoContext,
303
+ integrityContext,
304
+ appFetch,
305
+ }
306
+ );
280
307
 
281
308
  const idpHit = "https://example.com"; // Let's assume this is the IDP hint
282
309
 
@@ -41,4 +41,28 @@ export interface ObtainCredentialApi {
41
41
  credential: string;
42
42
  format: CredentialFormat;
43
43
  }>;
44
+
45
+ /**
46
+ * Obtains a batch of credentials from the issuer.
47
+ * The batch includes the same credential format and dataset with different cryptographic data.
48
+ * For this reason, the function accepts a list of {@link CryptoContext}; the rest of the parameters are the same as {@link obtainCredential}.
49
+ * @since 1.3.3
50
+ *
51
+ * @returns The list of credentials issued in the batch.
52
+ */
53
+ obtainCredentialsBatch(
54
+ issuerConf: IssuerConfig,
55
+ accessToken: Out<AuthorizeAccessApi["authorizeAccess"]>["accessToken"],
56
+ clientId: string,
57
+ credentialDefinition: {
58
+ credential_configuration_id: string;
59
+ credential_identifier: string;
60
+ },
61
+ context: {
62
+ dPopCryptoContext: CryptoContext;
63
+ credentialCryptoContexts: CryptoContext[];
64
+ walletUnitAttestation?: string;
65
+ appFetch?: GlobalFetch["fetch"];
66
+ }
67
+ ): Promise<{ credential: string; format: CredentialFormat }[]>;
44
68
  }
@@ -32,6 +32,10 @@ export interface VerifyAndParseCredentialApi {
32
32
  * Include attributes that are not explicitly mapped in the issuer configuration.
33
33
  */
34
34
  includeUndefinedAttributes?: boolean;
35
+ /**
36
+ * Validate the certificate chain of the credential against the provided `x509CertRoot`.
37
+ */
38
+ validateCertificateChain?: boolean;
35
39
  },
36
40
  x509CertRoot?: string
37
41
  ): Promise<{
@@ -1,3 +1,4 @@
1
+ import { IoWalletError } from "../../../utils/errors";
1
2
  import { LogLevel, Logger } from "../../../utils/logging";
2
3
  import { AuthorizationDetail } from "../../../utils/par";
3
4
  import type { IssuerConfig } from "../api";
@@ -30,7 +31,7 @@ export const selectCredentialDefinition = (
30
31
  LogLevel.ERROR,
31
32
  `Requested credential ${credentialId} is not supported by the issuer according to its configuration ${JSON.stringify(credential_configurations_supported)}`
32
33
  );
33
- throw new Error(`No credential support the type '${credentialId}'`);
34
+ throw new IoWalletError(`No credential support the type '${credentialId}'`);
34
35
  }
35
36
  return result;
36
37
  };
@@ -61,7 +62,7 @@ export const selectResponseMode = (
61
62
  LogLevel.ERROR,
62
63
  `${credentialIds} have incompatible response_mode: ${[...responseModeSet.values()]}`
63
64
  );
64
- throw new Error(
65
+ throw new IoWalletError(
65
66
  "Requested credentials have incompatible response_mode and cannot be requested with the same PAR request"
66
67
  );
67
68
  }
@@ -79,7 +80,9 @@ export const selectResponseMode = (
79
80
  LogLevel.ERROR,
80
81
  `Requested response mode ${responseMode} is not supported by the issuer according to its configuration ${JSON.stringify(responseModeSupported)}`
81
82
  );
82
- throw new Error(`No response mode support for IDs '${credentialIds}'`);
83
+ throw new IoWalletError(
84
+ `No response mode support for IDs '${credentialIds}'`
85
+ );
83
86
  }
84
87
 
85
88
  return responseMode!;
@@ -1,16 +1,18 @@
1
1
  import {
2
- getJwkFromHeader,
3
2
  type CryptoContext,
4
- decode,
3
+ verify as verifyJwt,
5
4
  } from "@pagopa/io-react-native-jwt";
6
5
  import { type SDJwt, SDJwtInstance } from "@sd-jwt/core";
7
- import { digest, ES256 } from "@sd-jwt/crypto-nodejs";
6
+ import { digest } from "@sd-jwt/crypto-nodejs";
7
+ import type { Verifier } from "@sd-jwt/types";
8
8
  import { isPathEqual, isPrefixOf } from "../../../utils/parser";
9
9
  import { IoWalletError } from "../../../utils/errors";
10
10
  import { LogLevel, Logger } from "../../../utils/logging";
11
11
  import { isSameThumbprint, type JWK } from "../../../utils/jwk";
12
12
  import type { SdJwt4VCBase } from "../../../sd-jwt/types";
13
13
  import { fixLegacyCredentialSdJwt } from "../../../utils/credentials";
14
+ import { verifyX509Chain } from "../../../utils/x509";
15
+ import { MissingX509CertsError } from "../../../trust/common/errors";
14
16
  import type { IssuanceApi, IssuerConfig, ParsedCredential } from "../api";
15
17
 
16
18
  type CredentialConf =
@@ -151,6 +153,27 @@ const parseCredentialSdJwt = (
151
153
  return processLevel(parsedCredentialRaw, []) as ParsedCredential;
152
154
  };
153
155
 
156
+ /**
157
+ * JWT verifier implementing the interface expected by the SD-JWT library.
158
+ * Verification is delegated to `io-react-native-jwt` to leverage its support for multiple algorithms.
159
+ * @returns Boolean indicating whether the verification succeeded or not
160
+ */
161
+ const sdJwtInstanceVerifier: Verifier<{ issuerKeys: JWK[] }> = async (
162
+ data,
163
+ signature,
164
+ options
165
+ ) => {
166
+ if (!options?.issuerKeys) {
167
+ return false;
168
+ }
169
+ try {
170
+ await verifyJwt(`${data}.${signature}`, options.issuerKeys);
171
+ return true;
172
+ } catch {
173
+ return false;
174
+ }
175
+ };
176
+
154
177
  /**
155
178
  * Given a credential, verify it's in the supported format
156
179
  * and the credential is correctly signed
@@ -171,16 +194,13 @@ async function verifyCredentialSdJwt(
171
194
  issuerKeys: JWK[],
172
195
  holderBindingContext: CryptoContext
173
196
  ): Promise<SDJwt> {
174
- const { protectedHeader } = decode(rawCredential);
175
- const verifierJwk = getJwkFromHeader(protectedHeader, issuerKeys);
176
-
177
197
  const sdJwtInstance = new SDJwtInstance({
178
198
  hasher: digest,
179
- verifier: await ES256.getVerifier(verifierJwk),
199
+ verifier: sdJwtInstanceVerifier,
180
200
  });
181
201
 
182
202
  const [verifiedCredential, holderBindingKey] = await Promise.all([
183
- sdJwtInstance.verify(rawCredential),
203
+ sdJwtInstance.verify(rawCredential, { issuerKeys }),
184
204
  holderBindingContext.getPublicKey(),
185
205
  ]);
186
206
 
@@ -203,7 +223,9 @@ export const verifyAndParseCredentialSdJwt: IssuanceApi["verifyAndParseCredentia
203
223
  credentialCryptoContext,
204
224
  ignoreMissingAttributes,
205
225
  includeUndefinedAttributes,
206
- }
226
+ validateCertificateChain,
227
+ },
228
+ x509CertRoot
207
229
  ) => {
208
230
  const decoded = await verifyCredentialSdJwt(
209
231
  credential,
@@ -216,6 +238,17 @@ export const verifyAndParseCredentialSdJwt: IssuanceApi["verifyAndParseCredentia
216
238
  `Decoded credential: ${JSON.stringify(decoded)}`
217
239
  );
218
240
 
241
+ if (validateCertificateChain) {
242
+ if (!x509CertRoot) {
243
+ throw new IoWalletError("Missing x509CertRoot");
244
+ }
245
+ const x5c = decoded.jwt?.header?.x5c as string[] | undefined;
246
+ if (!x5c || !Array.isArray(x5c) || x5c.length === 0) {
247
+ throw new MissingX509CertsError("Missing x509 certificates");
248
+ }
249
+ await verifyX509Chain(x5c, x509CertRoot);
250
+ }
251
+
219
252
  const credentialConfig =
220
253
  issuerConf.credential_configurations_supported[credentialConfigurationId];
221
254
 
@@ -1,61 +1,85 @@
1
- import { v4 as uuidv4 } from "uuid";
2
- import { fetchMrtdPopInit } from "@pagopa/io-wallet-oauth2";
3
- import { UnexpectedStatusCodeError as SdkUnexpectedStatusCodeError } from "@pagopa/io-wallet-utils";
4
- import { createPopToken } from "../../../utils/pop";
1
+ import {
2
+ createClientAttestationPopJwt,
3
+ fetchMrtdPopInit,
4
+ } from "@pagopa/io-wallet-oauth2";
5
+ import {
6
+ IoWalletSdkConfig,
7
+ UnexpectedStatusCodeError as SdkUnexpectedStatusCodeError,
8
+ } from "@pagopa/io-wallet-utils";
5
9
  import { Logger, LogLevel } from "../../../utils/logging";
6
- import * as WalletInstanceAttestation from "../../../wallet-instance-attestation/v1.0.0/utils"; // TODO: decouple from version 1.0.0
7
10
  import {
8
11
  IssuerResponseError,
9
12
  IssuerResponseErrorCodes,
10
13
  ResponseErrorBuilder,
11
14
  } from "../../../utils/errors";
12
15
  import type { MRTDPoPApi } from "../api/mrtd-pop";
13
- import { createVerifyJwtFromJwks } from "../../../utils/callbacks";
16
+ import {
17
+ createSignJwtFromCryptoContext,
18
+ createVerifyJwtFromJwks,
19
+ partialCallbacks,
20
+ } from "../../../utils/callbacks";
14
21
 
15
- export const initChallenge: MRTDPoPApi["initChallenge"] = async (
16
- issuerConf,
17
- initUrl,
18
- mrtd_auth_session,
19
- mrtd_pop_jwt_nonce,
20
- context
21
- ) => {
22
- const {
23
- appFetch = fetch,
24
- walletInstanceAttestation,
25
- wiaCryptoContext,
26
- } = context;
22
+ type Config = {
23
+ sdkConfig: IoWalletSdkConfig;
24
+ };
27
25
 
28
- const iss = WalletInstanceAttestation.decode(walletInstanceAttestation)
29
- .payload.cnf.jwk.kid;
26
+ /**
27
+ * Factory function to create `initChallenge` for MRTD PoP flow.
28
+ * The factory is needed to inject version specific SDK configuration.
29
+ * @param config Configuration object containing the IO Wallet SDK configuration
30
+ * @returns `initChallenge` function compliant with the public API
31
+ */
32
+ export function createInitChallenge(
33
+ config: Config
34
+ ): MRTDPoPApi["initChallenge"] {
35
+ return async function initChallenge(
36
+ issuerConf,
37
+ initUrl,
38
+ mrtd_auth_session,
39
+ mrtd_pop_jwt_nonce,
40
+ context
41
+ ) {
42
+ const {
43
+ appFetch = fetch,
44
+ walletInstanceAttestation,
45
+ wiaCryptoContext,
46
+ } = context;
30
47
 
31
- const signedWiaPoP = await createPopToken(
32
- {
33
- jti: uuidv4(),
34
- aud: issuerConf.credential_issuer,
35
- iss,
36
- },
37
- wiaCryptoContext
38
- );
48
+ const clientAttestationDPoP = await createClientAttestationPopJwt({
49
+ config: config.sdkConfig,
50
+ callbacks: {
51
+ generateRandom: partialCallbacks.generateRandom,
52
+ signJwt: createSignJwtFromCryptoContext(wiaCryptoContext),
53
+ },
54
+ clientAttestation: walletInstanceAttestation,
55
+ authorizationServer: issuerConf.credential_issuer,
56
+ signer: {
57
+ method: "jwk",
58
+ alg: "ES256",
59
+ publicJwk: await wiaCryptoContext.getPublicKey(),
60
+ },
61
+ });
39
62
 
40
- const initResult = await fetchMrtdPopInit({
41
- popInitEndpoint: initUrl,
42
- mrtdAuthSession: mrtd_auth_session,
43
- mrtdPopJwtNonce: mrtd_pop_jwt_nonce,
44
- walletAttestation: walletInstanceAttestation,
45
- clientAttestationDPoP: signedWiaPoP,
46
- callbacks: {
47
- verifyJwt: createVerifyJwtFromJwks(issuerConf.keys),
48
- fetch: appFetch,
49
- },
50
- }).catch(handleInitChallengeError);
63
+ const initResult = await fetchMrtdPopInit({
64
+ popInitEndpoint: initUrl,
65
+ mrtdAuthSession: mrtd_auth_session,
66
+ mrtdPopJwtNonce: mrtd_pop_jwt_nonce,
67
+ walletAttestation: walletInstanceAttestation,
68
+ clientAttestationDPoP,
69
+ callbacks: {
70
+ verifyJwt: createVerifyJwtFromJwks(issuerConf.keys),
71
+ fetch: appFetch,
72
+ },
73
+ }).catch(handleInitChallengeError);
51
74
 
52
- return {
53
- challenge: initResult.challenge,
54
- mrtd_pop_nonce: initResult.mrtdPopNonce,
55
- pop_verify_endpoint: initResult.popVerifyEndpoint,
56
- mrz: initResult.mrz,
75
+ return {
76
+ challenge: initResult.challenge,
77
+ mrtd_pop_nonce: initResult.mrtdPopNonce,
78
+ pop_verify_endpoint: initResult.popVerifyEndpoint,
79
+ mrz: initResult.mrz,
80
+ };
57
81
  };
58
- };
82
+ }
59
83
 
60
84
  const handleInitChallengeError = (e: unknown) => {
61
85
  Logger.log(LogLevel.ERROR, `Failed to get MRTD challenge: ${e}`);
@@ -1,76 +1,98 @@
1
1
  import { SignJWT } from "@pagopa/io-react-native-jwt";
2
- import { fetchMrtdPopVerify } from "@pagopa/io-wallet-oauth2";
3
- import { v4 as uuidv4 } from "uuid";
4
- import { createPopToken } from "../../../utils/pop";
5
- import * as WalletInstanceAttestation from "../../../wallet-instance-attestation/v1.0.0/utils"; // TODO: decouple from 1.0.0 version
2
+ import {
3
+ createClientAttestationPopJwt,
4
+ fetchMrtdPopVerify,
5
+ } from "@pagopa/io-wallet-oauth2";
6
+ import type { IoWalletSdkConfig } from "@pagopa/io-wallet-utils";
6
7
  import { sdkUnexpectedStatusCodeToIssuerError } from "../../../utils/errors";
7
- import { partialCallbacks } from "../../../utils/callbacks";
8
+ import {
9
+ createSignJwtFromCryptoContext,
10
+ partialCallbacks,
11
+ } from "../../../utils/callbacks";
8
12
  import type { MRTDPoPApi } from "../api/mrtd-pop";
9
13
 
10
- export const validateChallenge: MRTDPoPApi["validateChallenge"] = async (
11
- issuerConf,
12
- verifyUrl,
13
- mrtd_auth_session,
14
- mrtd_pop_nonce,
15
- mrtd,
16
- ias,
17
- context
18
- ) => {
19
- const {
20
- appFetch = fetch,
21
- walletInstanceAttestation,
22
- wiaCryptoContext,
23
- } = context;
14
+ type Config = {
15
+ sdkConfig: IoWalletSdkConfig;
16
+ };
17
+
18
+ /**
19
+ * Factory function to create `validateChallenge` for MRTD PoP flow.
20
+ * The factory is needed to inject version specific SDK configuration.
21
+ * @param config Configuration object containing the IO Wallet SDK configuration
22
+ * @returns `validateChallenge` function compliant with the public API
23
+ */
24
+ export function createValidateChallenge(
25
+ config: Config
26
+ ): MRTDPoPApi["validateChallenge"] {
27
+ return async function validateChallenge(
28
+ issuerConf,
29
+ verifyUrl,
30
+ mrtd_auth_session,
31
+ mrtd_pop_nonce,
32
+ mrtd,
33
+ ias,
34
+ context
35
+ ) {
36
+ const {
37
+ appFetch = fetch,
38
+ walletInstanceAttestation,
39
+ wiaCryptoContext,
40
+ } = context;
24
41
 
25
- const aud = issuerConf.credential_issuer;
26
- const iss = WalletInstanceAttestation.decode(walletInstanceAttestation)
27
- .payload.cnf.jwk.kid;
42
+ const aud = issuerConf.credential_issuer;
28
43
 
29
- const signedWiaPoP = await createPopToken(
30
- {
31
- jti: uuidv4(),
32
- aud,
33
- iss,
34
- },
35
- wiaCryptoContext
36
- );
44
+ const wiaPublicJwk = await wiaCryptoContext.getPublicKey();
37
45
 
38
- const { kid } = await wiaCryptoContext.getPublicKey();
46
+ const clientAttestationDPoP = await createClientAttestationPopJwt({
47
+ config: config.sdkConfig,
48
+ callbacks: {
49
+ generateRandom: partialCallbacks.generateRandom,
50
+ signJwt: createSignJwtFromCryptoContext(wiaCryptoContext),
51
+ },
52
+ clientAttestation: walletInstanceAttestation,
53
+ authorizationServer: aud,
54
+ signer: {
55
+ method: "jwk",
56
+ alg: "ES256",
57
+ publicJwk: wiaPublicJwk,
58
+ },
59
+ });
39
60
 
40
- const mrtdValidationJwt = await new SignJWT(wiaCryptoContext)
41
- .setProtectedHeader({
42
- typ: "mrtd-ias+jwt",
43
- kid,
44
- })
45
- .setPayload({
46
- iss,
47
- aud,
48
- document_type: "cie",
49
- mrtd,
50
- ias,
51
- })
52
- .setIssuedAt()
53
- .setExpirationTime("5m")
54
- .sign();
61
+ const mrtdValidationJwt = await new SignJWT(wiaCryptoContext)
62
+ .setProtectedHeader({
63
+ typ: "mrtd-ias+jwt",
64
+ kid: wiaPublicJwk.kid,
65
+ })
66
+ .setPayload({
67
+ iss: wiaPublicJwk.kid,
68
+ aud,
69
+ document_type: "cie",
70
+ mrtd,
71
+ ias,
72
+ })
73
+ .setIssuedAt()
74
+ .setExpirationTime("5m")
75
+ .sign();
55
76
 
56
- const verifyResult = await fetchMrtdPopVerify({
57
- popVerifyEndpoint: verifyUrl,
58
- mrtdAuthSession: mrtd_auth_session,
59
- mrtdPopNonce: mrtd_pop_nonce,
60
- clientAttestationDPoP: signedWiaPoP,
61
- mrtdValidationJwt,
62
- walletAttestation: walletInstanceAttestation,
63
- callbacks: {
64
- fetch: appFetch,
65
- ...partialCallbacks,
66
- },
67
- }).catch(sdkUnexpectedStatusCodeToIssuerError);
77
+ const verifyResult = await fetchMrtdPopVerify({
78
+ popVerifyEndpoint: verifyUrl,
79
+ mrtdAuthSession: mrtd_auth_session,
80
+ mrtdPopNonce: mrtd_pop_nonce,
81
+ clientAttestationDPoP,
82
+ mrtdValidationJwt,
83
+ walletAttestation: walletInstanceAttestation,
84
+ callbacks: {
85
+ fetch: appFetch,
86
+ ...partialCallbacks,
87
+ },
88
+ }).catch(sdkUnexpectedStatusCodeToIssuerError);
68
89
 
69
- return {
70
- redirect_uri: verifyResult.redirectUri,
71
- mrtd_val_pop_nonce: verifyResult.mrtdValPopNonce,
90
+ return {
91
+ redirect_uri: verifyResult.redirectUri,
92
+ mrtd_val_pop_nonce: verifyResult.mrtdValPopNonce,
93
+ };
72
94
  };
73
- };
95
+ }
74
96
 
75
97
  export const buildChallengeCallbackUrl: MRTDPoPApi["buildChallengeCallbackUrl"] =
76
98
  async (redirectUri, valPopNonce, authSession) => {