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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (438) hide show
  1. package/README.md +47 -1
  2. package/lib/commonjs/client/generated/wallet-provider.js +49 -20
  3. package/lib/commonjs/client/generated/wallet-provider.js.map +1 -1
  4. package/lib/commonjs/credential/index.js +5 -1
  5. package/lib/commonjs/credential/index.js.map +1 -1
  6. package/lib/commonjs/credential/issuance/02-evaluate-issuer-trust.js +27 -0
  7. package/lib/commonjs/credential/issuance/02-evaluate-issuer-trust.js.map +1 -0
  8. package/lib/commonjs/credential/issuance/03-start-user-authorization.js +25 -16
  9. package/lib/commonjs/credential/issuance/03-start-user-authorization.js.map +1 -1
  10. package/lib/commonjs/credential/issuance/04-complete-user-authorization.js +30 -18
  11. package/lib/commonjs/credential/issuance/04-complete-user-authorization.js.map +1 -1
  12. package/lib/commonjs/credential/issuance/05-authorize-access.js +17 -12
  13. package/lib/commonjs/credential/issuance/05-authorize-access.js.map +1 -1
  14. package/lib/commonjs/credential/issuance/06-obtain-credential.js +36 -29
  15. package/lib/commonjs/credential/issuance/06-obtain-credential.js.map +1 -1
  16. package/lib/commonjs/credential/issuance/07-verify-and-parse-credential.js +27 -207
  17. package/lib/commonjs/credential/issuance/07-verify-and-parse-credential.js.map +1 -1
  18. package/lib/commonjs/credential/issuance/README.md +23 -20
  19. package/lib/commonjs/credential/issuance/const.js +1 -1
  20. package/lib/commonjs/credential/issuance/const.js.map +1 -1
  21. package/lib/commonjs/credential/issuance/index.js +3 -3
  22. package/lib/commonjs/credential/issuance/index.js.map +1 -1
  23. package/lib/commonjs/credential/presentation/01-start-flow.js +14 -15
  24. package/lib/commonjs/credential/presentation/01-start-flow.js.map +1 -1
  25. package/lib/commonjs/credential/presentation/02-evaluate-rp-trust.js +6 -4
  26. package/lib/commonjs/credential/presentation/02-evaluate-rp-trust.js.map +1 -1
  27. package/lib/commonjs/credential/presentation/03-get-request-object.js +34 -7
  28. package/lib/commonjs/credential/presentation/03-get-request-object.js.map +1 -1
  29. package/lib/commonjs/credential/presentation/04-retrieve-rp-jwks.js +4 -126
  30. package/lib/commonjs/credential/presentation/04-retrieve-rp-jwks.js.map +1 -1
  31. package/lib/commonjs/credential/presentation/05-verify-request-object.js +80 -25
  32. package/lib/commonjs/credential/presentation/05-verify-request-object.js.map +1 -1
  33. package/lib/commonjs/credential/presentation/06-fetch-presentation-definition.js +6 -30
  34. package/lib/commonjs/credential/presentation/06-fetch-presentation-definition.js.map +1 -1
  35. package/lib/commonjs/credential/presentation/07-evaluate-dcql-query.js +97 -117
  36. package/lib/commonjs/credential/presentation/07-evaluate-dcql-query.js.map +1 -1
  37. package/lib/commonjs/credential/presentation/07-evaluate-input-descriptor.js +86 -191
  38. package/lib/commonjs/credential/presentation/07-evaluate-input-descriptor.js.map +1 -1
  39. package/lib/commonjs/credential/presentation/08-send-authorization-response.js +112 -176
  40. package/lib/commonjs/credential/presentation/08-send-authorization-response.js.map +1 -1
  41. package/lib/commonjs/credential/presentation/README.md +74 -79
  42. package/lib/commonjs/credential/presentation/errors.js +42 -21
  43. package/lib/commonjs/credential/presentation/errors.js.map +1 -1
  44. package/lib/commonjs/credential/presentation/index.js +13 -13
  45. package/lib/commonjs/credential/presentation/index.js.map +1 -1
  46. package/lib/commonjs/credential/presentation/types.js +53 -29
  47. package/lib/commonjs/credential/presentation/types.js.map +1 -1
  48. package/lib/commonjs/credential/status/01-start-flow.js +2 -0
  49. package/lib/commonjs/credential/status/01-start-flow.js.map +1 -0
  50. package/lib/commonjs/credential/status/02-status-attestation.js +73 -0
  51. package/lib/commonjs/credential/status/02-status-attestation.js.map +1 -0
  52. package/lib/commonjs/credential/status/03-verify-and-parse-status-attestation.js +55 -0
  53. package/lib/commonjs/credential/status/03-verify-and-parse-status-attestation.js.map +1 -0
  54. package/lib/commonjs/credential/status/README.md +67 -0
  55. package/lib/commonjs/credential/status/index.js +27 -0
  56. package/lib/commonjs/credential/status/index.js.map +1 -0
  57. package/lib/commonjs/credential/status/types.js +48 -0
  58. package/lib/commonjs/credential/status/types.js.map +1 -0
  59. package/lib/commonjs/credential/trustmark/README.md +62 -0
  60. package/lib/commonjs/credential/trustmark/get-credential-trustmark.js +86 -0
  61. package/lib/commonjs/credential/trustmark/get-credential-trustmark.js.map +1 -0
  62. package/lib/commonjs/credential/trustmark/index.js +13 -0
  63. package/lib/commonjs/credential/trustmark/index.js.map +1 -0
  64. package/lib/commonjs/index.js +5 -1
  65. package/lib/commonjs/index.js.map +1 -1
  66. package/lib/commonjs/pid/sd-jwt/types.js +18 -2
  67. package/lib/commonjs/pid/sd-jwt/types.js.map +1 -1
  68. package/lib/commonjs/sd-jwt/__test__/index.test.js +22 -34
  69. package/lib/commonjs/sd-jwt/__test__/index.test.js.map +1 -1
  70. package/lib/commonjs/sd-jwt/__test__/types.test.js +11 -23
  71. package/lib/commonjs/sd-jwt/__test__/types.test.js.map +1 -1
  72. package/lib/commonjs/sd-jwt/index.js +1 -7
  73. package/lib/commonjs/sd-jwt/index.js.map +1 -1
  74. package/lib/commonjs/sd-jwt/types.js +5 -21
  75. package/lib/commonjs/sd-jwt/types.js.map +1 -1
  76. package/lib/commonjs/{entity/trust → trust}/chain.js +49 -55
  77. package/lib/commonjs/trust/chain.js.map +1 -0
  78. package/lib/commonjs/trust/errors.js +110 -0
  79. package/lib/commonjs/trust/errors.js.map +1 -0
  80. package/lib/commonjs/trust/index.js +282 -0
  81. package/lib/commonjs/trust/index.js.map +1 -0
  82. package/lib/commonjs/{entity/trust → trust}/types.js +27 -47
  83. package/lib/commonjs/trust/types.js.map +1 -0
  84. package/lib/commonjs/trust/utils.js +41 -0
  85. package/lib/commonjs/trust/utils.js.map +1 -0
  86. package/lib/commonjs/utils/crypto.js +5 -112
  87. package/lib/commonjs/utils/crypto.js.map +1 -1
  88. package/lib/commonjs/utils/decoder.js +2 -0
  89. package/lib/commonjs/utils/decoder.js.map +1 -1
  90. package/lib/commonjs/utils/error-codes.js +22 -2
  91. package/lib/commonjs/utils/error-codes.js.map +1 -1
  92. package/lib/commonjs/utils/errors.js +72 -4
  93. package/lib/commonjs/utils/errors.js.map +1 -1
  94. package/lib/commonjs/utils/logging.js +68 -0
  95. package/lib/commonjs/utils/logging.js.map +1 -0
  96. package/lib/commonjs/utils/misc.js +2 -0
  97. package/lib/commonjs/utils/misc.js.map +1 -1
  98. package/lib/commonjs/utils/par.js +17 -10
  99. package/lib/commonjs/utils/par.js.map +1 -1
  100. package/lib/commonjs/utils/string.js +1 -12
  101. package/lib/commonjs/utils/string.js.map +1 -1
  102. package/lib/commonjs/wallet-instance/index.js +14 -0
  103. package/lib/commonjs/wallet-instance/index.js.map +1 -1
  104. package/lib/commonjs/wallet-instance-attestation/README.md +8 -3
  105. package/lib/commonjs/wallet-instance-attestation/issuing.js +15 -8
  106. package/lib/commonjs/wallet-instance-attestation/issuing.js.map +1 -1
  107. package/lib/commonjs/wallet-instance-attestation/types.js +16 -20
  108. package/lib/commonjs/wallet-instance-attestation/types.js.map +1 -1
  109. package/lib/module/client/generated/wallet-provider.js +40 -15
  110. package/lib/module/client/generated/wallet-provider.js.map +1 -1
  111. package/lib/module/credential/index.js +3 -1
  112. package/lib/module/credential/index.js.map +1 -1
  113. package/lib/module/credential/issuance/02-evaluate-issuer-trust.js +20 -0
  114. package/lib/module/credential/issuance/02-evaluate-issuer-trust.js.map +1 -0
  115. package/lib/module/credential/issuance/03-start-user-authorization.js +25 -16
  116. package/lib/module/credential/issuance/03-start-user-authorization.js.map +1 -1
  117. package/lib/module/credential/issuance/04-complete-user-authorization.js +30 -18
  118. package/lib/module/credential/issuance/04-complete-user-authorization.js.map +1 -1
  119. package/lib/module/credential/issuance/05-authorize-access.js +17 -11
  120. package/lib/module/credential/issuance/05-authorize-access.js.map +1 -1
  121. package/lib/module/credential/issuance/06-obtain-credential.js +36 -28
  122. package/lib/module/credential/issuance/06-obtain-credential.js.map +1 -1
  123. package/lib/module/credential/issuance/07-verify-and-parse-credential.js +27 -205
  124. package/lib/module/credential/issuance/07-verify-and-parse-credential.js.map +1 -1
  125. package/lib/module/credential/issuance/README.md +23 -20
  126. package/lib/module/credential/issuance/const.js +1 -1
  127. package/lib/module/credential/issuance/const.js.map +1 -1
  128. package/lib/module/credential/issuance/index.js +2 -2
  129. package/lib/module/credential/issuance/index.js.map +1 -1
  130. package/lib/module/credential/presentation/01-start-flow.js +14 -15
  131. package/lib/module/credential/presentation/01-start-flow.js.map +1 -1
  132. package/lib/module/credential/presentation/02-evaluate-rp-trust.js +5 -3
  133. package/lib/module/credential/presentation/02-evaluate-rp-trust.js.map +1 -1
  134. package/lib/module/credential/presentation/03-get-request-object.js +34 -7
  135. package/lib/module/credential/presentation/03-get-request-object.js.map +1 -1
  136. package/lib/module/credential/presentation/04-retrieve-rp-jwks.js +2 -124
  137. package/lib/module/credential/presentation/04-retrieve-rp-jwks.js.map +1 -1
  138. package/lib/module/credential/presentation/05-verify-request-object.js +78 -23
  139. package/lib/module/credential/presentation/05-verify-request-object.js.map +1 -1
  140. package/lib/module/credential/presentation/06-fetch-presentation-definition.js +6 -30
  141. package/lib/module/credential/presentation/06-fetch-presentation-definition.js.map +1 -1
  142. package/lib/module/credential/presentation/07-evaluate-dcql-query.js +97 -118
  143. package/lib/module/credential/presentation/07-evaluate-dcql-query.js.map +1 -1
  144. package/lib/module/credential/presentation/07-evaluate-input-descriptor.js +83 -186
  145. package/lib/module/credential/presentation/07-evaluate-input-descriptor.js.map +1 -1
  146. package/lib/module/credential/presentation/08-send-authorization-response.js +107 -170
  147. package/lib/module/credential/presentation/08-send-authorization-response.js.map +1 -1
  148. package/lib/module/credential/presentation/README.md +74 -79
  149. package/lib/module/credential/presentation/errors.js +30 -17
  150. package/lib/module/credential/presentation/errors.js.map +1 -1
  151. package/lib/module/credential/presentation/index.js +6 -6
  152. package/lib/module/credential/presentation/index.js.map +1 -1
  153. package/lib/module/credential/presentation/types.js +49 -27
  154. package/lib/module/credential/presentation/types.js.map +1 -1
  155. package/lib/module/credential/status/01-start-flow.js +2 -0
  156. package/lib/module/credential/status/01-start-flow.js.map +1 -0
  157. package/lib/module/credential/status/02-status-attestation.js +66 -0
  158. package/lib/module/credential/status/02-status-attestation.js.map +1 -0
  159. package/lib/module/credential/status/03-verify-and-parse-status-attestation.js +49 -0
  160. package/lib/module/credential/status/03-verify-and-parse-status-attestation.js.map +1 -0
  161. package/lib/module/credential/status/README.md +67 -0
  162. package/lib/module/credential/status/index.js +5 -0
  163. package/lib/module/credential/status/index.js.map +1 -0
  164. package/lib/module/credential/status/types.js +40 -0
  165. package/lib/module/credential/status/types.js.map +1 -0
  166. package/lib/module/credential/trustmark/README.md +62 -0
  167. package/lib/module/credential/trustmark/get-credential-trustmark.js +77 -0
  168. package/lib/module/credential/trustmark/get-credential-trustmark.js.map +1 -0
  169. package/lib/module/credential/trustmark/index.js +3 -0
  170. package/lib/module/credential/trustmark/index.js.map +1 -0
  171. package/lib/module/index.js +3 -1
  172. package/lib/module/index.js.map +1 -1
  173. package/lib/module/pid/sd-jwt/types.js +16 -1
  174. package/lib/module/pid/sd-jwt/types.js.map +1 -1
  175. package/lib/module/sd-jwt/__test__/index.test.js +22 -34
  176. package/lib/module/sd-jwt/__test__/index.test.js.map +1 -1
  177. package/lib/module/sd-jwt/__test__/types.test.js +11 -23
  178. package/lib/module/sd-jwt/__test__/types.test.js.map +1 -1
  179. package/lib/module/sd-jwt/index.js +1 -7
  180. package/lib/module/sd-jwt/index.js.map +1 -1
  181. package/lib/module/sd-jwt/types.js +4 -19
  182. package/lib/module/sd-jwt/types.js.map +1 -1
  183. package/lib/module/trust/chain.js +108 -0
  184. package/lib/module/trust/chain.js.map +1 -0
  185. package/lib/module/trust/errors.js +94 -0
  186. package/lib/module/trust/errors.js.map +1 -0
  187. package/lib/module/trust/index.js +263 -0
  188. package/lib/module/trust/index.js.map +1 -0
  189. package/lib/module/{entity/trust → trust}/types.js +25 -46
  190. package/lib/module/trust/types.js.map +1 -0
  191. package/lib/module/trust/utils.js +33 -0
  192. package/lib/module/trust/utils.js.map +1 -0
  193. package/lib/module/utils/crypto.js +4 -107
  194. package/lib/module/utils/crypto.js.map +1 -1
  195. package/lib/module/utils/decoder.js +3 -0
  196. package/lib/module/utils/decoder.js.map +1 -1
  197. package/lib/module/utils/error-codes.js +20 -1
  198. package/lib/module/utils/error-codes.js.map +1 -1
  199. package/lib/module/utils/errors.js +61 -4
  200. package/lib/module/utils/errors.js.map +1 -1
  201. package/lib/module/utils/logging.js +62 -0
  202. package/lib/module/utils/logging.js.map +1 -0
  203. package/lib/module/utils/misc.js +2 -0
  204. package/lib/module/utils/misc.js.map +1 -1
  205. package/lib/module/utils/par.js +17 -9
  206. package/lib/module/utils/par.js.map +1 -1
  207. package/lib/module/utils/string.js +0 -10
  208. package/lib/module/utils/string.js.map +1 -1
  209. package/lib/module/wallet-instance/index.js +13 -0
  210. package/lib/module/wallet-instance/index.js.map +1 -1
  211. package/lib/module/wallet-instance-attestation/README.md +8 -3
  212. package/lib/module/wallet-instance-attestation/index.js +2 -2
  213. package/lib/module/wallet-instance-attestation/index.js.map +1 -1
  214. package/lib/module/wallet-instance-attestation/issuing.js +16 -9
  215. package/lib/module/wallet-instance-attestation/issuing.js.map +1 -1
  216. package/lib/module/wallet-instance-attestation/types.js +14 -18
  217. package/lib/module/wallet-instance-attestation/types.js.map +1 -1
  218. package/lib/typescript/client/generated/wallet-provider.d.ts +206 -51
  219. package/lib/typescript/client/generated/wallet-provider.d.ts.map +1 -1
  220. package/lib/typescript/credential/index.d.ts +3 -1
  221. package/lib/typescript/credential/index.d.ts.map +1 -1
  222. package/lib/typescript/credential/issuance/01-start-flow.d.ts +1 -1
  223. package/lib/typescript/credential/issuance/02-evaluate-issuer-trust.d.ts +19 -0
  224. package/lib/typescript/credential/issuance/02-evaluate-issuer-trust.d.ts.map +1 -0
  225. package/lib/typescript/credential/issuance/03-start-user-authorization.d.ts +3 -3
  226. package/lib/typescript/credential/issuance/03-start-user-authorization.d.ts.map +1 -1
  227. package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts +9 -9
  228. package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts.map +1 -1
  229. package/lib/typescript/credential/issuance/05-authorize-access.d.ts +3 -3
  230. package/lib/typescript/credential/issuance/05-authorize-access.d.ts.map +1 -1
  231. package/lib/typescript/credential/issuance/06-obtain-credential.d.ts +4 -4
  232. package/lib/typescript/credential/issuance/06-obtain-credential.d.ts.map +1 -1
  233. package/lib/typescript/credential/issuance/07-verify-and-parse-credential.d.ts +3 -15
  234. package/lib/typescript/credential/issuance/07-verify-and-parse-credential.d.ts.map +1 -1
  235. package/lib/typescript/credential/issuance/const.d.ts +1 -1
  236. package/lib/typescript/credential/issuance/const.d.ts.map +1 -1
  237. package/lib/typescript/credential/issuance/index.d.ts +3 -3
  238. package/lib/typescript/credential/issuance/index.d.ts.map +1 -1
  239. package/lib/typescript/credential/issuance/types.d.ts +8 -3
  240. package/lib/typescript/credential/issuance/types.d.ts.map +1 -1
  241. package/lib/typescript/credential/presentation/01-start-flow.d.ts +28 -9
  242. package/lib/typescript/credential/presentation/01-start-flow.d.ts.map +1 -1
  243. package/lib/typescript/credential/presentation/02-evaluate-rp-trust.d.ts +2 -1
  244. package/lib/typescript/credential/presentation/02-evaluate-rp-trust.d.ts.map +1 -1
  245. package/lib/typescript/credential/presentation/03-get-request-object.d.ts +7 -5
  246. package/lib/typescript/credential/presentation/03-get-request-object.d.ts.map +1 -1
  247. package/lib/typescript/credential/presentation/04-retrieve-rp-jwks.d.ts +4 -30
  248. package/lib/typescript/credential/presentation/04-retrieve-rp-jwks.d.ts.map +1 -1
  249. package/lib/typescript/credential/presentation/05-verify-request-object.d.ts +17 -4
  250. package/lib/typescript/credential/presentation/05-verify-request-object.d.ts.map +1 -1
  251. package/lib/typescript/credential/presentation/06-fetch-presentation-definition.d.ts +4 -9
  252. package/lib/typescript/credential/presentation/06-fetch-presentation-definition.d.ts.map +1 -1
  253. package/lib/typescript/credential/presentation/07-evaluate-dcql-query.d.ts +13 -12
  254. package/lib/typescript/credential/presentation/07-evaluate-dcql-query.d.ts.map +1 -1
  255. package/lib/typescript/credential/presentation/07-evaluate-input-descriptor.d.ts +40 -42
  256. package/lib/typescript/credential/presentation/07-evaluate-input-descriptor.d.ts.map +1 -1
  257. package/lib/typescript/credential/presentation/08-send-authorization-response.d.ts +30 -43
  258. package/lib/typescript/credential/presentation/08-send-authorization-response.d.ts.map +1 -1
  259. package/lib/typescript/credential/presentation/errors.d.ts +25 -10
  260. package/lib/typescript/credential/presentation/errors.d.ts.map +1 -1
  261. package/lib/typescript/credential/presentation/index.d.ts +7 -8
  262. package/lib/typescript/credential/presentation/index.d.ts.map +1 -1
  263. package/lib/typescript/credential/presentation/types.d.ts +137 -307
  264. package/lib/typescript/credential/presentation/types.d.ts.map +1 -1
  265. package/lib/typescript/credential/status/01-start-flow.d.ts +10 -0
  266. package/lib/typescript/credential/status/01-start-flow.d.ts.map +1 -0
  267. package/lib/typescript/credential/status/02-status-attestation.d.ts +19 -0
  268. package/lib/typescript/credential/status/02-status-attestation.d.ts.map +1 -0
  269. package/lib/typescript/credential/status/03-verify-and-parse-status-attestation.d.ts +24 -0
  270. package/lib/typescript/credential/status/03-verify-and-parse-status-attestation.d.ts.map +1 -0
  271. package/lib/typescript/credential/status/index.d.ts +7 -0
  272. package/lib/typescript/credential/status/index.d.ts.map +1 -0
  273. package/lib/typescript/credential/status/types.d.ts +305 -0
  274. package/lib/typescript/credential/status/types.d.ts.map +1 -0
  275. package/lib/typescript/credential/trustmark/get-credential-trustmark.d.ts +52 -0
  276. package/lib/typescript/credential/trustmark/get-credential-trustmark.d.ts.map +1 -0
  277. package/lib/typescript/credential/trustmark/index.d.ts +4 -0
  278. package/lib/typescript/credential/trustmark/index.d.ts.map +1 -0
  279. package/lib/typescript/index.d.ts +3 -1
  280. package/lib/typescript/index.d.ts.map +1 -1
  281. package/lib/typescript/pid/sd-jwt/types.d.ts +103 -25
  282. package/lib/typescript/pid/sd-jwt/types.d.ts.map +1 -1
  283. package/lib/typescript/sd-jwt/index.d.ts +30 -82
  284. package/lib/typescript/sd-jwt/index.d.ts.map +1 -1
  285. package/lib/typescript/sd-jwt/types.d.ts +29 -134
  286. package/lib/typescript/sd-jwt/types.d.ts.map +1 -1
  287. package/lib/typescript/{entity/trust → trust}/chain.d.ts +5 -10
  288. package/lib/typescript/trust/chain.d.ts.map +1 -0
  289. package/lib/typescript/trust/errors.d.ts +80 -0
  290. package/lib/typescript/trust/errors.d.ts.map +1 -0
  291. package/lib/typescript/{entity/trust → trust}/index.d.ts +211 -186
  292. package/lib/typescript/trust/index.d.ts.map +1 -0
  293. package/lib/typescript/{entity/trust → trust}/types.d.ts +1533 -1120
  294. package/lib/typescript/{entity/trust → trust}/types.d.ts.map +1 -1
  295. package/lib/typescript/trust/utils.d.ts +12 -0
  296. package/lib/typescript/trust/utils.d.ts.map +1 -0
  297. package/lib/typescript/utils/crypto.d.ts +0 -32
  298. package/lib/typescript/utils/crypto.d.ts.map +1 -1
  299. package/lib/typescript/utils/decoder.d.ts.map +1 -1
  300. package/lib/typescript/utils/error-codes.d.ts +20 -0
  301. package/lib/typescript/utils/error-codes.d.ts.map +1 -1
  302. package/lib/typescript/utils/errors.d.ts +55 -10
  303. package/lib/typescript/utils/errors.d.ts.map +1 -1
  304. package/lib/typescript/utils/logging.d.ts +35 -0
  305. package/lib/typescript/utils/logging.d.ts.map +1 -0
  306. package/lib/typescript/utils/misc.d.ts.map +1 -1
  307. package/lib/typescript/utils/par.d.ts +8 -1
  308. package/lib/typescript/utils/par.d.ts.map +1 -1
  309. package/lib/typescript/utils/string.d.ts +0 -7
  310. package/lib/typescript/utils/string.d.ts.map +1 -1
  311. package/lib/typescript/wallet-instance/index.d.ts +8 -0
  312. package/lib/typescript/wallet-instance/index.d.ts.map +1 -1
  313. package/lib/typescript/wallet-instance-attestation/index.d.ts +1 -2
  314. package/lib/typescript/wallet-instance-attestation/index.d.ts.map +1 -1
  315. package/lib/typescript/wallet-instance-attestation/issuing.d.ts +4 -2
  316. package/lib/typescript/wallet-instance-attestation/issuing.d.ts.map +1 -1
  317. package/lib/typescript/wallet-instance-attestation/types.d.ts +78 -120
  318. package/lib/typescript/wallet-instance-attestation/types.d.ts.map +1 -1
  319. package/package.json +8 -9
  320. package/src/client/generated/wallet-provider.ts +52 -17
  321. package/src/credential/index.ts +4 -1
  322. package/src/credential/issuance/01-start-flow.ts +1 -1
  323. package/src/credential/issuance/02-evaluate-issuer-trust.ts +32 -0
  324. package/src/credential/issuance/03-start-user-authorization.ts +48 -22
  325. package/src/credential/issuance/04-complete-user-authorization.ts +74 -18
  326. package/src/credential/issuance/05-authorize-access.ts +29 -11
  327. package/src/credential/issuance/06-obtain-credential.ts +61 -36
  328. package/src/credential/issuance/07-verify-and-parse-credential.ts +37 -264
  329. package/src/credential/issuance/README.md +23 -20
  330. package/src/credential/issuance/const.ts +1 -1
  331. package/src/credential/issuance/index.ts +6 -3
  332. package/src/credential/presentation/01-start-flow.ts +19 -22
  333. package/src/credential/presentation/02-evaluate-rp-trust.ts +5 -4
  334. package/src/credential/presentation/03-get-request-object.ts +36 -8
  335. package/src/credential/presentation/04-retrieve-rp-jwks.ts +6 -148
  336. package/src/credential/presentation/05-verify-request-object.ts +115 -30
  337. package/src/credential/presentation/06-fetch-presentation-definition.ts +5 -35
  338. package/src/credential/presentation/07-evaluate-dcql-query.ts +132 -161
  339. package/src/credential/presentation/07-evaluate-input-descriptor.ts +136 -254
  340. package/src/credential/presentation/08-send-authorization-response.ts +178 -260
  341. package/src/credential/presentation/README.md +74 -79
  342. package/src/credential/presentation/errors.ts +38 -15
  343. package/src/credential/presentation/index.ts +18 -19
  344. package/src/credential/presentation/types.ts +67 -64
  345. package/src/credential/status/01-start-flow.ts +9 -0
  346. package/src/credential/status/02-status-attestation.ts +105 -0
  347. package/src/credential/status/03-verify-and-parse-status-attestation.ts +70 -0
  348. package/src/credential/status/README.md +67 -0
  349. package/src/credential/status/index.ts +22 -0
  350. package/src/credential/status/types.ts +43 -0
  351. package/src/credential/trustmark/README.md +62 -0
  352. package/src/credential/trustmark/get-credential-trustmark.ts +139 -0
  353. package/src/credential/trustmark/index.ts +8 -0
  354. package/src/index.ts +4 -0
  355. package/src/pid/sd-jwt/types.ts +18 -1
  356. package/src/sd-jwt/__test__/index.test.ts +36 -55
  357. package/src/sd-jwt/__test__/types.test.ts +16 -29
  358. package/src/sd-jwt/index.ts +1 -5
  359. package/src/sd-jwt/types.ts +2 -19
  360. package/src/trust/chain.ts +151 -0
  361. package/src/trust/errors.ts +105 -0
  362. package/src/{entity/trust → trust}/index.ts +198 -23
  363. package/src/{entity/trust → trust}/types.ts +24 -37
  364. package/src/trust/utils.ts +35 -0
  365. package/src/utils/crypto.ts +4 -106
  366. package/src/utils/decoder.ts +6 -1
  367. package/src/utils/error-codes.ts +23 -0
  368. package/src/utils/errors.ts +119 -15
  369. package/src/utils/logging.ts +68 -0
  370. package/src/utils/misc.ts +5 -0
  371. package/src/utils/par.ts +19 -6
  372. package/src/utils/string.ts +0 -10
  373. package/src/wallet-instance/index.ts +30 -1
  374. package/src/wallet-instance-attestation/README.md +8 -3
  375. package/src/wallet-instance-attestation/index.ts +2 -2
  376. package/src/wallet-instance-attestation/issuing.ts +33 -12
  377. package/src/wallet-instance-attestation/types.ts +18 -22
  378. package/lib/commonjs/credential/issuance/02-get-issuer-config.js +0 -48
  379. package/lib/commonjs/credential/issuance/02-get-issuer-config.js.map +0 -1
  380. package/lib/commonjs/entity/openid-connect/issuer/index.js +0 -25
  381. package/lib/commonjs/entity/openid-connect/issuer/index.js.map +0 -1
  382. package/lib/commonjs/entity/openid-connect/issuer/types.js +0 -64
  383. package/lib/commonjs/entity/openid-connect/issuer/types.js.map +0 -1
  384. package/lib/commonjs/entity/trust/chain.js.map +0 -1
  385. package/lib/commonjs/entity/trust/index.js +0 -148
  386. package/lib/commonjs/entity/trust/index.js.map +0 -1
  387. package/lib/commonjs/entity/trust/types.js.map +0 -1
  388. package/lib/commonjs/mdoc/converters.js +0 -26
  389. package/lib/commonjs/mdoc/converters.js.map +0 -1
  390. package/lib/commonjs/mdoc/index.js +0 -68
  391. package/lib/commonjs/mdoc/index.js.map +0 -1
  392. package/lib/commonjs/utils/credential/issuance/07-verify-and-parse-credentials-inputs.js +0 -469
  393. package/lib/commonjs/utils/credential/issuance/07-verify-and-parse-credentials-inputs.js.map +0 -1
  394. package/lib/commonjs/utils/credential/issuance/07-verify-and-parse-credentials-utils.js +0 -90
  395. package/lib/commonjs/utils/credential/issuance/07-verify-and-parse-credentials-utils.js.map +0 -1
  396. package/lib/module/credential/issuance/02-get-issuer-config.js +0 -42
  397. package/lib/module/credential/issuance/02-get-issuer-config.js.map +0 -1
  398. package/lib/module/entity/openid-connect/issuer/index.js +0 -20
  399. package/lib/module/entity/openid-connect/issuer/index.js.map +0 -1
  400. package/lib/module/entity/openid-connect/issuer/types.js +0 -48
  401. package/lib/module/entity/openid-connect/issuer/types.js.map +0 -1
  402. package/lib/module/entity/trust/chain.js +0 -113
  403. package/lib/module/entity/trust/chain.js.map +0 -1
  404. package/lib/module/entity/trust/index.js +0 -131
  405. package/lib/module/entity/trust/index.js.map +0 -1
  406. package/lib/module/entity/trust/types.js.map +0 -1
  407. package/lib/module/mdoc/converters.js +0 -20
  408. package/lib/module/mdoc/converters.js.map +0 -1
  409. package/lib/module/mdoc/index.js +0 -60
  410. package/lib/module/mdoc/index.js.map +0 -1
  411. package/lib/module/utils/credential/issuance/07-verify-and-parse-credentials-inputs.js +0 -462
  412. package/lib/module/utils/credential/issuance/07-verify-and-parse-credentials-inputs.js.map +0 -1
  413. package/lib/module/utils/credential/issuance/07-verify-and-parse-credentials-utils.js +0 -83
  414. package/lib/module/utils/credential/issuance/07-verify-and-parse-credentials-utils.js.map +0 -1
  415. package/lib/typescript/credential/issuance/02-get-issuer-config.d.ts +0 -32
  416. package/lib/typescript/credential/issuance/02-get-issuer-config.d.ts.map +0 -1
  417. package/lib/typescript/entity/openid-connect/issuer/index.d.ts +0 -12
  418. package/lib/typescript/entity/openid-connect/issuer/index.d.ts.map +0 -1
  419. package/lib/typescript/entity/openid-connect/issuer/types.d.ts +0 -777
  420. package/lib/typescript/entity/openid-connect/issuer/types.d.ts.map +0 -1
  421. package/lib/typescript/entity/trust/chain.d.ts.map +0 -1
  422. package/lib/typescript/entity/trust/index.d.ts.map +0 -1
  423. package/lib/typescript/mdoc/converters.d.ts +0 -8
  424. package/lib/typescript/mdoc/converters.d.ts.map +0 -1
  425. package/lib/typescript/mdoc/index.d.ts +0 -10
  426. package/lib/typescript/mdoc/index.d.ts.map +0 -1
  427. package/lib/typescript/utils/credential/issuance/07-verify-and-parse-credentials-inputs.d.ts +0 -3
  428. package/lib/typescript/utils/credential/issuance/07-verify-and-parse-credentials-inputs.d.ts.map +0 -1
  429. package/lib/typescript/utils/credential/issuance/07-verify-and-parse-credentials-utils.d.ts +0 -42
  430. package/lib/typescript/utils/credential/issuance/07-verify-and-parse-credentials-utils.d.ts.map +0 -1
  431. package/src/credential/issuance/02-get-issuer-config.ts +0 -67
  432. package/src/entity/openid-connect/issuer/index.ts +0 -27
  433. package/src/entity/openid-connect/issuer/types.ts +0 -76
  434. package/src/entity/trust/chain.ts +0 -154
  435. package/src/mdoc/converters.ts +0 -26
  436. package/src/mdoc/index.ts +0 -95
  437. package/src/utils/credential/issuance/07-verify-and-parse-credentials-inputs.ts +0 -615
  438. package/src/utils/credential/issuance/07-verify-and-parse-credentials-utils.ts +0 -171
@@ -0,0 +1,70 @@
1
+ import type { Out } from "../../utils/misc";
2
+ import { IoWalletError } from "../../utils/errors";
3
+ import { verify, type CryptoContext } from "@pagopa/io-react-native-jwt";
4
+ import type { EvaluateIssuerTrust, StatusAttestation } from "../status";
5
+ import { ParsedStatusAttestation } from "./types";
6
+ import { decode as decodeJwt } from "@pagopa/io-react-native-jwt";
7
+ import { LogLevel, Logger } from "../../utils/logging";
8
+
9
+ export type VerifyAndParseStatusAttestation = (
10
+ issuerConf: Out<EvaluateIssuerTrust>["issuerConf"],
11
+ statusAttestation: Out<StatusAttestation>,
12
+ context: {
13
+ credentialCryptoContext: CryptoContext;
14
+ }
15
+ ) => Promise<{ parsedStatusAttestation: ParsedStatusAttestation }>;
16
+
17
+ /**
18
+ * Given a status attestation, verifies that:
19
+ * - It's in the supported format;
20
+ * - The attestation is correctly signed;
21
+ * - It's bound to the given key.
22
+ * @param issuerConf The Issuer configuration returned by {@link evaluateIssuerTrust}
23
+ * @param statusAttestation The encoded status attestation returned by {@link statusAttestation}
24
+ * @param context.credentialCryptoContext The crypto context used to obtain the credential in {@link obtainCredential}
25
+ * @returns A parsed status attestation
26
+ * @throws {IoWalletError} If the credential signature is not verified with the Issuer key set
27
+ * @throws {IoWalletError} If the credential is not bound to the provided user key
28
+ * @throws {IoWalletError} If the credential data fail to parse
29
+ */
30
+ export const verifyAndParseStatusAttestation: VerifyAndParseStatusAttestation =
31
+ async (issuerConf, rawStatusAttestation, context) => {
32
+ try {
33
+ const { statusAttestation } = rawStatusAttestation;
34
+ const { credentialCryptoContext } = context;
35
+
36
+ await verify(
37
+ statusAttestation,
38
+ issuerConf.openid_credential_issuer.jwks.keys
39
+ );
40
+
41
+ const decodedJwt = decodeJwt(statusAttestation);
42
+ const parsedStatusAttestation = ParsedStatusAttestation.parse({
43
+ header: decodedJwt.protectedHeader,
44
+ payload: decodedJwt.payload,
45
+ });
46
+
47
+ Logger.log(
48
+ LogLevel.DEBUG,
49
+ `Parsed status attestation: ${JSON.stringify(parsedStatusAttestation)}`
50
+ );
51
+
52
+ const holderBindingKey = await credentialCryptoContext.getPublicKey();
53
+ const { cnf } = parsedStatusAttestation.payload;
54
+ if (!cnf.jwk.kid || cnf.jwk.kid !== holderBindingKey.kid) {
55
+ Logger.log(
56
+ LogLevel.ERROR,
57
+ `Failed to verify holder binding for status attestation, expected kid: ${holderBindingKey.kid}, got: ${parsedStatusAttestation.payload.cnf.jwk.kid}`
58
+ );
59
+ throw new IoWalletError(
60
+ `Failed to verify holder binding for status attestation, expected kid: ${holderBindingKey.kid}, got: ${parsedStatusAttestation.payload.cnf.jwk.kid}`
61
+ );
62
+ }
63
+
64
+ return { parsedStatusAttestation };
65
+ } catch (e) {
66
+ throw new IoWalletError(
67
+ `Failed to verify status attestation: ${JSON.stringify(e)}`
68
+ );
69
+ }
70
+ };
@@ -0,0 +1,67 @@
1
+ # Credential Status Attestation
2
+
3
+ This flow is used to obtain a credential status attestation from its credential issuer. Each step in the flow is imported from the related file which is named with a sequential number.
4
+ The credential status attestation is a JWT which contains the credential status which indicates if the credential is valid or not.
5
+ The status attestation is supposed to be stored securely along with the credential. It has a limited lifetime and should be refreshed periodically according to the `exp` field in the JWT payload.
6
+
7
+ ## Sequence Diagram
8
+
9
+ ```mermaid
10
+ graph TD;
11
+ 0[startFlow]
12
+ 1[statusAttestation]
13
+ 2[verifyAndParseStatusAttestation]
14
+
15
+ 0 --> 1
16
+ 1 --> 2
17
+ ```
18
+
19
+
20
+ ## Mapped results
21
+
22
+ The following errors are mapped to a `IssuerResponseError` with specific codes.
23
+
24
+ |HTTP Status|Error Code|Description|
25
+ |-----------|----------|-----------|
26
+ |`404 Not Found`|`ERR_CREDENTIAL_INVALID_STATUS`|This response is returned by the credential issuer when the status attestation is invalid. It might contain more details in the `reason` property.|
27
+
28
+ ## Example
29
+
30
+ <details>
31
+ <summary>Credential status attestation flow</summary>
32
+
33
+ ```ts
34
+ // Start the issuance flow
35
+ const credentialIssuerUrl = "https://issuer.example.com";
36
+ const startFlow: Credential.Status.StartFlow = () => ({
37
+ issuerUrl: credentialIssuerUrl, // Let's assum
38
+ });
39
+
40
+ const { issuerUrl } = startFlow();
41
+
42
+ // Evaluate issuer trust
43
+ const { issuerConf } = await Credential.Status.evaluateIssuerTrust(issuerUrl);
44
+
45
+ // Get the credential attestation
46
+ const res = await Credential.Status.statusAttestation(
47
+ issuerConf,
48
+ credential,
49
+ credentialCryptoContext
50
+ );
51
+
52
+ // Verify and parse the status attestation
53
+ const { parsedStatusAttestation } =
54
+ await Credential.Status.verifyAndParseStatusAttestation(
55
+ issuerConf,
56
+ res.statusAttestation,
57
+ { credentialCryptoContext }
58
+ );
59
+
60
+ return {
61
+ statusAttestation: res.statusAttestation,
62
+ parsedStatusAttestation,
63
+ credentialType,
64
+ };
65
+ ```
66
+
67
+ </details>
@@ -0,0 +1,22 @@
1
+ import { type StartFlow } from "./01-start-flow";
2
+ import {
3
+ statusAttestation,
4
+ type StatusAttestation,
5
+ } from "./02-status-attestation";
6
+ import { evaluateIssuerTrust, type EvaluateIssuerTrust } from "../issuance";
7
+ import {
8
+ verifyAndParseStatusAttestation,
9
+ type VerifyAndParseStatusAttestation,
10
+ } from "./03-verify-and-parse-status-attestation";
11
+
12
+ export {
13
+ evaluateIssuerTrust,
14
+ statusAttestation,
15
+ verifyAndParseStatusAttestation,
16
+ };
17
+ export type {
18
+ StartFlow,
19
+ EvaluateIssuerTrust,
20
+ StatusAttestation,
21
+ VerifyAndParseStatusAttestation,
22
+ };
@@ -0,0 +1,43 @@
1
+ import { UnixTime } from "../../sd-jwt/types";
2
+ import { JWK } from "../../utils/jwk";
3
+ import * as z from "zod";
4
+
5
+ /**
6
+ * Shape from parsing a status attestation response in case of 201.
7
+ */
8
+ export const StatusAttestationResponse = z.object({
9
+ status_attestation: z.string(),
10
+ });
11
+
12
+ /**
13
+ * Type from parsing a status attestation response in case of 201.
14
+ * Inferred from {@link StatusAttestationResponse}.
15
+ */
16
+ export type StatusAttestationResponse = z.infer<
17
+ typeof StatusAttestationResponse
18
+ >;
19
+
20
+ /**
21
+ * Type for a parsed status attestation.
22
+ */
23
+ export type ParsedStatusAttestation = z.infer<typeof ParsedStatusAttestation>;
24
+
25
+ /**
26
+ * Shape for parsing a status attestation in a JWT.
27
+ */
28
+ export const ParsedStatusAttestation = z.object({
29
+ header: z.object({
30
+ typ: z.literal("status-attestation+jwt"),
31
+ alg: z.string(),
32
+ kid: z.string().optional(),
33
+ }),
34
+ payload: z.object({
35
+ credential_hash_alg: z.string(),
36
+ credential_hash: z.string(),
37
+ cnf: z.object({
38
+ jwk: JWK,
39
+ }),
40
+ exp: UnixTime,
41
+ iat: UnixTime,
42
+ }),
43
+ });
@@ -0,0 +1,62 @@
1
+ # Credential Trustmark
2
+
3
+ A credential TrustMark is a signed JWT that verifies the authenticity of a credential issued by a trusted source. It serves as proof that a credential is valid and linked to a specific wallet instance.
4
+ The TrustMark is often presented as a QR code, containing cryptographic data to ensure it hasn't been tampered with. It includes fields like issuer, issuance and expiration timestamps, and credential-specific details. TrustMarks have a short validity period and are used to enhance security and prevent misuse, such as QR code swapping.
5
+
6
+ ### getCredentialTrustmark
7
+
8
+ A function that generates a signed JWT Trustmark to verify the authenticity of a digital credential. The Trustmark serves as a cryptographic proof linking a credential to a specific wallet instance, ensuring the credential's validity and preventing unauthorized modifications or misuse.
9
+
10
+ #### Signature
11
+
12
+ ```typescript
13
+ function getCredentialTrustmark({
14
+ walletInstanceAttestation: string,
15
+ wiaCryptoContext: CryptoContext,
16
+ credentialType: string,
17
+ docNumber?: string,
18
+ expirationTime?: number | string
19
+ }): Promise<{
20
+ jwt: string,
21
+ expirationTime: number
22
+ }>
23
+ ```
24
+
25
+ #### Parameters
26
+ | Parameter | Type | Required | Description |
27
+ |-----------|------|----------|-------------|
28
+ | walletInstanceAttestation | string | Yes | A base64-encoded string containing the Wallet Instance Attestation (WIA). This attestation proves the authenticity of the wallet instance. |
29
+ | wiaCryptoContext | CryptoContext | Yes | The cryptographic context associated with the wallet instance. Must contain the same key pair used to generate the WIA. |
30
+ | credentialType | string | Yes | Identifier for the type of credential (e.g., "MDL" for Mobile Driver's License). |
31
+ | docNumber | string | No | The document number of the credential. If provided, it will be obfuscated in the Trustmark for privacy. |
32
+ | expirationTime | number \| string | No | Specifies when the Trustmark expires. Can be either:<br>- A timestamp in seconds<br>- A time span string (e.g., "2m" for 2 minutes)<br>Default: "2m" |
33
+
34
+ #### Return Value
35
+
36
+ Returns a Promise that resolves to an object containing:
37
+ | Property | Type | Description |
38
+ |----------|------|-------------|
39
+ | jwt | string | The signed trustmark JWT string |
40
+ | expirationTime | number | The expiration timestamp of the JWT in seconds |
41
+
42
+ ## Example
43
+
44
+ ```typescript
45
+ // Required inputs
46
+ const walletInstanceAttestation = "base64AttestationString";
47
+ const credentialType = "MDL"; // Credential type (e.g., Mobile Driver's License)
48
+ const documentNumber = "AB123456"; // Optional document number
49
+ const cryptoContext = createCryptoContextFor("wiaKeyTag"); // Sample crypto context
50
+
51
+ // Generate the TrustMark JWT
52
+ const { jwt, expirationTime } = await getCredentialTrustmark({
53
+ walletInstanceAttestation: "eyJ0eXAi...", // WIA JWT
54
+ wiaCryptoContext: cryptoContext,
55
+ credentialType: "IdentityCard",
56
+ docNumber: "AB123456",
57
+ expirationTime: "5m", // 5 minutes
58
+ });
59
+
60
+ console.log("Generated TrustMark JWT:", jwt);
61
+ console.log("Expires at:", new Date(expirationTime * 1000));
62
+ ```
@@ -0,0 +1,139 @@
1
+ import {
2
+ SignJWT,
3
+ thumbprint,
4
+ type CryptoContext,
5
+ decode as decodeJwt,
6
+ } from "@pagopa/io-react-native-jwt";
7
+ import * as WalletInstanceAttestation from "../../wallet-instance-attestation";
8
+ import { IoWalletError } from "../../utils/errors";
9
+ import { obfuscateString } from "../../utils/string";
10
+ import { LogLevel, Logger } from "../../utils/logging";
11
+
12
+ export type GetCredentialTrustmarkJwt = (params: {
13
+ /**
14
+ * The Wallet Instance's attestation
15
+ */
16
+ walletInstanceAttestation: string;
17
+ /**
18
+ * The Wallet Instance's crypto context associated with the walletInstanceAttestation parameter
19
+ */
20
+ wiaCryptoContext: CryptoContext;
21
+ /**
22
+ * The type of credential for which the trustmark is generated
23
+ */
24
+ credentialType: string;
25
+ /**
26
+ * (Optional) Document number contained in the credential, if applicable
27
+ */
28
+ docNumber?: string;
29
+ /**
30
+ * (Optional) Expiration time for the trustmark, default is 2 minutes.
31
+ * If a number is provided, it is interpreted as a timestamp in seconds.
32
+ * If a string is provided, it is interpreted as a time span and added to the current timestamp.
33
+ */
34
+ expirationTime?: number | string;
35
+ }) => Promise<{
36
+ /**
37
+ * The signed JWT
38
+ */
39
+ jwt: string;
40
+ /**
41
+ * The expiration time of the JWT in seconds
42
+ */
43
+ expirationTime: number;
44
+ }>;
45
+
46
+ /**
47
+ * Generates a trustmark signed JWT, which is used to verify the authenticity of a credential.
48
+ * The public key used to sign the trustmark must the same used for the Wallet Instance Attestation.
49
+ *
50
+ * @param walletInstanceAttestation the Wallet Instance's attestation
51
+ * @param wiaCryptoContext The Wallet Instance's crypto context associated with the walletInstanceAttestation parameter
52
+ * @param credentialType The type of credential for which the trustmark is generated
53
+ * @param docNumber (Optional) Document number contained in the credential, if applicable
54
+ * @param expirationTime (Optional) Expiration time for the trustmark, default is 2 minutes.
55
+ * If a number is provided, it is interpreted as a timestamp in seconds.
56
+ * If a string is provided, it is interpreted as a time span and added to the current timestamp.
57
+ * @throws {IoWalletError} If the WIA is expired
58
+ * @throws {IoWalletError} If the public key associated to the WIA is not the same for the CryptoContext
59
+ * @throws {JWSSignatureVerificationFailed} If the WIA signature is not valid
60
+ * @returns A promise containing the signed JWT and its expiration time in seconds
61
+ */
62
+ export const getCredentialTrustmark: GetCredentialTrustmarkJwt = async ({
63
+ walletInstanceAttestation,
64
+ wiaCryptoContext,
65
+ credentialType,
66
+ docNumber,
67
+ expirationTime = "2m",
68
+ }) => {
69
+ /**
70
+ * Check that the public key used to sign the trustmark is the one used for the WIA
71
+ */
72
+ const holderBindingKey = await wiaCryptoContext.getPublicKey();
73
+ const decodedWia = WalletInstanceAttestation.decode(
74
+ walletInstanceAttestation
75
+ );
76
+
77
+ Logger.log(
78
+ LogLevel.DEBUG,
79
+ `Decoded wia ${JSON.stringify(decodedWia.payload)} with holder binding key ${JSON.stringify(holderBindingKey)}`
80
+ );
81
+
82
+ /**
83
+ * Check that the WIA is not expired
84
+ */
85
+ if (decodedWia.payload.exp * 1000 < Date.now()) {
86
+ Logger.log(
87
+ LogLevel.ERROR,
88
+ `Wallet Instance Attestation expired with exp: ${decodedWia.payload.exp}`
89
+ );
90
+ throw new IoWalletError("Wallet Instance Attestation expired");
91
+ }
92
+
93
+ /**
94
+ * Verify holder binding by comparing thumbprints of the WIA and the CryptoContext key
95
+ */
96
+ const wiaThumbprint = await thumbprint(decodedWia.payload.cnf.jwk);
97
+ const cryptoContextThumbprint = await thumbprint(holderBindingKey);
98
+
99
+ if (wiaThumbprint !== cryptoContextThumbprint) {
100
+ Logger.log(
101
+ LogLevel.ERROR,
102
+ `Failed to verify holder binding for status attestation, expected thumbprint: ${cryptoContextThumbprint}, got: ${wiaThumbprint}`
103
+ );
104
+ throw new IoWalletError(
105
+ `Failed to verify holder binding for status attestation, expected thumbprint: ${cryptoContextThumbprint}, got: ${wiaThumbprint}`
106
+ );
107
+ }
108
+
109
+ Logger.log(
110
+ LogLevel.DEBUG,
111
+ `Wia thumbprint: ${wiaThumbprint} CryptoContext thumbprint: ${cryptoContextThumbprint}`
112
+ );
113
+
114
+ /**
115
+ * Generate Trustmark signed JWT
116
+ */
117
+ const signedTrustmarkJwt = await new SignJWT(wiaCryptoContext)
118
+ .setProtectedHeader({
119
+ alg: "ES256",
120
+ })
121
+ .setPayload({
122
+ iss: walletInstanceAttestation,
123
+ /**
124
+ * If present, the document number is obfuscated before adding it to the payload
125
+ */
126
+ ...(docNumber ? { sub: obfuscateString(docNumber) } : {}),
127
+ subtyp: credentialType,
128
+ })
129
+ .setIssuedAt()
130
+ .setExpirationTime(expirationTime)
131
+ .sign();
132
+
133
+ const decodedTrustmark = decodeJwt(signedTrustmarkJwt);
134
+
135
+ return {
136
+ jwt: signedTrustmarkJwt,
137
+ expirationTime: decodedTrustmark.payload.exp ?? 0,
138
+ };
139
+ };
@@ -0,0 +1,8 @@
1
+ import {
2
+ type GetCredentialTrustmarkJwt,
3
+ getCredentialTrustmark,
4
+ } from "./get-credential-trustmark";
5
+
6
+ export { getCredentialTrustmark };
7
+
8
+ export type { GetCredentialTrustmarkJwt };
package/src/index.ts CHANGED
@@ -9,7 +9,9 @@ import * as PID from "./pid";
9
9
  import * as SdJwt from "./sd-jwt";
10
10
  import * as Errors from "./utils/errors";
11
11
  import * as WalletInstanceAttestation from "./wallet-instance-attestation";
12
+ import * as Trust from "./trust";
12
13
  import * as WalletInstance from "./wallet-instance";
14
+ import * as Logging from "./utils/logging";
13
15
  import { AuthorizationDetail, AuthorizationDetails } from "./utils/par";
14
16
  import { createCryptoContextFor } from "./utils/crypto";
15
17
  import type { IntegrityContext } from "./utils/integrity";
@@ -21,10 +23,12 @@ export {
21
23
  WalletInstanceAttestation,
22
24
  WalletInstance,
23
25
  Errors,
26
+ Trust,
24
27
  createCryptoContextFor,
25
28
  AuthorizationDetail,
26
29
  AuthorizationDetails,
27
30
  fixBase64EncodingOnKey,
31
+ Logging,
28
32
  };
29
33
 
30
34
  export type { IntegrityContext, AuthorizationContext };
@@ -1,5 +1,22 @@
1
1
  import { z } from "zod";
2
- import { Verification } from "../../sd-jwt/types";
2
+
3
+ const VerificationEvidence = z.object({
4
+ type: z.string(),
5
+ record: z.object({
6
+ type: z.string(),
7
+ source: z.object({
8
+ organization_name: z.string(),
9
+ organization_id: z.string(),
10
+ country_code: z.string(),
11
+ }),
12
+ }),
13
+ });
14
+ type Verification = z.infer<typeof Verification>;
15
+ const Verification = z.object({
16
+ trustFramework: z.literal("eidas"),
17
+ assuranceLevel: z.string(),
18
+ evidence: z.array(VerificationEvidence),
19
+ });
3
20
 
4
21
  /**
5
22
  * Data structure for the PID.
@@ -13,73 +13,56 @@ import { SdJwt4VC } from "../types";
13
13
  // - "address" is used as verification._sd
14
14
  // - all others disclosures are in claims._sd
15
15
  const token =
16
- "eyJraWQiOiJvTHZHOHFGeGJZQ2RZRXBGNVdEeEJVYzM1THI1YTgwZ2FtbjZPeU5pSFRjIiwidHlwIjoidmMrc2Qtand0IiwiYWxnIjoiRVMyNTYifQ.eyJzdWI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oic2hhLTI1NiJ9fX0";
20
20
 
21
21
  const signature =
22
- "guNNpF6KeKSowT6WCYvslgaPQbTRhwgqxTdJMPwsBOEkh6A9X2FvU8RMJoalhwXLHLo72bE4-HCvXO803I98JQ";
22
+ "qXHA2oqr8trX4fGxpxpUft2GX380TM3pzfo1MYAsDjUC8HsODA-4rdRWAvDe2zYP57x4tJU7eiABkd1Kmln9yQ";
23
23
 
24
24
  const signed = `${unsigned}.${signature}`;
25
25
 
26
26
  const tokenizedDisclosures = [
27
- "WyItR0wxV1NiMnRWdTVTMDM4OXRFZW9nIiwiZ2l2ZW5fbmFtZSIsIk1BUklBIl0",
28
- "WyJqSHYzdEFQNTNyRGxSbXVsdlo0Z2hBIiwiZmFtaWx5X25hbWUiLCJTUEVDSU1FTiJd",
29
- "WyJiX3FtcnVBWTJkOEN5bk4yc0FPVm5nIiwidW5pcXVlX2lkIiwiaWRBTlBSIl0",
30
- "WyJGajhqZ055bUVXYk9OdFpHeGV0SFh3IiwiYmlydGhfZGF0ZSIsIjE5OTUtMDEtMTgiXQ",
31
- "WyI5aUs2UF9jY2UyY29QR1Q4b3d2TWxBIiwiYmlydGhfcGxhY2UiLCJST01BIl0",
32
- "WyJucGVfcHJyUWxHT0hMU19pbS1pNmNnIiwibmF0aW9uYWxpdHkiLCJJVCJd",
33
- "WyJrazlUVW9DQm9OZFd0VElpUWJValNBIiwidGF4X2lkX2NvZGUiLCJUSU5JVC1TUENNUkE5NUE1OEg1MDFUIl0",
34
- "WyJjclNLNDlpaWpiZTdSbFFLSXlvcmlRIiwiaWF0IiwxNzQ3NzQ3MTI1XQ",
27
+ "WyJrSkRFUDhFYU5URU1CRE9aelp6VDR3IiwidW5pcXVlX2lkIiwiVElOSVQtTFZMREFBODVUNTBHNzAyQiJd",
28
+ "WyJ6SUF5VUZ2UGZJcEUxekJxeEk1aGFRIiwiYmlydGhfZGF0ZSIsIjE5ODUtMTItMTAiXQ",
29
+ "WyJHcjNSM3MyOTBPa1FVbS1ORlR1OTZBIiwidGF4X2lkX2NvZGUiLCJUSU5JVC1MVkxEQUE4NVQ1MEc3MDJCIl0",
30
+ "WyJHeE9SYWxNQWVsZlowZWRGSmpqWVV3IiwiZ2l2ZW5fbmFtZSIsIkFkYSJd",
31
+ "WyJfdlY1UklrbDBJT0VYS290czlrdDF3IiwiZmFtaWx5X25hbWUiLCJMb3ZlbGFjZSJd",
32
+ "WyJDajV0Y2NSNzJKd3J6ZTJUVzRhLXdnIiwiaWF0IiwxNzIwMDEwNTc1XQ",
35
33
  ];
36
34
 
37
35
  const sdJwt = {
38
36
  header: {
39
- kid: "oLvG8qFxbYCdYEpF5WDxBUc35Lr5a80gamn6OyNiHTc",
37
+ kid: "-F_6Uga8n3VegjY2U7YUHK1zLoaD-NPTc63RMISnLaw",
40
38
  typ: "vc+sd-jwt",
41
39
  alg: "ES256",
42
40
  },
43
41
  payload: {
44
- sub: "ZLbdJnwBmqBK6iRjfefusjr0Y1I5HMu1IeqryMbFz4g",
45
- vct: "urn:eu.europa.ec.eudi:pid:1",
46
- expiry_date: "2026-05-20",
47
- iss: "https://api.potential-wallet-it-pid-provider.it",
48
42
  _sd: [
49
- "43enOLCLRvxlx92LnPiLN11LGyHV2mOSrrdLkT_NmRA",
50
- "GdsXb_K9dxyYlBwyBrYhIWUByRlWqFOHFUVgRwEfSv4",
51
- "Ihh3PTWmc4fMLCQYAQl7iyj4XctplFNKEZP5mAOAZj8",
52
- "MLtFKiUGsP8k1C17xXnVfXXwzhiPstzLxkgKZMtavuA",
53
- "Y19Oo4S_V6Dv6QpeOpRR-lN2iFxrtG1vZEUz1JW-B7c",
54
- "u-iX1wneKcksCzWzzTd9FoQ9QPch6XqKhAfC2DVrJOs",
55
- "wQTDzXpVi6iUkMrQol4WiZJpfHlKahf-K-lXf18FYuc",
56
- "xjg5MlJWp5jTimvXsivQRhLVqe8cSzadMZ60Hkk53js",
43
+ "0q1D5Jmav6pQaEh_J_Fcv_uNNMQIgCyhQOxqlY4l3qU",
44
+ "KCJ-AVNv88d-xj6sUIAOJxFnbUh3rHXDKkIH1lFqbRs",
45
+ "M9lo9YxDNIXrAq2qWeiCA40zpJ_zYfFdR_4AEALcRtU",
46
+ "czgjUk0nqRCswShChCjdS6A1-v47d_qTCSFIvIHhMoI",
47
+ "nGnQr7clm3tfTp8yjL_uHrDSOtzR2PVb8S7GeLdAqBQ",
48
+ "xNIVwlpSsaZ8CJSf0gz5x_75VRWWc6V1mlpejdCrqUs",
57
49
  ],
58
- "vct#integrity":
59
- "242302d97d38da2714a257f2a253bf2fa30aae5c109fe9581bfcda3b1d797c97",
60
- issuing_country: "IT",
50
+ sub: "216f8946-9ecb-4819-9309-c076f34a7e11",
61
51
  _sd_alg: "sha-256",
62
- issuing_authority: "Istituto Poligrafico e Zecca dello Stato",
52
+ vct: "PersonIdentificationData",
53
+ iss: "https://pre.eid.wallet.ipzs.it",
63
54
  cnf: {
64
55
  jwk: {
65
56
  kty: "EC",
66
57
  crv: "P-256",
67
- kid: "M0PbvdYsjVgrmkWM1_aZY2NsbdL_vmrH287yO43LquY",
68
- x: "_8pnIX6-tzXJAkCR6iavsCQPtinYbFIxr74F-6rTz2U",
69
- y: "RLxNwtr1g8Hrb5NShj1GbMWgHoQ-C70BOz4-SydDhFg",
58
+ kid: "Rv3W-EiKpvBTyk5yZxvrev-7MDB6SlzUCBo_CQjjddU",
59
+ x: "0Wox7QtyPqByg35MH_XyCcnd5Le-Jm0AXHlUgDBA03Y",
60
+ y: "eEhVvg1JPqNd3DTSa4mGDGBlwY6NP-EZbLbNFXSXwIg",
70
61
  },
71
62
  },
72
- exp: 1779283125,
73
- iat: 1747747125,
74
- verification: {
75
- evidence: {
76
- method: "cie",
77
- },
78
- trust_framework: "eidas",
79
- assurance_level: "high",
80
- },
63
+ exp: 1751546576,
81
64
  status: {
82
- status_assertion: {
65
+ status_attestation: {
83
66
  credential_hash_alg: "sha-256",
84
67
  },
85
68
  },
@@ -88,14 +71,12 @@ const sdJwt = {
88
71
 
89
72
  // In the very same order than tokenizedDisclosures
90
73
  const disclosures = [
91
- ["-GL1WSb2tVu5S0389tEeog", "given_name", "MARIA"],
92
- ["jHv3tAP53rDlRmulvZ4ghA", "family_name", "SPECIMEN"],
93
- ["b_qmruAY2d8CynN2sAOVng", "unique_id", "idANPR"],
94
- ["Fj8jgNymEWbONtZGxetHXw", "birth_date", "1995-01-18"],
95
- ["9iK6P_cce2coPGT8owvMlA", "birth_place", "ROMA"],
96
- ["npe_prrQlGOHLS_im-i6cg", "nationality", "IT"],
97
- ["kk9TUoCBoNdWtTIiQbUjSA", "tax_id_code", "TINIT-SPCMRA95A58H501T"],
98
- ["crSK49iijbe7RlQKIyoriQ", "iat", 1747747125],
74
+ ["kJDEP8EaNTEMBDOZzZzT4w", "unique_id", "TINIT-LVLDAA85T50G702B"],
75
+ ["zIAyUFvPfIpE1zBqxI5haQ", "birth_date", "1985-12-10"],
76
+ ["Gr3R3s290OkQUm-NFTu96A", "tax_id_code", "TINIT-LVLDAA85T50G702B"],
77
+ ["GxORalMAelfZ0edFJjjYUw", "given_name", "Ada"],
78
+ ["_vV5RIkl0IOEXKots9kt1w", "family_name", "Lovelace"],
79
+ ["Cj5tccR72Jwrze2TW4a-wg", "iat", 1720010575],
99
80
  ];
100
81
  it("Ensures example data correctness", () => {
101
82
  expect(
@@ -149,10 +130,10 @@ describe("decode", () => {
149
130
 
150
131
  describe("disclose", () => {
151
132
  it("should encode a valid sdjwt (one claim)", async () => {
152
- const result = await disclose(token, ["unique_id"]);
133
+ const result = await disclose(token, ["given_name"]);
153
134
  const expected = {
154
- token: `${signed}~WyJiX3FtcnVBWTJkOEN5bk4yc0FPVm5nIiwidW5pcXVlX2lkIiwiaWRBTlBSIl0`,
155
- paths: [{ claim: "unique_id", path: "verified_claims.claims._sd[7]" }],
135
+ token: `${signed}~WyJHeE9SYWxNQWVsZlowZWRGSmpqWVV3IiwiZ2l2ZW5fbmFtZSIsIkFkYSJd`,
136
+ paths: [{ claim: "given_name", path: "verified_claims.claims._sd[3]" }],
156
137
  };
157
138
 
158
139
  expect(result).toEqual(expected);
@@ -168,15 +149,15 @@ describe("disclose", () => {
168
149
  it("should encode a valid sdjwt (multiple claims)", async () => {
169
150
  const result = await disclose(token, ["iat", "family_name"]);
170
151
  const expected = {
171
- token: `${signed}~WyJqSHYzdEFQNTNyRGxSbXVsdlo0Z2hBIiwiZmFtaWx5X25hbWUiLCJTUEVDSU1FTiJd~WyJjclNLNDlpaWpiZTdSbFFLSXlvcmlRIiwiaWF0IiwxNzQ3NzQ3MTI1XQ`,
152
+ token: `${signed}~WyJfdlY1UklrbDBJT0VYS290czlrdDF3IiwiZmFtaWx5X25hbWUiLCJMb3ZlbGFjZSJd~WyJDajV0Y2NSNzJKd3J6ZTJUVzRhLXdnIiwiaWF0IiwxNzIwMDEwNTc1XQ`,
172
153
  paths: [
173
154
  {
174
155
  claim: "iat",
175
- path: "verified_claims.claims._sd[0]",
156
+ path: "verified_claims.claims._sd[4]",
176
157
  },
177
158
  {
178
159
  claim: "family_name",
179
- path: "verified_claims.claims._sd[5]",
160
+ path: "verified_claims.claims._sd[0]",
180
161
  },
181
162
  ],
182
163
  };