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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (438) hide show
  1. package/README.md +47 -1
  2. package/lib/commonjs/client/generated/wallet-provider.js +49 -20
  3. package/lib/commonjs/client/generated/wallet-provider.js.map +1 -1
  4. package/lib/commonjs/credential/index.js +5 -1
  5. package/lib/commonjs/credential/index.js.map +1 -1
  6. package/lib/commonjs/credential/issuance/02-evaluate-issuer-trust.js +27 -0
  7. package/lib/commonjs/credential/issuance/02-evaluate-issuer-trust.js.map +1 -0
  8. package/lib/commonjs/credential/issuance/03-start-user-authorization.js +25 -16
  9. package/lib/commonjs/credential/issuance/03-start-user-authorization.js.map +1 -1
  10. package/lib/commonjs/credential/issuance/04-complete-user-authorization.js +30 -18
  11. package/lib/commonjs/credential/issuance/04-complete-user-authorization.js.map +1 -1
  12. package/lib/commonjs/credential/issuance/05-authorize-access.js +17 -12
  13. package/lib/commonjs/credential/issuance/05-authorize-access.js.map +1 -1
  14. package/lib/commonjs/credential/issuance/06-obtain-credential.js +36 -29
  15. package/lib/commonjs/credential/issuance/06-obtain-credential.js.map +1 -1
  16. package/lib/commonjs/credential/issuance/07-verify-and-parse-credential.js +27 -207
  17. package/lib/commonjs/credential/issuance/07-verify-and-parse-credential.js.map +1 -1
  18. package/lib/commonjs/credential/issuance/README.md +23 -20
  19. package/lib/commonjs/credential/issuance/const.js +1 -1
  20. package/lib/commonjs/credential/issuance/const.js.map +1 -1
  21. package/lib/commonjs/credential/issuance/index.js +3 -3
  22. package/lib/commonjs/credential/issuance/index.js.map +1 -1
  23. package/lib/commonjs/credential/presentation/01-start-flow.js +14 -15
  24. package/lib/commonjs/credential/presentation/01-start-flow.js.map +1 -1
  25. package/lib/commonjs/credential/presentation/02-evaluate-rp-trust.js +6 -4
  26. package/lib/commonjs/credential/presentation/02-evaluate-rp-trust.js.map +1 -1
  27. package/lib/commonjs/credential/presentation/03-get-request-object.js +34 -7
  28. package/lib/commonjs/credential/presentation/03-get-request-object.js.map +1 -1
  29. package/lib/commonjs/credential/presentation/04-retrieve-rp-jwks.js +4 -126
  30. package/lib/commonjs/credential/presentation/04-retrieve-rp-jwks.js.map +1 -1
  31. package/lib/commonjs/credential/presentation/05-verify-request-object.js +80 -25
  32. package/lib/commonjs/credential/presentation/05-verify-request-object.js.map +1 -1
  33. package/lib/commonjs/credential/presentation/06-fetch-presentation-definition.js +6 -30
  34. package/lib/commonjs/credential/presentation/06-fetch-presentation-definition.js.map +1 -1
  35. package/lib/commonjs/credential/presentation/07-evaluate-dcql-query.js +97 -117
  36. package/lib/commonjs/credential/presentation/07-evaluate-dcql-query.js.map +1 -1
  37. package/lib/commonjs/credential/presentation/07-evaluate-input-descriptor.js +86 -191
  38. package/lib/commonjs/credential/presentation/07-evaluate-input-descriptor.js.map +1 -1
  39. package/lib/commonjs/credential/presentation/08-send-authorization-response.js +112 -176
  40. package/lib/commonjs/credential/presentation/08-send-authorization-response.js.map +1 -1
  41. package/lib/commonjs/credential/presentation/README.md +74 -79
  42. package/lib/commonjs/credential/presentation/errors.js +42 -21
  43. package/lib/commonjs/credential/presentation/errors.js.map +1 -1
  44. package/lib/commonjs/credential/presentation/index.js +13 -13
  45. package/lib/commonjs/credential/presentation/index.js.map +1 -1
  46. package/lib/commonjs/credential/presentation/types.js +53 -29
  47. package/lib/commonjs/credential/presentation/types.js.map +1 -1
  48. package/lib/commonjs/credential/status/01-start-flow.js +2 -0
  49. package/lib/commonjs/credential/status/01-start-flow.js.map +1 -0
  50. package/lib/commonjs/credential/status/02-status-attestation.js +73 -0
  51. package/lib/commonjs/credential/status/02-status-attestation.js.map +1 -0
  52. package/lib/commonjs/credential/status/03-verify-and-parse-status-attestation.js +55 -0
  53. package/lib/commonjs/credential/status/03-verify-and-parse-status-attestation.js.map +1 -0
  54. package/lib/commonjs/credential/status/README.md +67 -0
  55. package/lib/commonjs/credential/status/index.js +27 -0
  56. package/lib/commonjs/credential/status/index.js.map +1 -0
  57. package/lib/commonjs/credential/status/types.js +48 -0
  58. package/lib/commonjs/credential/status/types.js.map +1 -0
  59. package/lib/commonjs/credential/trustmark/README.md +62 -0
  60. package/lib/commonjs/credential/trustmark/get-credential-trustmark.js +86 -0
  61. package/lib/commonjs/credential/trustmark/get-credential-trustmark.js.map +1 -0
  62. package/lib/commonjs/credential/trustmark/index.js +13 -0
  63. package/lib/commonjs/credential/trustmark/index.js.map +1 -0
  64. package/lib/commonjs/index.js +5 -1
  65. package/lib/commonjs/index.js.map +1 -1
  66. package/lib/commonjs/pid/sd-jwt/types.js +18 -2
  67. package/lib/commonjs/pid/sd-jwt/types.js.map +1 -1
  68. package/lib/commonjs/sd-jwt/__test__/index.test.js +22 -34
  69. package/lib/commonjs/sd-jwt/__test__/index.test.js.map +1 -1
  70. package/lib/commonjs/sd-jwt/__test__/types.test.js +11 -23
  71. package/lib/commonjs/sd-jwt/__test__/types.test.js.map +1 -1
  72. package/lib/commonjs/sd-jwt/index.js +1 -7
  73. package/lib/commonjs/sd-jwt/index.js.map +1 -1
  74. package/lib/commonjs/sd-jwt/types.js +5 -21
  75. package/lib/commonjs/sd-jwt/types.js.map +1 -1
  76. package/lib/commonjs/{entity/trust → trust}/chain.js +49 -55
  77. package/lib/commonjs/trust/chain.js.map +1 -0
  78. package/lib/commonjs/trust/errors.js +110 -0
  79. package/lib/commonjs/trust/errors.js.map +1 -0
  80. package/lib/commonjs/trust/index.js +282 -0
  81. package/lib/commonjs/trust/index.js.map +1 -0
  82. package/lib/commonjs/{entity/trust → trust}/types.js +27 -47
  83. package/lib/commonjs/trust/types.js.map +1 -0
  84. package/lib/commonjs/trust/utils.js +41 -0
  85. package/lib/commonjs/trust/utils.js.map +1 -0
  86. package/lib/commonjs/utils/crypto.js +5 -112
  87. package/lib/commonjs/utils/crypto.js.map +1 -1
  88. package/lib/commonjs/utils/decoder.js +2 -0
  89. package/lib/commonjs/utils/decoder.js.map +1 -1
  90. package/lib/commonjs/utils/error-codes.js +22 -2
  91. package/lib/commonjs/utils/error-codes.js.map +1 -1
  92. package/lib/commonjs/utils/errors.js +72 -4
  93. package/lib/commonjs/utils/errors.js.map +1 -1
  94. package/lib/commonjs/utils/logging.js +68 -0
  95. package/lib/commonjs/utils/logging.js.map +1 -0
  96. package/lib/commonjs/utils/misc.js +2 -0
  97. package/lib/commonjs/utils/misc.js.map +1 -1
  98. package/lib/commonjs/utils/par.js +17 -10
  99. package/lib/commonjs/utils/par.js.map +1 -1
  100. package/lib/commonjs/utils/string.js +1 -12
  101. package/lib/commonjs/utils/string.js.map +1 -1
  102. package/lib/commonjs/wallet-instance/index.js +14 -0
  103. package/lib/commonjs/wallet-instance/index.js.map +1 -1
  104. package/lib/commonjs/wallet-instance-attestation/README.md +8 -3
  105. package/lib/commonjs/wallet-instance-attestation/issuing.js +15 -8
  106. package/lib/commonjs/wallet-instance-attestation/issuing.js.map +1 -1
  107. package/lib/commonjs/wallet-instance-attestation/types.js +16 -20
  108. package/lib/commonjs/wallet-instance-attestation/types.js.map +1 -1
  109. package/lib/module/client/generated/wallet-provider.js +40 -15
  110. package/lib/module/client/generated/wallet-provider.js.map +1 -1
  111. package/lib/module/credential/index.js +3 -1
  112. package/lib/module/credential/index.js.map +1 -1
  113. package/lib/module/credential/issuance/02-evaluate-issuer-trust.js +20 -0
  114. package/lib/module/credential/issuance/02-evaluate-issuer-trust.js.map +1 -0
  115. package/lib/module/credential/issuance/03-start-user-authorization.js +25 -16
  116. package/lib/module/credential/issuance/03-start-user-authorization.js.map +1 -1
  117. package/lib/module/credential/issuance/04-complete-user-authorization.js +30 -18
  118. package/lib/module/credential/issuance/04-complete-user-authorization.js.map +1 -1
  119. package/lib/module/credential/issuance/05-authorize-access.js +17 -11
  120. package/lib/module/credential/issuance/05-authorize-access.js.map +1 -1
  121. package/lib/module/credential/issuance/06-obtain-credential.js +36 -28
  122. package/lib/module/credential/issuance/06-obtain-credential.js.map +1 -1
  123. package/lib/module/credential/issuance/07-verify-and-parse-credential.js +27 -205
  124. package/lib/module/credential/issuance/07-verify-and-parse-credential.js.map +1 -1
  125. package/lib/module/credential/issuance/README.md +23 -20
  126. package/lib/module/credential/issuance/const.js +1 -1
  127. package/lib/module/credential/issuance/const.js.map +1 -1
  128. package/lib/module/credential/issuance/index.js +2 -2
  129. package/lib/module/credential/issuance/index.js.map +1 -1
  130. package/lib/module/credential/presentation/01-start-flow.js +14 -15
  131. package/lib/module/credential/presentation/01-start-flow.js.map +1 -1
  132. package/lib/module/credential/presentation/02-evaluate-rp-trust.js +5 -3
  133. package/lib/module/credential/presentation/02-evaluate-rp-trust.js.map +1 -1
  134. package/lib/module/credential/presentation/03-get-request-object.js +34 -7
  135. package/lib/module/credential/presentation/03-get-request-object.js.map +1 -1
  136. package/lib/module/credential/presentation/04-retrieve-rp-jwks.js +2 -124
  137. package/lib/module/credential/presentation/04-retrieve-rp-jwks.js.map +1 -1
  138. package/lib/module/credential/presentation/05-verify-request-object.js +78 -23
  139. package/lib/module/credential/presentation/05-verify-request-object.js.map +1 -1
  140. package/lib/module/credential/presentation/06-fetch-presentation-definition.js +6 -30
  141. package/lib/module/credential/presentation/06-fetch-presentation-definition.js.map +1 -1
  142. package/lib/module/credential/presentation/07-evaluate-dcql-query.js +97 -118
  143. package/lib/module/credential/presentation/07-evaluate-dcql-query.js.map +1 -1
  144. package/lib/module/credential/presentation/07-evaluate-input-descriptor.js +83 -186
  145. package/lib/module/credential/presentation/07-evaluate-input-descriptor.js.map +1 -1
  146. package/lib/module/credential/presentation/08-send-authorization-response.js +107 -170
  147. package/lib/module/credential/presentation/08-send-authorization-response.js.map +1 -1
  148. package/lib/module/credential/presentation/README.md +74 -79
  149. package/lib/module/credential/presentation/errors.js +30 -17
  150. package/lib/module/credential/presentation/errors.js.map +1 -1
  151. package/lib/module/credential/presentation/index.js +6 -6
  152. package/lib/module/credential/presentation/index.js.map +1 -1
  153. package/lib/module/credential/presentation/types.js +49 -27
  154. package/lib/module/credential/presentation/types.js.map +1 -1
  155. package/lib/module/credential/status/01-start-flow.js +2 -0
  156. package/lib/module/credential/status/01-start-flow.js.map +1 -0
  157. package/lib/module/credential/status/02-status-attestation.js +66 -0
  158. package/lib/module/credential/status/02-status-attestation.js.map +1 -0
  159. package/lib/module/credential/status/03-verify-and-parse-status-attestation.js +49 -0
  160. package/lib/module/credential/status/03-verify-and-parse-status-attestation.js.map +1 -0
  161. package/lib/module/credential/status/README.md +67 -0
  162. package/lib/module/credential/status/index.js +5 -0
  163. package/lib/module/credential/status/index.js.map +1 -0
  164. package/lib/module/credential/status/types.js +40 -0
  165. package/lib/module/credential/status/types.js.map +1 -0
  166. package/lib/module/credential/trustmark/README.md +62 -0
  167. package/lib/module/credential/trustmark/get-credential-trustmark.js +77 -0
  168. package/lib/module/credential/trustmark/get-credential-trustmark.js.map +1 -0
  169. package/lib/module/credential/trustmark/index.js +3 -0
  170. package/lib/module/credential/trustmark/index.js.map +1 -0
  171. package/lib/module/index.js +3 -1
  172. package/lib/module/index.js.map +1 -1
  173. package/lib/module/pid/sd-jwt/types.js +16 -1
  174. package/lib/module/pid/sd-jwt/types.js.map +1 -1
  175. package/lib/module/sd-jwt/__test__/index.test.js +22 -34
  176. package/lib/module/sd-jwt/__test__/index.test.js.map +1 -1
  177. package/lib/module/sd-jwt/__test__/types.test.js +11 -23
  178. package/lib/module/sd-jwt/__test__/types.test.js.map +1 -1
  179. package/lib/module/sd-jwt/index.js +1 -7
  180. package/lib/module/sd-jwt/index.js.map +1 -1
  181. package/lib/module/sd-jwt/types.js +4 -19
  182. package/lib/module/sd-jwt/types.js.map +1 -1
  183. package/lib/module/trust/chain.js +108 -0
  184. package/lib/module/trust/chain.js.map +1 -0
  185. package/lib/module/trust/errors.js +94 -0
  186. package/lib/module/trust/errors.js.map +1 -0
  187. package/lib/module/trust/index.js +263 -0
  188. package/lib/module/trust/index.js.map +1 -0
  189. package/lib/module/{entity/trust → trust}/types.js +25 -46
  190. package/lib/module/trust/types.js.map +1 -0
  191. package/lib/module/trust/utils.js +33 -0
  192. package/lib/module/trust/utils.js.map +1 -0
  193. package/lib/module/utils/crypto.js +4 -107
  194. package/lib/module/utils/crypto.js.map +1 -1
  195. package/lib/module/utils/decoder.js +3 -0
  196. package/lib/module/utils/decoder.js.map +1 -1
  197. package/lib/module/utils/error-codes.js +20 -1
  198. package/lib/module/utils/error-codes.js.map +1 -1
  199. package/lib/module/utils/errors.js +61 -4
  200. package/lib/module/utils/errors.js.map +1 -1
  201. package/lib/module/utils/logging.js +62 -0
  202. package/lib/module/utils/logging.js.map +1 -0
  203. package/lib/module/utils/misc.js +2 -0
  204. package/lib/module/utils/misc.js.map +1 -1
  205. package/lib/module/utils/par.js +17 -9
  206. package/lib/module/utils/par.js.map +1 -1
  207. package/lib/module/utils/string.js +0 -10
  208. package/lib/module/utils/string.js.map +1 -1
  209. package/lib/module/wallet-instance/index.js +13 -0
  210. package/lib/module/wallet-instance/index.js.map +1 -1
  211. package/lib/module/wallet-instance-attestation/README.md +8 -3
  212. package/lib/module/wallet-instance-attestation/index.js +2 -2
  213. package/lib/module/wallet-instance-attestation/index.js.map +1 -1
  214. package/lib/module/wallet-instance-attestation/issuing.js +16 -9
  215. package/lib/module/wallet-instance-attestation/issuing.js.map +1 -1
  216. package/lib/module/wallet-instance-attestation/types.js +14 -18
  217. package/lib/module/wallet-instance-attestation/types.js.map +1 -1
  218. package/lib/typescript/client/generated/wallet-provider.d.ts +206 -51
  219. package/lib/typescript/client/generated/wallet-provider.d.ts.map +1 -1
  220. package/lib/typescript/credential/index.d.ts +3 -1
  221. package/lib/typescript/credential/index.d.ts.map +1 -1
  222. package/lib/typescript/credential/issuance/01-start-flow.d.ts +1 -1
  223. package/lib/typescript/credential/issuance/02-evaluate-issuer-trust.d.ts +19 -0
  224. package/lib/typescript/credential/issuance/02-evaluate-issuer-trust.d.ts.map +1 -0
  225. package/lib/typescript/credential/issuance/03-start-user-authorization.d.ts +3 -3
  226. package/lib/typescript/credential/issuance/03-start-user-authorization.d.ts.map +1 -1
  227. package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts +9 -9
  228. package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts.map +1 -1
  229. package/lib/typescript/credential/issuance/05-authorize-access.d.ts +3 -3
  230. package/lib/typescript/credential/issuance/05-authorize-access.d.ts.map +1 -1
  231. package/lib/typescript/credential/issuance/06-obtain-credential.d.ts +4 -4
  232. package/lib/typescript/credential/issuance/06-obtain-credential.d.ts.map +1 -1
  233. package/lib/typescript/credential/issuance/07-verify-and-parse-credential.d.ts +3 -15
  234. package/lib/typescript/credential/issuance/07-verify-and-parse-credential.d.ts.map +1 -1
  235. package/lib/typescript/credential/issuance/const.d.ts +1 -1
  236. package/lib/typescript/credential/issuance/const.d.ts.map +1 -1
  237. package/lib/typescript/credential/issuance/index.d.ts +3 -3
  238. package/lib/typescript/credential/issuance/index.d.ts.map +1 -1
  239. package/lib/typescript/credential/issuance/types.d.ts +8 -3
  240. package/lib/typescript/credential/issuance/types.d.ts.map +1 -1
  241. package/lib/typescript/credential/presentation/01-start-flow.d.ts +28 -9
  242. package/lib/typescript/credential/presentation/01-start-flow.d.ts.map +1 -1
  243. package/lib/typescript/credential/presentation/02-evaluate-rp-trust.d.ts +2 -1
  244. package/lib/typescript/credential/presentation/02-evaluate-rp-trust.d.ts.map +1 -1
  245. package/lib/typescript/credential/presentation/03-get-request-object.d.ts +7 -5
  246. package/lib/typescript/credential/presentation/03-get-request-object.d.ts.map +1 -1
  247. package/lib/typescript/credential/presentation/04-retrieve-rp-jwks.d.ts +4 -30
  248. package/lib/typescript/credential/presentation/04-retrieve-rp-jwks.d.ts.map +1 -1
  249. package/lib/typescript/credential/presentation/05-verify-request-object.d.ts +17 -4
  250. package/lib/typescript/credential/presentation/05-verify-request-object.d.ts.map +1 -1
  251. package/lib/typescript/credential/presentation/06-fetch-presentation-definition.d.ts +4 -9
  252. package/lib/typescript/credential/presentation/06-fetch-presentation-definition.d.ts.map +1 -1
  253. package/lib/typescript/credential/presentation/07-evaluate-dcql-query.d.ts +13 -12
  254. package/lib/typescript/credential/presentation/07-evaluate-dcql-query.d.ts.map +1 -1
  255. package/lib/typescript/credential/presentation/07-evaluate-input-descriptor.d.ts +40 -42
  256. package/lib/typescript/credential/presentation/07-evaluate-input-descriptor.d.ts.map +1 -1
  257. package/lib/typescript/credential/presentation/08-send-authorization-response.d.ts +30 -43
  258. package/lib/typescript/credential/presentation/08-send-authorization-response.d.ts.map +1 -1
  259. package/lib/typescript/credential/presentation/errors.d.ts +25 -10
  260. package/lib/typescript/credential/presentation/errors.d.ts.map +1 -1
  261. package/lib/typescript/credential/presentation/index.d.ts +7 -8
  262. package/lib/typescript/credential/presentation/index.d.ts.map +1 -1
  263. package/lib/typescript/credential/presentation/types.d.ts +137 -307
  264. package/lib/typescript/credential/presentation/types.d.ts.map +1 -1
  265. package/lib/typescript/credential/status/01-start-flow.d.ts +10 -0
  266. package/lib/typescript/credential/status/01-start-flow.d.ts.map +1 -0
  267. package/lib/typescript/credential/status/02-status-attestation.d.ts +19 -0
  268. package/lib/typescript/credential/status/02-status-attestation.d.ts.map +1 -0
  269. package/lib/typescript/credential/status/03-verify-and-parse-status-attestation.d.ts +24 -0
  270. package/lib/typescript/credential/status/03-verify-and-parse-status-attestation.d.ts.map +1 -0
  271. package/lib/typescript/credential/status/index.d.ts +7 -0
  272. package/lib/typescript/credential/status/index.d.ts.map +1 -0
  273. package/lib/typescript/credential/status/types.d.ts +305 -0
  274. package/lib/typescript/credential/status/types.d.ts.map +1 -0
  275. package/lib/typescript/credential/trustmark/get-credential-trustmark.d.ts +52 -0
  276. package/lib/typescript/credential/trustmark/get-credential-trustmark.d.ts.map +1 -0
  277. package/lib/typescript/credential/trustmark/index.d.ts +4 -0
  278. package/lib/typescript/credential/trustmark/index.d.ts.map +1 -0
  279. package/lib/typescript/index.d.ts +3 -1
  280. package/lib/typescript/index.d.ts.map +1 -1
  281. package/lib/typescript/pid/sd-jwt/types.d.ts +103 -25
  282. package/lib/typescript/pid/sd-jwt/types.d.ts.map +1 -1
  283. package/lib/typescript/sd-jwt/index.d.ts +30 -82
  284. package/lib/typescript/sd-jwt/index.d.ts.map +1 -1
  285. package/lib/typescript/sd-jwt/types.d.ts +29 -134
  286. package/lib/typescript/sd-jwt/types.d.ts.map +1 -1
  287. package/lib/typescript/{entity/trust → trust}/chain.d.ts +5 -10
  288. package/lib/typescript/trust/chain.d.ts.map +1 -0
  289. package/lib/typescript/trust/errors.d.ts +80 -0
  290. package/lib/typescript/trust/errors.d.ts.map +1 -0
  291. package/lib/typescript/{entity/trust → trust}/index.d.ts +211 -186
  292. package/lib/typescript/trust/index.d.ts.map +1 -0
  293. package/lib/typescript/{entity/trust → trust}/types.d.ts +1533 -1120
  294. package/lib/typescript/{entity/trust → trust}/types.d.ts.map +1 -1
  295. package/lib/typescript/trust/utils.d.ts +12 -0
  296. package/lib/typescript/trust/utils.d.ts.map +1 -0
  297. package/lib/typescript/utils/crypto.d.ts +0 -32
  298. package/lib/typescript/utils/crypto.d.ts.map +1 -1
  299. package/lib/typescript/utils/decoder.d.ts.map +1 -1
  300. package/lib/typescript/utils/error-codes.d.ts +20 -0
  301. package/lib/typescript/utils/error-codes.d.ts.map +1 -1
  302. package/lib/typescript/utils/errors.d.ts +55 -10
  303. package/lib/typescript/utils/errors.d.ts.map +1 -1
  304. package/lib/typescript/utils/logging.d.ts +35 -0
  305. package/lib/typescript/utils/logging.d.ts.map +1 -0
  306. package/lib/typescript/utils/misc.d.ts.map +1 -1
  307. package/lib/typescript/utils/par.d.ts +8 -1
  308. package/lib/typescript/utils/par.d.ts.map +1 -1
  309. package/lib/typescript/utils/string.d.ts +0 -7
  310. package/lib/typescript/utils/string.d.ts.map +1 -1
  311. package/lib/typescript/wallet-instance/index.d.ts +8 -0
  312. package/lib/typescript/wallet-instance/index.d.ts.map +1 -1
  313. package/lib/typescript/wallet-instance-attestation/index.d.ts +1 -2
  314. package/lib/typescript/wallet-instance-attestation/index.d.ts.map +1 -1
  315. package/lib/typescript/wallet-instance-attestation/issuing.d.ts +4 -2
  316. package/lib/typescript/wallet-instance-attestation/issuing.d.ts.map +1 -1
  317. package/lib/typescript/wallet-instance-attestation/types.d.ts +78 -120
  318. package/lib/typescript/wallet-instance-attestation/types.d.ts.map +1 -1
  319. package/package.json +8 -9
  320. package/src/client/generated/wallet-provider.ts +52 -17
  321. package/src/credential/index.ts +4 -1
  322. package/src/credential/issuance/01-start-flow.ts +1 -1
  323. package/src/credential/issuance/02-evaluate-issuer-trust.ts +32 -0
  324. package/src/credential/issuance/03-start-user-authorization.ts +48 -22
  325. package/src/credential/issuance/04-complete-user-authorization.ts +74 -18
  326. package/src/credential/issuance/05-authorize-access.ts +29 -11
  327. package/src/credential/issuance/06-obtain-credential.ts +61 -36
  328. package/src/credential/issuance/07-verify-and-parse-credential.ts +37 -264
  329. package/src/credential/issuance/README.md +23 -20
  330. package/src/credential/issuance/const.ts +1 -1
  331. package/src/credential/issuance/index.ts +6 -3
  332. package/src/credential/presentation/01-start-flow.ts +19 -22
  333. package/src/credential/presentation/02-evaluate-rp-trust.ts +5 -4
  334. package/src/credential/presentation/03-get-request-object.ts +36 -8
  335. package/src/credential/presentation/04-retrieve-rp-jwks.ts +6 -148
  336. package/src/credential/presentation/05-verify-request-object.ts +115 -30
  337. package/src/credential/presentation/06-fetch-presentation-definition.ts +5 -35
  338. package/src/credential/presentation/07-evaluate-dcql-query.ts +132 -161
  339. package/src/credential/presentation/07-evaluate-input-descriptor.ts +136 -254
  340. package/src/credential/presentation/08-send-authorization-response.ts +178 -260
  341. package/src/credential/presentation/README.md +74 -79
  342. package/src/credential/presentation/errors.ts +38 -15
  343. package/src/credential/presentation/index.ts +18 -19
  344. package/src/credential/presentation/types.ts +67 -64
  345. package/src/credential/status/01-start-flow.ts +9 -0
  346. package/src/credential/status/02-status-attestation.ts +105 -0
  347. package/src/credential/status/03-verify-and-parse-status-attestation.ts +70 -0
  348. package/src/credential/status/README.md +67 -0
  349. package/src/credential/status/index.ts +22 -0
  350. package/src/credential/status/types.ts +43 -0
  351. package/src/credential/trustmark/README.md +62 -0
  352. package/src/credential/trustmark/get-credential-trustmark.ts +139 -0
  353. package/src/credential/trustmark/index.ts +8 -0
  354. package/src/index.ts +4 -0
  355. package/src/pid/sd-jwt/types.ts +18 -1
  356. package/src/sd-jwt/__test__/index.test.ts +36 -55
  357. package/src/sd-jwt/__test__/types.test.ts +16 -29
  358. package/src/sd-jwt/index.ts +1 -5
  359. package/src/sd-jwt/types.ts +2 -19
  360. package/src/trust/chain.ts +151 -0
  361. package/src/trust/errors.ts +105 -0
  362. package/src/{entity/trust → trust}/index.ts +198 -23
  363. package/src/{entity/trust → trust}/types.ts +24 -37
  364. package/src/trust/utils.ts +35 -0
  365. package/src/utils/crypto.ts +4 -106
  366. package/src/utils/decoder.ts +6 -1
  367. package/src/utils/error-codes.ts +23 -0
  368. package/src/utils/errors.ts +119 -15
  369. package/src/utils/logging.ts +68 -0
  370. package/src/utils/misc.ts +5 -0
  371. package/src/utils/par.ts +19 -6
  372. package/src/utils/string.ts +0 -10
  373. package/src/wallet-instance/index.ts +30 -1
  374. package/src/wallet-instance-attestation/README.md +8 -3
  375. package/src/wallet-instance-attestation/index.ts +2 -2
  376. package/src/wallet-instance-attestation/issuing.ts +33 -12
  377. package/src/wallet-instance-attestation/types.ts +18 -22
  378. package/lib/commonjs/credential/issuance/02-get-issuer-config.js +0 -48
  379. package/lib/commonjs/credential/issuance/02-get-issuer-config.js.map +0 -1
  380. package/lib/commonjs/entity/openid-connect/issuer/index.js +0 -25
  381. package/lib/commonjs/entity/openid-connect/issuer/index.js.map +0 -1
  382. package/lib/commonjs/entity/openid-connect/issuer/types.js +0 -64
  383. package/lib/commonjs/entity/openid-connect/issuer/types.js.map +0 -1
  384. package/lib/commonjs/entity/trust/chain.js.map +0 -1
  385. package/lib/commonjs/entity/trust/index.js +0 -148
  386. package/lib/commonjs/entity/trust/index.js.map +0 -1
  387. package/lib/commonjs/entity/trust/types.js.map +0 -1
  388. package/lib/commonjs/mdoc/converters.js +0 -26
  389. package/lib/commonjs/mdoc/converters.js.map +0 -1
  390. package/lib/commonjs/mdoc/index.js +0 -68
  391. package/lib/commonjs/mdoc/index.js.map +0 -1
  392. package/lib/commonjs/utils/credential/issuance/07-verify-and-parse-credentials-inputs.js +0 -469
  393. package/lib/commonjs/utils/credential/issuance/07-verify-and-parse-credentials-inputs.js.map +0 -1
  394. package/lib/commonjs/utils/credential/issuance/07-verify-and-parse-credentials-utils.js +0 -90
  395. package/lib/commonjs/utils/credential/issuance/07-verify-and-parse-credentials-utils.js.map +0 -1
  396. package/lib/module/credential/issuance/02-get-issuer-config.js +0 -42
  397. package/lib/module/credential/issuance/02-get-issuer-config.js.map +0 -1
  398. package/lib/module/entity/openid-connect/issuer/index.js +0 -20
  399. package/lib/module/entity/openid-connect/issuer/index.js.map +0 -1
  400. package/lib/module/entity/openid-connect/issuer/types.js +0 -48
  401. package/lib/module/entity/openid-connect/issuer/types.js.map +0 -1
  402. package/lib/module/entity/trust/chain.js +0 -113
  403. package/lib/module/entity/trust/chain.js.map +0 -1
  404. package/lib/module/entity/trust/index.js +0 -131
  405. package/lib/module/entity/trust/index.js.map +0 -1
  406. package/lib/module/entity/trust/types.js.map +0 -1
  407. package/lib/module/mdoc/converters.js +0 -20
  408. package/lib/module/mdoc/converters.js.map +0 -1
  409. package/lib/module/mdoc/index.js +0 -60
  410. package/lib/module/mdoc/index.js.map +0 -1
  411. package/lib/module/utils/credential/issuance/07-verify-and-parse-credentials-inputs.js +0 -462
  412. package/lib/module/utils/credential/issuance/07-verify-and-parse-credentials-inputs.js.map +0 -1
  413. package/lib/module/utils/credential/issuance/07-verify-and-parse-credentials-utils.js +0 -83
  414. package/lib/module/utils/credential/issuance/07-verify-and-parse-credentials-utils.js.map +0 -1
  415. package/lib/typescript/credential/issuance/02-get-issuer-config.d.ts +0 -32
  416. package/lib/typescript/credential/issuance/02-get-issuer-config.d.ts.map +0 -1
  417. package/lib/typescript/entity/openid-connect/issuer/index.d.ts +0 -12
  418. package/lib/typescript/entity/openid-connect/issuer/index.d.ts.map +0 -1
  419. package/lib/typescript/entity/openid-connect/issuer/types.d.ts +0 -777
  420. package/lib/typescript/entity/openid-connect/issuer/types.d.ts.map +0 -1
  421. package/lib/typescript/entity/trust/chain.d.ts.map +0 -1
  422. package/lib/typescript/entity/trust/index.d.ts.map +0 -1
  423. package/lib/typescript/mdoc/converters.d.ts +0 -8
  424. package/lib/typescript/mdoc/converters.d.ts.map +0 -1
  425. package/lib/typescript/mdoc/index.d.ts +0 -10
  426. package/lib/typescript/mdoc/index.d.ts.map +0 -1
  427. package/lib/typescript/utils/credential/issuance/07-verify-and-parse-credentials-inputs.d.ts +0 -3
  428. package/lib/typescript/utils/credential/issuance/07-verify-and-parse-credentials-inputs.d.ts.map +0 -1
  429. package/lib/typescript/utils/credential/issuance/07-verify-and-parse-credentials-utils.d.ts +0 -42
  430. package/lib/typescript/utils/credential/issuance/07-verify-and-parse-credentials-utils.d.ts.map +0 -1
  431. package/src/credential/issuance/02-get-issuer-config.ts +0 -67
  432. package/src/entity/openid-connect/issuer/index.ts +0 -27
  433. package/src/entity/openid-connect/issuer/types.ts +0 -76
  434. package/src/entity/trust/chain.ts +0 -154
  435. package/src/mdoc/converters.ts +0 -26
  436. package/src/mdoc/index.ts +0 -95
  437. package/src/utils/credential/issuance/07-verify-and-parse-credentials-inputs.ts +0 -615
  438. package/src/utils/credential/issuance/07-verify-and-parse-credentials-utils.ts +0 -171
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/entity/openid-connect/issuer/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAIzB,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAClE,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASxC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"chain.d.ts","sourceRoot":"","sources":["../../../../src/entity/trust/chain.ts"],"names":[],"mappings":"AAIA,OAAO,EAGL,8BAA8B,EAC/B,MAAM,SAAS,CAAC;AACjB,OAAO,EAAO,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAK5D,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,eAAe,CAAC,iBAAiB,CAAC,CAAC;IAC3C,OAAO,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;CACrC,CAAC;AAiCF;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CACtC,iBAAiB,EAAE,8BAA8B,EACjD,KAAK,EAAE,MAAM,EAAE,GACd,OAAO,CAAC,WAAW,EAAE,CAAC,CA+CxB;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,MAAM,EAAE,EACf,QAAQ,GAAE,WAAW,CAAC,OAAO,CAAS,qBAiCvC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/entity/trust/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,iCAAiC,EACjC,8BAA8B,EAC9B,mCAAmC,EACnC,+BAA+B,EAC/B,mBAAmB,EACnB,eAAe,EAChB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,kBAAkB,EAAmB,MAAM,SAAS,CAAC;A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ASG;AACH,wBAAsB,kBAAkB,CACtC,wBAAwB,EAAE,MAAM,EAChC,yBAAyB,EAAE,MAAM,EACjC,EACE,QAAgB,GACjB,GAAE;IACD,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CAC5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAeP;AAED;;;;;;;;GAQG;AACH,wBAAsB,wBAAwB,CAC5C,wBAAwB,EAAE,MAAM,EAChC,yBAAyB,EAAE,MAAM,EACjC,EACE,QAAgB,GACjB,GAAE;IACD,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CAC5B,mBAWP"}
@@ -1,8 +0,0 @@
1
- /**
2
- * Extracts the date value of a given elementIdentifier from an MDOC object.
3
- * Searches through the issuerSigned namespaces and attempts to parse the value as a Date.
4
- * The expected date format is "DD-MM-YYYY".
5
- * Returns the Date object if found, otherwise returns null.
6
- */
7
- export declare function extractElementValueAsDate(elementValue: string): Date | null;
8
- //# sourceMappingURL=converters.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"converters.d.ts","sourceRoot":"","sources":["../../../src/mdoc/converters.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAmB3E"}
@@ -1,10 +0,0 @@
1
- import { CBOR } from "@pagopa/io-react-native-cbor";
2
- import type { JWK } from "../utils/jwk";
3
- import { type Presentation } from "../credential/presentation/types";
4
- export declare const verify: (token: string, _: JWK | JWK[]) => Promise<{
5
- issuerSigned: CBOR.IssuerSigned;
6
- }>;
7
- export declare const prepareVpTokenMdoc: (requestNonce: string, generatedNonce: string, clientId: string, responseUri: string, docType: string, keyTag: string, [verifiableCredential, requestedClaims, _]: Presentation) => Promise<{
8
- vp_token: string;
9
- }>;
10
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/mdoc/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAkB,MAAM,8BAA8B,CAAC;AACpE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAQxC,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAGrE,eAAO,MAAM,MAAM,UACV,MAAM,KACV,GAAG,GAAG,GAAG,EAAE;kBACW,KAAK,YAAY;EA0B3C,CAAC;AAEF,eAAO,MAAM,kBAAkB,iBACf,MAAM,kBACJ,MAAM,YACZ,MAAM,eACH,MAAM,WACV,MAAM,UACP,MAAM;cAGJ,MAAM;EA0CjB,CAAC"}
@@ -1,3 +0,0 @@
1
- import { type TestScenario, type ParseCredentialArg, type ParseCredentialReturn } from "./07-verify-and-parse-credentials-utils";
2
- export declare const inputs: TestScenario<ParseCredentialArg, ParseCredentialReturn, Error>[];
3
- //# sourceMappingURL=07-verify-and-parse-credentials-inputs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"07-verify-and-parse-credentials-inputs.d.ts","sourceRoot":"","sources":["../../../../../src/utils/credential/issuance/07-verify-and-parse-credentials-inputs.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAG3B,MAAM,yCAAyC,CAAC;AAGjD,eAAO,MAAM,MAAM,EAAE,YAAY,CAC/B,kBAAkB,EAClB,qBAAqB,EACrB,KAAK,CACN,EAylBA,CAAC"}
@@ -1,42 +0,0 @@
1
- import type { parseCredentialMDoc, parseCredentialSdJwt } from "src/credential/issuance/07-verify-and-parse-credential";
2
- export type TestScenario<T extends object, R extends object, E extends Error> = {
3
- name: string;
4
- input: T;
5
- expected?: R;
6
- throws?: E;
7
- };
8
- export type ParseCredentialArg = {
9
- format: "vc+sd-jwt";
10
- parameters: Parameters<typeof parseCredentialSdJwt>;
11
- } | {
12
- format: "mso_mdoc";
13
- parameters: Parameters<typeof parseCredentialMDoc>;
14
- };
15
- export type ClaimsSdJwt = Record<string, {
16
- display: {
17
- name: string;
18
- locale: string;
19
- }[];
20
- mandatory: boolean;
21
- }> | Record<string, Record<string, {
22
- display: {
23
- name: string;
24
- locale: string;
25
- }[];
26
- mandatory: boolean;
27
- }>>;
28
- export type ClaimsMDOC = Record<string, {
29
- display: {
30
- name: string;
31
- locale: string;
32
- }[];
33
- mandatory: boolean;
34
- }>;
35
- export type ParseCredentialReturn = Record<string, {
36
- name?: string | Record<string, string>;
37
- value: unknown;
38
- mandatory?: boolean;
39
- }>;
40
- export declare function buildMockMDOCTestScenario(claims: ClaimsMDOC, nameSpaces: [string, any][]): Parameters<typeof parseCredentialMDoc>;
41
- export declare function buildMockSDJWTTestScenario(claims: ClaimsSdJwt, disclosures: [string, string, unknown][]): Parameters<typeof parseCredentialSdJwt>;
42
- //# sourceMappingURL=07-verify-and-parse-credentials-utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"07-verify-and-parse-credentials-utils.d.ts","sourceRoot":"","sources":["../../../../../src/utils/credential/issuance/07-verify-and-parse-credentials-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,wDAAwD,CAAC;AAEhE,MAAM,MAAM,YAAY,CACtB,CAAC,SAAS,MAAM,EAChB,CAAC,SAAS,MAAM,EAChB,CAAC,SAAS,KAAK,IACb;IACF,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,CAAC,CAAC;IACT,QAAQ,CAAC,EAAE,CAAC,CAAC;IACb,MAAM,CAAC,EAAE,CAAC,CAAC;CACZ,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAC1B;IACE,MAAM,EAAE,WAAW,CAAC;IACpB,UAAU,EAAE,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC;CACrD,GACD;IACE,MAAM,EAAE,UAAU,CAAC;IACnB,UAAU,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC;CACpD,CAAC;AAEN,MAAM,MAAM,WAAW,GACnB,MAAM,CACJ,MAAM,EACN;IACE,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;KAChB,EAAE,CAAC;IACJ,SAAS,EAAE,OAAO,CAAC;CACpB,CACF,GACD,MAAM,CACJ,MAAM,EACN,MAAM,CACJ,MAAM,EACN;IACE,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;KAChB,EAAE,CAAC;IACJ,SAAS,EAAE,OAAO,CAAC;CACpB,CACF,CACF,CAAC;AAEN,MAAM,MAAM,UAAU,GAAG,MAAM,CAC7B,MAAM,EACN;IACE,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;KAChB,EAAE,CAAC;IACJ,SAAS,EAAE,OAAO,CAAC;CACpB,CACF,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,MAAM,CACxC,MAAM,EACN;IACE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,KAAK,EAAE,OAAO,CAAC;IACf,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CACF,CAAC;AAEF,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,UAAU,EAClB,UAAU,EAAE,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,GAC1B,UAAU,CAAC,OAAO,mBAAmB,CAAC,CA+CxC;AAED,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,WAAW,EACnB,WAAW,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GACvC,UAAU,CAAC,OAAO,oBAAoB,CAAC,CA4CzC"}
@@ -1,67 +0,0 @@
1
- import type { StartFlow } from "./01-start-flow";
2
- import type { Out } from "../../utils/misc";
3
- import type { JWK } from "src/utils/jwk";
4
- import { getCredentialIssuerMetadata } from "../../entity/openid-connect/issuer";
5
- import type { CredentialConfigurationSupported } from "../../entity/openid-connect/issuer/types";
6
-
7
- export type GetIssuerConfig = (
8
- issuerUrl: Out<StartFlow>["issuerUrl"],
9
- context?: {
10
- appFetch?: GlobalFetch["fetch"];
11
- }
12
- ) => Promise<{ issuerConf: IssuerConfig }>;
13
-
14
- /**
15
- * Common configuration for the issuer.
16
- * This is needed to have a common configuration for the issuer to be used in our flows.
17
- * It allows to support multiple issuers with different configurations, defining a common interface to interact with them.
18
- */
19
- export type IssuerConfig = {
20
- credential_configurations_supported: CredentialConfigurationSupported;
21
- pushed_authorization_request_endpoint: string;
22
- authorization_endpoint: string;
23
- token_endpoint: string;
24
- credential_endpoint: string;
25
- keys: Array<JWK>;
26
- };
27
-
28
- /**
29
- * WARNING: This function must be called after {@link startFlow}. The next function to be called is {@link startUserAuthorization}.
30
- * Get the Issuer's configuration from the Issuer's metadata.
31
- * Currently it only supports a mixed configuration based on OpenID Connect partial implementation.
32
- * @param issuerUrl The base url of the Issuer returned by {@link startFlow}
33
- * @param context.appFetch (optional) fetch api implementation. Default: built-in fetch
34
- * @returns The Issuer's configuration
35
- */
36
- export const getIssuerConfig: GetIssuerConfig = async (
37
- issuerUrl,
38
- context = {}
39
- ): ReturnType<GetIssuerConfig> => {
40
- const res = await getCredentialIssuerMetadata(issuerUrl, {
41
- appFetch: context.appFetch,
42
- });
43
-
44
- return credentialIssuerRationalization(res);
45
- };
46
-
47
- /**
48
- * Rationalize the issuer's metadata to the issuer's configuration which is then used in our flows to interact with the issuer.
49
- * @param issuerMetadata - The issuer's metadata
50
- * @returns the isssuer configuration to be used later in our flows
51
- */
52
- const credentialIssuerRationalization = (
53
- issuerMetadata: Awaited<ReturnType<typeof getCredentialIssuerMetadata>>
54
- ): Awaited<ReturnType<GetIssuerConfig>> => {
55
- return {
56
- issuerConf: {
57
- credential_configurations_supported:
58
- issuerMetadata.credential_configurations_supported,
59
- pushed_authorization_request_endpoint:
60
- issuerMetadata.pushed_authorization_request_endpoint,
61
- authorization_endpoint: issuerMetadata.authorization_endpoint,
62
- token_endpoint: issuerMetadata.token_endpoint,
63
- credential_endpoint: issuerMetadata.credential_endpoint,
64
- keys: issuerMetadata.jwks.keys,
65
- },
66
- };
67
- };
@@ -1,27 +0,0 @@
1
- import { hasStatusOrThrow } from "../../../utils/misc";
2
- import { CredentialIssuerConfiguration } from "./types";
3
-
4
- /**
5
- * Fetch the signed entity configuration token for an entity
6
- *
7
- * @param entityBaseUrl The url of the entity to fetch
8
- * @param param.appFetch (optional) fetch api implemention
9
- * @returns The signed Entity Configuration token
10
- */
11
- export async function getCredentialIssuerMetadata(
12
- entityBaseUrl: string,
13
- {
14
- appFetch = fetch,
15
- }: {
16
- appFetch?: GlobalFetch["fetch"];
17
- } = {}
18
- ): Promise<CredentialIssuerConfiguration> {
19
- const wellKnownUrl = `${entityBaseUrl}/.well-known/openid-credential-issuer`;
20
-
21
- return await appFetch(wellKnownUrl, {
22
- method: "GET",
23
- })
24
- .then(hasStatusOrThrow(200))
25
- .then((res) => res.json())
26
- .then(CredentialIssuerConfiguration.parse);
27
- }
@@ -1,76 +0,0 @@
1
- import { JWK } from "../../../utils/jwk";
2
- import * as z from "zod";
3
-
4
- // Display metadata for a credential, used by the issuer to
5
- // instruct the Wallet Solution on how to render the credential correctly
6
- export type CredentialDisplay = z.infer<typeof CredentialDisplay>;
7
- export const CredentialDisplay = z.object({
8
- name: z.string(),
9
- locale: z.string(),
10
- logo: z
11
- .object({
12
- url: z.string(),
13
- alt_text: z.string(),
14
- })
15
- .optional(),
16
- background_color: z.string().optional(),
17
- text_color: z.string().optional(),
18
- });
19
-
20
- export const CredentialClaimDisplay = z.object({
21
- name: z.string(),
22
- locale: z.string(),
23
- });
24
-
25
- export const CredentialFormat = z.union([
26
- z.literal("vc+sd-jwt"),
27
- z.literal("mso_mdoc"),
28
- ]);
29
-
30
- export type CredentialClaim = z.infer<typeof CredentialClaim>;
31
- export const CredentialClaim = z.object({
32
- mandatory: z.boolean(),
33
- display: z.array(CredentialClaimDisplay),
34
- });
35
-
36
- export type CredentialSdJwtClaims = z.infer<typeof CredentialSdJwtClaims>;
37
- export const CredentialSdJwtClaims = z.record(CredentialClaim);
38
-
39
- export type CredentialConfigurationSupported = z.infer<
40
- typeof CredentialConfigurationSupported
41
- >;
42
- export const CredentialConfigurationSupported = z.record(
43
- z.object({
44
- cryptographic_suites_supported: z.array(z.string()),
45
- vct: z.string().optional(),
46
- scope: z.string().optional(),
47
- cryptographic_binding_methods_supported: z.array(z.string()),
48
- display: z.array(CredentialDisplay),
49
- format: CredentialFormat,
50
- claims: z
51
- .union([
52
- CredentialSdJwtClaims,
53
- z.record(z.string(), CredentialSdJwtClaims),
54
- ])
55
- .optional(),
56
- })
57
- );
58
-
59
- export type CredentialIssuerKeys = z.infer<typeof CredentialIssuerKeys>;
60
- export const CredentialIssuerKeys = z.object({
61
- keys: z.array(JWK),
62
- });
63
-
64
- export type CredentialIssuerConfiguration = z.infer<
65
- typeof CredentialIssuerConfiguration
66
- >;
67
- export const CredentialIssuerConfiguration = z.object({
68
- credential_configurations_supported: CredentialConfigurationSupported,
69
- pushed_authorization_request_endpoint: z.string(),
70
- dpop_signing_alg_values_supported: z.array(z.string()),
71
- jwks: CredentialIssuerKeys,
72
- credential_issuer: z.string(),
73
- authorization_endpoint: z.string(),
74
- token_endpoint: z.string(),
75
- credential_endpoint: z.string(),
76
- });
@@ -1,154 +0,0 @@
1
- import {
2
- decode as decodeJwt,
3
- verify as verifyJwt,
4
- } from "@pagopa/io-react-native-jwt";
5
- import {
6
- EntityConfiguration,
7
- EntityStatement,
8
- TrustAnchorEntityConfiguration,
9
- } from "./types";
10
- import { JWK, type JWTDecodeResult } from "../../utils/jwk";
11
- import { IoWalletError } from "../../utils/errors";
12
- import * as z from "zod";
13
- import { getSignedEntityConfiguration, getSignedEntityStatement } from ".";
14
-
15
- type ParsedToken = {
16
- header: JWTDecodeResult["protectedHeader"];
17
- payload: JWTDecodeResult["payload"];
18
- };
19
-
20
- // Verify a token signature
21
- // The kid is extracted from the token header
22
- const verify = async (
23
- token: string,
24
- kid: string,
25
- jwks: JWK[]
26
- ): Promise<ParsedToken> => {
27
- const jwk = jwks.find((k) => k.kid === kid);
28
- if (!jwk) {
29
- throw new Error(`Invalid kid: ${kid}, token: ${token}`);
30
- }
31
- const { protectedHeader: header, payload } = await verifyJwt(token, jwk);
32
- return { header, payload };
33
- };
34
-
35
- const decode = (token: string) => {
36
- const { protectedHeader: header, payload } = decodeJwt(token);
37
- return { header, payload };
38
- };
39
-
40
- // The first element of the chain is supposed to be the Entity Configuration for the document issuer
41
- const FirstElementShape = EntityConfiguration;
42
- // Each element but the first is supposed to be an Entity Statement
43
- const MiddleElementShape = EntityStatement;
44
- // The last element of the chain can either be an Entity Statement
45
- // or the Entity Configuration for the known Trust Anchor
46
- const LastElementShape = z.union([
47
- EntityStatement,
48
- TrustAnchorEntityConfiguration,
49
- ]);
50
-
51
- /**
52
- * Validates a provided trust chain against a known trust
53
- *
54
- * @param trustAnchorEntity The entity configuration of the known trust anchor
55
- * @param chain The chain of statements to be validate
56
- * @returns The list of parsed token representing the chain
57
- * @throws {IoWalletError} If the chain is not valid
58
- */
59
- export async function validateTrustChain(
60
- trustAnchorEntity: TrustAnchorEntityConfiguration,
61
- chain: string[]
62
- ): Promise<ParsedToken[]> {
63
- // If the chain is empty, fail
64
- if (chain.length === 0) {
65
- throw new IoWalletError("Cannot verify empty trust chain");
66
- }
67
-
68
- // Select the expected token shape
69
- const selectTokenShape = (elementIndex: number) =>
70
- elementIndex === 0
71
- ? FirstElementShape
72
- : elementIndex === chain.length - 1
73
- ? LastElementShape
74
- : MiddleElementShape;
75
-
76
- // select the kid from the current index
77
- const selectKid = (currentIndex: number): string => {
78
- const token = chain[currentIndex];
79
- if (!token) {
80
- throw new IoWalletError(`Cannot select kid: empty token`);
81
- }
82
- const shape = selectTokenShape(currentIndex);
83
- return shape.parse(decode(token)).header.kid;
84
- };
85
-
86
- // select keys from the next token
87
- // if the current token is the last, keys fro trust anchor will be used
88
- const selectKeys = (currentIndex: number): JWK[] => {
89
- if (currentIndex === chain.length - 1) {
90
- return trustAnchorEntity.payload.jwks.keys;
91
- }
92
-
93
- const nextIndex = currentIndex + 1;
94
- const nextToken = chain[nextIndex];
95
- if (!nextToken) {
96
- throw new IoWalletError(`Cannot select keys: empty nextToken`);
97
- }
98
- const shape = selectTokenShape(nextIndex);
99
- return shape.parse(decode(nextToken)).payload.jwks.keys;
100
- };
101
-
102
- // Iterate the chain and validate each element's signature against the public keys of its next
103
- // If there is no next, hence it's the end of the chain and it must be verified by the Trust Anchor
104
- return Promise.all(
105
- chain
106
- .map((token, i) => [token, selectKid(i), selectKeys(i)] as const)
107
- .map((args) => verify(...args))
108
- );
109
- }
110
-
111
- /**
112
- * Given a trust chain, obtain a new trust chain by fetching each element's fresh version
113
- *
114
- * @param chain The original chain
115
- * @param appFetch (optional) fetch api implementation
116
- * @returns A list of signed token that reprensent the trust chain, in the same order of the provided chain
117
- * @throws When an element of the chain fails to parse
118
- */
119
- export function renewTrustChain(
120
- chain: string[],
121
- appFetch: GlobalFetch["fetch"] = fetch
122
- ) {
123
- return Promise.all(
124
- chain
125
- // Decode each item to determine its shape
126
- .map(decode)
127
- .map(
128
- (e) =>
129
- [
130
- EntityStatement.safeParse(e),
131
- EntityConfiguration.safeParse(e),
132
- ] as const
133
- )
134
- // fetch the element according to its shape
135
- .map(([es, ec], i) =>
136
- ec.success
137
- ? getSignedEntityConfiguration(ec.data.payload.iss, { appFetch })
138
- : es.success
139
- ? getSignedEntityStatement(
140
- es.data.payload.iss,
141
- es.data.payload.sub,
142
- {
143
- appFetch,
144
- }
145
- )
146
- : // if the element fail to parse in both EntityStatement and EntityConfiguration, raise an error
147
- Promise.reject(
148
- new IoWalletError(
149
- `Cannot renew trust chain because the element #${i} failed to be parsed.`
150
- )
151
- )
152
- )
153
- );
154
- }
@@ -1,26 +0,0 @@
1
- /**
2
- * Extracts the date value of a given elementIdentifier from an MDOC object.
3
- * Searches through the issuerSigned namespaces and attempts to parse the value as a Date.
4
- * The expected date format is "DD-MM-YYYY".
5
- * Returns the Date object if found, otherwise returns null.
6
- */
7
- export function extractElementValueAsDate(elementValue: string): Date | null {
8
- if (typeof elementValue === "string") {
9
- const dateParts = elementValue.split("-");
10
- if (dateParts.length === 3) {
11
- const [day, month, year] = dateParts.map((part) => Number(part));
12
- if (
13
- day !== undefined &&
14
- month !== undefined &&
15
- year !== undefined &&
16
- !isNaN(day) &&
17
- !isNaN(month) &&
18
- !isNaN(year)
19
- ) {
20
- return new Date(year, month - 1, day); // Month is zero-based in JS Date
21
- }
22
- }
23
- }
24
-
25
- return null; // Return null if no matching element is found or it's not a valid date
26
- }
package/src/mdoc/index.ts DELETED
@@ -1,95 +0,0 @@
1
- import { CBOR, COSE, ISO18013 } from "@pagopa/io-react-native-cbor";
2
- import type { JWK } from "../utils/jwk";
3
- import type { PublicKey } from "@pagopa/io-react-native-crypto";
4
- import { b64utob64 } from "jsrsasign";
5
- import {
6
- convertCertToPem,
7
- getSigningJwk,
8
- parsePublicKey,
9
- } from "../utils/crypto";
10
- import { type Presentation } from "../credential/presentation/types";
11
- import { base64ToBase64Url } from "../utils/string";
12
-
13
- export const verify = async (
14
- token: string,
15
- _: JWK | JWK[]
16
- ): Promise<{ issuerSigned: CBOR.IssuerSigned }> => {
17
- // get decoded data
18
- const issuerSigned = await CBOR.decodeIssuerSigned(token);
19
- if (!issuerSigned) {
20
- throw new Error("Invalid mDoc");
21
- }
22
-
23
- const cert = issuerSigned.issuerAuth.unprotectedHeader[0]?.x5chain?.[0];
24
- if (!cert) throw new Error("Certificate not present in credential");
25
-
26
- const pemcert = convertCertToPem(b64utob64(cert));
27
- const publickey = parsePublicKey(pemcert);
28
- if (!publickey) throw new Error("Certificate not present in credential");
29
-
30
- const jwk = getSigningJwk(publickey);
31
-
32
- jwk.x = b64utob64(jwk.x!);
33
- jwk.y = b64utob64(jwk.y!);
34
-
35
- const signatureCorrect = await COSE.verify(
36
- b64utob64(issuerSigned.issuerAuth.rawValue!),
37
- jwk as PublicKey
38
- ).catch(() => false);
39
- if (!signatureCorrect) throw new Error("Invalid mDoc signature");
40
-
41
- return { issuerSigned };
42
- };
43
-
44
- export const prepareVpTokenMdoc = async (
45
- requestNonce: string,
46
- generatedNonce: string,
47
- clientId: string,
48
- responseUri: string,
49
- docType: string,
50
- keyTag: string,
51
- [verifiableCredential, requestedClaims, _]: Presentation
52
- ): Promise<{
53
- vp_token: string;
54
- }> => {
55
- /* verifiableCredential is a IssuerSigned structure */
56
- const documents = [
57
- {
58
- issuerSignedContent: verifiableCredential,
59
- alias: keyTag,
60
- docType,
61
- },
62
- ];
63
-
64
- /* we map each requested claim as for ex. { "org.iso.18013.5.1.mDL": { "org.iso.18013.5.1": { <claim-name>: true, ... }}} for selective disclosure */
65
- const fieldRequestedAndAccepted = JSON.stringify({
66
- [docType]: requestedClaims.reduce<Record<string, unknown>>(
67
- (acc, { name, namespace }) => {
68
- if (namespace) {
69
- acc[namespace] ??= {};
70
- const existingNamespace = acc[namespace] as Record<string, boolean>;
71
- existingNamespace[name] = true;
72
- } else {
73
- acc[name] = true;
74
- }
75
- return acc;
76
- },
77
- {} as Record<string, unknown>
78
- ),
79
- });
80
-
81
- /* clientId,responseUri,requestNonce are retrieved by Auth Request Object */
82
- /* create DeviceResponse as { documents: { docType, issuerSigned, deviceSigned }, version, status } */
83
- const vp_token = await ISO18013.generateOID4VPDeviceResponse(
84
- clientId,
85
- responseUri,
86
- requestNonce,
87
- generatedNonce,
88
- documents,
89
- fieldRequestedAndAccepted
90
- );
91
-
92
- return {
93
- vp_token: base64ToBase64Url(vp_token),
94
- };
95
- };