@pagopa/io-react-native-wallet 3.2.0 → 3.4.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 (328) hide show
  1. package/README.md +1 -1
  2. package/lib/commonjs/credential/issuance/README.md +32 -14
  3. package/lib/commonjs/credential/issuance/api/IssuerConfig.js +1 -0
  4. package/lib/commonjs/credential/issuance/api/IssuerConfig.js.map +1 -1
  5. package/lib/commonjs/credential/issuance/common/02-start-user-authorization.js +4 -3
  6. package/lib/commonjs/credential/issuance/common/02-start-user-authorization.js.map +1 -1
  7. package/lib/commonjs/credential/issuance/common/06-verify-and-parse-credential.sdjwt.js +39 -8
  8. package/lib/commonjs/credential/issuance/common/06-verify-and-parse-credential.sdjwt.js.map +1 -1
  9. package/lib/commonjs/credential/issuance/mrtd-pop/02-init-challenge.js +46 -38
  10. package/lib/commonjs/credential/issuance/mrtd-pop/02-init-challenge.js.map +1 -1
  11. package/lib/commonjs/credential/issuance/mrtd-pop/03-validate-challenge.js +58 -51
  12. package/lib/commonjs/credential/issuance/mrtd-pop/03-validate-challenge.js.map +1 -1
  13. package/lib/commonjs/credential/issuance/mrtd-pop/index.js +21 -5
  14. package/lib/commonjs/credential/issuance/mrtd-pop/index.js.map +1 -1
  15. package/lib/commonjs/credential/issuance/v1.0.0/02-start-user-authorization.js +5 -4
  16. package/lib/commonjs/credential/issuance/v1.0.0/02-start-user-authorization.js.map +1 -1
  17. package/lib/commonjs/credential/issuance/v1.0.0/03-complete-user-authorization.js +8 -5
  18. package/lib/commonjs/credential/issuance/v1.0.0/03-complete-user-authorization.js.map +1 -1
  19. package/lib/commonjs/credential/issuance/v1.0.0/index.js +3 -2
  20. package/lib/commonjs/credential/issuance/v1.0.0/index.js.map +1 -1
  21. package/lib/commonjs/credential/issuance/v1.0.0/mappers.js +4 -2
  22. package/lib/commonjs/credential/issuance/v1.0.0/mappers.js.map +1 -1
  23. package/lib/commonjs/credential/issuance/v1.3.3/01-evaluate-issuer-trust.js +0 -2
  24. package/lib/commonjs/credential/issuance/v1.3.3/01-evaluate-issuer-trust.js.map +1 -1
  25. package/lib/commonjs/credential/issuance/v1.3.3/02-start-user-authorization.js +21 -17
  26. package/lib/commonjs/credential/issuance/v1.3.3/02-start-user-authorization.js.map +1 -1
  27. package/lib/commonjs/credential/issuance/v1.3.3/03-complete-user-authorization.js +108 -69
  28. package/lib/commonjs/credential/issuance/v1.3.3/03-complete-user-authorization.js.map +1 -1
  29. package/lib/commonjs/credential/issuance/v1.3.3/04-authorize-access.js +20 -19
  30. package/lib/commonjs/credential/issuance/v1.3.3/04-authorize-access.js.map +1 -1
  31. package/lib/commonjs/credential/issuance/v1.3.3/05-obtain-credential.js +5 -7
  32. package/lib/commonjs/credential/issuance/v1.3.3/05-obtain-credential.js.map +1 -1
  33. package/lib/commonjs/credential/issuance/v1.3.3/06-verify-and-parse-credential.js +4 -1
  34. package/lib/commonjs/credential/issuance/v1.3.3/06-verify-and-parse-credential.js.map +1 -1
  35. package/lib/commonjs/credential/issuance/v1.3.3/index.js +3 -2
  36. package/lib/commonjs/credential/issuance/v1.3.3/index.js.map +1 -1
  37. package/lib/commonjs/credential/issuance/v1.3.3/mappers.js +10 -11
  38. package/lib/commonjs/credential/issuance/v1.3.3/mappers.js.map +1 -1
  39. package/lib/commonjs/credential/presentation/api/types.js.map +1 -1
  40. package/lib/commonjs/credential/presentation/common/utils/http.js +9 -4
  41. package/lib/commonjs/credential/presentation/common/utils/http.js.map +1 -1
  42. package/lib/commonjs/credential/presentation/{v1.3.3/utils.mdoc.js → common/utils/mdoc.js} +2 -2
  43. package/lib/commonjs/credential/presentation/common/utils/mdoc.js.map +1 -0
  44. package/lib/commonjs/credential/presentation/v1.0.0/07-send-authorization-response.js +3 -1
  45. package/lib/commonjs/credential/presentation/v1.0.0/07-send-authorization-response.js.map +1 -1
  46. package/lib/commonjs/credential/presentation/v1.3.3/05-verify-request-object.js +11 -10
  47. package/lib/commonjs/credential/presentation/v1.3.3/05-verify-request-object.js.map +1 -1
  48. package/lib/commonjs/credential/presentation/v1.3.3/06-evaluate-dcql-query.js +2 -2
  49. package/lib/commonjs/credential/presentation/v1.3.3/06-evaluate-dcql-query.js.map +1 -1
  50. package/lib/commonjs/credential/presentation/v1.3.3/07-send-authorization-response.js +2 -0
  51. package/lib/commonjs/credential/presentation/v1.3.3/07-send-authorization-response.js.map +1 -1
  52. package/lib/commonjs/credential/presentation/v1.3.3/mappers.js +1 -1
  53. package/lib/commonjs/credential/presentation/v1.3.3/mappers.js.map +1 -1
  54. package/lib/commonjs/credential/status/README.md +3 -2
  55. package/lib/commonjs/credential/status/v1.3.3/01-status-list.js +27 -5
  56. package/lib/commonjs/credential/status/v1.3.3/01-status-list.js.map +1 -1
  57. package/lib/commonjs/credential/status/v1.3.3/02-verify-and-parse-status-list.js +17 -6
  58. package/lib/commonjs/credential/status/v1.3.3/02-verify-and-parse-status-list.js.map +1 -1
  59. package/lib/commonjs/credentials-catalogue/api/DigitalCredentialsCatalogue.js +2 -1
  60. package/lib/commonjs/credentials-catalogue/api/DigitalCredentialsCatalogue.js.map +1 -1
  61. package/lib/commonjs/credentials-catalogue/common/get-status-l10n-ids.js +23 -0
  62. package/lib/commonjs/credentials-catalogue/common/get-status-l10n-ids.js.map +1 -0
  63. package/lib/commonjs/credentials-catalogue/v1.0.0/index.js +3 -1
  64. package/lib/commonjs/credentials-catalogue/v1.0.0/index.js.map +1 -1
  65. package/lib/commonjs/credentials-catalogue/v1.3.3/index.js +3 -1
  66. package/lib/commonjs/credentials-catalogue/v1.3.3/index.js.map +1 -1
  67. package/lib/commonjs/mdoc/index.js +3 -24
  68. package/lib/commonjs/mdoc/index.js.map +1 -1
  69. package/lib/commonjs/sd-jwt/__test__/types.test.js +2 -14
  70. package/lib/commonjs/sd-jwt/__test__/types.test.js.map +1 -1
  71. package/lib/commonjs/sd-jwt/__test__/utils.test.js +0 -12
  72. package/lib/commonjs/sd-jwt/__test__/utils.test.js.map +1 -1
  73. package/lib/commonjs/sd-jwt/types.js +1 -14
  74. package/lib/commonjs/sd-jwt/types.js.map +1 -1
  75. package/lib/commonjs/utils/callbacks.js +20 -1
  76. package/lib/commonjs/utils/callbacks.js.map +1 -1
  77. package/lib/commonjs/utils/config.js +9 -1
  78. package/lib/commonjs/utils/config.js.map +1 -1
  79. package/lib/commonjs/utils/x509.js +34 -0
  80. package/lib/commonjs/utils/x509.js.map +1 -0
  81. package/lib/commonjs/wallet-instance-attestation/api/types.js +0 -2
  82. package/lib/commonjs/wallet-instance-attestation/api/types.js.map +1 -1
  83. package/lib/commonjs/wallet-instance-attestation/v1.3.3/mappers.js +1 -14
  84. package/lib/commonjs/wallet-instance-attestation/v1.3.3/mappers.js.map +1 -1
  85. package/lib/commonjs/wallet-instance-attestation/v1.3.3/types.js +2 -7
  86. package/lib/commonjs/wallet-instance-attestation/v1.3.3/types.js.map +1 -1
  87. package/lib/commonjs/wallet-unit-attestation/api/types.js +0 -11
  88. package/lib/commonjs/wallet-unit-attestation/api/types.js.map +1 -1
  89. package/lib/module/credential/issuance/README.md +32 -14
  90. package/lib/module/credential/issuance/api/IssuerConfig.js +1 -0
  91. package/lib/module/credential/issuance/api/IssuerConfig.js.map +1 -1
  92. package/lib/module/credential/issuance/common/02-start-user-authorization.js +4 -3
  93. package/lib/module/credential/issuance/common/02-start-user-authorization.js.map +1 -1
  94. package/lib/module/credential/issuance/common/06-verify-and-parse-credential.sdjwt.js +41 -10
  95. package/lib/module/credential/issuance/common/06-verify-and-parse-credential.sdjwt.js.map +1 -1
  96. package/lib/module/credential/issuance/mrtd-pop/02-init-challenge.js +47 -34
  97. package/lib/module/credential/issuance/mrtd-pop/02-init-challenge.js.map +1 -1
  98. package/lib/module/credential/issuance/mrtd-pop/03-validate-challenge.js +58 -47
  99. package/lib/module/credential/issuance/mrtd-pop/03-validate-challenge.js.map +1 -1
  100. package/lib/module/credential/issuance/mrtd-pop/index.js +20 -5
  101. package/lib/module/credential/issuance/mrtd-pop/index.js.map +1 -1
  102. package/lib/module/credential/issuance/v1.0.0/02-start-user-authorization.js +3 -2
  103. package/lib/module/credential/issuance/v1.0.0/02-start-user-authorization.js.map +1 -1
  104. package/lib/module/credential/issuance/v1.0.0/03-complete-user-authorization.js +6 -4
  105. package/lib/module/credential/issuance/v1.0.0/03-complete-user-authorization.js.map +1 -1
  106. package/lib/module/credential/issuance/v1.0.0/index.js +5 -4
  107. package/lib/module/credential/issuance/v1.0.0/index.js.map +1 -1
  108. package/lib/module/credential/issuance/v1.0.0/mappers.js +4 -2
  109. package/lib/module/credential/issuance/v1.0.0/mappers.js.map +1 -1
  110. package/lib/module/credential/issuance/v1.3.3/01-evaluate-issuer-trust.js +0 -2
  111. package/lib/module/credential/issuance/v1.3.3/01-evaluate-issuer-trust.js.map +1 -1
  112. package/lib/module/credential/issuance/v1.3.3/02-start-user-authorization.js +21 -17
  113. package/lib/module/credential/issuance/v1.3.3/02-start-user-authorization.js.map +1 -1
  114. package/lib/module/credential/issuance/v1.3.3/03-complete-user-authorization.js +108 -70
  115. package/lib/module/credential/issuance/v1.3.3/03-complete-user-authorization.js.map +1 -1
  116. package/lib/module/credential/issuance/v1.3.3/04-authorize-access.js +22 -19
  117. package/lib/module/credential/issuance/v1.3.3/04-authorize-access.js.map +1 -1
  118. package/lib/module/credential/issuance/v1.3.3/05-obtain-credential.js +6 -8
  119. package/lib/module/credential/issuance/v1.3.3/05-obtain-credential.js.map +1 -1
  120. package/lib/module/credential/issuance/v1.3.3/06-verify-and-parse-credential.js +4 -1
  121. package/lib/module/credential/issuance/v1.3.3/06-verify-and-parse-credential.js.map +1 -1
  122. package/lib/module/credential/issuance/v1.3.3/index.js +5 -4
  123. package/lib/module/credential/issuance/v1.3.3/index.js.map +1 -1
  124. package/lib/module/credential/issuance/v1.3.3/mappers.js +10 -11
  125. package/lib/module/credential/issuance/v1.3.3/mappers.js.map +1 -1
  126. package/lib/module/credential/presentation/api/types.js.map +1 -1
  127. package/lib/module/credential/presentation/common/utils/http.js +9 -4
  128. package/lib/module/credential/presentation/common/utils/http.js.map +1 -1
  129. package/lib/module/credential/presentation/{v1.3.3/utils.mdoc.js → common/utils/mdoc.js} +2 -2
  130. package/lib/module/credential/presentation/common/utils/mdoc.js.map +1 -0
  131. package/lib/module/credential/presentation/v1.0.0/07-send-authorization-response.js +3 -1
  132. package/lib/module/credential/presentation/v1.0.0/07-send-authorization-response.js.map +1 -1
  133. package/lib/module/credential/presentation/v1.3.3/05-verify-request-object.js +11 -10
  134. package/lib/module/credential/presentation/v1.3.3/05-verify-request-object.js.map +1 -1
  135. package/lib/module/credential/presentation/v1.3.3/06-evaluate-dcql-query.js +2 -3
  136. package/lib/module/credential/presentation/v1.3.3/06-evaluate-dcql-query.js.map +1 -1
  137. package/lib/module/credential/presentation/v1.3.3/07-send-authorization-response.js +2 -0
  138. package/lib/module/credential/presentation/v1.3.3/07-send-authorization-response.js.map +1 -1
  139. package/lib/module/credential/presentation/v1.3.3/mappers.js +1 -1
  140. package/lib/module/credential/presentation/v1.3.3/mappers.js.map +1 -1
  141. package/lib/module/credential/status/README.md +3 -2
  142. package/lib/module/credential/status/v1.3.3/01-status-list.js +27 -5
  143. package/lib/module/credential/status/v1.3.3/01-status-list.js.map +1 -1
  144. package/lib/module/credential/status/v1.3.3/02-verify-and-parse-status-list.js +17 -6
  145. package/lib/module/credential/status/v1.3.3/02-verify-and-parse-status-list.js.map +1 -1
  146. package/lib/module/credentials-catalogue/api/DigitalCredentialsCatalogue.js +1 -1
  147. package/lib/module/credentials-catalogue/api/DigitalCredentialsCatalogue.js.map +1 -1
  148. package/lib/module/credentials-catalogue/common/get-status-l10n-ids.js +16 -0
  149. package/lib/module/credentials-catalogue/common/get-status-l10n-ids.js.map +1 -0
  150. package/lib/module/credentials-catalogue/v1.0.0/index.js +3 -1
  151. package/lib/module/credentials-catalogue/v1.0.0/index.js.map +1 -1
  152. package/lib/module/credentials-catalogue/v1.3.3/index.js +3 -1
  153. package/lib/module/credentials-catalogue/v1.3.3/index.js.map +1 -1
  154. package/lib/module/mdoc/index.js +3 -24
  155. package/lib/module/mdoc/index.js.map +1 -1
  156. package/lib/module/sd-jwt/__test__/types.test.js +2 -14
  157. package/lib/module/sd-jwt/__test__/types.test.js.map +1 -1
  158. package/lib/module/sd-jwt/__test__/utils.test.js +0 -12
  159. package/lib/module/sd-jwt/__test__/utils.test.js.map +1 -1
  160. package/lib/module/sd-jwt/types.js +1 -14
  161. package/lib/module/sd-jwt/types.js.map +1 -1
  162. package/lib/module/utils/callbacks.js +19 -1
  163. package/lib/module/utils/callbacks.js.map +1 -1
  164. package/lib/module/utils/config.js +7 -0
  165. package/lib/module/utils/config.js.map +1 -1
  166. package/lib/module/utils/x509.js +28 -0
  167. package/lib/module/utils/x509.js.map +1 -0
  168. package/lib/module/wallet-instance-attestation/api/types.js +0 -2
  169. package/lib/module/wallet-instance-attestation/api/types.js.map +1 -1
  170. package/lib/module/wallet-instance-attestation/v1.3.3/mappers.js +1 -14
  171. package/lib/module/wallet-instance-attestation/v1.3.3/mappers.js.map +1 -1
  172. package/lib/module/wallet-instance-attestation/v1.3.3/types.js +2 -7
  173. package/lib/module/wallet-instance-attestation/v1.3.3/types.js.map +1 -1
  174. package/lib/module/wallet-unit-attestation/api/types.js +0 -11
  175. package/lib/module/wallet-unit-attestation/api/types.js.map +1 -1
  176. package/lib/typescript/credential/issuance/api/02-start-user-authorization.d.ts +1 -0
  177. package/lib/typescript/credential/issuance/api/02-start-user-authorization.d.ts.map +1 -1
  178. package/lib/typescript/credential/issuance/api/03-complete-user-authorization.d.ts +19 -5
  179. package/lib/typescript/credential/issuance/api/03-complete-user-authorization.d.ts.map +1 -1
  180. package/lib/typescript/credential/issuance/api/06-verify-and-parse-credential.d.ts +4 -0
  181. package/lib/typescript/credential/issuance/api/06-verify-and-parse-credential.d.ts.map +1 -1
  182. package/lib/typescript/credential/issuance/api/IssuerConfig.d.ts +1 -0
  183. package/lib/typescript/credential/issuance/api/IssuerConfig.d.ts.map +1 -1
  184. package/lib/typescript/credential/issuance/common/02-start-user-authorization.d.ts.map +1 -1
  185. package/lib/typescript/credential/issuance/common/06-verify-and-parse-credential.sdjwt.d.ts.map +1 -1
  186. package/lib/typescript/credential/issuance/mrtd-pop/02-init-challenge.d.ts +12 -1
  187. package/lib/typescript/credential/issuance/mrtd-pop/02-init-challenge.d.ts.map +1 -1
  188. package/lib/typescript/credential/issuance/mrtd-pop/03-validate-challenge.d.ts +12 -1
  189. package/lib/typescript/credential/issuance/mrtd-pop/03-validate-challenge.d.ts.map +1 -1
  190. package/lib/typescript/credential/issuance/mrtd-pop/index.d.ts +2 -1
  191. package/lib/typescript/credential/issuance/mrtd-pop/index.d.ts.map +1 -1
  192. package/lib/typescript/credential/issuance/v1.0.0/02-start-user-authorization.d.ts.map +1 -1
  193. package/lib/typescript/credential/issuance/v1.0.0/03-complete-user-authorization.d.ts +2 -1
  194. package/lib/typescript/credential/issuance/v1.0.0/03-complete-user-authorization.d.ts.map +1 -1
  195. package/lib/typescript/credential/issuance/v1.0.0/index.d.ts.map +1 -1
  196. package/lib/typescript/credential/issuance/v1.0.0/mappers.d.ts +1 -0
  197. package/lib/typescript/credential/issuance/v1.0.0/mappers.d.ts.map +1 -1
  198. package/lib/typescript/credential/issuance/v1.3.3/01-evaluate-issuer-trust.d.ts.map +1 -1
  199. package/lib/typescript/credential/issuance/v1.3.3/02-start-user-authorization.d.ts.map +1 -1
  200. package/lib/typescript/credential/issuance/v1.3.3/03-complete-user-authorization.d.ts +2 -1
  201. package/lib/typescript/credential/issuance/v1.3.3/03-complete-user-authorization.d.ts.map +1 -1
  202. package/lib/typescript/credential/issuance/v1.3.3/04-authorize-access.d.ts.map +1 -1
  203. package/lib/typescript/credential/issuance/v1.3.3/05-obtain-credential.d.ts.map +1 -1
  204. package/lib/typescript/credential/issuance/v1.3.3/06-verify-and-parse-credential.d.ts.map +1 -1
  205. package/lib/typescript/credential/issuance/v1.3.3/index.d.ts.map +1 -1
  206. package/lib/typescript/credential/issuance/v1.3.3/mappers.d.ts +7 -4
  207. package/lib/typescript/credential/issuance/v1.3.3/mappers.d.ts.map +1 -1
  208. package/lib/typescript/credential/presentation/api/05-verify-request-object.d.ts +1 -1
  209. package/lib/typescript/credential/presentation/api/types.d.ts +3 -7
  210. package/lib/typescript/credential/presentation/api/types.d.ts.map +1 -1
  211. package/lib/typescript/credential/presentation/common/utils/http.d.ts +1 -1
  212. package/lib/typescript/credential/presentation/common/utils/http.d.ts.map +1 -1
  213. package/lib/typescript/credential/presentation/{v1.3.3/utils.mdoc.d.ts → common/utils/mdoc.d.ts} +2 -2
  214. package/lib/typescript/credential/presentation/common/utils/mdoc.d.ts.map +1 -0
  215. package/lib/typescript/credential/presentation/v1.3.3/05-verify-request-object.d.ts.map +1 -1
  216. package/lib/typescript/credential/presentation/v1.3.3/06-evaluate-dcql-query.d.ts.map +1 -1
  217. package/lib/typescript/credential/presentation/v1.3.3/07-send-authorization-response.d.ts.map +1 -1
  218. package/lib/typescript/credential/presentation/v1.3.3/mappers.d.ts +8 -8
  219. package/lib/typescript/credential/presentation/v1.3.3/types.d.ts +8 -8
  220. package/lib/typescript/credential/status/api/status-list.d.ts +8 -4
  221. package/lib/typescript/credential/status/api/status-list.d.ts.map +1 -1
  222. package/lib/typescript/credential/status/v1.3.3/01-status-list.d.ts.map +1 -1
  223. package/lib/typescript/credential/status/v1.3.3/02-verify-and-parse-status-list.d.ts.map +1 -1
  224. package/lib/typescript/credentials-catalogue/api/DigitalCredentialsCatalogue.d.ts +6 -0
  225. package/lib/typescript/credentials-catalogue/api/DigitalCredentialsCatalogue.d.ts.map +1 -1
  226. package/lib/typescript/credentials-catalogue/api/index.d.ts +14 -2
  227. package/lib/typescript/credentials-catalogue/api/index.d.ts.map +1 -1
  228. package/lib/typescript/credentials-catalogue/common/get-status-l10n-ids.d.ts +9 -0
  229. package/lib/typescript/credentials-catalogue/common/get-status-l10n-ids.d.ts.map +1 -0
  230. package/lib/typescript/credentials-catalogue/v1.0.0/index.d.ts.map +1 -1
  231. package/lib/typescript/credentials-catalogue/v1.3.3/index.d.ts.map +1 -1
  232. package/lib/typescript/mdoc/index.d.ts +1 -1
  233. package/lib/typescript/mdoc/index.d.ts.map +1 -1
  234. package/lib/typescript/mdoc/utils.d.ts +0 -24
  235. package/lib/typescript/mdoc/utils.d.ts.map +1 -1
  236. package/lib/typescript/sd-jwt/types.d.ts +0 -12
  237. package/lib/typescript/sd-jwt/types.d.ts.map +1 -1
  238. package/lib/typescript/trust/v1.3.3/types.d.ts +6 -4
  239. package/lib/typescript/trust/v1.3.3/types.d.ts.map +1 -1
  240. package/lib/typescript/utils/callbacks.d.ts +7 -0
  241. package/lib/typescript/utils/callbacks.d.ts.map +1 -1
  242. package/lib/typescript/utils/config.d.ts +4 -0
  243. package/lib/typescript/utils/config.d.ts.map +1 -1
  244. package/lib/typescript/utils/x509.d.ts +10 -0
  245. package/lib/typescript/utils/x509.d.ts.map +1 -0
  246. package/lib/typescript/wallet-instance-attestation/api/types.d.ts +0 -2
  247. package/lib/typescript/wallet-instance-attestation/api/types.d.ts.map +1 -1
  248. package/lib/typescript/wallet-instance-attestation/v1.0.0/mappers.d.ts +0 -2
  249. package/lib/typescript/wallet-instance-attestation/v1.0.0/mappers.d.ts.map +1 -1
  250. package/lib/typescript/wallet-instance-attestation/v1.3.3/mappers.d.ts +2 -9
  251. package/lib/typescript/wallet-instance-attestation/v1.3.3/mappers.d.ts.map +1 -1
  252. package/lib/typescript/wallet-instance-attestation/v1.3.3/types.d.ts +2 -7
  253. package/lib/typescript/wallet-instance-attestation/v1.3.3/types.d.ts.map +1 -1
  254. package/lib/typescript/wallet-unit-attestation/api/types.d.ts +0 -11
  255. package/lib/typescript/wallet-unit-attestation/api/types.d.ts.map +1 -1
  256. package/lib/typescript/wallet-unit-attestation/v1.3.3/mappers.d.ts +0 -22
  257. package/lib/typescript/wallet-unit-attestation/v1.3.3/mappers.d.ts.map +1 -1
  258. package/lib/typescript/wallet-unit-attestation/v1.3.3/types.d.ts +0 -11
  259. package/lib/typescript/wallet-unit-attestation/v1.3.3/types.d.ts.map +1 -1
  260. package/package.json +6 -6
  261. package/src/credential/issuance/README.md +32 -14
  262. package/src/credential/issuance/api/02-start-user-authorization.ts +1 -0
  263. package/src/credential/issuance/api/03-complete-user-authorization.ts +26 -5
  264. package/src/credential/issuance/api/06-verify-and-parse-credential.ts +4 -0
  265. package/src/credential/issuance/api/IssuerConfig.ts +1 -0
  266. package/src/credential/issuance/common/02-start-user-authorization.ts +6 -3
  267. package/src/credential/issuance/common/06-verify-and-parse-credential.sdjwt.ts +47 -10
  268. package/src/credential/issuance/mrtd-pop/02-init-challenge.ts +69 -45
  269. package/src/credential/issuance/mrtd-pop/03-validate-challenge.ts +84 -62
  270. package/src/credential/issuance/mrtd-pop/index.ts +13 -5
  271. package/src/credential/issuance/v1.0.0/02-start-user-authorization.ts +8 -2
  272. package/src/credential/issuance/v1.0.0/03-complete-user-authorization.ts +16 -4
  273. package/src/credential/issuance/v1.0.0/index.ts +6 -4
  274. package/src/credential/issuance/v1.0.0/mappers.ts +9 -1
  275. package/src/credential/issuance/v1.3.3/01-evaluate-issuer-trust.ts +0 -2
  276. package/src/credential/issuance/v1.3.3/02-start-user-authorization.ts +25 -21
  277. package/src/credential/issuance/v1.3.3/03-complete-user-authorization.ts +138 -94
  278. package/src/credential/issuance/v1.3.3/04-authorize-access.ts +28 -23
  279. package/src/credential/issuance/v1.3.3/05-obtain-credential.ts +9 -9
  280. package/src/credential/issuance/v1.3.3/06-verify-and-parse-credential.ts +2 -1
  281. package/src/credential/issuance/v1.3.3/index.ts +6 -4
  282. package/src/credential/issuance/v1.3.3/mappers.ts +13 -11
  283. package/src/credential/presentation/api/05-verify-request-object.ts +1 -1
  284. package/src/credential/presentation/api/types.ts +3 -7
  285. package/src/credential/presentation/common/utils/http.ts +2 -2
  286. package/src/credential/presentation/{v1.3.3/utils.mdoc.ts → common/utils/mdoc.ts} +2 -2
  287. package/src/credential/presentation/v1.0.0/07-send-authorization-response.ts +1 -1
  288. package/src/credential/presentation/v1.3.3/05-verify-request-object.ts +15 -14
  289. package/src/credential/presentation/v1.3.3/06-evaluate-dcql-query.ts +3 -3
  290. package/src/credential/presentation/v1.3.3/07-send-authorization-response.ts +2 -0
  291. package/src/credential/presentation/v1.3.3/mappers.ts +1 -1
  292. package/src/credential/status/README.md +3 -2
  293. package/src/credential/status/api/status-list.ts +10 -7
  294. package/src/credential/status/v1.3.3/01-status-list.ts +21 -7
  295. package/src/credential/status/v1.3.3/02-verify-and-parse-status-list.ts +19 -5
  296. package/src/credentials-catalogue/api/DigitalCredentialsCatalogue.ts +4 -1
  297. package/src/credentials-catalogue/api/index.ts +15 -0
  298. package/src/credentials-catalogue/common/get-status-l10n-ids.ts +25 -0
  299. package/src/credentials-catalogue/v1.0.0/index.ts +2 -0
  300. package/src/credentials-catalogue/v1.3.3/index.ts +2 -0
  301. package/src/mdoc/index.ts +5 -41
  302. package/src/sd-jwt/__test__/types.test.ts +1 -13
  303. package/src/sd-jwt/__test__/utils.test.ts +0 -12
  304. package/src/sd-jwt/types.ts +0 -13
  305. package/src/utils/callbacks.ts +28 -1
  306. package/src/utils/config.ts +7 -0
  307. package/src/utils/x509.ts +43 -0
  308. package/src/wallet-instance-attestation/api/types.ts +0 -2
  309. package/src/wallet-instance-attestation/v1.3.3/mappers.ts +3 -11
  310. package/src/wallet-instance-attestation/v1.3.3/types.ts +2 -7
  311. package/src/wallet-unit-attestation/api/types.ts +0 -11
  312. package/lib/commonjs/credential/issuance/common/authorization.js +0 -56
  313. package/lib/commonjs/credential/issuance/common/authorization.js.map +0 -1
  314. package/lib/commonjs/credential/presentation/common/utils.js +0 -28
  315. package/lib/commonjs/credential/presentation/common/utils.js.map +0 -1
  316. package/lib/commonjs/credential/presentation/v1.3.3/utils.mdoc.js.map +0 -1
  317. package/lib/module/credential/issuance/common/authorization.js +0 -48
  318. package/lib/module/credential/issuance/common/authorization.js.map +0 -1
  319. package/lib/module/credential/presentation/common/utils.js +0 -21
  320. package/lib/module/credential/presentation/common/utils.js.map +0 -1
  321. package/lib/module/credential/presentation/v1.3.3/utils.mdoc.js.map +0 -1
  322. package/lib/typescript/credential/issuance/common/authorization.d.ts +0 -21
  323. package/lib/typescript/credential/issuance/common/authorization.d.ts.map +0 -1
  324. package/lib/typescript/credential/presentation/common/utils.d.ts +0 -11
  325. package/lib/typescript/credential/presentation/common/utils.d.ts.map +0 -1
  326. package/lib/typescript/credential/presentation/v1.3.3/utils.mdoc.d.ts.map +0 -1
  327. package/src/credential/issuance/common/authorization.ts +0 -89
  328. package/src/credential/presentation/common/utils.ts +0 -30
@@ -9,6 +9,7 @@ export const mapToIssuerConfig = createMapper<
9
9
  const {
10
10
  oauth_authorization_server,
11
11
  openid_credential_issuer,
12
+ openid_credential_verifier,
12
13
  federation_entity,
13
14
  } = x.payload.metadata;
14
15
  return {
@@ -17,7 +18,10 @@ export const mapToIssuerConfig = createMapper<
17
18
  credential_issuer: openid_credential_issuer.credential_issuer,
18
19
  credential_configurations_supported:
19
20
  openid_credential_issuer.credential_configurations_supported,
20
- keys: openid_credential_issuer.jwks.keys,
21
+ keys: [
22
+ ...openid_credential_issuer.jwks.keys,
23
+ ...oauth_authorization_server.jwks.keys,
24
+ ],
21
25
  pushed_authorization_request_endpoint:
22
26
  oauth_authorization_server.pushed_authorization_request_endpoint,
23
27
  token_endpoint: oauth_authorization_server.token_endpoint,
@@ -25,5 +29,9 @@ export const mapToIssuerConfig = createMapper<
25
29
  openid_credential_issuer.status_attestation_endpoint,
26
30
  nonce_endpoint: openid_credential_issuer.nonce_endpoint,
27
31
  federation_entity,
32
+ encrypted_response_enc_values_supported:
33
+ openid_credential_verifier?.authorization_encrypted_response_enc
34
+ ? [openid_credential_verifier.authorization_encrypted_response_enc]
35
+ : undefined,
28
36
  };
29
37
  });
@@ -2,7 +2,6 @@ import {
2
2
  fetchMetadata,
3
3
  type MetadataResponseV1_3,
4
4
  } from "@pagopa/io-wallet-oid4vci";
5
- import { partialCallbacks } from "../../../utils/callbacks";
6
5
  import { sdkConfigV1_3 } from "../../../utils/config";
7
6
  import type { IssuanceApi } from "../api";
8
7
  import { mapToIssuerConfig } from "./mappers";
@@ -15,7 +14,6 @@ export const evaluateIssuerTrust: IssuanceApi["evaluateIssuerTrust"] = async (
15
14
  config: sdkConfigV1_3,
16
15
  credentialIssuerUrl: issuerUrl,
17
16
  callbacks: {
18
- ...partialCallbacks,
19
17
  fetch: context.appFetch,
20
18
  },
21
19
  })) as MetadataResponseV1_3;
@@ -3,16 +3,17 @@ import {
3
3
  fetchPushedAuthorizationResponse,
4
4
  createClientAttestationPopJwt,
5
5
  } from "@pagopa/io-wallet-oauth2";
6
- import type { CallbackContext } from "@pagopa/io-wallet-oauth2";
6
+ import type { JwtSignerJwk } from "@pagopa/io-wallet-oauth2";
7
+ import { v4 as uuidv4 } from "uuid";
7
8
  import { LogLevel, Logger } from "../../../utils/logging";
8
9
  import type { IssuanceApi } from "../api";
9
- import { SignJWT } from "@pagopa/io-react-native-jwt";
10
- import { partialCallbacks } from "../../../utils/callbacks";
11
- import { IoWalletError } from "../../../utils/errors";
12
10
  import {
13
- selectCredentialDefinition,
14
- selectResponseMode,
15
- } from "../common/authorization";
11
+ createSignJwtFromCryptoContext,
12
+ partialCallbacks,
13
+ } from "../../../utils/callbacks";
14
+ import { IoWalletError } from "../../../utils/errors";
15
+ import { sdkConfigV1_3 } from "../../../utils/config";
16
+ import { selectCredentialDefinition } from "../common/02-start-user-authorization";
16
17
 
17
18
  export const startUserAuthorization: IssuanceApi["startUserAuthorization"] =
18
19
  async (issuerConf, credentialIds, proof, ctx) => {
@@ -33,8 +34,6 @@ export const startUserAuthorization: IssuanceApi["startUserAuthorization"] =
33
34
  throw new IoWalletError("No public key found");
34
35
  }
35
36
 
36
- const responseMode = selectResponseMode(issuerConf, credentialIds);
37
-
38
37
  const credentialDefinition = credentialIds.map((c) =>
39
38
  selectCredentialDefinition(issuerConf, c)
40
39
  );
@@ -54,13 +53,16 @@ export const startUserAuthorization: IssuanceApi["startUserAuthorization"] =
54
53
  });
55
54
  }
56
55
 
57
- const signerJwk = await wiaCryptoContext.getPublicKey();
58
- const signJwt: CallbackContext["signJwt"] = async (_, payload) => ({
59
- jwt: await new SignJWT(wiaCryptoContext).setPayload(payload).sign(),
60
- signerJwk,
61
- });
56
+ const wiaSigner: JwtSignerJwk = {
57
+ method: "jwk",
58
+ alg: "ES256",
59
+ publicJwk: await wiaCryptoContext.getPublicKey(),
60
+ };
61
+
62
+ const signJwt = createSignJwtFromCryptoContext(wiaCryptoContext);
62
63
 
63
64
  const parRequest = await createPushedAuthorizationRequest({
65
+ config: sdkConfigV1_3,
64
66
  callbacks: {
65
67
  ...partialCallbacks,
66
68
  signJwt,
@@ -68,25 +70,27 @@ export const startUserAuthorization: IssuanceApi["startUserAuthorization"] =
68
70
  authorizationServerMetadata: {
69
71
  require_signed_request_object: true,
70
72
  },
73
+ jti: uuidv4(),
71
74
  clientId,
72
75
  audience: issuerConf.credential_issuer,
73
76
  authorization_details: credentialDefinition,
74
77
  codeChallengeMethodsSupported: ["S256"],
75
- responseMode,
76
78
  redirectUri,
79
+ dpop: {
80
+ signer: wiaSigner,
81
+ },
77
82
  });
78
83
 
79
84
  const clientAttestationPoP = await createClientAttestationPopJwt({
85
+ config: sdkConfigV1_3,
80
86
  callbacks: {
87
+ generateRandom: partialCallbacks.generateRandom,
81
88
  signJwt,
82
89
  },
83
90
  clientAttestation: walletInstanceAttestation,
84
- authorizationServer: issuerConf.authorization_endpoint,
85
- signer: {
86
- method: "jwk",
87
- alg: "ES256",
88
- publicJwk: signerJwk,
89
- },
91
+ authorizationServer: issuerConf.credential_issuer,
92
+ signer: wiaSigner,
93
+ jti: uuidv4(),
90
94
  });
91
95
 
92
96
  const { request_uri } = await fetchPushedAuthorizationResponse({
@@ -6,30 +6,33 @@ import {
6
6
  import parseUrl from "parse-url";
7
7
  import type { DcqlQuery } from "dcql";
8
8
  import {
9
- fetchAuthorizationRequest,
9
+ createAuthorizationResponse,
10
10
  parseAuthorizeRequest,
11
+ fetchAuthorizationResponse,
12
+ type CreateAuthorizationResponseResult,
11
13
  } from "@pagopa/io-wallet-oid4vp";
12
14
  import { sendAuthorizationResponseAndExtractCode } from "@pagopa/io-wallet-oid4vci";
15
+ import type { jsonWebKeySet } from "@pagopa/io-wallet-oid-federation";
13
16
  import { parseMrtdChallenge } from "@pagopa/io-wallet-oauth2";
14
- import { SignJWT, type CryptoContext } from "@pagopa/io-react-native-jwt";
15
17
  import { AuthorizationError, AuthorizationIdpError } from "../common/errors";
16
18
  import { LogLevel, Logger } from "../../../utils/logging";
17
19
  import { RemotePresentation as RemotePresentationFlow } from "../../presentation/v1.3.3";
18
- import { partialCallbacks } from "../../../utils/callbacks";
19
- import { sdkConfigV1_3 } from "../../../utils/config";
20
20
  import {
21
- IoWalletError,
22
- sdkUnexpectedStatusCodeToIssuerError,
23
- } from "../../../utils/errors";
24
- import type { IssuanceApi } from "../api";
21
+ createVerifyJwtFromJwks,
22
+ partialCallbacks,
23
+ } from "../../../utils/callbacks";
24
+ import { sdkConfigV1_3, sdkConfigV1_4 } from "../../../utils/config";
25
+ import { IoWalletError, IssuerResponseError } from "../../../utils/errors";
26
+ import type { IssuanceApi, IssuerConfig } from "../api";
25
27
  import { mapToRequestObject } from "./mappers";
26
- import type { RemotePresentation } from "../../presentation";
28
+ import type { RequestObject } from "../../presentation";
29
+ import { hasStatusOrThrow } from "../../../utils/misc";
27
30
 
28
31
  export const continueUserAuthorizationWithMRTDPoPChallenge: IssuanceApi["continueUserAuthorizationWithMRTDPoPChallenge"] =
29
32
  async (authRedirectUrl) => {
30
33
  Logger.log(
31
34
  LogLevel.DEBUG,
32
- `The requested credential is a PersonIdentificationData and requires MRTD PoP, starting MRTD PoP validation from auth redirect`
35
+ "The requested credential is a PID and requires MRTD PoP, starting MRTD PoP validation from auth redirect"
33
36
  );
34
37
  try {
35
38
  const parsedChallenge = parseMrtdChallenge({
@@ -65,11 +68,11 @@ export const buildAuthorizationUrl: IssuanceApi["buildAuthorizationUrl"] =
65
68
  return { authUrl };
66
69
  };
67
70
 
68
- export const completeUserAuthorizationWithQueryMode: IssuanceApi["completeUserAuthorizationWithQueryMode"] =
71
+ export const completePidUserAuthorizationWithQueryMode: IssuanceApi["completePidUserAuthorizationWithQueryMode"] =
69
72
  async (authRedirectUrl) => {
70
73
  Logger.log(
71
74
  LogLevel.DEBUG,
72
- `The requested credential is a PersonIdentificationData, completing the user authorization with query mode`
75
+ "The requested credential is a PID, completing the user authorization with query mode"
73
76
  );
74
77
  const query = parseUrl(authRedirectUrl).query;
75
78
 
@@ -80,7 +83,7 @@ export const getRequestedCredentialToBePresented: IssuanceApi["getRequestedCrede
80
83
  async (issuerRequestUri, clientId, issuerConf, appFetch = fetch) => {
81
84
  Logger.log(
82
85
  LogLevel.DEBUG,
83
- `The requeste credential is not a PersonIdentificationData, requesting the credential to be presented`
86
+ "The requested credential is not a PID, requesting the credential to be presented"
84
87
  );
85
88
 
86
89
  const authzRequestEndpoint = issuerConf.authorization_endpoint;
@@ -94,61 +97,39 @@ export const getRequestedCredentialToBePresented: IssuanceApi["getRequestedCrede
94
97
  `Requesting the request object to ${authzRequestEndpoint}?${params.toString()}`
95
98
  );
96
99
 
97
- const authRequest = await fetchAuthorizationRequest({
98
- authorizeRequestUrl: `${authzRequestEndpoint}?${params.toString()}`,
99
- callbacks: {
100
- fetch: appFetch,
101
- },
102
- }).catch(sdkUnexpectedStatusCodeToIssuerError);
100
+ const requestObjectJwt = await appFetch(
101
+ `${authzRequestEndpoint}?${params.toString()}`,
102
+ { method: "GET" }
103
+ )
104
+ .then(hasStatusOrThrow(200, IssuerResponseError))
105
+ .then((res) => res.text());
103
106
 
104
107
  const parsedAuthRequest = await parseAuthorizeRequest({
105
108
  config: sdkConfigV1_3,
106
- requestObjectJwt: authRequest.requestObjectJwt,
107
- callbacks: partialCallbacks,
109
+ requestObjectJwt,
110
+ callbacks: {
111
+ verifyJwt: createVerifyJwtFromJwks(issuerConf.keys),
112
+ },
108
113
  });
109
114
 
110
115
  return mapToRequestObject(parsedAuthRequest);
111
116
  };
112
117
 
118
+ // NOTE: this function is not used in the 1.3 issuance flow. It may be removed in the future.
113
119
  export const completeUserAuthorizationWithFormPostJwtMode: IssuanceApi["completeUserAuthorizationWithFormPostJwtMode"] =
114
- async (
115
- requestObject,
116
- issuerConfig,
117
- pid,
118
- { wiaCryptoContext, pidKeyTag, appFetch = fetch }
119
- ) => {
120
+ async (requestObject, issuerConfig, pid, { appFetch = fetch }) => {
120
121
  Logger.log(
121
122
  LogLevel.DEBUG,
122
- `The requeste credential is not a PersonIdentificationData, completing the user authorization with form_post.jwt mode`
123
- );
124
-
125
- const dcqlQueryResult = await RemotePresentationFlow.evaluateDcqlQuery(
126
- requestObject.dcql_query as DcqlQuery,
127
- [[pidKeyTag, pid]]
123
+ "The requested credential is not a PID, completing the user authorization with form_post.jwt mode"
128
124
  );
129
125
 
130
- const authRequestObject = {
131
- nonce: requestObject.nonce,
132
- clientId: requestObject.client_id,
133
- responseUri: requestObject.response_uri,
134
- };
135
-
136
- const remotePresentation =
137
- await RemotePresentationFlow.prepareRemotePresentations(
138
- dcqlQueryResult,
139
- authRequestObject
140
- );
141
-
142
- const authzResponsePayload = await createAuthzResponsePayload({
143
- state: requestObject.state,
144
- remotePresentation,
145
- wiaCryptoContext,
126
+ const authzResponse = await processPidPresentationAndCreateAuthzResponse({
127
+ requestObject,
128
+ issuerConfig,
129
+ pid,
146
130
  });
147
131
 
148
- Logger.log(
149
- LogLevel.DEBUG,
150
- `Authz response payload: ${authzResponsePayload}`
151
- );
132
+ Logger.log(LogLevel.DEBUG, `Authz response: ${authzResponse}`);
152
133
 
153
134
  const issuerSigKey = issuerConfig.keys.find((key) => key.use === "sig");
154
135
  if (!issuerSigKey) {
@@ -158,13 +139,13 @@ export const completeUserAuthorizationWithFormPostJwtMode: IssuanceApi["complete
158
139
  }
159
140
 
160
141
  return sendAuthorizationResponseAndExtractCode({
161
- authorizationResponseJarm: authzResponsePayload,
142
+ authorizationResponseJarm: authzResponse.jarm.responseJwe,
162
143
  callbacks: {
163
144
  ...partialCallbacks,
164
145
  fetch: appFetch,
165
146
  },
166
147
  iss: requestObject.iss,
167
- state: requestObject.state!,
148
+ state: requestObject.state ?? "",
168
149
  presentationResponseUri: requestObject.response_uri,
169
150
  signer: {
170
151
  alg: "ES256",
@@ -174,6 +155,62 @@ export const completeUserAuthorizationWithFormPostJwtMode: IssuanceApi["complete
174
155
  });
175
156
  };
176
157
 
158
+ export const completeEaaUserAuthorizationWithQueryMode: IssuanceApi["completeEaaUserAuthorizationWithQueryMode"] =
159
+ async (
160
+ requestObject,
161
+ issuerConfig,
162
+ pid,
163
+ clientRedirectUri,
164
+ { appFetch = fetch } = {}
165
+ ) => {
166
+ Logger.log(
167
+ LogLevel.DEBUG,
168
+ "The requested credential is not a PID, completing the user authorization with query mode"
169
+ );
170
+
171
+ const authzResponse = await processPidPresentationAndCreateAuthzResponse({
172
+ requestObject,
173
+ issuerConfig,
174
+ pid,
175
+ });
176
+
177
+ Logger.log(LogLevel.DEBUG, `Authz response: ${authzResponse}`);
178
+
179
+ const { redirect_uri } = await fetchAuthorizationResponse({
180
+ authorizationResponseJarm: authzResponse.jarm.responseJwe,
181
+ presentationResponseUri: requestObject.response_uri,
182
+ callbacks: {
183
+ ...partialCallbacks,
184
+ fetch: appFetch,
185
+ },
186
+ });
187
+
188
+ if (!redirect_uri) {
189
+ const errorMessage =
190
+ "The authorization server did not return a redirect_uri to continue the authorization flow";
191
+ Logger.log(LogLevel.ERROR, errorMessage);
192
+ throw new AuthorizationError(errorMessage);
193
+ }
194
+
195
+ const response = await appFetch(redirect_uri).catch(() => null);
196
+
197
+ if (!response || !response.ok) {
198
+ const errorMessage = `An error occurred while completing the authorization flow. Ensure ${clientRedirectUri} is a valid HTTP url for redirect`;
199
+ Logger.log(LogLevel.ERROR, errorMessage);
200
+ throw new AuthorizationError(errorMessage);
201
+ }
202
+
203
+ const finalRedirectUri = response.url;
204
+
205
+ if (!finalRedirectUri || !finalRedirectUri.startsWith(clientRedirectUri)) {
206
+ const errorMessage = `The authorization server did not redirect to the provided client redirect URI. Expected: ${clientRedirectUri}, got: ${finalRedirectUri}`;
207
+ Logger.log(LogLevel.ERROR, errorMessage);
208
+ throw new AuthorizationError(errorMessage);
209
+ }
210
+
211
+ return parseAuthorizationResponse(parseUrl(finalRedirectUri).query);
212
+ };
213
+
177
214
  /**
178
215
  * Parse the authorization response and return the result which contains code, state and iss.
179
216
  * @throws {AuthorizationError} if an error occurs during the parsing process
@@ -207,45 +244,52 @@ export const parseAuthorizationResponse = (
207
244
  };
208
245
 
209
246
  /**
210
- * Creates the authorization response payload to be sent.
211
- * This payload includes the state and the VP tokens for the presented credentials.
212
- * The payload is encoded in Base64.
213
- * @param state - The state parameter from the request object (optional).
214
- * @param remotePresentation The presentations to send, each with their VP token
215
- * @returns The Base64 encoded authorization response payload.
247
+ * Utility function to process the DCQL query for PID presentation and to create the authorization response to send to the Issuer.
248
+ * @param params.requestObject - The request object containing the DCQL query
249
+ * @param params.issuerConfig - The Issuer unified configuration
250
+ * @param params.pid - The PID credential to be presented, as a tuple of [keyTag, credential]
251
+ * @returns The authorization response containing the JARM to be sent to the Issuer
216
252
  */
217
- const createAuthzResponsePayload = async ({
218
- state,
219
- remotePresentation,
220
- wiaCryptoContext,
253
+ const processPidPresentationAndCreateAuthzResponse = async ({
254
+ requestObject,
255
+ issuerConfig,
256
+ pid,
221
257
  }: {
222
- state?: string;
223
- remotePresentation: RemotePresentation;
224
- wiaCryptoContext: CryptoContext;
225
- }): Promise<string> => {
226
- const { kid } = await wiaCryptoContext.getPublicKey();
227
-
228
- return new SignJWT(wiaCryptoContext)
229
- .setProtectedHeader({
230
- typ: "jwt",
231
- kid,
232
- })
233
- .setPayload({
234
- /**
235
- * TODO [SIW-2264]: `state` coming from `requestObject` is marked as `optional`
236
- * At the moment, it is not entirely clear whether this value can indeed be omitted
237
- * and, if so, what the consequences of its absence might be.
238
- */
239
- ...(state ? { state } : {}),
240
- vp_token: remotePresentation.presentations.reduce(
241
- (vp_token, { credentialId, vpToken }) => ({
242
- ...vp_token,
243
- [credentialId]: [vpToken],
244
- }),
245
- {}
246
- ),
247
- })
248
- .setIssuedAt()
249
- .setExpirationTime("1h")
250
- .sign();
258
+ requestObject: RequestObject;
259
+ issuerConfig: IssuerConfig;
260
+ pid: [keyTag: string, credential: string];
261
+ }): Promise<CreateAuthorizationResponseResult> => {
262
+ const dcqlQueryResult = await RemotePresentationFlow.evaluateDcqlQuery(
263
+ requestObject.dcql_query as DcqlQuery,
264
+ [pid]
265
+ );
266
+
267
+ const remotePresentation =
268
+ await RemotePresentationFlow.prepareRemotePresentations(dcqlQueryResult, {
269
+ clientId: requestObject.client_id,
270
+ nonce: requestObject.nonce,
271
+ responseUri: requestObject.response_uri,
272
+ });
273
+
274
+ const vp_token = remotePresentation.presentations.reduce(
275
+ (acc, { credentialId, vpToken }) => ({ ...acc, [credentialId]: [vpToken] }),
276
+ {} as Record<string, string[]>
277
+ );
278
+
279
+ return createAuthorizationResponse({
280
+ // The SDK 1.4 config is used here in order to resolve the encryption data from the Request Object
281
+ // client_metadata, otherwise OpenID Federation clients always ignore client_metadata as per 1.3.3 specs.
282
+ config: sdkConfigV1_4,
283
+ requestObject,
284
+ rpJwks: {
285
+ jwks: { keys: issuerConfig.keys } as jsonWebKeySet,
286
+ encrypted_response_enc_values_supported:
287
+ issuerConfig.encrypted_response_enc_values_supported,
288
+ },
289
+ vp_token,
290
+ callbacks: {
291
+ encryptJwe: partialCallbacks.encryptJwe,
292
+ generateRandom: partialCallbacks.generateRandom,
293
+ },
294
+ });
251
295
  };
@@ -1,10 +1,15 @@
1
- import { SignJWT } from "@pagopa/io-react-native-jwt";
2
- import { createTokenDPoP, fetchTokenResponse } from "@pagopa/io-wallet-oauth2";
1
+ import {
2
+ createClientAttestationPopJwt,
3
+ createTokenDPoP,
4
+ fetchTokenResponse,
5
+ } from "@pagopa/io-wallet-oauth2";
3
6
  import { v4 as uuidv4 } from "uuid";
4
- import { createPopToken } from "../../../utils/pop";
5
- import * as WalletInstanceAttestation from "../../../wallet-instance-attestation/v1.0.0/utils";
6
- import { partialCallbacks } from "../../../utils/callbacks";
7
+ import {
8
+ createSignJwtFromCryptoContext,
9
+ partialCallbacks,
10
+ } from "../../../utils/callbacks";
7
11
  import { IoWalletError } from "../../../utils/errors";
12
+ import { sdkConfigV1_3 } from "../../../utils/config";
8
13
  import type { IssuanceApi, TokenResponse } from "../api";
9
14
 
10
15
  export const authorizeAccess: IssuanceApi["authorizeAccess"] = async (
@@ -21,37 +26,37 @@ export const authorizeAccess: IssuanceApi["authorizeAccess"] = async (
21
26
  dPopCryptoContext,
22
27
  } = context;
23
28
 
24
- const dPopSignerJwk = await dPopCryptoContext.getPublicKey();
25
29
  const tokenDPoP = await createTokenDPoP({
26
30
  callbacks: {
27
31
  ...partialCallbacks,
28
- signJwt: async (_, payload) => ({
29
- jwt: await new SignJWT(wiaCryptoContext).setPayload(payload).sign(),
30
- signerJwk: dPopSignerJwk,
31
- }),
32
+ signJwt: createSignJwtFromCryptoContext(dPopCryptoContext),
32
33
  },
33
34
  signer: {
34
- alg: "ES256",
35
35
  method: "jwk",
36
- publicJwk: dPopSignerJwk,
36
+ alg: "ES256",
37
+ publicJwk: await dPopCryptoContext.getPublicKey(),
37
38
  },
39
+ jti: uuidv4(),
38
40
  tokenRequest: {
39
41
  method: "POST",
40
42
  url: issuerConf.token_endpoint,
41
43
  },
42
44
  });
43
45
 
44
- const iss = WalletInstanceAttestation.decode(walletInstanceAttestation)
45
- .payload.cnf.jwk.kid;
46
-
47
- const signedWiaPoP = await createPopToken(
48
- {
49
- jti: uuidv4(),
50
- aud: issuerConf.credential_issuer,
51
- iss,
46
+ const clientAttestationDPoP = await createClientAttestationPopJwt({
47
+ config: sdkConfigV1_3,
48
+ callbacks: {
49
+ generateRandom: partialCallbacks.generateRandom,
50
+ signJwt: createSignJwtFromCryptoContext(wiaCryptoContext),
52
51
  },
53
- wiaCryptoContext
54
- );
52
+ clientAttestation: walletInstanceAttestation,
53
+ authorizationServer: issuerConf.credential_issuer,
54
+ signer: {
55
+ method: "jwk",
56
+ alg: "ES256",
57
+ publicJwk: await wiaCryptoContext.getPublicKey(),
58
+ },
59
+ });
55
60
 
56
61
  const tokenResponse = await fetchTokenResponse({
57
62
  accessTokenEndpoint: issuerConf.token_endpoint,
@@ -61,7 +66,7 @@ export const authorizeAccess: IssuanceApi["authorizeAccess"] = async (
61
66
  },
62
67
  walletAttestation: walletInstanceAttestation,
63
68
  dPoP: tokenDPoP.jwt,
64
- clientAttestationDPoP: signedWiaPoP,
69
+ clientAttestationDPoP,
65
70
  accessTokenRequest: {
66
71
  code,
67
72
  grant_type: "authorization_code",
@@ -9,6 +9,7 @@ import {
9
9
  createCredentialRequest,
10
10
  } from "@pagopa/io-wallet-oid4vci";
11
11
  import { UnexpectedStatusCodeError as SdkUnexpectedStatusCodeError } from "@pagopa/io-wallet-utils";
12
+ import { v4 as uuidv4 } from "uuid";
12
13
  import { hasStatusOrThrow, type Out } from "../../../utils/misc";
13
14
  import {
14
15
  IoWalletError,
@@ -19,7 +20,10 @@ import {
19
20
  } from "../../../utils/errors";
20
21
  import { LogLevel, Logger } from "../../../utils/logging";
21
22
  import { sdkConfigV1_3 } from "../../../utils/config";
22
- import { partialCallbacks } from "../../../utils/callbacks";
23
+ import {
24
+ createSignJwtFromCryptoContext,
25
+ partialCallbacks,
26
+ } from "../../../utils/callbacks";
23
27
  import type { IssuanceApi, IssuerConfig } from "../api";
24
28
  import { NonceResponse } from "./types";
25
29
  import type { AuthorizeAccessApi } from "../api/04-authorize-access";
@@ -108,28 +112,24 @@ export const requestCredentials = async ({
108
112
  },
109
113
  clientId,
110
114
  credential_identifier: credentialIdentifier,
111
- issuerIdentifier: issuerConf.credential_issuer,
115
+ issuerIdentifier: issuerConf.credential_endpoint,
112
116
  maxBatchSize: issuerConf.credential_issuance_batch_size,
113
117
  nonce: c_nonce,
114
118
  keyAttestation: keyAttestationJwt,
115
119
  signers,
116
120
  });
117
121
 
118
- const dPopSignerJwk = await dPopCryptoContext.getPublicKey();
119
-
120
122
  const credentialDPoP = await createTokenDPoP({
121
123
  callbacks: {
122
124
  ...partialCallbacks,
123
- signJwt: async (_, payload) => ({
124
- jwt: await new SignJWT(dPopCryptoContext).setPayload(payload).sign(),
125
- signerJwk: dPopSignerJwk,
126
- }),
125
+ signJwt: createSignJwtFromCryptoContext(dPopCryptoContext),
127
126
  },
128
127
  signer: {
129
128
  method: "jwk",
130
129
  alg: "ES256",
131
- publicJwk: dPopSignerJwk,
130
+ publicJwk: await dPopCryptoContext.getPublicKey(),
132
131
  },
132
+ jti: uuidv4(),
133
133
  tokenRequest: {
134
134
  method: "POST",
135
135
  url: issuerConf.credential_endpoint,
@@ -23,7 +23,8 @@ export const verifyAndParseCredential: IssuanceApi["verifyAndParseCredential"] =
23
23
  issuerConf,
24
24
  credential,
25
25
  credentialConfigurationId,
26
- context
26
+ { validateCertificateChain: true, ...context },
27
+ x509CertRoot
27
28
  );
28
29
  }
29
30
  case "mso_mdoc": {
@@ -3,7 +3,8 @@ import { evaluateIssuerTrust } from "./01-evaluate-issuer-trust";
3
3
  import { startUserAuthorization } from "./02-start-user-authorization";
4
4
  import {
5
5
  continueUserAuthorizationWithMRTDPoPChallenge,
6
- completeUserAuthorizationWithQueryMode,
6
+ completePidUserAuthorizationWithQueryMode,
7
+ completeEaaUserAuthorizationWithQueryMode,
7
8
  completeUserAuthorizationWithFormPostJwtMode,
8
9
  buildAuthorizationUrl,
9
10
  getRequestedCredentialToBePresented,
@@ -14,13 +15,14 @@ import {
14
15
  obtainCredentialsBatch,
15
16
  } from "./05-obtain-credential";
16
17
  import { verifyAndParseCredential } from "./06-verify-and-parse-credential";
17
- import { MRTDPoP } from "../mrtd-pop";
18
+ import { MRTDPoPv1_3 } from "../mrtd-pop";
18
19
 
19
20
  export const Issuance: IssuanceApi = {
20
21
  evaluateIssuerTrust,
21
22
  startUserAuthorization,
22
23
  buildAuthorizationUrl,
23
- completeUserAuthorizationWithQueryMode,
24
+ completePidUserAuthorizationWithQueryMode,
25
+ completeEaaUserAuthorizationWithQueryMode,
24
26
  continueUserAuthorizationWithMRTDPoPChallenge,
25
27
  getRequestedCredentialToBePresented,
26
28
  completeUserAuthorizationWithFormPostJwtMode,
@@ -28,5 +30,5 @@ export const Issuance: IssuanceApi = {
28
30
  obtainCredential,
29
31
  obtainCredentialsBatch,
30
32
  verifyAndParseCredential,
31
- MRTDPoP,
33
+ MRTDPoP: MRTDPoPv1_3,
32
34
  };