@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,4 +1,5 @@
1
1
  import { IoWalletError, serializeAttrs } from "../../utils/errors";
2
+ export { DcqlError } from "dcql";
2
3
 
3
4
  /**
4
5
  * An error subclass thrown when auth request decode fail
@@ -41,18 +42,32 @@ export class NoSuitableKeysFoundInEntityConfiguration extends IoWalletError {
41
42
  }
42
43
 
43
44
  /**
44
- * When the entity is unverified because the Relying Party is not trusted.
45
+ * When a QR code is not valid.
45
46
  *
46
47
  */
47
- export class UnverifiedEntityError extends IoWalletError {
48
- code = "ERR_UNVERIFIED_RP_ENTITY";
48
+ export class InvalidQRCodeError extends IoWalletError {
49
+ code = "ERR_INVALID_QR_CODE";
50
+
51
+ /** Detailed reason for the QR code validation failure. */
49
52
 
50
- /**
51
- * @param reason A description of why the entity cannot be verified.
52
- */
53
53
  constructor(reason) {
54
- const message = `Unverified entity: ${reason}.`;
54
+ super("Invalid QR code");
55
+ this.reason = reason;
56
+ }
57
+ }
58
+
59
+ /**
60
+ * When the Request Object sent by the Relying Party is not valid
61
+ */
62
+ export class InvalidRequestObjectError extends IoWalletError {
63
+ code = "ERR_INVALID_REQUEST_OBJECT";
64
+
65
+ /** Detailed reason for the Request Object validation failure. */
66
+
67
+ constructor(message) {
68
+ let reason = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "unspecified";
55
69
  super(message);
70
+ this.reason = reason;
56
71
  }
57
72
  }
58
73
 
@@ -71,20 +86,18 @@ export class MissingDataError extends IoWalletError {
71
86
  super(message);
72
87
  }
73
88
  }
74
-
75
89
  /**
76
- * When a credential is not found in the wallet.
77
- *
90
+ * Error thrown when one or more credentials cannot be found in the wallet
91
+ * and the presentation request cannot be satisfied.
78
92
  */
79
- export class CredentialNotFoundError extends IoWalletError {
80
- code = "ERR_CREDENTIAL_NOT_FOUND";
81
-
93
+ export class CredentialsNotFoundError extends IoWalletError {
94
+ code = "ERR_CREDENTIALS_NOT_FOUND";
82
95
  /**
83
- * @param credentialId The ID of the credential that was not found.
96
+ * @param details The details of the credentials that could not be found.
84
97
  */
85
- constructor(credentialId) {
86
- const message = `Credential not found: ${credentialId}.`;
87
- super(message);
98
+ constructor(details) {
99
+ super("One or more credentials cannot be found in the wallet");
100
+ this.details = details;
88
101
  }
89
102
  }
90
103
  //# sourceMappingURL=errors.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["IoWalletError","serializeAttrs","AuthRequestDecodeError","code","constructor","message","claim","arguments","length","undefined","reason","NoSuitableKeysFoundInEntityConfiguration","scenario","UnverifiedEntityError","MissingDataError","missingAttributes","CredentialNotFoundError","credentialId"],"sourceRoot":"../../../../src","sources":["credential/presentation/errors.ts"],"mappings":"AAAA,SAASA,aAAa,EAAEC,cAAc,QAAQ,oBAAoB;;AAElE;AACA;AACA;AACA;AACA,OAAO,MAAMC,sBAAsB,SAASF,aAAa,CAAC;EACxDG,IAAI,GAAG,oDAAoD;;EAE3D;;EAGA;;EAGAC,WAAWA,CACTC,OAAe,EAGf;IAAA,IAFAC,KAAa,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,aAAa;IAAA,IAC7BG,MAAc,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,aAAa;IAE9B,KAAK,CAACN,cAAc,CAAC;MAAEI,OAAO;MAAEC,KAAK;MAAEI;IAAO,CAAC,CAAC,CAAC;IACjD,IAAI,CAACJ,KAAK,GAAGA,KAAK;IAClB,IAAI,CAACI,MAAM,GAAGA,MAAM;EACtB;AACF;;AAEA;AACA;AACA;AACA;AACA,OAAO,MAAMC,wCAAwC,SAASX,aAAa,CAAC;EAC1EG,IAAI,GAAG,gCAAgC;;EAEvC;AACF;AACA;EACEC,WAAWA,CAACQ,QAAgB,EAAE;IAC5B,MAAMP,OAAO,GAAI,0DAAyDO,QAAS,IAAG;IACtF,KAAK,CAACP,OAAO,CAAC;EAChB;AACF;;AAEA;AACA;AACA;AACA;AACA,OAAO,MAAMQ,qBAAqB,SAASb,aAAa,CAAC;EACvDG,IAAI,GAAG,0BAA0B;;EAEjC;AACF;AACA;EACEC,WAAWA,CAACM,MAAc,EAAE;IAC1B,MAAML,OAAO,GAAI,sBAAqBK,MAAO,GAAE;IAC/C,KAAK,CAACL,OAAO,CAAC;EAChB;AACF;;AAEA;AACA;AACA;AACA;AACA,OAAO,MAAMS,gBAAgB,SAASd,aAAa,CAAC;EAClDG,IAAI,GAAG,kBAAkB;;EAEzB;AACF;AACA;EACEC,WAAWA,CAACW,iBAAyB,EAAE;IACrC,MAAMV,OAAO,GAAI,kCAAiCU,iBAAkB,GAAE;IACtE,KAAK,CAACV,OAAO,CAAC;EAChB;AACF;;AAEA;AACA;AACA;AACA;AACA,OAAO,MAAMW,uBAAuB,SAAShB,aAAa,CAAC;EACzDG,IAAI,GAAG,0BAA0B;;EAEjC;AACF;AACA;EACEC,WAAWA,CAACa,YAAoB,EAAE;IAChC,MAAMZ,OAAO,GAAI,yBAAwBY,YAAa,GAAE;IACxD,KAAK,CAACZ,OAAO,CAAC;EAChB;AACF"}
1
+ {"version":3,"names":["IoWalletError","serializeAttrs","DcqlError","AuthRequestDecodeError","code","constructor","message","claim","arguments","length","undefined","reason","NoSuitableKeysFoundInEntityConfiguration","scenario","InvalidQRCodeError","InvalidRequestObjectError","MissingDataError","missingAttributes","CredentialsNotFoundError","details"],"sourceRoot":"../../../../src","sources":["credential/presentation/errors.ts"],"mappings":"AAAA,SAASA,aAAa,EAAEC,cAAc,QAAQ,oBAAoB;AAClE,SAASC,SAAS,QAAQ,MAAM;;AAEhC;AACA;AACA;AACA;AACA,OAAO,MAAMC,sBAAsB,SAASH,aAAa,CAAC;EACxDI,IAAI,GAAG,oDAAoD;;EAE3D;;EAGA;;EAGAC,WAAWA,CACTC,OAAe,EAGf;IAAA,IAFAC,KAAa,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,aAAa;IAAA,IAC7BG,MAAc,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,aAAa;IAE9B,KAAK,CAACP,cAAc,CAAC;MAAEK,OAAO;MAAEC,KAAK;MAAEI;IAAO,CAAC,CAAC,CAAC;IACjD,IAAI,CAACJ,KAAK,GAAGA,KAAK;IAClB,IAAI,CAACI,MAAM,GAAGA,MAAM;EACtB;AACF;;AAEA;AACA;AACA;A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1
1
  import { startFlowFromQR } from "./01-start-flow";
2
2
  import { evaluateRelyingPartyTrust } from "./02-evaluate-rp-trust";
3
3
  import { getRequestObject } from "./03-get-request-object";
4
- import { fetchJwksFromRequestObject, fetchJwksFromConfig } from "./04-retrieve-rp-jwks";
5
- import { verifyRequestObjectSignature } from "./05-verify-request-object";
4
+ import { getJwksFromConfig } from "./04-retrieve-rp-jwks";
5
+ import { verifyRequestObject } from "./05-verify-request-object";
6
6
  import { fetchPresentDefinition } from "./06-fetch-presentation-definition";
7
- import { evaluateInputDescriptors } from "./07-evaluate-input-descriptor";
8
- import { evaluateDcqlQuery } from "./07-evaluate-dcql-query";
9
- import { prepareRemotePresentations, sendAuthorizationResponse, sendAuthorizationErrorResponse, sendAuthorizationResponseDcql } from "./08-send-authorization-response";
7
+ import { evaluateInputDescriptors, prepareLegacyRemotePresentations } from "./07-evaluate-input-descriptor";
8
+ import { evaluateDcqlQuery, prepareRemotePresentations } from "./07-evaluate-dcql-query";
9
+ import { sendAuthorizationResponse, sendLegacyAuthorizationResponse, sendAuthorizationErrorResponse } from "./08-send-authorization-response";
10
10
  import * as Errors from "./errors";
11
- export { startFlowFromQR, evaluateRelyingPartyTrust, getRequestObject, fetchJwksFromRequestObject, fetchJwksFromConfig, verifyRequestObjectSignature, fetchPresentDefinition, evaluateInputDescriptors, evaluateDcqlQuery, sendAuthorizationResponse, sendAuthorizationErrorResponse, sendAuthorizationResponseDcql, prepareRemotePresentations, Errors };
11
+ export { startFlowFromQR, evaluateRelyingPartyTrust, getRequestObject, getJwksFromConfig, verifyRequestObject, fetchPresentDefinition, evaluateInputDescriptors, evaluateDcqlQuery, prepareLegacyRemotePresentations, prepareRemotePresentations, sendAuthorizationResponse, sendLegacyAuthorizationResponse, sendAuthorizationErrorResponse, Errors };
12
12
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["startFlowFromQR","evaluateRelyingPartyTrust","getRequestObject","fetchJwksFromRequestObject","fetchJwksFromConfig","verifyRequestObjectSignature","fetchPresentDefinition","evaluateInputDescriptors","evaluateDcqlQuery","prepareRemotePresentations","sendAuthorizationResponse","sendAuthorizationErrorResponse","sendAuthorizationResponseDcql","Errors"],"sourceRoot":"../../../../src","sources":["credential/presentation/index.ts"],"mappings":"AAAA,SAASA,eAAe,QAAwB,iBAAiB;AACjE,SACEC,yBAAyB,QAEpB,wBAAwB;AAC/B,SACEC,gBAAgB,QAEX,yBAAyB;AAChC,SACEC,0BAA0B,EAC1BC,mBAAmB,QAEd,uBAAuB;AAC9B,SACEC,4BAA4B,QAEvB,4BAA4B;AACnC,SACEC,sBAAsB,QAEjB,oCAAoC;AAC3C,SACEC,wBAAwB,QAEnB,gCAAgC;AACvC,SACEC,iBAAiB,QAEZ,0BAA0B;AACjC,SACEC,0BAA0B,EAC1BC,yBAAyB,EAEzBC,8BAA8B,EAE9BC,6BAA6B,QAExB,kCAAkC;AACzC,OAAO,KAAKC,MAAM,MAAM,UAAU;AAGlC,SACEb,eAAe,EACfC,yBAAyB,EACzBC,gBAAgB,EAChBC,0BAA0B,EAC1BC,mBAAmB,EACnBC,4BAA4B,EAC5BC,sBAAsB,EACtBC,wBAAwB,EACxBC,iBAAiB,EACjBE,yBAAyB,EACzBC,8BAA8B,EAC9BC,6BAA6B,EAC7BH,0BAA0B,EAC1BI,MAAM"}
1
+ {"version":3,"names":["startFlowFromQR","evaluateRelyingPartyTrust","getRequestObject","getJwksFromConfig","verifyRequestObject","fetchPresentDefinition","evaluateInputDescriptors","prepareLegacyRemotePresentations","evaluateDcqlQuery","prepareRemotePresentations","sendAuthorizationResponse","sendLegacyAuthorizationResponse","sendAuthorizationErrorResponse","Errors"],"sourceRoot":"../../../../src","sources":["credential/presentation/index.ts"],"mappings":"AAAA,SAASA,eAAe,QAAwB,iBAAiB;AACjE,SACEC,yBAAyB,QAEpB,wBAAwB;AAC/B,SACEC,gBAAgB,QAEX,yBAAyB;AAChC,SAASC,iBAAiB,QAAwB,uBAAuB;AACzE,SACEC,mBAAmB,QAEd,4BAA4B;AACnC,SACEC,sBAAsB,QAEjB,oCAAoC;AAC3C,SACEC,wBAAwB,EACxBC,gCAAgC,QAG3B,gCAAgC;AACvC,SACEC,iBAAiB,EACjBC,0BAA0B,QAGrB,0BAA0B;AACjC,SACEC,yBAAyB,EAEzBC,+BAA+B,EAE/BC,8BAA8B,QAEzB,kCAAkC;AACzC,OAAO,KAAKC,MAAM,MAAM,UAAU;AAElC,SACEb,eAAe,EACfC,yBAAyB,EACzBC,gBAAgB,EAChBC,iBAAiB,EACjBC,mBAAmB,EACnBC,sBAAsB,EACtBC,wBAAwB,EACxBE,iBAAiB,EACjBD,gCAAgC,EAChCE,0BAA0B,EAC1BC,yBAAyB,EACzBC,+BAA+B,EAC/BC,8BAA8B,EAC9BC,MAAM"}
@@ -1,6 +1,5 @@
1
1
  import { UnixTime } from "../../sd-jwt/types";
2
2
  import * as z from "zod";
3
- import { JWKS } from "../../utils/jwk";
4
3
 
5
4
  /**
6
5
  * A pair that associate a tokenized Verified Credential with the claims presented or requested to present.
@@ -8,6 +7,13 @@ import { JWKS } from "../../utils/jwk";
8
7
 
9
8
  /**
10
9
  * A object that associate the information needed to multiple remote presentation
10
+ * Used with `presentation_definition`
11
+ * @deprecated Use `RemotePresentation`
12
+ */
13
+
14
+ /**
15
+ * A object that associate the information needed to multiple remote presentation
16
+ * Used with DCQL queries
11
17
  */
12
18
 
13
19
  const Fields = z.object({
@@ -74,51 +80,67 @@ export const PresentationDefinition = z.object({
74
80
  submission_requirements: z.array(SubmissionRequirement).optional()
75
81
  });
76
82
  export const RequestObject = z.object({
77
- iss: z.string().optional(),
78
- //optional by RFC 7519, mandatory for Potential
79
- iat: UnixTime.optional(),
80
- exp: UnixTime.optional(),
83
+ iss: z.string(),
84
+ iat: UnixTime,
85
+ exp: UnixTime,
81
86
  state: z.string().optional(),
82
87
  nonce: z.string(),
83
88
  response_uri: z.string(),
89
+ response_uri_method: z.string().optional(),
84
90
  response_type: z.literal("vp_token"),
85
- response_mode: z.enum(["direct_post.jwt", "direct_post"]),
91
+ response_mode: z.literal("direct_post.jwt"),
86
92
  client_id: z.string(),
87
- client_id_scheme: z.string().optional(),
88
- // previous z.literal("entity_id"),
89
- client_metadata: z.object({
90
- authorization_encrypted_response_alg: z.string().optional(),
91
- authorization_encrypted_response_enc: z.string().optional(),
92
- jwks_uri: z.string().optional(),
93
- jwks: JWKS.optional()
94
- }).optional(),
95
- // previous z.literal("entity_id"),
96
93
  dcql_query: z.record(z.string(), z.any()).optional(),
97
94
  // Validation happens within the `dcql` library, no need to duplicate it here
98
95
  scope: z.string().optional(),
99
96
  presentation_definition: PresentationDefinition.optional()
100
97
  });
98
+ export const WalletMetadata = z.object({
99
+ presentation_definition_uri_supported: z.boolean().optional(),
100
+ client_id_schemes_supported: z.array(z.string()).optional(),
101
+ request_object_signing_alg_values_supported: z.array(z.string()).optional(),
102
+ vp_formats_supported: z.record(z.string(),
103
+ // TODO [SIW-2110]: use explicit credential format?
104
+ z.object({
105
+ "sd-jwt_alg_values": z.array(z.string()).optional() // alg_values_supported?
106
+ }))
107
+ // TODO [SIW-2110]: include other metadata?
108
+ });
109
+
110
+ /**
111
+ * Wallet capabilities that must be submitted to get the Request Object
112
+ * via POST request when the `request_uri_method` is `post`.
113
+ */
114
+
115
+ export const RequestObjectWalletCapabilities = z.object({
116
+ wallet_metadata: WalletMetadata,
117
+ wallet_nonce: z.string().optional()
118
+ });
101
119
 
102
120
  /**
103
121
  * This type models the possible error responses the OpenID4VP protocol allows for a presentation of a credential.
104
- * See https://openid.github.io/OpenID4VP/openid-4-verifiable-presentations-wg-draft.html#name-error-response for more information.
122
+ * When the Wallet encounters one of these errors, it will notify the Relying Party through the `response_uri` endpoint.
123
+ * See https://italia.github.io/eid-wallet-it-docs/versione-corrente/en/pid-eaa-presentation.html#authorization-response-errors for more information.
105
124
  */
106
125
 
107
- export const ErrorResponse = z.enum(["invalid_scope", "invalid_request", "invalid_client", "access_denied"]);
126
+ export const ErrorResponse = z.enum(["invalid_request_object", "invalid_request_uri", "vp_formats_not_supported", "invalid_request", "access_denied", "invalid_client"]);
127
+
128
+ /**
129
+ * @deprecated Use `DirectAuthorizationBodyPayload`
130
+ */
131
+ const LegacyDirectAuthorizationBodyPayload = z.object({
132
+ vp_token: z.union([z.string(), z.array(z.string())]).optional(),
133
+ presentation_submission: z.record(z.string(), z.unknown())
134
+ });
108
135
 
109
136
  /**
110
- * Type that defines the possible payload formats accepted by {@link buildDirectPostJwtBody} and {@link buildDirectPostBody}
137
+ * Authorization Response payload sent to the Relying Party.
111
138
  */
112
139
 
113
140
  export const DirectAuthorizationBodyPayload = z.union([z.object({
114
- vp_token: z.union([z.string(),
115
- // Presentation Definition with one credential
116
- z.array(z.string()),
117
- // Presentation Definition with more credential
118
- z.record(z.string(), z.string()) // DCQL query
119
- ]).optional(),
120
- presentation_submission: z.record(z.string(), z.unknown()).optional()
141
+ vp_token: z.record(z.string(), z.string())
121
142
  }), z.object({
122
- error: ErrorResponse
123
- })]);
143
+ error: ErrorResponse,
144
+ error_description: z.string()
145
+ }), LegacyDirectAuthorizationBodyPayload]);
124
146
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["UnixTime","z","JWKS","Fields","object","path","array","string","min","id","optional","purpose","name","filter","any","boolean","intent_to_retain","Constraints","fields","limit_disclosure","enum","InputDescriptor","format","record","constraints","group","SubmissionRequirement","rule","from","from_nested","count","number","PresentationDefinition","input_descriptors","submission_requirements","RequestObject","iss","iat","exp","state","nonce","response_uri","response_type","literal","response_mode","client_id","client_id_scheme","client_metadata","authorization_encrypted_response_alg","authorization_encrypted_response_enc","jwks_uri","jwks","dcql_query","scope","presentation_definition","ErrorResponse","DirectAuthorizationBodyPayload","union","vp_token","presentation_submission","unknown","error"],"sourceRoot":"../../../../src","sources":["credential/presentation/types.ts"],"mappings":"AACA,SAASA,QAAQ,QAAQ,oBAAoB;AAC7C,OAAO,KAAKC,CAAC,MAAM,KAAK;A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AC,CAACsB,MAAM,CAACtB,CAAC,CAACM,MAAM,CAAC,CAAC,EAAEN,CAAC,CAAC2D,OAAO,CAAC,CAAC,CAAC,CAAClD,QAAQ,CAAC;AACtE,CAAC,CAAC,EACFT,CAAC,CAACG,MAAM,CAAC;EAAEyD,KAAK,EAAEN;AAAc,CAAC,CAAC,CACnC,CAAC"}
1
+ {"version":3,"names":["UnixTime","z","Fields","object","path","array","string","min","id","optional","purpose","name","filter","any","boolean","intent_to_retain","Constraints","fields","limit_disclosure","enum","InputDescriptor","format","record","constraints","group","SubmissionRequirement","rule","from","from_nested","count","number","PresentationDefinition","input_descriptors","submission_requirements","RequestObject","iss","iat","exp","state","nonce","response_uri","response_uri_method","response_type","literal","response_mode","client_id","dcql_query","scope","presentation_definition","WalletMetadata","presentation_definition_uri_supported","client_id_schemes_supported","request_object_signing_alg_values_supported","vp_formats_supported","RequestObjectWalletCapabilities","wallet_metadata","wallet_nonce","ErrorResponse","LegacyDirectAuthorizationBodyPayload","vp_token","union","presentation_submission","unknown","DirectAuthorizationBodyPayload","error","error_description"],"sourceRoot":"../../../../src","sources":["credential/presentation/types.ts"],"mappings":"AACA,SAASA,QAAQ,QAAQ,oBAAoB;AAC7C,OAAO,KAAKC,CAAC,MAAM,KAAK;;AAExB;AACA;AACA;;AAOA;AACA;AACA;AACA;AACA;;AAQA;AACA;AACA;AACA;;AAQA,MAAMC,MAAM,GAAGD,CAAC,CAACE,MAAM,CAAC;EACtBC,IAAI,EAAEH,CAAC,CAACI,KAAK,CAACJ,CAAC,CAACK,MAAM,CAAC,CAAC,CAACC,GAAG,CAAC,CAAC,CAAC,CAAC;EAAE;EAClCC,EAAE,EAAEP,CAAC,CAACK,MAAM,CAAC,CAAC,CAACG,QAAQ,CAAC,CAAC;EAAE;EAC3BC,OAAO,EAAET,CAAC,CAACK,MAAM,CAAC,CAAC,CAACG,QAAQ,CAAC,CAAC;EAAE;EAChCE,IAAI,EAAEV,CAAC,CAACK,MAAM,CAAC,CAAC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E1D,CAAC,CAACqB,MAAM,CAACrB,CAAC,CAACK,MAAM,CAAC,CAAC,EAAEL,CAAC,CAACK,MAAM,CAAC,CAAC;AAC3C,CAAC,CAAC,EACFL,CAAC,CAACE,MAAM,CAAC;EAAE6D,KAAK,EAAEP,aAAa;EAAEQ,iBAAiB,EAAEhE,CAAC,CAACK,MAAM,CAAC;AAAE,CAAC,CAAC,EACjEoD,oCAAoC,CACrC,CAAC"}
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=01-start-flow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../../src","sources":["credential/status/01-start-flow.ts"],"mappings":""}
@@ -0,0 +1,66 @@
1
+ import { getCredentialHashWithouDiscloures, hasStatusOrThrow } from "../../utils/misc";
2
+ import { SignJWT } from "@pagopa/io-react-native-jwt";
3
+ import { v4 as uuidv4 } from "uuid";
4
+ import { StatusAttestationResponse } from "./types";
5
+ import { IssuerResponseError, IssuerResponseErrorCodes, ResponseErrorBuilder, UnexpectedStatusCodeError } from "../../utils/errors";
6
+ import { LogLevel, Logger } from "../../utils/logging";
7
+ /**
8
+ * WARNING: This function must be called after {@link startFlow}.
9
+ * Verify the status of the credential attestation.
10
+ * @param issuerConf - The issuer's configuration
11
+ * @param credential - The credential to be verified
12
+ * @param credentialCryptoContext - The credential's crypto context
13
+ * @param context.appFetch (optional) fetch api implementation. Default: built-in fetch
14
+ * @throws {IssuerResponseError} with a specific code for more context
15
+ * @returns The credential status attestation
16
+ */
17
+ export const statusAttestation = async function (issuerConf, credential, credentialCryptoContext) {
18
+ let appFetch = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : fetch;
19
+ const jwk = await credentialCryptoContext.getPublicKey();
20
+ const credentialHash = await getCredentialHashWithouDiscloures(credential);
21
+ const statusAttUrl = issuerConf.openid_credential_issuer.status_attestation_endpoint;
22
+ const credentialPop = await new SignJWT(credentialCryptoContext).setPayload({
23
+ aud: statusAttUrl,
24
+ jti: uuidv4().toString(),
25
+ credential_hash: credentialHash,
26
+ credential_hash_alg: "S256"
27
+ }).setProtectedHeader({
28
+ alg: "ES256",
29
+ typ: "status-attestation-request+jwt",
30
+ kid: jwk.kid
31
+ }).setIssuedAt().setExpirationTime("5m").sign();
32
+ const body = {
33
+ credential_pop: credentialPop
34
+ };
35
+ Logger.log(LogLevel.DEBUG, `Credential pop: ${credentialPop}`);
36
+ const result = await appFetch(statusAttUrl, {
37
+ method: "POST",
38
+ headers: {
39
+ "Content-Type": "application/json"
40
+ },
41
+ body: JSON.stringify(body)
42
+ }).then(hasStatusOrThrow(201)).then(raw => raw.json()).then(json => StatusAttestationResponse.parse(json)).catch(handleStatusAttestationError);
43
+ return {
44
+ statusAttestation: result.status_attestation
45
+ };
46
+ };
47
+
48
+ /**
49
+ * Handle the status attestation error by mapping it to a custom exception.
50
+ * If the error is not an instance of {@link UnexpectedStatusCodeError}, it is thrown as is.
51
+ * @param e - The error to be handled
52
+ * @throws {IssuerResponseError} with a specific code for more context
53
+ */
54
+ const handleStatusAttestationError = e => {
55
+ if (!(e instanceof UnexpectedStatusCodeError)) {
56
+ throw e;
57
+ }
58
+ throw new ResponseErrorBuilder(IssuerResponseError).handle(404, {
59
+ code: IssuerResponseErrorCodes.CredentialInvalidStatus,
60
+ message: "Invalid status found for the given credential"
61
+ }).handle("*", {
62
+ code: IssuerResponseErrorCodes.StatusAttestationRequestFailed,
63
+ message: `Unable to obtain the status attestation for the given credential`
64
+ }).buildFrom(e);
65
+ };
66
+ //# sourceMappingURL=02-status-attestation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["getCredentialHashWithouDiscloures","hasStatusOrThrow","SignJWT","v4","uuidv4","StatusAttestationResponse","IssuerResponseError","IssuerResponseErrorCodes","ResponseErrorBuilder","UnexpectedStatusCodeError","LogLevel","Logger","statusAttestation","issuerConf","credential","credentialCryptoContext","appFetch","arguments","length","undefined","fetch","jwk","getPublicKey","credentialHash","statusAttUrl","openid_credential_issuer","status_attestation_endpoint","credentialPop","setPayload","aud","jti","toString","credential_hash","credential_hash_alg","setProtectedHeader","alg","typ","kid","setIssuedAt","setExpirationTime","sign","body","credential_pop","log","DEBUG","result","method","headers","JSON","stringify","then","raw","json","parse","catch","handleStatusAttestationError","status_attestation","e","handle","code","CredentialInvalidStatus","message","StatusAttestationRequestFailed","buildFrom"],"sourceRoot":"../../../../src","sources":["credential/status/02-status-attestation.ts"],"mappings":"AAAA,SACEA,iCAAiC,EACjCC,gBAAgB,QAEX,kBAAkB;AAEzB,SAA6BC,OAAO,QAAQ,6BAA6B;AACzE,SAASC,EAAE,IAAIC,MAAM,QAAQ,MAAM;AACnC,SAASC,yBAAyB,QAAQ,SAAS;AACnD,SACEC,mBAAmB,EACnBC,wBAAwB,EACxBC,oBAAoB,EACpBC,yBAAyB,QACpB,oBAAoB;AAC3B,SAASC,QAAQ,EAAEC,MAAM,QAAQ,qBAAqB;AAWtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,iBAAoC,GAAG,eAAAA,CAClDC,UAAU,EACVC,UAAU,EACVC,uBAAuB,EAEpB;EAAA,IADHC,QAA8B,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGG,KAAK;EAEtC,MAAMC,GAAG,GAAG,MAAMN,uBAAuB,CAACO,YAAY,CAAC,CAAC;EACxD,MAAMC,cAAc,GAAG,MAAMvB,iCAAiC,CAACc,UAAU,CAAC;EAC1E,MAAMU,YAAY,GAChBX,UAAU,CAACY,wBAAwB,CAACC,2BAA2B;EACjE,MAAMC,aAAa,GAAG,MAAM,IAAIzB,OAAO,CAACa,uBAAuB,CAAC,CAC7Da,UAAU,CAAC;IACVC,GAAG,EAAEL,YAAY;IACjBM,GAAG,EAAE1B,MAAM,CAAC,CAAC,CAAC2B,QAAQ,CAAC,CAAC;IACxBC,eAAe,EAAET,cAAc;IAC/BU,mBAAmB,EAAE;EACvB,CAAC,CA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AEpD,wBAAwB,CAACuD,8BAA8B;IAC7DD,OAAO,EAAG;EACZ,CAAC,CAAC,CACDE,SAAS,CAACN,CAAC,CAAC;AACjB,CAAC"}
@@ -0,0 +1,49 @@
1
+ import { IoWalletError } from "../../utils/errors";
2
+ import { verify } from "@pagopa/io-react-native-jwt";
3
+ import { ParsedStatusAttestation } from "./types";
4
+ import { decode as decodeJwt } from "@pagopa/io-react-native-jwt";
5
+ import { LogLevel, Logger } from "../../utils/logging";
6
+ /**
7
+ * Given a status attestation, verifies that:
8
+ * - It's in the supported format;
9
+ * - The attestation is correctly signed;
10
+ * - It's bound to the given key.
11
+ * @param issuerConf The Issuer configuration returned by {@link evaluateIssuerTrust}
12
+ * @param statusAttestation The encoded status attestation returned by {@link statusAttestation}
13
+ * @param context.credentialCryptoContext The crypto context used to obtain the credential in {@link obtainCredential}
14
+ * @returns A parsed status attestation
15
+ * @throws {IoWalletError} If the credential signature is not verified with the Issuer key set
16
+ * @throws {IoWalletError} If the credential is not bound to the provided user key
17
+ * @throws {IoWalletError} If the credential data fail to parse
18
+ */
19
+ export const verifyAndParseStatusAttestation = async (issuerConf, rawStatusAttestation, context) => {
20
+ try {
21
+ const {
22
+ statusAttestation
23
+ } = rawStatusAttestation;
24
+ const {
25
+ credentialCryptoContext
26
+ } = context;
27
+ await verify(statusAttestation, issuerConf.openid_credential_issuer.jwks.keys);
28
+ const decodedJwt = decodeJwt(statusAttestation);
29
+ const parsedStatusAttestation = ParsedStatusAttestation.parse({
30
+ header: decodedJwt.protectedHeader,
31
+ payload: decodedJwt.payload
32
+ });
33
+ Logger.log(LogLevel.DEBUG, `Parsed status attestation: ${JSON.stringify(parsedStatusAttestation)}`);
34
+ const holderBindingKey = await credentialCryptoContext.getPublicKey();
35
+ const {
36
+ cnf
37
+ } = parsedStatusAttestation.payload;
38
+ if (!cnf.jwk.kid || cnf.jwk.kid !== holderBindingKey.kid) {
39
+ Logger.log(LogLevel.ERROR, `Failed to verify holder binding for status attestation, expected kid: ${holderBindingKey.kid}, got: ${parsedStatusAttestation.payload.cnf.jwk.kid}`);
40
+ throw new IoWalletError(`Failed to verify holder binding for status attestation, expected kid: ${holderBindingKey.kid}, got: ${parsedStatusAttestation.payload.cnf.jwk.kid}`);
41
+ }
42
+ return {
43
+ parsedStatusAttestation
44
+ };
45
+ } catch (e) {
46
+ throw new IoWalletError(`Failed to verify status attestation: ${JSON.stringify(e)}`);
47
+ }
48
+ };
49
+ //# sourceMappingURL=03-verify-and-parse-status-attestation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["IoWalletError","verify","ParsedStatusAttestation","decode","decodeJwt","LogLevel","Logger","verifyAndParseStatusAttestation","issuerConf","rawStatusAttestation","context","statusAttestation","credentialCryptoContext","openid_credential_issuer","jwks","keys","decodedJwt","parsedStatusAttestation","parse","header","protectedHeader","payload","log","DEBUG","JSON","stringify","holderBindingKey","getPublicKey","cnf","jwk","kid","ERROR","e"],"sourceRoot":"../../../../src","sources":["credential/status/03-verify-and-parse-status-attestation.ts"],"mappings":"AACA,SAASA,aAAa,QAAQ,oBAAoB;AAClD,SAASC,MAAM,QAA4B,6BAA6B;AAExE,SAASC,uBAAuB,QAAQ,SAAS;AACjD,SAASC,MAAM,IAAIC,SAAS,QAAQ,6BAA6B;AACjE,SAASC,QAAQ,EAAEC,MAAM,QAAQ,qBAAqB;AAUtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,+BAAgE,GAC3E,MAAAA,CAAOC,UAAU,EAAEC,oBAAoB,EAAEC,OAAO,KAAK;EACnD,IAAI;IACF,MAAM;MAAEC;IAAkB,CAAC,GAAGF,oBAAoB;IAClD,MAAM;MAAEG;IAAwB,CAAC,GAAGF,OAAO;IAE3C,MAAMT,MAAM,CACVU,iBAAiB,EACjBH,UAAU,CAACK,wBAAwB,CAACC,IAAI,CAACC,IAC3C,CAAC;IAED,MAAMC,UAAU,GAAGZ,SAAS,CAACO,iBAAiB,CAAC;IAC/C,MAAMM,uBAAuB,GAAGf,uBAAuB,CAACgB,KAAK,CAAC;MAC5DC,MAAM,EAAEH,UAAU,CAACI,eAAe;MAClCC,OAAO,EAAEL,UAAU,CAACK;IACtB,CAAC,CAAC;IAEFf,MAAM,CAACgB,GAAG,CACRjB,QAAQ,CAACkB,KAAK,EACb,8BAA6BC,IAAI,CAACC,SAAS,CAACR,uBAAuB,CAAE,EACxE,CAAC;IAED,MAAMS,gBAAgB,GAAG,MAAMd,uBAAuB,CAACe,YAAY,CAAC,CAAC;IACrE,MAAM;MAAEC;IAAI,CAAC,GAAGX,uBAAuB,CAACI,OAAO;IAC/C,IAAI,CAACO,GAAG,CAACC,GAAG,CAACC,GAAG,IAAIF,GAAG,CAACC,GAAG,CAACC,GAAG,KAAKJ,gBAAgB,CAACI,GAAG,EAAE;MACxDxB,MAAM,CAACgB,GAAG,CACRjB,QAAQ,CAAC0B,KAAK,EACb,yEAAwEL,gBAAgB,CAACI,GAAI,UAASb,uBAAuB,CAACI,OAAO,CAACO,GAAG,CAACC,GAAG,CAACC,GAAI,EACrJ,CAAC;MACD,MAAM,IAAI9B,aAAa,CACpB,yEAAwE0B,gBAAgB,CAACI,GAAI,UAASb,uBAAuB,CAACI,OAAO,CAACO,GAAG,CAACC,GAAG,CAACC,GAAI,EACrJ,CAAC;IACH;IAEA,OAAO;MAAEb;IAAwB,CAAC;EACpC,CAAC,CAAC,OAAOe,CAAC,EAAE;IACV,MAAM,IAAIhC,aAAa,CACpB,wCAAuCwB,IAAI,CAACC,SAAS,CAACO,CAAC,CAAE,EAC5D,CAAC;EACH;AACF,CAAC"}
@@ -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,5 @@
1
+ import { statusAttestation } from "./02-status-attestation";
2
+ import { evaluateIssuerTrust } from "../issuance";
3
+ import { verifyAndParseStatusAttestation } from "./03-verify-and-parse-status-attestation";
4
+ export { evaluateIssuerTrust, statusAttestation, verifyAndParseStatusAttestation };
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["statusAttestation","evaluateIssuerTrust","verifyAndParseStatusAttestation"],"sourceRoot":"../../../../src","sources":["credential/status/index.ts"],"mappings":"AACA,SACEA,iBAAiB,QAEZ,yBAAyB;AAChC,SAASC,mBAAmB,QAAkC,aAAa;AAC3E,SACEC,+BAA+B,QAE1B,0CAA0C;AAEjD,SACED,mBAAmB,EACnBD,iBAAiB,EACjBE,+BAA+B"}
@@ -0,0 +1,40 @@
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
+
17
+ /**
18
+ * Type for a parsed status attestation.
19
+ */
20
+
21
+ /**
22
+ * Shape for parsing a status attestation in a JWT.
23
+ */
24
+ export const ParsedStatusAttestation = z.object({
25
+ header: z.object({
26
+ typ: z.literal("status-attestation+jwt"),
27
+ alg: z.string(),
28
+ kid: z.string().optional()
29
+ }),
30
+ payload: z.object({
31
+ credential_hash_alg: z.string(),
32
+ credential_hash: z.string(),
33
+ cnf: z.object({
34
+ jwk: JWK
35
+ }),
36
+ exp: UnixTime,
37
+ iat: UnixTime
38
+ })
39
+ });
40
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["UnixTime","JWK","z","StatusAttestationResponse","object","status_attestation","string","ParsedStatusAttestation","header","typ","literal","alg","kid","optional","payload","credential_hash_alg","credential_hash","cnf","jwk","exp","iat"],"sourceRoot":"../../../../src","sources":["credential/status/types.ts"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,GAAG,QAAQ,iBAAiB;AACrC,OAAO,KAAKC,CAAC,MAAM,KAAK;;AAExB;AACA;AACA;AACA,OAAO,MAAMC,yBAAyB,GAAGD,CAAC,CAACE,MAAM,CAAC;EAChDC,kBAAkB,EAAEH,CAAC,CAACI,MAAM,CAAC;AAC/B,CAAC,CAAC;;AAEF;AACA;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA;AACA;AACA,OAAO,MAAMC,uBAAuB,GAAGL,CAAC,CAACE,MAAM,CAAC;EAC9CI,MAAM,EAAEN,CAAC,CAACE,MAAM,CAAC;IACfK,GAAG,EAAEP,CAAC,CAACQ,OAAO,CAAC,wBAAwB,CAAC;IACxCC,GAAG,EAAET,CAAC,CAACI,MAAM,CAAC,CAAC;IACfM,GAAG,EAAEV,CAAC,CAACI,MAAM,CAAC,CAAC,CAACO,QAAQ,CAAC;EAC3B,CAAC,CAAC;EACFC,OAAO,EAAEZ,CAAC,CAACE,MAAM,CAAC;IAChBW,mBAAmB,EAAEb,CAAC,CAACI,MAAM,CAAC,CAAC;IAC/BU,eAAe,EAAEd,CAAC,CAACI,MAAM,CAAC,CAAC;IAC3BW,GAAG,EAAEf,CAAC,CAACE,MAAM,CAAC;MACZc,GAAG,EAAEjB;IACP,CAAC,CAAC;IACFkB,GAAG,EAAEnB,QAAQ;IACboB,GAAG,EAAEpB;EACP,CAAC;AACH,CAAC,CAAC"}
@@ -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
+ ```