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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (443) hide show
  1. package/README.md +47 -1
  2. package/lib/commonjs/client/generated/wallet-provider.js +49 -20
  3. package/lib/commonjs/client/generated/wallet-provider.js.map +1 -1
  4. package/lib/commonjs/credential/index.js +5 -1
  5. package/lib/commonjs/credential/index.js.map +1 -1
  6. package/lib/commonjs/credential/issuance/02-evaluate-issuer-trust.js +27 -0
  7. package/lib/commonjs/credential/issuance/02-evaluate-issuer-trust.js.map +1 -0
  8. package/lib/commonjs/credential/issuance/03-start-user-authorization.js +25 -16
  9. package/lib/commonjs/credential/issuance/03-start-user-authorization.js.map +1 -1
  10. package/lib/commonjs/credential/issuance/04-complete-user-authorization.js +30 -18
  11. package/lib/commonjs/credential/issuance/04-complete-user-authorization.js.map +1 -1
  12. package/lib/commonjs/credential/issuance/05-authorize-access.js +17 -12
  13. package/lib/commonjs/credential/issuance/05-authorize-access.js.map +1 -1
  14. package/lib/commonjs/credential/issuance/06-obtain-credential.js +36 -29
  15. package/lib/commonjs/credential/issuance/06-obtain-credential.js.map +1 -1
  16. package/lib/commonjs/credential/issuance/07-verify-and-parse-credential.js +27 -207
  17. package/lib/commonjs/credential/issuance/07-verify-and-parse-credential.js.map +1 -1
  18. package/lib/commonjs/credential/issuance/README.md +23 -20
  19. package/lib/commonjs/credential/issuance/const.js +1 -1
  20. package/lib/commonjs/credential/issuance/const.js.map +1 -1
  21. package/lib/commonjs/credential/issuance/index.js +3 -3
  22. package/lib/commonjs/credential/issuance/index.js.map +1 -1
  23. package/lib/commonjs/credential/presentation/01-start-flow.js +14 -15
  24. package/lib/commonjs/credential/presentation/01-start-flow.js.map +1 -1
  25. package/lib/commonjs/credential/presentation/02-evaluate-rp-trust.js +6 -4
  26. package/lib/commonjs/credential/presentation/02-evaluate-rp-trust.js.map +1 -1
  27. package/lib/commonjs/credential/presentation/03-get-request-object.js +34 -7
  28. package/lib/commonjs/credential/presentation/03-get-request-object.js.map +1 -1
  29. package/lib/commonjs/credential/presentation/04-retrieve-rp-jwks.js +4 -126
  30. package/lib/commonjs/credential/presentation/04-retrieve-rp-jwks.js.map +1 -1
  31. package/lib/commonjs/credential/presentation/05-verify-request-object.js +80 -25
  32. package/lib/commonjs/credential/presentation/05-verify-request-object.js.map +1 -1
  33. package/lib/commonjs/credential/presentation/06-fetch-presentation-definition.js +6 -30
  34. package/lib/commonjs/credential/presentation/06-fetch-presentation-definition.js.map +1 -1
  35. package/lib/commonjs/credential/presentation/07-evaluate-dcql-query.js +97 -117
  36. package/lib/commonjs/credential/presentation/07-evaluate-dcql-query.js.map +1 -1
  37. package/lib/commonjs/credential/presentation/07-evaluate-input-descriptor.js +86 -191
  38. package/lib/commonjs/credential/presentation/07-evaluate-input-descriptor.js.map +1 -1
  39. package/lib/commonjs/credential/presentation/08-send-authorization-response.js +112 -176
  40. package/lib/commonjs/credential/presentation/08-send-authorization-response.js.map +1 -1
  41. package/lib/commonjs/credential/presentation/README.md +74 -79
  42. package/lib/commonjs/credential/presentation/errors.js +42 -21
  43. package/lib/commonjs/credential/presentation/errors.js.map +1 -1
  44. package/lib/commonjs/credential/presentation/index.js +13 -13
  45. package/lib/commonjs/credential/presentation/index.js.map +1 -1
  46. package/lib/commonjs/credential/presentation/types.js +53 -29
  47. package/lib/commonjs/credential/presentation/types.js.map +1 -1
  48. package/lib/commonjs/credential/status/01-start-flow.js +2 -0
  49. package/lib/commonjs/credential/status/01-start-flow.js.map +1 -0
  50. package/lib/commonjs/credential/status/02-status-attestation.js +73 -0
  51. package/lib/commonjs/credential/status/02-status-attestation.js.map +1 -0
  52. package/lib/commonjs/credential/status/03-verify-and-parse-status-attestation.js +55 -0
  53. package/lib/commonjs/credential/status/03-verify-and-parse-status-attestation.js.map +1 -0
  54. package/lib/commonjs/credential/status/README.md +67 -0
  55. package/lib/commonjs/credential/status/index.js +27 -0
  56. package/lib/commonjs/credential/status/index.js.map +1 -0
  57. package/lib/commonjs/credential/status/types.js +48 -0
  58. package/lib/commonjs/credential/status/types.js.map +1 -0
  59. package/lib/commonjs/credential/trustmark/README.md +62 -0
  60. package/lib/commonjs/credential/trustmark/get-credential-trustmark.js +86 -0
  61. package/lib/commonjs/credential/trustmark/get-credential-trustmark.js.map +1 -0
  62. package/lib/commonjs/credential/trustmark/index.js +13 -0
  63. package/lib/commonjs/credential/trustmark/index.js.map +1 -0
  64. package/lib/commonjs/index.js +5 -1
  65. package/lib/commonjs/index.js.map +1 -1
  66. package/lib/commonjs/pid/sd-jwt/types.js +18 -2
  67. package/lib/commonjs/pid/sd-jwt/types.js.map +1 -1
  68. package/lib/commonjs/sd-jwt/__test__/index.test.js +22 -34
  69. package/lib/commonjs/sd-jwt/__test__/index.test.js.map +1 -1
  70. package/lib/commonjs/sd-jwt/__test__/types.test.js +11 -23
  71. package/lib/commonjs/sd-jwt/__test__/types.test.js.map +1 -1
  72. package/lib/commonjs/sd-jwt/index.js +1 -7
  73. package/lib/commonjs/sd-jwt/index.js.map +1 -1
  74. package/lib/commonjs/sd-jwt/types.js +5 -21
  75. package/lib/commonjs/sd-jwt/types.js.map +1 -1
  76. package/lib/commonjs/trust/README.md +147 -0
  77. package/lib/commonjs/trust/chain.js +153 -0
  78. package/lib/commonjs/trust/chain.js.map +1 -0
  79. package/lib/commonjs/trust/errors.js +133 -0
  80. package/lib/commonjs/trust/errors.js.map +1 -0
  81. package/lib/commonjs/trust/index.js +288 -0
  82. package/lib/commonjs/trust/index.js.map +1 -0
  83. package/lib/commonjs/{entity/trust → trust}/types.js +27 -47
  84. package/lib/commonjs/trust/types.js.map +1 -0
  85. package/lib/commonjs/trust/utils.js +70 -0
  86. package/lib/commonjs/trust/utils.js.map +1 -0
  87. package/lib/commonjs/utils/crypto.js +5 -112
  88. package/lib/commonjs/utils/crypto.js.map +1 -1
  89. package/lib/commonjs/utils/decoder.js +2 -0
  90. package/lib/commonjs/utils/decoder.js.map +1 -1
  91. package/lib/commonjs/utils/error-codes.js +22 -2
  92. package/lib/commonjs/utils/error-codes.js.map +1 -1
  93. package/lib/commonjs/utils/errors.js +72 -4
  94. package/lib/commonjs/utils/errors.js.map +1 -1
  95. package/lib/commonjs/utils/logging.js +68 -0
  96. package/lib/commonjs/utils/logging.js.map +1 -0
  97. package/lib/commonjs/utils/misc.js +2 -0
  98. package/lib/commonjs/utils/misc.js.map +1 -1
  99. package/lib/commonjs/utils/par.js +17 -10
  100. package/lib/commonjs/utils/par.js.map +1 -1
  101. package/lib/commonjs/utils/string.js +1 -12
  102. package/lib/commonjs/utils/string.js.map +1 -1
  103. package/lib/commonjs/wallet-instance/index.js +14 -0
  104. package/lib/commonjs/wallet-instance/index.js.map +1 -1
  105. package/lib/commonjs/wallet-instance-attestation/README.md +8 -3
  106. package/lib/commonjs/wallet-instance-attestation/issuing.js +15 -8
  107. package/lib/commonjs/wallet-instance-attestation/issuing.js.map +1 -1
  108. package/lib/commonjs/wallet-instance-attestation/types.js +16 -20
  109. package/lib/commonjs/wallet-instance-attestation/types.js.map +1 -1
  110. package/lib/module/client/generated/wallet-provider.js +40 -15
  111. package/lib/module/client/generated/wallet-provider.js.map +1 -1
  112. package/lib/module/credential/index.js +3 -1
  113. package/lib/module/credential/index.js.map +1 -1
  114. package/lib/module/credential/issuance/02-evaluate-issuer-trust.js +20 -0
  115. package/lib/module/credential/issuance/02-evaluate-issuer-trust.js.map +1 -0
  116. package/lib/module/credential/issuance/03-start-user-authorization.js +25 -16
  117. package/lib/module/credential/issuance/03-start-user-authorization.js.map +1 -1
  118. package/lib/module/credential/issuance/04-complete-user-authorization.js +30 -18
  119. package/lib/module/credential/issuance/04-complete-user-authorization.js.map +1 -1
  120. package/lib/module/credential/issuance/05-authorize-access.js +17 -11
  121. package/lib/module/credential/issuance/05-authorize-access.js.map +1 -1
  122. package/lib/module/credential/issuance/06-obtain-credential.js +36 -28
  123. package/lib/module/credential/issuance/06-obtain-credential.js.map +1 -1
  124. package/lib/module/credential/issuance/07-verify-and-parse-credential.js +27 -205
  125. package/lib/module/credential/issuance/07-verify-and-parse-credential.js.map +1 -1
  126. package/lib/module/credential/issuance/README.md +23 -20
  127. package/lib/module/credential/issuance/const.js +1 -1
  128. package/lib/module/credential/issuance/const.js.map +1 -1
  129. package/lib/module/credential/issuance/index.js +2 -2
  130. package/lib/module/credential/issuance/index.js.map +1 -1
  131. package/lib/module/credential/presentation/01-start-flow.js +14 -15
  132. package/lib/module/credential/presentation/01-start-flow.js.map +1 -1
  133. package/lib/module/credential/presentation/02-evaluate-rp-trust.js +5 -3
  134. package/lib/module/credential/presentation/02-evaluate-rp-trust.js.map +1 -1
  135. package/lib/module/credential/presentation/03-get-request-object.js +34 -7
  136. package/lib/module/credential/presentation/03-get-request-object.js.map +1 -1
  137. package/lib/module/credential/presentation/04-retrieve-rp-jwks.js +2 -124
  138. package/lib/module/credential/presentation/04-retrieve-rp-jwks.js.map +1 -1
  139. package/lib/module/credential/presentation/05-verify-request-object.js +78 -23
  140. package/lib/module/credential/presentation/05-verify-request-object.js.map +1 -1
  141. package/lib/module/credential/presentation/06-fetch-presentation-definition.js +6 -30
  142. package/lib/module/credential/presentation/06-fetch-presentation-definition.js.map +1 -1
  143. package/lib/module/credential/presentation/07-evaluate-dcql-query.js +97 -118
  144. package/lib/module/credential/presentation/07-evaluate-dcql-query.js.map +1 -1
  145. package/lib/module/credential/presentation/07-evaluate-input-descriptor.js +83 -186
  146. package/lib/module/credential/presentation/07-evaluate-input-descriptor.js.map +1 -1
  147. package/lib/module/credential/presentation/08-send-authorization-response.js +107 -170
  148. package/lib/module/credential/presentation/08-send-authorization-response.js.map +1 -1
  149. package/lib/module/credential/presentation/README.md +74 -79
  150. package/lib/module/credential/presentation/errors.js +30 -17
  151. package/lib/module/credential/presentation/errors.js.map +1 -1
  152. package/lib/module/credential/presentation/index.js +6 -6
  153. package/lib/module/credential/presentation/index.js.map +1 -1
  154. package/lib/module/credential/presentation/types.js +49 -27
  155. package/lib/module/credential/presentation/types.js.map +1 -1
  156. package/lib/module/credential/status/01-start-flow.js +2 -0
  157. package/lib/module/credential/status/01-start-flow.js.map +1 -0
  158. package/lib/module/credential/status/02-status-attestation.js +66 -0
  159. package/lib/module/credential/status/02-status-attestation.js.map +1 -0
  160. package/lib/module/credential/status/03-verify-and-parse-status-attestation.js +49 -0
  161. package/lib/module/credential/status/03-verify-and-parse-status-attestation.js.map +1 -0
  162. package/lib/module/credential/status/README.md +67 -0
  163. package/lib/module/credential/status/index.js +5 -0
  164. package/lib/module/credential/status/index.js.map +1 -0
  165. package/lib/module/credential/status/types.js +40 -0
  166. package/lib/module/credential/status/types.js.map +1 -0
  167. package/lib/module/credential/trustmark/README.md +62 -0
  168. package/lib/module/credential/trustmark/get-credential-trustmark.js +77 -0
  169. package/lib/module/credential/trustmark/get-credential-trustmark.js.map +1 -0
  170. package/lib/module/credential/trustmark/index.js +3 -0
  171. package/lib/module/credential/trustmark/index.js.map +1 -0
  172. package/lib/module/index.js +3 -1
  173. package/lib/module/index.js.map +1 -1
  174. package/lib/module/pid/sd-jwt/types.js +16 -1
  175. package/lib/module/pid/sd-jwt/types.js.map +1 -1
  176. package/lib/module/sd-jwt/__test__/index.test.js +22 -34
  177. package/lib/module/sd-jwt/__test__/index.test.js.map +1 -1
  178. package/lib/module/sd-jwt/__test__/types.test.js +11 -23
  179. package/lib/module/sd-jwt/__test__/types.test.js.map +1 -1
  180. package/lib/module/sd-jwt/index.js +1 -7
  181. package/lib/module/sd-jwt/index.js.map +1 -1
  182. package/lib/module/sd-jwt/types.js +4 -19
  183. package/lib/module/sd-jwt/types.js.map +1 -1
  184. package/lib/module/trust/README.md +147 -0
  185. package/lib/module/trust/chain.js +145 -0
  186. package/lib/module/trust/chain.js.map +1 -0
  187. package/lib/module/trust/errors.js +115 -0
  188. package/lib/module/trust/errors.js.map +1 -0
  189. package/lib/module/trust/index.js +269 -0
  190. package/lib/module/trust/index.js.map +1 -0
  191. package/lib/module/{entity/trust → trust}/types.js +25 -46
  192. package/lib/module/trust/types.js.map +1 -0
  193. package/lib/module/trust/utils.js +60 -0
  194. package/lib/module/trust/utils.js.map +1 -0
  195. package/lib/module/utils/crypto.js +4 -107
  196. package/lib/module/utils/crypto.js.map +1 -1
  197. package/lib/module/utils/decoder.js +3 -0
  198. package/lib/module/utils/decoder.js.map +1 -1
  199. package/lib/module/utils/error-codes.js +20 -1
  200. package/lib/module/utils/error-codes.js.map +1 -1
  201. package/lib/module/utils/errors.js +61 -4
  202. package/lib/module/utils/errors.js.map +1 -1
  203. package/lib/module/utils/logging.js +62 -0
  204. package/lib/module/utils/logging.js.map +1 -0
  205. package/lib/module/utils/misc.js +2 -0
  206. package/lib/module/utils/misc.js.map +1 -1
  207. package/lib/module/utils/par.js +17 -9
  208. package/lib/module/utils/par.js.map +1 -1
  209. package/lib/module/utils/string.js +0 -10
  210. package/lib/module/utils/string.js.map +1 -1
  211. package/lib/module/wallet-instance/index.js +13 -0
  212. package/lib/module/wallet-instance/index.js.map +1 -1
  213. package/lib/module/wallet-instance-attestation/README.md +8 -3
  214. package/lib/module/wallet-instance-attestation/index.js +2 -2
  215. package/lib/module/wallet-instance-attestation/index.js.map +1 -1
  216. package/lib/module/wallet-instance-attestation/issuing.js +16 -9
  217. package/lib/module/wallet-instance-attestation/issuing.js.map +1 -1
  218. package/lib/module/wallet-instance-attestation/types.js +14 -18
  219. package/lib/module/wallet-instance-attestation/types.js.map +1 -1
  220. package/lib/typescript/client/generated/wallet-provider.d.ts +206 -51
  221. package/lib/typescript/client/generated/wallet-provider.d.ts.map +1 -1
  222. package/lib/typescript/credential/index.d.ts +3 -1
  223. package/lib/typescript/credential/index.d.ts.map +1 -1
  224. package/lib/typescript/credential/issuance/01-start-flow.d.ts +1 -1
  225. package/lib/typescript/credential/issuance/02-evaluate-issuer-trust.d.ts +19 -0
  226. package/lib/typescript/credential/issuance/02-evaluate-issuer-trust.d.ts.map +1 -0
  227. package/lib/typescript/credential/issuance/03-start-user-authorization.d.ts +3 -3
  228. package/lib/typescript/credential/issuance/03-start-user-authorization.d.ts.map +1 -1
  229. package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts +9 -9
  230. package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts.map +1 -1
  231. package/lib/typescript/credential/issuance/05-authorize-access.d.ts +3 -3
  232. package/lib/typescript/credential/issuance/05-authorize-access.d.ts.map +1 -1
  233. package/lib/typescript/credential/issuance/06-obtain-credential.d.ts +4 -4
  234. package/lib/typescript/credential/issuance/06-obtain-credential.d.ts.map +1 -1
  235. package/lib/typescript/credential/issuance/07-verify-and-parse-credential.d.ts +3 -15
  236. package/lib/typescript/credential/issuance/07-verify-and-parse-credential.d.ts.map +1 -1
  237. package/lib/typescript/credential/issuance/const.d.ts +1 -1
  238. package/lib/typescript/credential/issuance/const.d.ts.map +1 -1
  239. package/lib/typescript/credential/issuance/index.d.ts +3 -3
  240. package/lib/typescript/credential/issuance/index.d.ts.map +1 -1
  241. package/lib/typescript/credential/issuance/types.d.ts +8 -3
  242. package/lib/typescript/credential/issuance/types.d.ts.map +1 -1
  243. package/lib/typescript/credential/presentation/01-start-flow.d.ts +28 -9
  244. package/lib/typescript/credential/presentation/01-start-flow.d.ts.map +1 -1
  245. package/lib/typescript/credential/presentation/02-evaluate-rp-trust.d.ts +2 -1
  246. package/lib/typescript/credential/presentation/02-evaluate-rp-trust.d.ts.map +1 -1
  247. package/lib/typescript/credential/presentation/03-get-request-object.d.ts +7 -5
  248. package/lib/typescript/credential/presentation/03-get-request-object.d.ts.map +1 -1
  249. package/lib/typescript/credential/presentation/04-retrieve-rp-jwks.d.ts +4 -30
  250. package/lib/typescript/credential/presentation/04-retrieve-rp-jwks.d.ts.map +1 -1
  251. package/lib/typescript/credential/presentation/05-verify-request-object.d.ts +17 -4
  252. package/lib/typescript/credential/presentation/05-verify-request-object.d.ts.map +1 -1
  253. package/lib/typescript/credential/presentation/06-fetch-presentation-definition.d.ts +4 -9
  254. package/lib/typescript/credential/presentation/06-fetch-presentation-definition.d.ts.map +1 -1
  255. package/lib/typescript/credential/presentation/07-evaluate-dcql-query.d.ts +13 -12
  256. package/lib/typescript/credential/presentation/07-evaluate-dcql-query.d.ts.map +1 -1
  257. package/lib/typescript/credential/presentation/07-evaluate-input-descriptor.d.ts +40 -42
  258. package/lib/typescript/credential/presentation/07-evaluate-input-descriptor.d.ts.map +1 -1
  259. package/lib/typescript/credential/presentation/08-send-authorization-response.d.ts +30 -43
  260. package/lib/typescript/credential/presentation/08-send-authorization-response.d.ts.map +1 -1
  261. package/lib/typescript/credential/presentation/errors.d.ts +25 -10
  262. package/lib/typescript/credential/presentation/errors.d.ts.map +1 -1
  263. package/lib/typescript/credential/presentation/index.d.ts +7 -8
  264. package/lib/typescript/credential/presentation/index.d.ts.map +1 -1
  265. package/lib/typescript/credential/presentation/types.d.ts +137 -307
  266. package/lib/typescript/credential/presentation/types.d.ts.map +1 -1
  267. package/lib/typescript/credential/status/01-start-flow.d.ts +10 -0
  268. package/lib/typescript/credential/status/01-start-flow.d.ts.map +1 -0
  269. package/lib/typescript/credential/status/02-status-attestation.d.ts +19 -0
  270. package/lib/typescript/credential/status/02-status-attestation.d.ts.map +1 -0
  271. package/lib/typescript/credential/status/03-verify-and-parse-status-attestation.d.ts +24 -0
  272. package/lib/typescript/credential/status/03-verify-and-parse-status-attestation.d.ts.map +1 -0
  273. package/lib/typescript/credential/status/index.d.ts +7 -0
  274. package/lib/typescript/credential/status/index.d.ts.map +1 -0
  275. package/lib/typescript/credential/status/types.d.ts +305 -0
  276. package/lib/typescript/credential/status/types.d.ts.map +1 -0
  277. package/lib/typescript/credential/trustmark/get-credential-trustmark.d.ts +52 -0
  278. package/lib/typescript/credential/trustmark/get-credential-trustmark.d.ts.map +1 -0
  279. package/lib/typescript/credential/trustmark/index.d.ts +4 -0
  280. package/lib/typescript/credential/trustmark/index.d.ts.map +1 -0
  281. package/lib/typescript/index.d.ts +3 -1
  282. package/lib/typescript/index.d.ts.map +1 -1
  283. package/lib/typescript/pid/sd-jwt/types.d.ts +103 -25
  284. package/lib/typescript/pid/sd-jwt/types.d.ts.map +1 -1
  285. package/lib/typescript/sd-jwt/index.d.ts +20 -72
  286. package/lib/typescript/sd-jwt/index.d.ts.map +1 -1
  287. package/lib/typescript/sd-jwt/types.d.ts +24 -129
  288. package/lib/typescript/sd-jwt/types.d.ts.map +1 -1
  289. package/lib/typescript/trust/chain.d.ts +23 -0
  290. package/lib/typescript/trust/chain.d.ts.map +1 -0
  291. package/lib/typescript/trust/errors.d.ts +102 -0
  292. package/lib/typescript/trust/errors.d.ts.map +1 -0
  293. package/lib/typescript/{entity/trust → trust}/index.d.ts +308 -281
  294. package/lib/typescript/trust/index.d.ts.map +1 -0
  295. package/lib/typescript/{entity/trust → trust}/types.d.ts +1714 -1301
  296. package/lib/typescript/{entity/trust → trust}/types.d.ts.map +1 -1
  297. package/lib/typescript/trust/utils.d.ts +22 -0
  298. package/lib/typescript/trust/utils.d.ts.map +1 -0
  299. package/lib/typescript/utils/crypto.d.ts +0 -32
  300. package/lib/typescript/utils/crypto.d.ts.map +1 -1
  301. package/lib/typescript/utils/decoder.d.ts.map +1 -1
  302. package/lib/typescript/utils/error-codes.d.ts +20 -0
  303. package/lib/typescript/utils/error-codes.d.ts.map +1 -1
  304. package/lib/typescript/utils/errors.d.ts +55 -10
  305. package/lib/typescript/utils/errors.d.ts.map +1 -1
  306. package/lib/typescript/utils/logging.d.ts +35 -0
  307. package/lib/typescript/utils/logging.d.ts.map +1 -0
  308. package/lib/typescript/utils/misc.d.ts.map +1 -1
  309. package/lib/typescript/utils/par.d.ts +8 -1
  310. package/lib/typescript/utils/par.d.ts.map +1 -1
  311. package/lib/typescript/utils/string.d.ts +0 -7
  312. package/lib/typescript/utils/string.d.ts.map +1 -1
  313. package/lib/typescript/wallet-instance/index.d.ts +8 -0
  314. package/lib/typescript/wallet-instance/index.d.ts.map +1 -1
  315. package/lib/typescript/wallet-instance-attestation/index.d.ts +1 -2
  316. package/lib/typescript/wallet-instance-attestation/index.d.ts.map +1 -1
  317. package/lib/typescript/wallet-instance-attestation/issuing.d.ts +4 -2
  318. package/lib/typescript/wallet-instance-attestation/issuing.d.ts.map +1 -1
  319. package/lib/typescript/wallet-instance-attestation/types.d.ts +60 -102
  320. package/lib/typescript/wallet-instance-attestation/types.d.ts.map +1 -1
  321. package/package.json +9 -10
  322. package/src/client/generated/wallet-provider.ts +52 -17
  323. package/src/credential/index.ts +4 -1
  324. package/src/credential/issuance/01-start-flow.ts +1 -1
  325. package/src/credential/issuance/02-evaluate-issuer-trust.ts +32 -0
  326. package/src/credential/issuance/03-start-user-authorization.ts +48 -22
  327. package/src/credential/issuance/04-complete-user-authorization.ts +74 -18
  328. package/src/credential/issuance/05-authorize-access.ts +29 -11
  329. package/src/credential/issuance/06-obtain-credential.ts +61 -36
  330. package/src/credential/issuance/07-verify-and-parse-credential.ts +37 -264
  331. package/src/credential/issuance/README.md +23 -20
  332. package/src/credential/issuance/const.ts +1 -1
  333. package/src/credential/issuance/index.ts +6 -3
  334. package/src/credential/presentation/01-start-flow.ts +19 -22
  335. package/src/credential/presentation/02-evaluate-rp-trust.ts +5 -4
  336. package/src/credential/presentation/03-get-request-object.ts +36 -8
  337. package/src/credential/presentation/04-retrieve-rp-jwks.ts +6 -148
  338. package/src/credential/presentation/05-verify-request-object.ts +115 -30
  339. package/src/credential/presentation/06-fetch-presentation-definition.ts +5 -35
  340. package/src/credential/presentation/07-evaluate-dcql-query.ts +132 -161
  341. package/src/credential/presentation/07-evaluate-input-descriptor.ts +136 -254
  342. package/src/credential/presentation/08-send-authorization-response.ts +178 -260
  343. package/src/credential/presentation/README.md +74 -79
  344. package/src/credential/presentation/errors.ts +38 -15
  345. package/src/credential/presentation/index.ts +18 -19
  346. package/src/credential/presentation/types.ts +67 -64
  347. package/src/credential/status/01-start-flow.ts +9 -0
  348. package/src/credential/status/02-status-attestation.ts +105 -0
  349. package/src/credential/status/03-verify-and-parse-status-attestation.ts +70 -0
  350. package/src/credential/status/README.md +67 -0
  351. package/src/credential/status/index.ts +22 -0
  352. package/src/credential/status/types.ts +43 -0
  353. package/src/credential/trustmark/README.md +62 -0
  354. package/src/credential/trustmark/get-credential-trustmark.ts +139 -0
  355. package/src/credential/trustmark/index.ts +8 -0
  356. package/src/index.ts +4 -0
  357. package/src/pid/sd-jwt/types.ts +18 -1
  358. package/src/sd-jwt/__test__/index.test.ts +36 -55
  359. package/src/sd-jwt/__test__/types.test.ts +16 -29
  360. package/src/sd-jwt/index.ts +1 -5
  361. package/src/sd-jwt/types.ts +2 -19
  362. package/src/trust/README.md +147 -0
  363. package/src/trust/chain.ts +227 -0
  364. package/src/trust/errors.ts +136 -0
  365. package/src/{entity/trust → trust}/index.ts +207 -25
  366. package/src/{entity/trust → trust}/types.ts +24 -37
  367. package/src/trust/utils.ts +70 -0
  368. package/src/utils/crypto.ts +4 -106
  369. package/src/utils/decoder.ts +6 -1
  370. package/src/utils/error-codes.ts +23 -0
  371. package/src/utils/errors.ts +119 -15
  372. package/src/utils/logging.ts +68 -0
  373. package/src/utils/misc.ts +5 -0
  374. package/src/utils/par.ts +19 -6
  375. package/src/utils/string.ts +0 -10
  376. package/src/wallet-instance/index.ts +30 -1
  377. package/src/wallet-instance-attestation/README.md +8 -3
  378. package/src/wallet-instance-attestation/index.ts +2 -2
  379. package/src/wallet-instance-attestation/issuing.ts +33 -12
  380. package/src/wallet-instance-attestation/types.ts +18 -22
  381. package/lib/commonjs/credential/issuance/02-get-issuer-config.js +0 -48
  382. package/lib/commonjs/credential/issuance/02-get-issuer-config.js.map +0 -1
  383. package/lib/commonjs/entity/openid-connect/issuer/index.js +0 -25
  384. package/lib/commonjs/entity/openid-connect/issuer/index.js.map +0 -1
  385. package/lib/commonjs/entity/openid-connect/issuer/types.js +0 -64
  386. package/lib/commonjs/entity/openid-connect/issuer/types.js.map +0 -1
  387. package/lib/commonjs/entity/trust/chain.js +0 -122
  388. package/lib/commonjs/entity/trust/chain.js.map +0 -1
  389. package/lib/commonjs/entity/trust/index.js +0 -148
  390. package/lib/commonjs/entity/trust/index.js.map +0 -1
  391. package/lib/commonjs/entity/trust/types.js.map +0 -1
  392. package/lib/commonjs/mdoc/converters.js +0 -26
  393. package/lib/commonjs/mdoc/converters.js.map +0 -1
  394. package/lib/commonjs/mdoc/index.js +0 -68
  395. package/lib/commonjs/mdoc/index.js.map +0 -1
  396. package/lib/commonjs/utils/credential/issuance/07-verify-and-parse-credentials-inputs.js +0 -469
  397. package/lib/commonjs/utils/credential/issuance/07-verify-and-parse-credentials-inputs.js.map +0 -1
  398. package/lib/commonjs/utils/credential/issuance/07-verify-and-parse-credentials-utils.js +0 -90
  399. package/lib/commonjs/utils/credential/issuance/07-verify-and-parse-credentials-utils.js.map +0 -1
  400. package/lib/module/credential/issuance/02-get-issuer-config.js +0 -42
  401. package/lib/module/credential/issuance/02-get-issuer-config.js.map +0 -1
  402. package/lib/module/entity/openid-connect/issuer/index.js +0 -20
  403. package/lib/module/entity/openid-connect/issuer/index.js.map +0 -1
  404. package/lib/module/entity/openid-connect/issuer/types.js +0 -48
  405. package/lib/module/entity/openid-connect/issuer/types.js.map +0 -1
  406. package/lib/module/entity/trust/chain.js +0 -113
  407. package/lib/module/entity/trust/chain.js.map +0 -1
  408. package/lib/module/entity/trust/index.js +0 -131
  409. package/lib/module/entity/trust/index.js.map +0 -1
  410. package/lib/module/entity/trust/types.js.map +0 -1
  411. package/lib/module/mdoc/converters.js +0 -20
  412. package/lib/module/mdoc/converters.js.map +0 -1
  413. package/lib/module/mdoc/index.js +0 -60
  414. package/lib/module/mdoc/index.js.map +0 -1
  415. package/lib/module/utils/credential/issuance/07-verify-and-parse-credentials-inputs.js +0 -462
  416. package/lib/module/utils/credential/issuance/07-verify-and-parse-credentials-inputs.js.map +0 -1
  417. package/lib/module/utils/credential/issuance/07-verify-and-parse-credentials-utils.js +0 -83
  418. package/lib/module/utils/credential/issuance/07-verify-and-parse-credentials-utils.js.map +0 -1
  419. package/lib/typescript/credential/issuance/02-get-issuer-config.d.ts +0 -32
  420. package/lib/typescript/credential/issuance/02-get-issuer-config.d.ts.map +0 -1
  421. package/lib/typescript/entity/openid-connect/issuer/index.d.ts +0 -12
  422. package/lib/typescript/entity/openid-connect/issuer/index.d.ts.map +0 -1
  423. package/lib/typescript/entity/openid-connect/issuer/types.d.ts +0 -777
  424. package/lib/typescript/entity/openid-connect/issuer/types.d.ts.map +0 -1
  425. package/lib/typescript/entity/trust/chain.d.ts +0 -26
  426. package/lib/typescript/entity/trust/chain.d.ts.map +0 -1
  427. package/lib/typescript/entity/trust/index.d.ts.map +0 -1
  428. package/lib/typescript/mdoc/converters.d.ts +0 -8
  429. package/lib/typescript/mdoc/converters.d.ts.map +0 -1
  430. package/lib/typescript/mdoc/index.d.ts +0 -10
  431. package/lib/typescript/mdoc/index.d.ts.map +0 -1
  432. package/lib/typescript/utils/credential/issuance/07-verify-and-parse-credentials-inputs.d.ts +0 -3
  433. package/lib/typescript/utils/credential/issuance/07-verify-and-parse-credentials-inputs.d.ts.map +0 -1
  434. package/lib/typescript/utils/credential/issuance/07-verify-and-parse-credentials-utils.d.ts +0 -42
  435. package/lib/typescript/utils/credential/issuance/07-verify-and-parse-credentials-utils.d.ts.map +0 -1
  436. package/src/credential/issuance/02-get-issuer-config.ts +0 -67
  437. package/src/entity/openid-connect/issuer/index.ts +0 -27
  438. package/src/entity/openid-connect/issuer/types.ts +0 -76
  439. package/src/entity/trust/chain.ts +0 -154
  440. package/src/mdoc/converters.ts +0 -26
  441. package/src/mdoc/index.ts +0 -95
  442. package/src/utils/credential/issuance/07-verify-and-parse-credentials-inputs.ts +0 -615
  443. package/src/utils/credential/issuance/07-verify-and-parse-credentials-utils.ts +0 -171
@@ -0,0 +1,269 @@
1
+ import { decode, verify } from "./utils";
2
+ import { decode as decodeJwt } from "@pagopa/io-react-native-jwt";
3
+ import { CredentialIssuerEntityConfiguration, EntityConfiguration, EntityStatement, FederationListResponse, RelyingPartyEntityConfiguration, TrustAnchorEntityConfiguration, WalletProviderEntityConfiguration } from "./types";
4
+ import { renewTrustChain, validateTrustChain } from "./chain";
5
+ import { hasStatusOrThrow } from "../utils/misc";
6
+ import { BuildTrustChainError, FederationListParseError, MissingFederationFetchEndpointError, RelyingPartyNotAuthorizedError, TrustAnchorKidMissingError } from "./errors";
7
+ /**
8
+ * Verify a given trust chain is actually valid.
9
+ * It can handle fast chain renewal, which means we try to fetch a fresh version of each statement.
10
+ *
11
+ * @param trustAnchorEntity The entity configuration of the known trust anchor
12
+ * @param chain The chain of statements to be validated
13
+ * @param x509Options Options for the verification process
14
+ * @param appFetch (optional) fetch api implementation
15
+ * @param renewOnFail Whether to attempt to renew the trust chain if the initial validation fails
16
+ * @returns The result of the chain validation
17
+ * @throws {FederationError} If the chain is not valid
18
+ */
19
+ export async function verifyTrustChain(trustAnchorEntity, chain) {
20
+ let x509Options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
21
+ connectTimeout: 10000,
22
+ readTimeout: 10000,
23
+ requireCrl: true
24
+ };
25
+ let {
26
+ appFetch = fetch,
27
+ renewOnFail = true
28
+ } = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
29
+ try {
30
+ return validateTrustChain(trustAnchorEntity, chain, x509Options);
31
+ } catch (error) {
32
+ if (renewOnFail) {
33
+ const renewedChain = await renewTrustChain(chain, appFetch);
34
+ return validateTrustChain(trustAnchorEntity, renewedChain, x509Options);
35
+ } else {
36
+ throw error;
37
+ }
38
+ }
39
+ }
40
+
41
+ /**
42
+ * Fetch the signed entity configuration token for an entity
43
+ *
44
+ * @param entityBaseUrl The url of the entity to fetch
45
+ * @param appFetch (optional) fetch api implementation
46
+ * @returns The signed Entity Configuration token
47
+ */
48
+ export async function getSignedEntityConfiguration(entityBaseUrl) {
49
+ let {
50
+ appFetch = fetch
51
+ } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
52
+ const wellKnownUrl = `${entityBaseUrl}/.well-known/openid-federation`;
53
+ return await appFetch(wellKnownUrl, {
54
+ method: "GET"
55
+ }).then(hasStatusOrThrow(200)).then(res => res.text());
56
+ }
57
+
58
+ /**
59
+ * Fetch and parse the entity configuration document for a given federation entity.
60
+ * This is an inner method to serve public interfaces.
61
+ *
62
+ * To add another entity configuration type (example: Foo entity type):
63
+ * - create its zod schema and type by inherit from the base type (example: FooEntityConfiguration = BaseEntityConfiguration.and(...))
64
+ * - add such type to EntityConfiguration union
65
+ * - add an overload to this function
66
+ * - create a public function which use such type (example: getFooEntityConfiguration = (url, options) => Promise<FooEntityConfiguration>)
67
+ *
68
+ * @param entityBaseUrl The base url of the entity.
69
+ * @param schema The expected schema of the entity configuration, according to the kind of entity we are fetching from.
70
+ * @param options An optional object with additional options.
71
+ * @param options.appFetch An optional instance of the http client to be used.
72
+ * @returns The parsed entity configuration object
73
+ * @throws {IoWalletError} If the http request fails
74
+ * @throws Parse error if the document is not in the expected shape.
75
+ */
76
+
77
+ async function fetchAndParseEntityConfiguration(entityBaseUrl, schema) {
78
+ let {
79
+ appFetch = fetch
80
+ } = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
81
+ const responseText = await getSignedEntityConfiguration(entityBaseUrl, {
82
+ appFetch
83
+ });
84
+ const responseJwt = decodeJwt(responseText);
85
+ return schema.parse({
86
+ header: responseJwt.protectedHeader,
87
+ payload: responseJwt.payload
88
+ });
89
+ }
90
+ export const getWalletProviderEntityConfiguration = (entityBaseUrl, options) => fetchAndParseEntityConfiguration(entityBaseUrl, WalletProviderEntityConfiguration, options);
91
+ export const getCredentialIssuerEntityConfiguration = (entityBaseUrl, options) => fetchAndParseEntityConfiguration(entityBaseUrl, CredentialIssuerEntityConfiguration, options);
92
+ export const getTrustAnchorEntityConfiguration = (entityBaseUrl, options) => fetchAndParseEntityConfiguration(entityBaseUrl, TrustAnchorEntityConfiguration, options);
93
+ export const getRelyingPartyEntityConfiguration = (entityBaseUrl, options) => fetchAndParseEntityConfiguration(entityBaseUrl, RelyingPartyEntityConfiguration, options);
94
+ export const getEntityConfiguration = (entityBaseUrl, options) => fetchAndParseEntityConfiguration(entityBaseUrl, EntityConfiguration, options);
95
+
96
+ /**
97
+ * Fetch and parse the entity statement document for a given federation entity.
98
+ *
99
+ * @param accreditationBodyBaseUrl The base url of the accreditation body which holds and signs the required entity statement
100
+ * @param subordinatedEntityBaseUrl The url that identifies the subordinate entity
101
+ * @param appFetch An optional instance of the http client to be used.
102
+ * @returns The parsed entity configuration object
103
+ * @throws {IoWalletError} If the http request fails
104
+ */
105
+ export async function getEntityStatement(accreditationBodyBaseUrl, subordinatedEntityBaseUrl) {
106
+ let {
107
+ appFetch = fetch
108
+ } = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
109
+ const responseText = await getSignedEntityStatement(accreditationBodyBaseUrl, subordinatedEntityBaseUrl, {
110
+ appFetch
111
+ });
112
+ const responseJwt = decodeJwt(responseText);
113
+ return EntityStatement.parse({
114
+ header: responseJwt.protectedHeader,
115
+ payload: responseJwt.payload
116
+ });
117
+ }
118
+
119
+ /**
120
+ * Fetch the entity statement document for a given federation entity.
121
+ *
122
+ * @param federationFetchEndpoint The exact endpoint provided by the parent EC's metadata.
123
+ * @param subordinatedEntityBaseUrl The url that identifies the subordinate entity.
124
+ * @param appFetch An optional instance of the http client to be used.
125
+ * @returns The signed entity statement token.
126
+ * @throws {IoWalletError} If the http request fails.
127
+ */
128
+ export async function getSignedEntityStatement(federationFetchEndpoint, subordinatedEntityBaseUrl) {
129
+ let {
130
+ appFetch = fetch
131
+ } = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
132
+ const url = new URL(federationFetchEndpoint);
133
+ url.searchParams.set("sub", subordinatedEntityBaseUrl);
134
+ return await appFetch(url.toString(), {
135
+ method: "GET"
136
+ }).then(hasStatusOrThrow(200)).then(res => res.text());
137
+ }
138
+
139
+ /**
140
+ * Fetch the federation list document from a given endpoint.
141
+ *
142
+ * @param federationListEndpoint The URL of the federation list endpoint.
143
+ * @param appFetch An optional instance of the http client to be used.
144
+ * @returns The federation list as an array of strings.
145
+ * @throws {IoWalletError} If the HTTP request fails.
146
+ * @throws {FederationError} If the result is not in the expected format.
147
+ */
148
+ export async function getFederationList(federationListEndpoint) {
149
+ let {
150
+ appFetch = fetch
151
+ } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
152
+ return await appFetch(federationListEndpoint, {
153
+ method: "GET"
154
+ }).then(hasStatusOrThrow(200)).then(res => res.json()).then(json => {
155
+ const result = FederationListResponse.safeParse(json);
156
+ if (!result.success) {
157
+ throw new FederationListParseError(`Invalid federation list format received from ${federationListEndpoint}. Error: ${result.error.message}`, {
158
+ url: federationListEndpoint,
159
+ parseError: result.error.toString()
160
+ });
161
+ }
162
+ return result.data;
163
+ });
164
+ }
165
+
166
+ /**
167
+ * Build a not-verified trust chain for a given Relying Party (RP) entity.
168
+ *
169
+ * @param relyingPartyEntityBaseUrl The base URL of the RP entity
170
+ * @param trustAnchorKey The public key of the Trust Anchor (TA) entity
171
+ * @param appFetch An optional instance of the http client to be used.
172
+ * @returns A list of signed tokens that represent the trust chain, in the order of the chain (from the RP to the Trust Anchor)
173
+ * @throws {FederationError} When an element of the chain fails to parse or other build steps fail.
174
+ */
175
+ export async function buildTrustChain(relyingPartyEntityBaseUrl, trustAnchorKey) {
176
+ let appFetch = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : fetch;
177
+ // 1: Recursively gather the trust chain from the RP up to the Trust Anchor
178
+ const trustChain = await gatherTrustChain(relyingPartyEntityBaseUrl, appFetch);
179
+
180
+ // 2: Trust Anchor signature verification
181
+ const trustAnchorJwt = trustChain[trustChain.length - 1];
182
+ if (!trustAnchorJwt) {
183
+ throw new BuildTrustChainError("Cannot verify trust anchor: missing entity configuration in gathered chain.", {
184
+ relyingPartyUrl: relyingPartyEntityBaseUrl
185
+ });
186
+ }
187
+ if (!trustAnchorKey.kid) {
188
+ throw new TrustAnchorKidMissingError();
189
+ }
190
+ await verify(trustAnchorJwt, trustAnchorKey.kid, [trustAnchorKey]);
191
+
192
+ // 3: Check the federation list
193
+ const trustAnchorConfig = EntityConfiguration.parse(decode(trustAnchorJwt));
194
+ const federationListEndpoint = trustAnchorConfig.payload.metadata.federation_entity.federation_list_endpoint;
195
+ if (federationListEndpoint) {
196
+ const federationList = await getFederationList(federationListEndpoint, {
197
+ appFetch
198
+ });
199
+ if (!federationList.includes(relyingPartyEntityBaseUrl)) {
200
+ throw new RelyingPartyNotAuthorizedError("Relying Party entity base URL is not authorized by the Trust Anchor's federation list.", {
201
+ relyingPartyUrl: relyingPartyEntityBaseUrl,
202
+ federationListEndpoint
203
+ });
204
+ }
205
+ }
206
+ return trustChain;
207
+ }
208
+
209
+ /**
210
+ * Recursively gather the trust chain for an entity and all its superiors.
211
+ * @param entityBaseUrl The base URL of the entity for which to gather the chain.
212
+ * @param appFetch An optional instance of the http client to be used.
213
+ * @param isLeaf Whether the current entity is the leaf of the chain.
214
+ * @returns A full ordered list of JWTs (ECs and ESs) forming the trust chain.
215
+ * @throws {FederationError} If any of the fetched documents fail to parse or other errors occur during the gathering process.
216
+ */
217
+ async function gatherTrustChain(entityBaseUrl, appFetch) {
218
+ let isLeaf = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
219
+ const chain = [];
220
+
221
+ // Fetch self-signed EC (only needed for the leaf)
222
+ const entityECJwt = await getSignedEntityConfiguration(entityBaseUrl, {
223
+ appFetch
224
+ });
225
+ const entityEC = EntityConfiguration.parse(decode(entityECJwt));
226
+ if (isLeaf) {
227
+ // Only push EC for the leaf
228
+ chain.push(entityECJwt);
229
+ }
230
+
231
+ // Find authority_hints (parent, if any)
232
+ const authorityHints = entityEC.payload.authority_hints ?? [];
233
+ if (authorityHints.length === 0) {
234
+ // This is the Trust Anchor (no parent)
235
+ if (!isLeaf) {
236
+ chain.push(entityECJwt);
237
+ }
238
+ return chain;
239
+ }
240
+ const parentEntityBaseUrl = authorityHints[0];
241
+
242
+ // Fetch parent EC
243
+ const parentECJwt = await getSignedEntityConfiguration(parentEntityBaseUrl, {
244
+ appFetch
245
+ });
246
+ const parentEC = EntityConfiguration.parse(decode(parentECJwt));
247
+
248
+ // Fetch ES
249
+ const federationFetchEndpoint = parentEC.payload.metadata.federation_entity.federation_fetch_endpoint;
250
+ if (!federationFetchEndpoint) {
251
+ throw new MissingFederationFetchEndpointError(`Missing federation_fetch_endpoint in parent's (${parentEntityBaseUrl}) configuration when gathering chain for ${entityBaseUrl}.`, {
252
+ entityBaseUrl,
253
+ missingInEntityUrl: parentEntityBaseUrl
254
+ });
255
+ }
256
+ const entityStatementJwt = await getSignedEntityStatement(federationFetchEndpoint, entityBaseUrl, {
257
+ appFetch
258
+ });
259
+ // Validate the ES
260
+ EntityStatement.parse(decode(entityStatementJwt));
261
+
262
+ // Push this ES into the chain
263
+ chain.push(entityStatementJwt);
264
+
265
+ // Recurse into the parent
266
+ const parentChain = await gatherTrustChain(parentEntityBaseUrl, appFetch, false);
267
+ return chain.concat(parentChain);
268
+ }
269
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["decode","verify","decodeJwt","CredentialIssuerEntityConfiguration","EntityConfiguration","EntityStatement","FederationListResponse","RelyingPartyEntityConfiguration","TrustAnchorEntityConfiguration","WalletProviderEntityConfiguration","renewTrustChain","validateTrustChain","hasStatusOrThrow","BuildTrustChainError","FederationListParseError","MissingFederationFetchEndpointError","RelyingPartyNotAuthorizedError","TrustAnchorKidMissingError","verifyTrustChain","trustAnchorEntity","chain","x509Options","arguments","length","undefined","connectTimeout","readTimeout","requireCrl","appFetch","fetch","renewOnFail","error","renewedChain","getSignedEntityConfiguration","entityBaseUrl","wellKnownUrl","method","then","res","text","fetchAndParseEntityConfiguration","schema","responseText","responseJwt","parse","header","protectedHeader","payload","getWalletProviderEntityConfiguration","options","getCredentialIssuerEntityConfiguration","getTrustAnchorEntityConfiguration","getRelyingPartyEntityConfiguration","getEntityConfiguration","getEntityStatement","accreditationBodyBaseUrl","subordinatedEntityBaseUrl","getSignedEntityStatement","federationFetchEndpoint","url","URL","searchParams","set","toString","getFederationList","federationListEndpoint","json","result","safeParse","success","message","parseError","data","buildTrustChain","relyingPartyEntityBaseUrl","trustAnchorKey","trustChain","gatherTrustChain","trustAnchorJwt","relyingPartyUrl","kid","trustAnchorConfig","metadata","federation_entity","federation_list_endpoint","federationList","includes","isLeaf","entityECJwt","entityEC","push","authorityHints","authority_hints","parentEntityBaseUrl","parentECJwt","parentEC","federation_fetch_endpoint","missingInEntityUrl","entityStatementJwt","parentChain","concat"],"sourceRoot":"../../../src","sources":["trust/index.ts"],"mappings":"AAAA,SAASA,MAAM,EAAEC,MAAM,QAAQ,SAAS;AACxC,SAASD,MAAM,IAAIE,SAAS,QAAQ,6BAA6B;AACjE,SACEC,mCAAmC,EACnCC,mBAAmB,EACnBC,eAAe,EACfC,sBAAsB,EACtBC,+BAA+B,EAC/BC,8BAA8B,EAC9BC,iCAAiC,QAC5B,SAAS;AAChB,SAASC,eAAe,EAAEC,kBAAkB,QAAQ,SAAS;AAC7D,SAASC,gBAAgB,QAAQ,eAAe;AAEhD,SACEC,oBAAoB,EACpBC,wBAAwB,EACxBC,mCAAmC,EACnCC,8BAA8B,EAC9BC,0BAA0B,QACrB,UAAU;AAYjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,gBAAgBA,CACpCC,iBAAiD,EACjDC,KAAe,EAUiC;EAAA,IAThDC,WAAmC,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG;IACpCG,cAAc,EAAE,KAAK;IACrBC,WAAW,EAAE,KAAK;IAClBC,UAAU,EAAE;EACd,CAAC;EAAA,IACD;IACEC,QAAQ,GAAGC,KAAK;IAChBC,WAAW,GAAG;EAC4C,CAAC,GAAAR,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF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AG3F,mBAAmB,CAACwC,KAAK,CAAC5C,MAAM,CAAC8F,WAAW,CAAC,CAAC;;EAE/D;EACA,MAAMpC,uBAAuB,GAC3BqC,QAAQ,CAAChD,OAAO,CAACmC,QAAQ,CAACC,iBAAiB,CAACa,yBAAyB;EACvE,IAAI,CAACtC,uBAAuB,EAAE;IAC5B,MAAM,IAAI3C,mCAAmC,CAC1C,kDAAiD8E,mBAAoB,4CAA2C3D,aAAc,GAAE,EACjI;MAAEA,aAAa;MAAE+D,kBAAkB,EAAEJ;IAAoB,CAC3D,CAAC;EACH;EAEA,MAAMK,kBAAkB,GAAG,MAAMzC,wBAAwB,CACvDC,uBAAuB,EACvBxB,aAAa,EACb;IAAEN;EAAS,CACb,CAAC;EACD;EACAvB,eAAe,CAACuC,KAAK,CAAC5C,MAAM,CAACkG,kBAAkB,CAAC,CAAC;;EAEjD;EACA9E,KAAK,CAACsE,IAAI,CAACQ,kBAAkB,CAAC;;EAE9B;EACA,MAAMC,WAAW,GAAG,MAAMtB,gBAAgB,CACxCgB,mBAAmB,EACnBjE,QAAQ,EACR,KACF,CAAC;EAED,OAAOR,KAAK,CAACgF,MAAM,CAACD,WAAW,CAAC;AAClC"}
@@ -1,7 +1,7 @@
1
- import { UnixTime } from "../../sd-jwt/types";
2
- import { JWK } from "../../utils/jwk";
1
+ import { UnixTime } from "../sd-jwt/types";
2
+ import { JWK } from "../utils/jwk";
3
3
  import * as z from "zod";
4
- import { PresentationDefinition } from "../../credential/presentation/types";
4
+ import { PresentationDefinition } from "../credential/presentation/types";
5
5
  export const TrustMark = z.object({
6
6
  id: z.string(),
7
7
  trust_mark: z.string()
@@ -15,36 +15,25 @@ const RelyingPartyMetadata = z.object({
15
15
  }),
16
16
  contacts: z.array(z.string()).optional(),
17
17
  presentation_definition: PresentationDefinition.optional(),
18
- presentation_definition_uri: z.string().optional()
18
+ request_uris: z.array(z.string()).optional(),
19
+ authorization_signed_response_alg: z.string().optional(),
20
+ authorization_encrypted_response_alg: z.string().optional(),
21
+ authorization_encrypted_response_enc: z.string().optional()
19
22
  });
20
- //.passthrough();
21
23
 
22
24
  // Display metadata for a credential, used by the issuer to
23
25
  // instruct the Wallet Solution on how to render the credential correctly
24
26
  const CredentialDisplayMetadata = z.object({
25
27
  name: z.string(),
26
- locale: z.string(),
27
- logo: z.object({
28
- url: z.string(),
29
- alt_text: z.string()
30
- }).optional(),
31
- // TODO [SIW-1268]: should not be optional
32
- background_color: z.string().optional(),
33
- // TODO [SIW-1268]: should not be optional
34
- text_color: z.string().optional() // TODO [SIW-1268]: should not be optional
28
+ locale: z.string()
35
29
  });
36
30
 
37
31
  // Metadata for displaying issuer information
38
32
 
39
33
  const CredentialIssuerDisplayMetadata = z.object({
40
34
  name: z.string(),
41
- locale: z.string(),
42
- logo: z.object({
43
- url: z.string(),
44
- alt_text: z.string()
45
- }).optional() // TODO [SIW-1268]: should not be optional
35
+ locale: z.string()
46
36
  });
47
-
48
37
  const ClaimsMetadata = z.record(z.object({
49
38
  value_type: z.string(),
50
39
  display: z.array(z.object({
@@ -60,14 +49,13 @@ const IssuanceErrorSupported = z.object({
60
49
  }))
61
50
  });
62
51
 
63
- // Metadata for a credentia which is supported by a Issuer
52
+ // Metadata for a credential which is supported by an Issuer
64
53
 
65
54
  const SupportedCredentialMetadata = z.object({
66
- format: z.union([z.literal("vc+sd-jwt"), z.literal("mso_mdoc")]),
55
+ format: z.union([z.literal("vc+sd-jwt"), z.literal("vc+mdoc-cbor")]),
67
56
  scope: z.string(),
68
57
  display: z.array(CredentialDisplayMetadata),
69
- claims: ClaimsMetadata.optional(),
70
- // TODO [SIW-1268]: should not be optional
58
+ claims: ClaimsMetadata,
71
59
  cryptographic_binding_methods_supported: z.array(z.string()),
72
60
  credential_signing_alg_values_supported: z.array(z.string()),
73
61
  authentic_source: z.string().optional(),
@@ -85,7 +73,7 @@ export const EntityStatement = z.object({
85
73
  jwks: z.object({
86
74
  keys: z.array(JWK)
87
75
  }),
88
- trust_marks: z.array(TrustMark),
76
+ trust_marks: z.array(TrustMark).optional(),
89
77
  iat: z.number(),
90
78
  exp: z.number()
91
79
  })
@@ -97,7 +85,7 @@ export const EntityConfigurationHeader = z.object({
97
85
  });
98
86
 
99
87
  /**
100
- * @see https://openid.net/specs/openid-connect-federation-1_0-29.html#name-federation-entity
88
+ * @see https://openid.net/specs/openid-federation-1_0-41.html
101
89
  */
102
90
  const FederationEntityMetadata = z.object({
103
91
  federation_fetch_endpoint: z.string().optional(),
@@ -105,6 +93,9 @@ const FederationEntityMetadata = z.object({
105
93
  federation_resolve_endpoint: z.string().optional(),
106
94
  federation_trust_mark_status_endpoint: z.string().optional(),
107
95
  federation_trust_mark_list_endpoint: z.string().optional(),
96
+ federation_trust_mark_endpoint: z.string().optional(),
97
+ federation_historical_keys_endpoint: z.string().optional(),
98
+ endpoint_auth_signing_alg_values_supported: z.string().optional(),
108
99
  organization_name: z.string().optional(),
109
100
  homepage_uri: z.string().optional(),
110
101
  policy_uri: z.string().optional(),
@@ -112,7 +103,7 @@ const FederationEntityMetadata = z.object({
112
103
  contacts: z.array(z.string()).optional()
113
104
  }).passthrough();
114
105
 
115
- // Structuire common to every Entity Configuration document
106
+ // Structure common to every Entity Configuration document
116
107
  const BaseEntityConfiguration = z.object({
117
108
  header: EntityConfigurationHeader,
118
109
  payload: z.object({
@@ -156,15 +147,9 @@ export const CredentialIssuerEntityConfiguration = BaseEntityConfiguration.and(z
156
147
  oauth_authorization_server: z.object({
157
148
  authorization_endpoint: z.string(),
158
149
  pushed_authorization_request_endpoint: z.string(),
159
- dpop_signing_alg_values_supported: z.array(z.string()).optional(),
160
- // TODO [SIW-1268]: should not be optional
161
150
  token_endpoint: z.string(),
162
- introspection_endpoint: z.string().optional(),
163
- // TODO [SIW-1268]: should not be optional
164
151
  client_registration_types_supported: z.array(z.string()),
165
152
  code_challenge_methods_supported: z.array(z.string()),
166
- authorization_details_types_supported: z.array(z.string()).optional(),
167
- // TODO [SIW-1268]: should not be optional,
168
153
  acr_values_supported: z.array(z.string()),
169
154
  grant_types_supported: z.array(z.string()),
170
155
  issuer: z.string(),
@@ -172,23 +157,16 @@ export const CredentialIssuerEntityConfiguration = BaseEntityConfiguration.and(z
172
157
  keys: z.array(JWK)
173
158
  }),
174
159
  scopes_supported: z.array(z.string()),
175
- request_parameter_supported: z.boolean().optional(),
176
- // TODO [SIW-1268]: should not be optional
177
- request_uri_parameter_supported: z.boolean().optional(),
178
- // TODO [SIW-1268]: should not be optional
179
- response_types_supported: z.array(z.string()).optional(),
180
- // TODO [SIW-1268]: should not be optional
181
160
  response_modes_supported: z.array(z.string()),
182
- subject_types_supported: z.array(z.string()).optional(),
183
- // TODO [SIW-1268]: should not be optional
184
161
  token_endpoint_auth_methods_supported: z.array(z.string()),
185
162
  token_endpoint_auth_signing_alg_values_supported: z.array(z.string()),
186
163
  request_object_signing_alg_values_supported: z.array(z.string())
187
164
  }),
188
- /** Credential Issuers act as Relying Party
189
- when they require the presentation of other credentials.
190
- This does not apply for PID issuance, which requires CIE authz. */
191
- wallet_relying_party: RelyingPartyMetadata.optional()
165
+ /**
166
+ * Credential Issuers act as Relying Party when they require the presentation of other credentials.
167
+ * This does not apply for PID issuance, which requires CIE authz.
168
+ */
169
+ openid_credential_verifier: RelyingPartyMetadata.optional()
192
170
  })
193
171
  })
194
172
  }));
@@ -198,7 +176,7 @@ export const CredentialIssuerEntityConfiguration = BaseEntityConfiguration.and(z
198
176
  export const RelyingPartyEntityConfiguration = BaseEntityConfiguration.and(z.object({
199
177
  payload: z.object({
200
178
  metadata: z.object({
201
- wallet_relying_party: RelyingPartyMetadata
179
+ openid_credential_verifier: RelyingPartyMetadata
202
180
  })
203
181
  })
204
182
  }));
@@ -227,4 +205,5 @@ export const WalletProviderEntityConfiguration = BaseEntityConfiguration.and(z.o
227
205
  export const EntityConfiguration = z.union([WalletProviderEntityConfiguration, CredentialIssuerEntityConfiguration, TrustAnchorEntityConfiguration, RelyingPartyEntityConfiguration], {
228
206
  description: "Any kind of Entity Configuration allowed in the ecosystem"
229
207
  });
208
+ export const FederationListResponse = z.array(z.string());
230
209
  //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["UnixTime","JWK","z","PresentationDefinition","TrustMark","object","id","string","trust_mark","RelyingPartyMetadata","application_type","optional","client_id","client_name","jwks","keys","array","contacts","presentation_definition","request_uris","authorization_signed_response_alg","authorization_encrypted_response_alg","authorization_encrypted_response_enc","CredentialDisplayMetadata","name","locale","CredentialIssuerDisplayMetadata","ClaimsMetadata","record","value_type","display","IssuanceErrorSupported","title","description","SupportedCredentialMetadata","format","union","literal","scope","claims","cryptographic_binding_methods_supported","credential_signing_alg_values_supported","authentic_source","issuance_errors_supported","EntityStatement","header","typ","alg","kid","payload","iss","sub","trust_marks","iat","number","exp","EntityConfigurationHeader","FederationEntityMetadata","federation_fetch_endpoint","federation_list_endpoint","federation_resolve_endpoint","federation_trust_mark_status_endpoint","federation_trust_mark_list_endpoint","federation_trust_mark_endpoint","federation_historical_keys_endpoint","endpoint_auth_signing_alg_values_supported","organization_name","homepage_uri","policy_uri","logo_uri","passthrough","BaseEntityConfiguration","authority_hints","metadata","federation_entity","TrustAnchorEntityConfiguration","CredentialIssuerEntityConfiguration","and","openid_credential_issuer","credential_issuer","credential_endpoint","revocation_endpoint","status_attestation_endpoint","credential_configurations_supported","oauth_authorization_server","authorization_endpoint","pushed_authorization_request_endpoint","token_endpoint","client_registration_types_supported","code_challenge_methods_supported","acr_values_supported","grant_types_supported","issuer","scopes_supported","response_modes_supported","token_endpoint_auth_methods_supported","token_endpoint_auth_signing_alg_values_supported","request_object_signing_alg_values_supported","openid_credential_verifier","RelyingPartyEntityConfiguration","WalletProviderEntityConfiguration","wallet_provider","aal_values_supported","EntityConfiguration","FederationListResponse"],"sourceRoot":"../../../src","sources":["trust/types.ts"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,iBAAiB;AAC1C,SAASC,GAAG,QAAQ,cAAc;AAClC,OAAO,KAAKC,CAA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CAAC,CAACK,MAAM,CAAC,CAAC,CAAC;QAC1CwF,qCAAqC,EAAE7F,CAAC,CAACc,KAAK,CAACd,CAAC,CAACK,MAAM,CAAC,CAAC,CAAC;QAC1DyF,gDAAgD,EAAE9F,CAAC,CAACc,KAAK,CACvDd,CAAC,CAACK,MAAM,CAAC,CACX,CAAC;QACDO,IAAI,EAAEZ,CAAC,CAACG,MAAM,CAAC;UAAEU,IAAI,EAAEb,CAAC,CAACc,KAAK,CAACf,GAAG;QAAE,CAAC;MACvC,CAAC,CAAC,CACDqE,WAAW,CAAC;IACjB,CAAC;EACH,CAAC;AACH,CAAC,CACH,CAAC;;AAED;;AAEA,OAAO,MAAMiC,mBAAmB,GAAGrG,CAAC,CAACkC,KAAK,CACxC,CACEgE,iCAAiC,EACjCxB,mCAAmC,EACnCD,8BAA8B,EAC9BwB,+BAA+B,CAChC,EACD;EACElE,WAAW,EAAE;AACf,CACF,CAAC;AAED,OAAO,MAAMuE,sBAAsB,GAAGtG,CAAC,CAACc,KAAK,CAACd,CAAC,CAACK,MAAM,CAAC,CAAC,CAAC"}
@@ -0,0 +1,60 @@
1
+ import { decode as decodeJwt, verify as verifyJwt } from "@pagopa/io-react-native-jwt";
2
+ import { FederationError } from "./errors";
3
+ // Verify a token signature
4
+ // The kid is extracted from the token header
5
+ export const verify = async (token, kid, jwks) => {
6
+ const jwk = jwks.find(k => k.kid === kid);
7
+ if (!jwk) {
8
+ throw new Error(`Invalid kid: ${kid}, token: ${token}`);
9
+ }
10
+ const {
11
+ protectedHeader: header,
12
+ payload
13
+ } = await verifyJwt(token, jwk);
14
+ return {
15
+ header,
16
+ payload
17
+ };
18
+ };
19
+
20
+ /**
21
+ * Return type for this function is necessary to avoid an issue during the bob build process.
22
+ * It seems like typescript can't correctly infer the return type of the function.
23
+ */
24
+ export const decode = token => {
25
+ const {
26
+ protectedHeader: header,
27
+ payload
28
+ } = decodeJwt(token);
29
+ return {
30
+ header,
31
+ payload
32
+ };
33
+ };
34
+
35
+ /**
36
+ * Extracts the X.509 Trust Anchor certificate (Base64 encoded) from the
37
+ * Trust Anchor's Entity Configuration.
38
+ *
39
+ * @param trustAnchorEntity The entity configuration of the known trust anchor.
40
+ * @returns The Base64 encoded X.509 certificate string.
41
+ * @throws {FederationError} If the certificate cannot be derived.
42
+ */
43
+ export function getTrustAnchorX509Certificate(trustAnchorEntity) {
44
+ const taHeaderKid = trustAnchorEntity.header.kid;
45
+ const taSigningJwk = trustAnchorEntity.payload.jwks.keys.find(key => key.kid === taHeaderKid);
46
+ if (!taSigningJwk) {
47
+ throw new FederationError(`Cannot derive X.509 Trust Anchor certificate: JWK with kid '${taHeaderKid}' not found in Trust Anchor's JWKS.`, {
48
+ trustAnchorKid: taHeaderKid,
49
+ reason: "JWK not found for header kid"
50
+ });
51
+ }
52
+ if (taSigningJwk.x5c && taSigningJwk.x5c.length > 0 && taSigningJwk.x5c[0]) {
53
+ return taSigningJwk.x5c[0];
54
+ }
55
+ throw new FederationError(`Cannot derive X.509 Trust Anchor certificate: JWK with kid '${taHeaderKid}' does not contain a valid 'x5c' certificate array.`, {
56
+ trustAnchorKid: taHeaderKid,
57
+ reason: "Missing or empty x5c in JWK"
58
+ });
59
+ }
60
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["decode","decodeJwt","verify","verifyJwt","FederationError","token","kid","jwks","jwk","find","k","Error","protectedHeader","header","payload","getTrustAnchorX509Certificate","trustAnchorEntity","taHeaderKid","taSigningJwk","keys","key","trustAnchorKid","reason","x5c","length"],"sourceRoot":"../../../src","sources":["trust/utils.ts"],"mappings":"AAAA,SACEA,MAAM,IAAIC,SAAS,EACnBC,MAAM,IAAIC,SAAS,QACd,6BAA6B;AAGpC,SAASC,eAAe,QAAQ,UAAU;AAQ1C;AACA;AACA,OAAO,MAAMF,MAAM,GAAG,MAAAA,CACpBG,KAAa,EACbC,GAAW,EACXC,IAAW,KACc;EACzB,MAAMC,GAAG,GAAGD,IAAI,CAACE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