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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (443) hide show
  1. package/README.md +47 -1
  2. package/lib/commonjs/client/generated/wallet-provider.js +49 -20
  3. package/lib/commonjs/client/generated/wallet-provider.js.map +1 -1
  4. package/lib/commonjs/credential/index.js +5 -1
  5. package/lib/commonjs/credential/index.js.map +1 -1
  6. package/lib/commonjs/credential/issuance/02-evaluate-issuer-trust.js +27 -0
  7. package/lib/commonjs/credential/issuance/02-evaluate-issuer-trust.js.map +1 -0
  8. package/lib/commonjs/credential/issuance/03-start-user-authorization.js +25 -16
  9. package/lib/commonjs/credential/issuance/03-start-user-authorization.js.map +1 -1
  10. package/lib/commonjs/credential/issuance/04-complete-user-authorization.js +30 -18
  11. package/lib/commonjs/credential/issuance/04-complete-user-authorization.js.map +1 -1
  12. package/lib/commonjs/credential/issuance/05-authorize-access.js +17 -12
  13. package/lib/commonjs/credential/issuance/05-authorize-access.js.map +1 -1
  14. package/lib/commonjs/credential/issuance/06-obtain-credential.js +36 -29
  15. package/lib/commonjs/credential/issuance/06-obtain-credential.js.map +1 -1
  16. package/lib/commonjs/credential/issuance/07-verify-and-parse-credential.js +27 -207
  17. package/lib/commonjs/credential/issuance/07-verify-and-parse-credential.js.map +1 -1
  18. package/lib/commonjs/credential/issuance/README.md +23 -20
  19. package/lib/commonjs/credential/issuance/const.js +1 -1
  20. package/lib/commonjs/credential/issuance/const.js.map +1 -1
  21. package/lib/commonjs/credential/issuance/index.js +3 -3
  22. package/lib/commonjs/credential/issuance/index.js.map +1 -1
  23. package/lib/commonjs/credential/presentation/01-start-flow.js +14 -15
  24. package/lib/commonjs/credential/presentation/01-start-flow.js.map +1 -1
  25. package/lib/commonjs/credential/presentation/02-evaluate-rp-trust.js +6 -4
  26. package/lib/commonjs/credential/presentation/02-evaluate-rp-trust.js.map +1 -1
  27. package/lib/commonjs/credential/presentation/03-get-request-object.js +34 -7
  28. package/lib/commonjs/credential/presentation/03-get-request-object.js.map +1 -1
  29. package/lib/commonjs/credential/presentation/04-retrieve-rp-jwks.js +4 -126
  30. package/lib/commonjs/credential/presentation/04-retrieve-rp-jwks.js.map +1 -1
  31. package/lib/commonjs/credential/presentation/05-verify-request-object.js +80 -25
  32. package/lib/commonjs/credential/presentation/05-verify-request-object.js.map +1 -1
  33. package/lib/commonjs/credential/presentation/06-fetch-presentation-definition.js +6 -30
  34. package/lib/commonjs/credential/presentation/06-fetch-presentation-definition.js.map +1 -1
  35. package/lib/commonjs/credential/presentation/07-evaluate-dcql-query.js +97 -117
  36. package/lib/commonjs/credential/presentation/07-evaluate-dcql-query.js.map +1 -1
  37. package/lib/commonjs/credential/presentation/07-evaluate-input-descriptor.js +86 -191
  38. package/lib/commonjs/credential/presentation/07-evaluate-input-descriptor.js.map +1 -1
  39. package/lib/commonjs/credential/presentation/08-send-authorization-response.js +112 -176
  40. package/lib/commonjs/credential/presentation/08-send-authorization-response.js.map +1 -1
  41. package/lib/commonjs/credential/presentation/README.md +74 -79
  42. package/lib/commonjs/credential/presentation/errors.js +42 -21
  43. package/lib/commonjs/credential/presentation/errors.js.map +1 -1
  44. package/lib/commonjs/credential/presentation/index.js +13 -13
  45. package/lib/commonjs/credential/presentation/index.js.map +1 -1
  46. package/lib/commonjs/credential/presentation/types.js +53 -29
  47. package/lib/commonjs/credential/presentation/types.js.map +1 -1
  48. package/lib/commonjs/credential/status/01-start-flow.js +2 -0
  49. package/lib/commonjs/credential/status/01-start-flow.js.map +1 -0
  50. package/lib/commonjs/credential/status/02-status-attestation.js +73 -0
  51. package/lib/commonjs/credential/status/02-status-attestation.js.map +1 -0
  52. package/lib/commonjs/credential/status/03-verify-and-parse-status-attestation.js +55 -0
  53. package/lib/commonjs/credential/status/03-verify-and-parse-status-attestation.js.map +1 -0
  54. package/lib/commonjs/credential/status/README.md +67 -0
  55. package/lib/commonjs/credential/status/index.js +27 -0
  56. package/lib/commonjs/credential/status/index.js.map +1 -0
  57. package/lib/commonjs/credential/status/types.js +48 -0
  58. package/lib/commonjs/credential/status/types.js.map +1 -0
  59. package/lib/commonjs/credential/trustmark/README.md +62 -0
  60. package/lib/commonjs/credential/trustmark/get-credential-trustmark.js +86 -0
  61. package/lib/commonjs/credential/trustmark/get-credential-trustmark.js.map +1 -0
  62. package/lib/commonjs/credential/trustmark/index.js +13 -0
  63. package/lib/commonjs/credential/trustmark/index.js.map +1 -0
  64. package/lib/commonjs/index.js +5 -1
  65. package/lib/commonjs/index.js.map +1 -1
  66. package/lib/commonjs/pid/sd-jwt/types.js +18 -2
  67. package/lib/commonjs/pid/sd-jwt/types.js.map +1 -1
  68. package/lib/commonjs/sd-jwt/__test__/index.test.js +22 -34
  69. package/lib/commonjs/sd-jwt/__test__/index.test.js.map +1 -1
  70. package/lib/commonjs/sd-jwt/__test__/types.test.js +11 -23
  71. package/lib/commonjs/sd-jwt/__test__/types.test.js.map +1 -1
  72. package/lib/commonjs/sd-jwt/index.js +1 -7
  73. package/lib/commonjs/sd-jwt/index.js.map +1 -1
  74. package/lib/commonjs/sd-jwt/types.js +5 -21
  75. package/lib/commonjs/sd-jwt/types.js.map +1 -1
  76. package/lib/commonjs/trust/README.md +147 -0
  77. package/lib/commonjs/trust/chain.js +153 -0
  78. package/lib/commonjs/trust/chain.js.map +1 -0
  79. package/lib/commonjs/trust/errors.js +133 -0
  80. package/lib/commonjs/trust/errors.js.map +1 -0
  81. package/lib/commonjs/trust/index.js +288 -0
  82. package/lib/commonjs/trust/index.js.map +1 -0
  83. package/lib/commonjs/{entity/trust → trust}/types.js +27 -47
  84. package/lib/commonjs/trust/types.js.map +1 -0
  85. package/lib/commonjs/trust/utils.js +70 -0
  86. package/lib/commonjs/trust/utils.js.map +1 -0
  87. package/lib/commonjs/utils/crypto.js +5 -112
  88. package/lib/commonjs/utils/crypto.js.map +1 -1
  89. package/lib/commonjs/utils/decoder.js +2 -0
  90. package/lib/commonjs/utils/decoder.js.map +1 -1
  91. package/lib/commonjs/utils/error-codes.js +22 -2
  92. package/lib/commonjs/utils/error-codes.js.map +1 -1
  93. package/lib/commonjs/utils/errors.js +72 -4
  94. package/lib/commonjs/utils/errors.js.map +1 -1
  95. package/lib/commonjs/utils/logging.js +68 -0
  96. package/lib/commonjs/utils/logging.js.map +1 -0
  97. package/lib/commonjs/utils/misc.js +2 -0
  98. package/lib/commonjs/utils/misc.js.map +1 -1
  99. package/lib/commonjs/utils/par.js +17 -10
  100. package/lib/commonjs/utils/par.js.map +1 -1
  101. package/lib/commonjs/utils/string.js +1 -12
  102. package/lib/commonjs/utils/string.js.map +1 -1
  103. package/lib/commonjs/wallet-instance/index.js +14 -0
  104. package/lib/commonjs/wallet-instance/index.js.map +1 -1
  105. package/lib/commonjs/wallet-instance-attestation/README.md +8 -3
  106. package/lib/commonjs/wallet-instance-attestation/issuing.js +15 -8
  107. package/lib/commonjs/wallet-instance-attestation/issuing.js.map +1 -1
  108. package/lib/commonjs/wallet-instance-attestation/types.js +16 -20
  109. package/lib/commonjs/wallet-instance-attestation/types.js.map +1 -1
  110. package/lib/module/client/generated/wallet-provider.js +40 -15
  111. package/lib/module/client/generated/wallet-provider.js.map +1 -1
  112. package/lib/module/credential/index.js +3 -1
  113. package/lib/module/credential/index.js.map +1 -1
  114. package/lib/module/credential/issuance/02-evaluate-issuer-trust.js +20 -0
  115. package/lib/module/credential/issuance/02-evaluate-issuer-trust.js.map +1 -0
  116. package/lib/module/credential/issuance/03-start-user-authorization.js +25 -16
  117. package/lib/module/credential/issuance/03-start-user-authorization.js.map +1 -1
  118. package/lib/module/credential/issuance/04-complete-user-authorization.js +30 -18
  119. package/lib/module/credential/issuance/04-complete-user-authorization.js.map +1 -1
  120. package/lib/module/credential/issuance/05-authorize-access.js +17 -11
  121. package/lib/module/credential/issuance/05-authorize-access.js.map +1 -1
  122. package/lib/module/credential/issuance/06-obtain-credential.js +36 -28
  123. package/lib/module/credential/issuance/06-obtain-credential.js.map +1 -1
  124. package/lib/module/credential/issuance/07-verify-and-parse-credential.js +27 -205
  125. package/lib/module/credential/issuance/07-verify-and-parse-credential.js.map +1 -1
  126. package/lib/module/credential/issuance/README.md +23 -20
  127. package/lib/module/credential/issuance/const.js +1 -1
  128. package/lib/module/credential/issuance/const.js.map +1 -1
  129. package/lib/module/credential/issuance/index.js +2 -2
  130. package/lib/module/credential/issuance/index.js.map +1 -1
  131. package/lib/module/credential/presentation/01-start-flow.js +14 -15
  132. package/lib/module/credential/presentation/01-start-flow.js.map +1 -1
  133. package/lib/module/credential/presentation/02-evaluate-rp-trust.js +5 -3
  134. package/lib/module/credential/presentation/02-evaluate-rp-trust.js.map +1 -1
  135. package/lib/module/credential/presentation/03-get-request-object.js +34 -7
  136. package/lib/module/credential/presentation/03-get-request-object.js.map +1 -1
  137. package/lib/module/credential/presentation/04-retrieve-rp-jwks.js +2 -124
  138. package/lib/module/credential/presentation/04-retrieve-rp-jwks.js.map +1 -1
  139. package/lib/module/credential/presentation/05-verify-request-object.js +78 -23
  140. package/lib/module/credential/presentation/05-verify-request-object.js.map +1 -1
  141. package/lib/module/credential/presentation/06-fetch-presentation-definition.js +6 -30
  142. package/lib/module/credential/presentation/06-fetch-presentation-definition.js.map +1 -1
  143. package/lib/module/credential/presentation/07-evaluate-dcql-query.js +97 -118
  144. package/lib/module/credential/presentation/07-evaluate-dcql-query.js.map +1 -1
  145. package/lib/module/credential/presentation/07-evaluate-input-descriptor.js +83 -186
  146. package/lib/module/credential/presentation/07-evaluate-input-descriptor.js.map +1 -1
  147. package/lib/module/credential/presentation/08-send-authorization-response.js +107 -170
  148. package/lib/module/credential/presentation/08-send-authorization-response.js.map +1 -1
  149. package/lib/module/credential/presentation/README.md +74 -79
  150. package/lib/module/credential/presentation/errors.js +30 -17
  151. package/lib/module/credential/presentation/errors.js.map +1 -1
  152. package/lib/module/credential/presentation/index.js +6 -6
  153. package/lib/module/credential/presentation/index.js.map +1 -1
  154. package/lib/module/credential/presentation/types.js +49 -27
  155. package/lib/module/credential/presentation/types.js.map +1 -1
  156. package/lib/module/credential/status/01-start-flow.js +2 -0
  157. package/lib/module/credential/status/01-start-flow.js.map +1 -0
  158. package/lib/module/credential/status/02-status-attestation.js +66 -0
  159. package/lib/module/credential/status/02-status-attestation.js.map +1 -0
  160. package/lib/module/credential/status/03-verify-and-parse-status-attestation.js +49 -0
  161. package/lib/module/credential/status/03-verify-and-parse-status-attestation.js.map +1 -0
  162. package/lib/module/credential/status/README.md +67 -0
  163. package/lib/module/credential/status/index.js +5 -0
  164. package/lib/module/credential/status/index.js.map +1 -0
  165. package/lib/module/credential/status/types.js +40 -0
  166. package/lib/module/credential/status/types.js.map +1 -0
  167. package/lib/module/credential/trustmark/README.md +62 -0
  168. package/lib/module/credential/trustmark/get-credential-trustmark.js +77 -0
  169. package/lib/module/credential/trustmark/get-credential-trustmark.js.map +1 -0
  170. package/lib/module/credential/trustmark/index.js +3 -0
  171. package/lib/module/credential/trustmark/index.js.map +1 -0
  172. package/lib/module/index.js +3 -1
  173. package/lib/module/index.js.map +1 -1
  174. package/lib/module/pid/sd-jwt/types.js +16 -1
  175. package/lib/module/pid/sd-jwt/types.js.map +1 -1
  176. package/lib/module/sd-jwt/__test__/index.test.js +22 -34
  177. package/lib/module/sd-jwt/__test__/index.test.js.map +1 -1
  178. package/lib/module/sd-jwt/__test__/types.test.js +11 -23
  179. package/lib/module/sd-jwt/__test__/types.test.js.map +1 -1
  180. package/lib/module/sd-jwt/index.js +1 -7
  181. package/lib/module/sd-jwt/index.js.map +1 -1
  182. package/lib/module/sd-jwt/types.js +4 -19
  183. package/lib/module/sd-jwt/types.js.map +1 -1
  184. package/lib/module/trust/README.md +147 -0
  185. package/lib/module/trust/chain.js +145 -0
  186. package/lib/module/trust/chain.js.map +1 -0
  187. package/lib/module/trust/errors.js +115 -0
  188. package/lib/module/trust/errors.js.map +1 -0
  189. package/lib/module/trust/index.js +269 -0
  190. package/lib/module/trust/index.js.map +1 -0
  191. package/lib/module/{entity/trust → trust}/types.js +25 -46
  192. package/lib/module/trust/types.js.map +1 -0
  193. package/lib/module/trust/utils.js +60 -0
  194. package/lib/module/trust/utils.js.map +1 -0
  195. package/lib/module/utils/crypto.js +4 -107
  196. package/lib/module/utils/crypto.js.map +1 -1
  197. package/lib/module/utils/decoder.js +3 -0
  198. package/lib/module/utils/decoder.js.map +1 -1
  199. package/lib/module/utils/error-codes.js +20 -1
  200. package/lib/module/utils/error-codes.js.map +1 -1
  201. package/lib/module/utils/errors.js +61 -4
  202. package/lib/module/utils/errors.js.map +1 -1
  203. package/lib/module/utils/logging.js +62 -0
  204. package/lib/module/utils/logging.js.map +1 -0
  205. package/lib/module/utils/misc.js +2 -0
  206. package/lib/module/utils/misc.js.map +1 -1
  207. package/lib/module/utils/par.js +17 -9
  208. package/lib/module/utils/par.js.map +1 -1
  209. package/lib/module/utils/string.js +0 -10
  210. package/lib/module/utils/string.js.map +1 -1
  211. package/lib/module/wallet-instance/index.js +13 -0
  212. package/lib/module/wallet-instance/index.js.map +1 -1
  213. package/lib/module/wallet-instance-attestation/README.md +8 -3
  214. package/lib/module/wallet-instance-attestation/index.js +2 -2
  215. package/lib/module/wallet-instance-attestation/index.js.map +1 -1
  216. package/lib/module/wallet-instance-attestation/issuing.js +16 -9
  217. package/lib/module/wallet-instance-attestation/issuing.js.map +1 -1
  218. package/lib/module/wallet-instance-attestation/types.js +14 -18
  219. package/lib/module/wallet-instance-attestation/types.js.map +1 -1
  220. package/lib/typescript/client/generated/wallet-provider.d.ts +206 -51
  221. package/lib/typescript/client/generated/wallet-provider.d.ts.map +1 -1
  222. package/lib/typescript/credential/index.d.ts +3 -1
  223. package/lib/typescript/credential/index.d.ts.map +1 -1
  224. package/lib/typescript/credential/issuance/01-start-flow.d.ts +1 -1
  225. package/lib/typescript/credential/issuance/02-evaluate-issuer-trust.d.ts +19 -0
  226. package/lib/typescript/credential/issuance/02-evaluate-issuer-trust.d.ts.map +1 -0
  227. package/lib/typescript/credential/issuance/03-start-user-authorization.d.ts +3 -3
  228. package/lib/typescript/credential/issuance/03-start-user-authorization.d.ts.map +1 -1
  229. package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts +9 -9
  230. package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts.map +1 -1
  231. package/lib/typescript/credential/issuance/05-authorize-access.d.ts +3 -3
  232. package/lib/typescript/credential/issuance/05-authorize-access.d.ts.map +1 -1
  233. package/lib/typescript/credential/issuance/06-obtain-credential.d.ts +4 -4
  234. package/lib/typescript/credential/issuance/06-obtain-credential.d.ts.map +1 -1
  235. package/lib/typescript/credential/issuance/07-verify-and-parse-credential.d.ts +3 -15
  236. package/lib/typescript/credential/issuance/07-verify-and-parse-credential.d.ts.map +1 -1
  237. package/lib/typescript/credential/issuance/const.d.ts +1 -1
  238. package/lib/typescript/credential/issuance/const.d.ts.map +1 -1
  239. package/lib/typescript/credential/issuance/index.d.ts +3 -3
  240. package/lib/typescript/credential/issuance/index.d.ts.map +1 -1
  241. package/lib/typescript/credential/issuance/types.d.ts +8 -3
  242. package/lib/typescript/credential/issuance/types.d.ts.map +1 -1
  243. package/lib/typescript/credential/presentation/01-start-flow.d.ts +28 -9
  244. package/lib/typescript/credential/presentation/01-start-flow.d.ts.map +1 -1
  245. package/lib/typescript/credential/presentation/02-evaluate-rp-trust.d.ts +2 -1
  246. package/lib/typescript/credential/presentation/02-evaluate-rp-trust.d.ts.map +1 -1
  247. package/lib/typescript/credential/presentation/03-get-request-object.d.ts +7 -5
  248. package/lib/typescript/credential/presentation/03-get-request-object.d.ts.map +1 -1
  249. package/lib/typescript/credential/presentation/04-retrieve-rp-jwks.d.ts +4 -30
  250. package/lib/typescript/credential/presentation/04-retrieve-rp-jwks.d.ts.map +1 -1
  251. package/lib/typescript/credential/presentation/05-verify-request-object.d.ts +17 -4
  252. package/lib/typescript/credential/presentation/05-verify-request-object.d.ts.map +1 -1
  253. package/lib/typescript/credential/presentation/06-fetch-presentation-definition.d.ts +4 -9
  254. package/lib/typescript/credential/presentation/06-fetch-presentation-definition.d.ts.map +1 -1
  255. package/lib/typescript/credential/presentation/07-evaluate-dcql-query.d.ts +13 -12
  256. package/lib/typescript/credential/presentation/07-evaluate-dcql-query.d.ts.map +1 -1
  257. package/lib/typescript/credential/presentation/07-evaluate-input-descriptor.d.ts +40 -42
  258. package/lib/typescript/credential/presentation/07-evaluate-input-descriptor.d.ts.map +1 -1
  259. package/lib/typescript/credential/presentation/08-send-authorization-response.d.ts +30 -43
  260. package/lib/typescript/credential/presentation/08-send-authorization-response.d.ts.map +1 -1
  261. package/lib/typescript/credential/presentation/errors.d.ts +25 -10
  262. package/lib/typescript/credential/presentation/errors.d.ts.map +1 -1
  263. package/lib/typescript/credential/presentation/index.d.ts +7 -8
  264. package/lib/typescript/credential/presentation/index.d.ts.map +1 -1
  265. package/lib/typescript/credential/presentation/types.d.ts +137 -307
  266. package/lib/typescript/credential/presentation/types.d.ts.map +1 -1
  267. package/lib/typescript/credential/status/01-start-flow.d.ts +10 -0
  268. package/lib/typescript/credential/status/01-start-flow.d.ts.map +1 -0
  269. package/lib/typescript/credential/status/02-status-attestation.d.ts +19 -0
  270. package/lib/typescript/credential/status/02-status-attestation.d.ts.map +1 -0
  271. package/lib/typescript/credential/status/03-verify-and-parse-status-attestation.d.ts +24 -0
  272. package/lib/typescript/credential/status/03-verify-and-parse-status-attestation.d.ts.map +1 -0
  273. package/lib/typescript/credential/status/index.d.ts +7 -0
  274. package/lib/typescript/credential/status/index.d.ts.map +1 -0
  275. package/lib/typescript/credential/status/types.d.ts +305 -0
  276. package/lib/typescript/credential/status/types.d.ts.map +1 -0
  277. package/lib/typescript/credential/trustmark/get-credential-trustmark.d.ts +52 -0
  278. package/lib/typescript/credential/trustmark/get-credential-trustmark.d.ts.map +1 -0
  279. package/lib/typescript/credential/trustmark/index.d.ts +4 -0
  280. package/lib/typescript/credential/trustmark/index.d.ts.map +1 -0
  281. package/lib/typescript/index.d.ts +3 -1
  282. package/lib/typescript/index.d.ts.map +1 -1
  283. package/lib/typescript/pid/sd-jwt/types.d.ts +103 -25
  284. package/lib/typescript/pid/sd-jwt/types.d.ts.map +1 -1
  285. package/lib/typescript/sd-jwt/index.d.ts +20 -72
  286. package/lib/typescript/sd-jwt/index.d.ts.map +1 -1
  287. package/lib/typescript/sd-jwt/types.d.ts +24 -129
  288. package/lib/typescript/sd-jwt/types.d.ts.map +1 -1
  289. package/lib/typescript/trust/chain.d.ts +23 -0
  290. package/lib/typescript/trust/chain.d.ts.map +1 -0
  291. package/lib/typescript/trust/errors.d.ts +102 -0
  292. package/lib/typescript/trust/errors.d.ts.map +1 -0
  293. package/lib/typescript/{entity/trust → trust}/index.d.ts +308 -281
  294. package/lib/typescript/trust/index.d.ts.map +1 -0
  295. package/lib/typescript/{entity/trust → trust}/types.d.ts +1714 -1301
  296. package/lib/typescript/{entity/trust → trust}/types.d.ts.map +1 -1
  297. package/lib/typescript/trust/utils.d.ts +22 -0
  298. package/lib/typescript/trust/utils.d.ts.map +1 -0
  299. package/lib/typescript/utils/crypto.d.ts +0 -32
  300. package/lib/typescript/utils/crypto.d.ts.map +1 -1
  301. package/lib/typescript/utils/decoder.d.ts.map +1 -1
  302. package/lib/typescript/utils/error-codes.d.ts +20 -0
  303. package/lib/typescript/utils/error-codes.d.ts.map +1 -1
  304. package/lib/typescript/utils/errors.d.ts +55 -10
  305. package/lib/typescript/utils/errors.d.ts.map +1 -1
  306. package/lib/typescript/utils/logging.d.ts +35 -0
  307. package/lib/typescript/utils/logging.d.ts.map +1 -0
  308. package/lib/typescript/utils/misc.d.ts.map +1 -1
  309. package/lib/typescript/utils/par.d.ts +8 -1
  310. package/lib/typescript/utils/par.d.ts.map +1 -1
  311. package/lib/typescript/utils/string.d.ts +0 -7
  312. package/lib/typescript/utils/string.d.ts.map +1 -1
  313. package/lib/typescript/wallet-instance/index.d.ts +8 -0
  314. package/lib/typescript/wallet-instance/index.d.ts.map +1 -1
  315. package/lib/typescript/wallet-instance-attestation/index.d.ts +1 -2
  316. package/lib/typescript/wallet-instance-attestation/index.d.ts.map +1 -1
  317. package/lib/typescript/wallet-instance-attestation/issuing.d.ts +4 -2
  318. package/lib/typescript/wallet-instance-attestation/issuing.d.ts.map +1 -1
  319. package/lib/typescript/wallet-instance-attestation/types.d.ts +60 -102
  320. package/lib/typescript/wallet-instance-attestation/types.d.ts.map +1 -1
  321. package/package.json +9 -10
  322. package/src/client/generated/wallet-provider.ts +52 -17
  323. package/src/credential/index.ts +4 -1
  324. package/src/credential/issuance/01-start-flow.ts +1 -1
  325. package/src/credential/issuance/02-evaluate-issuer-trust.ts +32 -0
  326. package/src/credential/issuance/03-start-user-authorization.ts +48 -22
  327. package/src/credential/issuance/04-complete-user-authorization.ts +74 -18
  328. package/src/credential/issuance/05-authorize-access.ts +29 -11
  329. package/src/credential/issuance/06-obtain-credential.ts +61 -36
  330. package/src/credential/issuance/07-verify-and-parse-credential.ts +37 -264
  331. package/src/credential/issuance/README.md +23 -20
  332. package/src/credential/issuance/const.ts +1 -1
  333. package/src/credential/issuance/index.ts +6 -3
  334. package/src/credential/presentation/01-start-flow.ts +19 -22
  335. package/src/credential/presentation/02-evaluate-rp-trust.ts +5 -4
  336. package/src/credential/presentation/03-get-request-object.ts +36 -8
  337. package/src/credential/presentation/04-retrieve-rp-jwks.ts +6 -148
  338. package/src/credential/presentation/05-verify-request-object.ts +115 -30
  339. package/src/credential/presentation/06-fetch-presentation-definition.ts +5 -35
  340. package/src/credential/presentation/07-evaluate-dcql-query.ts +132 -161
  341. package/src/credential/presentation/07-evaluate-input-descriptor.ts +136 -254
  342. package/src/credential/presentation/08-send-authorization-response.ts +178 -260
  343. package/src/credential/presentation/README.md +74 -79
  344. package/src/credential/presentation/errors.ts +38 -15
  345. package/src/credential/presentation/index.ts +18 -19
  346. package/src/credential/presentation/types.ts +67 -64
  347. package/src/credential/status/01-start-flow.ts +9 -0
  348. package/src/credential/status/02-status-attestation.ts +105 -0
  349. package/src/credential/status/03-verify-and-parse-status-attestation.ts +70 -0
  350. package/src/credential/status/README.md +67 -0
  351. package/src/credential/status/index.ts +22 -0
  352. package/src/credential/status/types.ts +43 -0
  353. package/src/credential/trustmark/README.md +62 -0
  354. package/src/credential/trustmark/get-credential-trustmark.ts +139 -0
  355. package/src/credential/trustmark/index.ts +8 -0
  356. package/src/index.ts +4 -0
  357. package/src/pid/sd-jwt/types.ts +18 -1
  358. package/src/sd-jwt/__test__/index.test.ts +36 -55
  359. package/src/sd-jwt/__test__/types.test.ts +16 -29
  360. package/src/sd-jwt/index.ts +1 -5
  361. package/src/sd-jwt/types.ts +2 -19
  362. package/src/trust/README.md +147 -0
  363. package/src/trust/chain.ts +227 -0
  364. package/src/trust/errors.ts +136 -0
  365. package/src/{entity/trust → trust}/index.ts +207 -25
  366. package/src/{entity/trust → trust}/types.ts +24 -37
  367. package/src/trust/utils.ts +70 -0
  368. package/src/utils/crypto.ts +4 -106
  369. package/src/utils/decoder.ts +6 -1
  370. package/src/utils/error-codes.ts +23 -0
  371. package/src/utils/errors.ts +119 -15
  372. package/src/utils/logging.ts +68 -0
  373. package/src/utils/misc.ts +5 -0
  374. package/src/utils/par.ts +19 -6
  375. package/src/utils/string.ts +0 -10
  376. package/src/wallet-instance/index.ts +30 -1
  377. package/src/wallet-instance-attestation/README.md +8 -3
  378. package/src/wallet-instance-attestation/index.ts +2 -2
  379. package/src/wallet-instance-attestation/issuing.ts +33 -12
  380. package/src/wallet-instance-attestation/types.ts +18 -22
  381. package/lib/commonjs/credential/issuance/02-get-issuer-config.js +0 -48
  382. package/lib/commonjs/credential/issuance/02-get-issuer-config.js.map +0 -1
  383. package/lib/commonjs/entity/openid-connect/issuer/index.js +0 -25
  384. package/lib/commonjs/entity/openid-connect/issuer/index.js.map +0 -1
  385. package/lib/commonjs/entity/openid-connect/issuer/types.js +0 -64
  386. package/lib/commonjs/entity/openid-connect/issuer/types.js.map +0 -1
  387. package/lib/commonjs/entity/trust/chain.js +0 -122
  388. package/lib/commonjs/entity/trust/chain.js.map +0 -1
  389. package/lib/commonjs/entity/trust/index.js +0 -148
  390. package/lib/commonjs/entity/trust/index.js.map +0 -1
  391. package/lib/commonjs/entity/trust/types.js.map +0 -1
  392. package/lib/commonjs/mdoc/converters.js +0 -26
  393. package/lib/commonjs/mdoc/converters.js.map +0 -1
  394. package/lib/commonjs/mdoc/index.js +0 -68
  395. package/lib/commonjs/mdoc/index.js.map +0 -1
  396. package/lib/commonjs/utils/credential/issuance/07-verify-and-parse-credentials-inputs.js +0 -469
  397. package/lib/commonjs/utils/credential/issuance/07-verify-and-parse-credentials-inputs.js.map +0 -1
  398. package/lib/commonjs/utils/credential/issuance/07-verify-and-parse-credentials-utils.js +0 -90
  399. package/lib/commonjs/utils/credential/issuance/07-verify-and-parse-credentials-utils.js.map +0 -1
  400. package/lib/module/credential/issuance/02-get-issuer-config.js +0 -42
  401. package/lib/module/credential/issuance/02-get-issuer-config.js.map +0 -1
  402. package/lib/module/entity/openid-connect/issuer/index.js +0 -20
  403. package/lib/module/entity/openid-connect/issuer/index.js.map +0 -1
  404. package/lib/module/entity/openid-connect/issuer/types.js +0 -48
  405. package/lib/module/entity/openid-connect/issuer/types.js.map +0 -1
  406. package/lib/module/entity/trust/chain.js +0 -113
  407. package/lib/module/entity/trust/chain.js.map +0 -1
  408. package/lib/module/entity/trust/index.js +0 -131
  409. package/lib/module/entity/trust/index.js.map +0 -1
  410. package/lib/module/entity/trust/types.js.map +0 -1
  411. package/lib/module/mdoc/converters.js +0 -20
  412. package/lib/module/mdoc/converters.js.map +0 -1
  413. package/lib/module/mdoc/index.js +0 -60
  414. package/lib/module/mdoc/index.js.map +0 -1
  415. package/lib/module/utils/credential/issuance/07-verify-and-parse-credentials-inputs.js +0 -462
  416. package/lib/module/utils/credential/issuance/07-verify-and-parse-credentials-inputs.js.map +0 -1
  417. package/lib/module/utils/credential/issuance/07-verify-and-parse-credentials-utils.js +0 -83
  418. package/lib/module/utils/credential/issuance/07-verify-and-parse-credentials-utils.js.map +0 -1
  419. package/lib/typescript/credential/issuance/02-get-issuer-config.d.ts +0 -32
  420. package/lib/typescript/credential/issuance/02-get-issuer-config.d.ts.map +0 -1
  421. package/lib/typescript/entity/openid-connect/issuer/index.d.ts +0 -12
  422. package/lib/typescript/entity/openid-connect/issuer/index.d.ts.map +0 -1
  423. package/lib/typescript/entity/openid-connect/issuer/types.d.ts +0 -777
  424. package/lib/typescript/entity/openid-connect/issuer/types.d.ts.map +0 -1
  425. package/lib/typescript/entity/trust/chain.d.ts +0 -26
  426. package/lib/typescript/entity/trust/chain.d.ts.map +0 -1
  427. package/lib/typescript/entity/trust/index.d.ts.map +0 -1
  428. package/lib/typescript/mdoc/converters.d.ts +0 -8
  429. package/lib/typescript/mdoc/converters.d.ts.map +0 -1
  430. package/lib/typescript/mdoc/index.d.ts +0 -10
  431. package/lib/typescript/mdoc/index.d.ts.map +0 -1
  432. package/lib/typescript/utils/credential/issuance/07-verify-and-parse-credentials-inputs.d.ts +0 -3
  433. package/lib/typescript/utils/credential/issuance/07-verify-and-parse-credentials-inputs.d.ts.map +0 -1
  434. package/lib/typescript/utils/credential/issuance/07-verify-and-parse-credentials-utils.d.ts +0 -42
  435. package/lib/typescript/utils/credential/issuance/07-verify-and-parse-credentials-utils.d.ts.map +0 -1
  436. package/src/credential/issuance/02-get-issuer-config.ts +0 -67
  437. package/src/entity/openid-connect/issuer/index.ts +0 -27
  438. package/src/entity/openid-connect/issuer/types.ts +0 -76
  439. package/src/entity/trust/chain.ts +0 -154
  440. package/src/mdoc/converters.ts +0 -26
  441. package/src/mdoc/index.ts +0 -95
  442. package/src/utils/credential/issuance/07-verify-and-parse-credentials-inputs.ts +0 -615
  443. package/src/utils/credential/issuance/07-verify-and-parse-credentials-utils.ts +0 -171
@@ -1,48 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getIssuerConfig = void 0;
7
- var _issuer = require("../../entity/openid-connect/issuer");
8
- /**
9
- * Common configuration for the issuer.
10
- * This is needed to have a common configuration for the issuer to be used in our flows.
11
- * It allows to support multiple issuers with different configurations, defining a common interface to interact with them.
12
- */
13
-
14
- /**
15
- * WARNING: This function must be called after {@link startFlow}. The next function to be called is {@link startUserAuthorization}.
16
- * Get the Issuer's configuration from the Issuer's metadata.
17
- * Currently it only supports a mixed configuration based on OpenID Connect partial implementation.
18
- * @param issuerUrl The base url of the Issuer returned by {@link startFlow}
19
- * @param context.appFetch (optional) fetch api implementation. Default: built-in fetch
20
- * @returns The Issuer's configuration
21
- */
22
- const getIssuerConfig = async function (issuerUrl) {
23
- let context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
24
- const res = await (0, _issuer.getCredentialIssuerMetadata)(issuerUrl, {
25
- appFetch: context.appFetch
26
- });
27
- return credentialIssuerRationalization(res);
28
- };
29
-
30
- /**
31
- * Rationalize the issuer's metadata to the issuer's configuration which is then used in our flows to interact with the issuer.
32
- * @param issuerMetadata - The issuer's metadata
33
- * @returns the isssuer configuration to be used later in our flows
34
- */
35
- exports.getIssuerConfig = getIssuerConfig;
36
- const credentialIssuerRationalization = issuerMetadata => {
37
- return {
38
- issuerConf: {
39
- credential_configurations_supported: issuerMetadata.credential_configurations_supported,
40
- pushed_authorization_request_endpoint: issuerMetadata.pushed_authorization_request_endpoint,
41
- authorization_endpoint: issuerMetadata.authorization_endpoint,
42
- token_endpoint: issuerMetadata.token_endpoint,
43
- credential_endpoint: issuerMetadata.credential_endpoint,
44
- keys: issuerMetadata.jwks.keys
45
- }
46
- };
47
- };
48
- //# sourceMappingURL=02-get-issuer-config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_issuer","require","getIssuerConfig","issuerUrl","context","arguments","length","undefined","res","getCredentialIssuerMetadata","appFetch","credentialIssuerRationalization","exports","issuerMetadata","issuerConf","credential_configurations_supported","pushed_authorization_request_endpoint","authorization_endpoint","token_endpoint","credential_endpoint","keys","jwks"],"sourceRoot":"../../../../src","sources":["credential/issuance/02-get-issuer-config.ts"],"mappings":";;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AAUA;AACA;AACA;AACA;AACA;;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,eAAgC,GAAG,eAAAA,CAC9CC,SAAS,EAEuB;EAAA,IADhCC,OAAO,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAEZ,MAAMG,GAAG,GAAG,MAAM,IAAAC,mCAA2B,EAACN,SAAS,EAAE;IACvDO,QAAQ,EAAEN,OAAO,CAACM;EACpB,CAAC,CAAC;EAEF,OAAOC,+BAA+B,CAACH,GAAG,CAAC;AAC7C,CAAC;;AAED;AACA;AACA;AACA;AACA;AAJAI,OAAA,CAAAV,eAAA,GAAAA,eAAA;AAKA,MAAMS,+BAA+B,GACnCE,cAAuE,IAC9B;EACzC,OAAO;IACLC,UAAU,EAAE;MACVC,mCAAmC,EACjCF,cAAc,CAACE,mCAAmC;MACpDC,qCAAqC,EACnCH,cAAc,CAACG,qCAAqC;MACtDC,sBAAsB,EAAEJ,cAAc,CAACI,sBAAsB;MAC7DC,cAAc,EAAEL,cAAc,CAACK,cAAc;MAC7CC,mBAAmB,EAAEN,cAAc,CAACM,mBAAmB;MACvDC,IAAI,EAAEP,cAAc,CAACQ,IAAI,CAACD;IAC5B;EACF,CAAC;AACH,CAAC"}
@@ -1,25 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getCredentialIssuerMetadata = getCredentialIssuerMetadata;
7
- var _misc = require("../../../utils/misc");
8
- var _types = require("./types");
9
- /**
10
- * Fetch the signed entity configuration token for an entity
11
- *
12
- * @param entityBaseUrl The url of the entity to fetch
13
- * @param param.appFetch (optional) fetch api implemention
14
- * @returns The signed Entity Configuration token
15
- */
16
- async function getCredentialIssuerMetadata(entityBaseUrl) {
17
- let {
18
- appFetch = fetch
19
- } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
20
- const wellKnownUrl = `${entityBaseUrl}/.well-known/openid-credential-issuer`;
21
- return await appFetch(wellKnownUrl, {
22
- method: "GET"
23
- }).then((0, _misc.hasStatusOrThrow)(200)).then(res => res.json()).then(_types.CredentialIssuerConfiguration.parse);
24
- }
25
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_misc","require","_types","getCredentialIssuerMetadata","entityBaseUrl","appFetch","fetch","arguments","length","undefined","wellKnownUrl","method","then","hasStatusOrThrow","res","json","CredentialIssuerConfiguration","parse"],"sourceRoot":"../../../../../src","sources":["entity/openid-connect/issuer/index.ts"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAeE,2BAA2BA,CAC/CC,aAAqB,EAMmB;EAAA,IALxC;IACEC,QAAQ,GAAGC;EAGb,CAAC,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAEN,MAAMG,YAAY,GAAI,GAAEN,aAAc,uCAAsC;EAE5E,OAAO,MAAMC,QAAQ,CAACK,YAAY,EAAE;IAClCC,MAAM,EAAE;EACV,CAAC,CAAC,CACCC,IAAI,CAAC,IAAAC,sBAAgB,EAAC,GAAG,CAAC,CAAC,CAC3BD,IAAI,CAAEE,GAAG,IAAKA,GAAG,CAACC,IAAI,CAAC,CAAC,CAAC,CACzBH,IAAI,CAACI,oCAA6B,CAACC,KAAK,CAAC;AAC9C"}
@@ -1,64 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.CredentialSdJwtClaims = exports.CredentialIssuerKeys = exports.CredentialIssuerConfiguration = exports.CredentialFormat = exports.CredentialDisplay = exports.CredentialConfigurationSupported = exports.CredentialClaimDisplay = exports.CredentialClaim = void 0;
7
- var _jwk = require("../../../utils/jwk");
8
- var z = _interopRequireWildcard(require("zod"));
9
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
10
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
11
- // Display metadata for a credential, used by the issuer to
12
- // instruct the Wallet Solution on how to render the credential correctly
13
-
14
- const CredentialDisplay = z.object({
15
- name: z.string(),
16
- locale: z.string(),
17
- logo: z.object({
18
- url: z.string(),
19
- alt_text: z.string()
20
- }).optional(),
21
- background_color: z.string().optional(),
22
- text_color: z.string().optional()
23
- });
24
- exports.CredentialDisplay = CredentialDisplay;
25
- const CredentialClaimDisplay = z.object({
26
- name: z.string(),
27
- locale: z.string()
28
- });
29
- exports.CredentialClaimDisplay = CredentialClaimDisplay;
30
- const CredentialFormat = z.union([z.literal("vc+sd-jwt"), z.literal("mso_mdoc")]);
31
- exports.CredentialFormat = CredentialFormat;
32
- const CredentialClaim = z.object({
33
- mandatory: z.boolean(),
34
- display: z.array(CredentialClaimDisplay)
35
- });
36
- exports.CredentialClaim = CredentialClaim;
37
- const CredentialSdJwtClaims = z.record(CredentialClaim);
38
- exports.CredentialSdJwtClaims = CredentialSdJwtClaims;
39
- const CredentialConfigurationSupported = z.record(z.object({
40
- cryptographic_suites_supported: z.array(z.string()),
41
- vct: z.string().optional(),
42
- scope: z.string().optional(),
43
- cryptographic_binding_methods_supported: z.array(z.string()),
44
- display: z.array(CredentialDisplay),
45
- format: CredentialFormat,
46
- claims: z.union([CredentialSdJwtClaims, z.record(z.string(), CredentialSdJwtClaims)]).optional()
47
- }));
48
- exports.CredentialConfigurationSupported = CredentialConfigurationSupported;
49
- const CredentialIssuerKeys = z.object({
50
- keys: z.array(_jwk.JWK)
51
- });
52
- exports.CredentialIssuerKeys = CredentialIssuerKeys;
53
- const CredentialIssuerConfiguration = z.object({
54
- credential_configurations_supported: CredentialConfigurationSupported,
55
- pushed_authorization_request_endpoint: z.string(),
56
- dpop_signing_alg_values_supported: z.array(z.string()),
57
- jwks: CredentialIssuerKeys,
58
- credential_issuer: z.string(),
59
- authorization_endpoint: z.string(),
60
- token_endpoint: z.string(),
61
- credential_endpoint: z.string()
62
- });
63
- exports.CredentialIssuerConfiguration = CredentialIssuerConfiguration;
64
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_jwk","require","z","_interopRequireWildcard","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","CredentialDisplay","object","name","string","locale","logo","url","alt_text","optional","background_color","text_color","exports","CredentialClaimDisplay","CredentialFormat","union","literal","CredentialClaim","mandatory","boolean","display","array","CredentialSdJwtClaims","record","CredentialConfigurationSupported","cryptographic_suites_supported","vct","scope","cryptographic_binding_methods_supported","format","claims","CredentialIssuerKeys","keys","JWK","CredentialIssuerConfiguration","credential_configurations_supported","pushed_authorization_request_endpoint","dpop_signing_alg_values_supported","jwks","credential_issuer","authorization_endpoint","token_endpoint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C,CAAC4C,KAAK,CAAC5C,CAAC,CAAC2B,MAAM,CAAC,CAAC,CAAC;EACtDkC,IAAI,EAAEP,oBAAoB;EAC1BQ,iBAAiB,EAAE9D,CAAC,CAAC2B,MAAM,CAAC,CAAC;EAC7BoC,sBAAsB,EAAE/D,CAAC,CAAC2B,MAAM,CAAC,CAAC;EAClCqC,cAAc,EAAEhE,CAAC,CAAC2B,MAAM,CAAC,CAAC;EAC1BsC,mBAAmB,EAAEjE,CAAC,CAAC2B,MAAM,CAAC;AAChC,CAAC,CAAC;AAACQ,OAAA,CAAAsB,6BAAA,GAAAA,6BAAA"}
@@ -1,122 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.renewTrustChain = renewTrustChain;
7
- exports.validateTrustChain = validateTrustChain;
8
- var _ioReactNativeJwt = require("@pagopa/io-react-native-jwt");
9
- var _types = require("./types");
10
- var _errors = require("../../utils/errors");
11
- var z = _interopRequireWildcard(require("zod"));
12
- var _ = require(".");
13
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
14
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
15
- // Verify a token signature
16
- // The kid is extracted from the token header
17
- const verify = async (token, kid, jwks) => {
18
- const jwk = jwks.find(k => k.kid === kid);
19
- if (!jwk) {
20
- throw new Error(`Invalid kid: ${kid}, token: ${token}`);
21
- }
22
- const {
23
- protectedHeader: header,
24
- payload
25
- } = await (0, _ioReactNativeJwt.verify)(token, jwk);
26
- return {
27
- header,
28
- payload
29
- };
30
- };
31
- const decode = token => {
32
- const {
33
- protectedHeader: header,
34
- payload
35
- } = (0, _ioReactNativeJwt.decode)(token);
36
- return {
37
- header,
38
- payload
39
- };
40
- };
41
-
42
- // The first element of the chain is supposed to be the Entity Configuration for the document issuer
43
- const FirstElementShape = _types.EntityConfiguration;
44
- // Each element but the first is supposed to be an Entity Statement
45
- const MiddleElementShape = _types.EntityStatement;
46
- // The last element of the chain can either be an Entity Statement
47
- // or the Entity Configuration for the known Trust Anchor
48
- const LastElementShape = z.union([_types.EntityStatement, _types.TrustAnchorEntityConfiguration]);
49
-
50
- /**
51
- * Validates a provided trust chain against a known trust
52
- *
53
- * @param trustAnchorEntity The entity configuration of the known trust anchor
54
- * @param chain The chain of statements to be validate
55
- * @returns The list of parsed token representing the chain
56
- * @throws {IoWalletError} If the chain is not valid
57
- */
58
- async function validateTrustChain(trustAnchorEntity, chain) {
59
- // If the chain is empty, fail
60
- if (chain.length === 0) {
61
- throw new _errors.IoWalletError("Cannot verify empty trust chain");
62
- }
63
-
64
- // Select the expected token shape
65
- const selectTokenShape = elementIndex => elementIndex === 0 ? FirstElementShape : elementIndex === chain.length - 1 ? LastElementShape : MiddleElementShape;
66
-
67
- // select the kid from the current index
68
- const selectKid = currentIndex => {
69
- const token = chain[currentIndex];
70
- if (!token) {
71
- throw new _errors.IoWalletError(`Cannot select kid: empty token`);
72
- }
73
- const shape = selectTokenShape(currentIndex);
74
- return shape.parse(decode(token)).header.kid;
75
- };
76
-
77
- // select keys from the next token
78
- // if the current token is the last, keys fro trust anchor will be used
79
- const selectKeys = currentIndex => {
80
- if (currentIndex === chain.length - 1) {
81
- return trustAnchorEntity.payload.jwks.keys;
82
- }
83
- const nextIndex = currentIndex + 1;
84
- const nextToken = chain[nextIndex];
85
- if (!nextToken) {
86
- throw new _errors.IoWalletError(`Cannot select keys: empty nextToken`);
87
- }
88
- const shape = selectTokenShape(nextIndex);
89
- return shape.parse(decode(nextToken)).payload.jwks.keys;
90
- };
91
-
92
- // Iterate the chain and validate each element's signature against the public keys of its next
93
- // If there is no next, hence it's the end of the chain and it must be verified by the Trust Anchor
94
- return Promise.all(chain.map((token, i) => [token, selectKid(i), selectKeys(i)]).map(args => verify(...args)));
95
- }
96
-
97
- /**
98
- * Given a trust chain, obtain a new trust chain by fetching each element's fresh version
99
- *
100
- * @param chain The original chain
101
- * @param appFetch (optional) fetch api implementation
102
- * @returns A list of signed token that reprensent the trust chain, in the same order of the provided chain
103
- * @throws When an element of the chain fails to parse
104
- */
105
- function renewTrustChain(chain) {
106
- let appFetch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : fetch;
107
- return Promise.all(chain
108
- // Decode each item to determine its shape
109
- .map(decode).map(e => [_types.EntityStatement.safeParse(e), _types.EntityConfiguration.safeParse(e)])
110
- // fetch the element according to its shape
111
- .map((_ref, i) => {
112
- let [es, ec] = _ref;
113
- return ec.success ? (0, _.getSignedEntityConfiguration)(ec.data.payload.iss, {
114
- appFetch
115
- }) : es.success ? (0, _.getSignedEntityStatement)(es.data.payload.iss, es.data.payload.sub, {
116
- appFetch
117
- }) :
118
- // if the element fail to parse in both EntityStatement and EntityConfiguration, raise an error
119
- Promise.reject(new _errors.IoWalletError(`Cannot renew trust chain because the element #${i} failed to be parsed.`));
120
- }));
121
- }
122
- //# sourceMappingURL=chain.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_ioReactNativeJwt","require","_types","_errors","z","_interopRequireWildcard","_","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","verify","token","kid","jwks","jwk","find","k","Error","protectedHeader","header","payload","verifyJwt","decode","decodeJwt","FirstElementShape","EntityConfiguration","MiddleElementShape","EntityStatement","LastElementShape","union","TrustAnchorEntityConfiguration","validateTrustChain","trustAnchorEntity","chain","length","IoWalletError","selectTokenShape","elementIndex","selectKid","currentIndex","shape","parse","selectKeys","keys","nextIndex","nextToken","Promise","all","map","i","args","renewTrustChain","appFetch","arguments","undefined","fetch","e","safeParse","_ref","es","ec","success","getSignedEntityConfiguration","data","iss","getSignedEntityStatement","sub","reject"],"sourceRoot":"../../../../src","sources":["entity/trust/chain.ts"],"mappings":";;;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAIA,IAAAC,MAAA,GAAAD,OAAA;AAMA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,CAAA,GAAAC,uBAAA,CAAAJ,OAAA;AACA,IAAAK,CAAA,GAAAL,OAAA;AAA2E,SAAAM,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAH,wBAAAO,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CAAAL,GAAA,SAAAM,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,G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G,EACnB;MACEd;IACF,CACF,CAAC;IACD;IACAN,OAAO,CAACqB,MAAM,CACZ,IAAIhC,qBAAa,CACd,iDAAgDc,CAAE,uBACrD,CACF,CAAC;EAAA,CACT,CACJ,CAAC;AACH"}
@@ -1,148 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getEntityConfiguration = exports.getCredentialIssuerEntityConfiguration = void 0;
7
- exports.getEntityStatement = getEntityStatement;
8
- exports.getRelyingPartyEntityConfiguration = void 0;
9
- exports.getSignedEntityConfiguration = getSignedEntityConfiguration;
10
- exports.getSignedEntityStatement = getSignedEntityStatement;
11
- exports.getWalletProviderEntityConfiguration = exports.getTrustAnchorEntityConfiguration = void 0;
12
- exports.verifyTrustChain = verifyTrustChain;
13
- var _ioReactNativeJwt = require("@pagopa/io-react-native-jwt");
14
- var _types = require("./types");
15
- var _chain = require("./chain");
16
- var _misc = require("../../utils/misc");
17
- /**
18
- * Verify a given trust chain is actually valid.
19
- * It can handle fast chain renewal, which means we try to fetch a fresh version of each statement.
20
- *
21
- * @param trustAnchorEntity The entity configuration of the known trust anchor
22
- * @param chain The chain of statements to be validate
23
- * @param options.renewOnFail Whether to renew the provided chain if the validation fails at first. Default: true
24
- * @param options.appFetch Fetch api implementation. Default: the built-in implementation
25
- * @returns The result of the chain validation
26
- * @throws {IoWalletError} When either validation or renewal fail
27
- */
28
- async function verifyTrustChain(trustAnchorEntity, chain) {
29
- let {
30
- appFetch = fetch,
31
- renewOnFail = true
32
- } = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
33
- try {
34
- return (0, _chain.validateTrustChain)(trustAnchorEntity, chain);
35
- } catch (error) {
36
- if (renewOnFail) {
37
- const renewedChain = await (0, _chain.renewTrustChain)(chain, appFetch);
38
- return (0, _chain.validateTrustChain)(trustAnchorEntity, renewedChain);
39
- } else {
40
- throw error;
41
- }
42
- }
43
- }
44
-
45
- /**
46
- * Fetch the signed entity configuration token for an entity
47
- *
48
- * @param entityBaseUrl The url of the entity to fetch
49
- * @param param.appFetch (optional) fetch api implemention
50
- * @returns The signed Entity Configuration token
51
- */
52
- async function getSignedEntityConfiguration(entityBaseUrl) {
53
- let {
54
- appFetch = fetch
55
- } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
56
- const wellKnownUrl = `${entityBaseUrl}/.well-known/openid-federation`;
57
- return await appFetch(wellKnownUrl, {
58
- method: "GET"
59
- }).then((0, _misc.hasStatusOrThrow)(200)).then(res => res.text());
60
- }
61
-
62
- /**
63
- * Fetch and parse the entity configuration document for a given federation entity.
64
- * This is an inner method to serve public interfaces.
65
- *
66
- * To add another entity configuration type (example: Foo entity type):
67
- * - create its zod schema and type by inherit from the base type (example: FooEntityConfiguration = BaseEntityConfiguration.and(...))
68
- * - add such type to EntityConfiguration union
69
- * - add an overload to this function
70
- * - create a public function which use such type (example: getFooEntityConfiguration = (url, options) => Promise<FooEntityConfiguration>)
71
- *
72
- * @param entityBaseUrl The base url of the entity.
73
- * @param schema The expected schema of the entity configuration, according to the kind of entity we are fetching from.
74
- * @param options.appFetch An optional instance of the http client to be used.
75
- * @returns The parsed entity configuration object
76
- * @throws {IoWalletError} If the http request fails
77
- * @throws Parse error if the document is not in the expected shape.
78
- */
79
-
80
- async function fetchAndParseEntityConfiguration(entityBaseUrl, schema) {
81
- let {
82
- appFetch = fetch
83
- } = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
84
- const responseText = await getSignedEntityConfiguration(entityBaseUrl, {
85
- appFetch
86
- });
87
- const responseJwt = (0, _ioReactNativeJwt.decode)(responseText);
88
- return schema.parse({
89
- header: responseJwt.protectedHeader,
90
- payload: responseJwt.payload
91
- });
92
- }
93
- const getWalletProviderEntityConfiguration = (entityBaseUrl, options) => fetchAndParseEntityConfiguration(entityBaseUrl, _types.WalletProviderEntityConfiguration, options);
94
- exports.getWalletProviderEntityConfiguration = getWalletProviderEntityConfiguration;
95
- const getCredentialIssuerEntityConfiguration = (entityBaseUrl, options) => fetchAndParseEntityConfiguration(entityBaseUrl, _types.CredentialIssuerEntityConfiguration, options);
96
- exports.getCredentialIssuerEntityConfiguration = getCredentialIssuerEntityConfiguration;
97
- const getTrustAnchorEntityConfiguration = (entityBaseUrl, options) => fetchAndParseEntityConfiguration(entityBaseUrl, _types.TrustAnchorEntityConfiguration, options);
98
- exports.getTrustAnchorEntityConfiguration = getTrustAnchorEntityConfiguration;
99
- const getRelyingPartyEntityConfiguration = (entityBaseUrl, options) => fetchAndParseEntityConfiguration(entityBaseUrl, _types.RelyingPartyEntityConfiguration, options);
100
- exports.getRelyingPartyEntityConfiguration = getRelyingPartyEntityConfiguration;
101
- const getEntityConfiguration = (entityBaseUrl, options) => fetchAndParseEntityConfiguration(entityBaseUrl, _types.EntityConfiguration, options);
102
-
103
- /**
104
- * Fetch and parse the entity statement document for a given federation entity.
105
- *
106
- * @param accreditationBodyBaseUrl The base url of the accreditaion body which holds and signs the required entity statement
107
- * @param subordinatedEntityBaseUrl The url that identifies the subordinate entity
108
- * @param options.appFetch An optional instance of the http client to be used.
109
- * @returns The parsed entity configuration object
110
- * @throws {IoWalletError} If the http request fails
111
- * @throws Parse error if the document is not in the expected shape.
112
- */
113
- exports.getEntityConfiguration = getEntityConfiguration;
114
- async function getEntityStatement(accreditationBodyBaseUrl, subordinatedEntityBaseUrl) {
115
- let {
116
- appFetch = fetch
117
- } = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
118
- const responseText = await getSignedEntityStatement(accreditationBodyBaseUrl, subordinatedEntityBaseUrl, {
119
- appFetch
120
- });
121
- const responseJwt = (0, _ioReactNativeJwt.decode)(responseText);
122
- return _types.EntityStatement.parse({
123
- header: responseJwt.protectedHeader,
124
- payload: responseJwt.payload
125
- });
126
- }
127
-
128
- /**
129
- * Fetch the entity statement document for a given federation entity.
130
- *
131
- * @param accreditationBodyBaseUrl The base url of the accreditaion body which holds and signs the required entity statement
132
- * @param subordinatedEntityBaseUrl The url that identifies the subordinate entity
133
- * @param options.appFetch An optional instance of the http client to be used.
134
- * @returns The signed entity statement token
135
- * @throws {IoWalletError} If the http request fails
136
- */
137
- async function getSignedEntityStatement(accreditationBodyBaseUrl, subordinatedEntityBaseUrl) {
138
- let {
139
- appFetch = fetch
140
- } = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
141
- const url = `${accreditationBodyBaseUrl}/fetch?${new URLSearchParams({
142
- sub: subordinatedEntityBaseUrl
143
- })}`;
144
- return await appFetch(url, {
145
- method: "GET"
146
- }).then((0, _misc.hasStatusOrThrow)(200)).then(res => res.text());
147
- }
148
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_ioReactNativeJwt","require","_types","_chain","_misc","verifyTrustChain","trustAnchorEntity","chain","appFetch","fetch","renewOnFail","arguments","length","undefined","validateTrustChain","error","renewedChain","renewTrustChain","getSignedEntityConfiguration","entityBaseUrl","wellKnownUrl","method","then","hasStatusOrThrow","res","text","fetchAndParseEntityConfiguration","schema","responseText","responseJwt","decodeJwt","parse","header","protectedHeader","payload","getWalletProviderEntityConfiguration","options","WalletProviderEntityConfiguration","exports","getCredentialIssuerEntityConfiguration","CredentialIssuerEntityConfiguration","getTrustAnchorEntityConfiguration","TrustAnchorEntityConfiguration","getRelyingPartyEntityConfiguration","RelyingPartyEntityConfiguration","getEntityConfiguration","EntityConfiguration","getEntityStatement","accreditationBodyBaseUrl","subordinatedEntityBaseUrl","getSignedEntityStatement","EntityStatement","url","URLSearchParams","sub"],"sourceRoot":"../../../../src","sources":["entity/trust/index.ts"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAQA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAWA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAeI,gBAAgBA,CACpCC,iBAAiD,EACjDC,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EAAA,IALA;IACEzC,QAAQ,GAAGC;EAGb,CAAC,GAAAE,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAEN,MAAMiB,YAAY,GAAG,MAAMsB,wBAAwB,CACjDF,wBAAwB,EACxBC,yBAAyB,EACzB;IACEzC;EACF,CACF,CAAC;EAED,MAAMqB,WAAW,GAAG,IAAAC,wBAAS,EAACF,YAAY,CAAC;EAC3C,OAAOuB,sBAAe,CAACpB,KAAK,CAAC;IAC3BC,MAAM,EAAEH,WAAW,CAACI,eAAe;IACnCC,OAAO,EAAEL,WAAW,CAACK;EACvB,CAAC,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAegB,wBAAwBA,CAC5CF,wBAAgC,EAChCC,yBAAiC,EAMjC;EAAA,IALA;IACEzC,QAAQ,GAAGC;EAGb,CAAC,GAAAE,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAEN,MAAMyC,GAAG,GAAI,GAAEJ,wBAAyB,UAAS,IAAIK,eAAe,CAAC;IACnEC,GAAG,EAAEL;EACP,CAAC,CAAE,EAAC;EAEJ,OAAO,MAAMzC,QAAQ,CAAC4C,GAAG,EAAE;IACzB/B,MAAM,EAAE;EACV,CAAC,CAAC,CACCC,IAAI,CAAC,IAAAC,sBAAgB,EAAC,GAAG,CAAC,CAAC,CAC3BD,IAAI,CAAEE,GAAG,IAAKA,GAAG,CAACC,IAAI,CAAC,CAAC,CAAC;AAC9B"}
@@ -1 +0,0 @@
1
- {"version":3,"names":["_types","require","_jwk","z","_interopRequireWildcard","_types2","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","TrustMark","object","id","string","trust_mark","exports","RelyingPartyMetadata","application_type","optional","client_id","client_name","jwks","keys","array","JWK","contacts","presentation_definition","PresentationDefinition","presentation_definition_uri","CredentialDisplayMetadata","name","locale","logo","url","alt_text","background_color","text_color","CredentialIssuerDisplayMetadata","ClaimsMetadata","record","value_type","display","IssuanceErrorSupported","title","description","SupportedCredentialMetadata","format","union","literal","scope","claims","cryptographic_binding_methods_supported","credential_signing_alg_values_supported","authentic_source","issuance_errors_supported","EntityStatement","header","typ","alg","kid","payload","iss","sub","trust_marks","iat","number","exp","EntityConfigurationHeader","FederationEntityMetadata","federation_fetch_endpoint","federation_list_endpoint","federation_resolve_endpoint","federation_trust_mark_status_endpoint","federation_trust_mark_list_endpoint","organization_name","homepage_uri","policy_uri","logo_uri","passthrough","BaseEntityConfiguration","UnixTime","authority_hints","metadata","federation_entity","TrustAnchorEntityConfiguration","CredentialIssuerEntityConfiguration","and","openid_credential_issuer","credential_issuer","credential_endpoint","revocation_endpoint","status_attestation_endpoint","credential_configurations_supported","oauth_authorization_server","authorization_endpoint","pushed_authorization_request_endpoint","dpop_signing_alg_values_supported","token_endpoint","introspection_endpoint","client_registration_types_supported","code_challenge_methods_supported","authorization_details_types_supported","acr_values_supported","grant_types_supported","issuer","scopes_supported","request_parameter_supported","boolean","request_uri_parameter_supported","response_types_supported","response_modes_supported","subject_types_supported","token_endpoint_auth_methods_supported","token_endpoint_auth_signing_alg_values_supported","request_object_signing_alg_values_supported","wallet_relying_party","RelyingPartyEntityConfiguration","WalletProviderEntityConfiguration","wallet_provider","aal_values_supported","EntityConfiguration"],"sourceRoot":"../../../../src","sources":["entity/trust/types.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,CAAA,GAAAC,uBAAA,CAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAA6E,SAAAK,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAA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sC,KAAK,CACvDtC,CAAC,CAAC4B,MAAM,CAAC,CACX,CAAC;QACDQ,IAAI,EAAEpC,CAAC,CAAC0B,MAAM,CAAC;UAAEW,IAAI,EAAErC,CAAC,CAACsC,KAAK,CAACC,QAAG;QAAE,CAAC;MACvC,CAAC,CAAC,CACDsD,WAAW,CAAC;IACjB,CAAC;EACH,CAAC;AACH,CAAC,CACH,CAAC;;AAED;AAAA/D,OAAA,CAAAsG,iCAAA,GAAAA,iCAAA;AAEO,MAAMG,mBAAmB,GAAGvI,CAAC,CAAC8D,KAAK,CACxC,CACEsE,iCAAiC,EACjChC,mCAAmC,EACnCD,8BAA8B,EAC9BgC,+BAA+B,CAChC,EACD;EACExE,WAAW,EAAE;AACf,CACF,CAAC;AAAC7B,OAAA,CAAAyG,mBAAA,GAAAA,mBAAA"}
@@ -1,26 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.extractElementValueAsDate = extractElementValueAsDate;
7
- /**
8
- * Extracts the date value of a given elementIdentifier from an MDOC object.
9
- * Searches through the issuerSigned namespaces and attempts to parse the value as a Date.
10
- * The expected date format is "DD-MM-YYYY".
11
- * Returns the Date object if found, otherwise returns null.
12
- */
13
- function extractElementValueAsDate(elementValue) {
14
- if (typeof elementValue === "string") {
15
- const dateParts = elementValue.split("-");
16
- if (dateParts.length === 3) {
17
- const [day, month, year] = dateParts.map(part => Number(part));
18
- if (day !== undefined && month !== undefined && year !== undefined && !isNaN(day) && !isNaN(month) && !isNaN(year)) {
19
- return new Date(year, month - 1, day); // Month is zero-based in JS Date
20
- }
21
- }
22
- }
23
-
24
- return null; // Return null if no matching element is found or it's not a valid date
25
- }
26
- //# sourceMappingURL=converters.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["extractElementValueAsDate","elementValue","dateParts","split","length","day","month","year","map","part","Number","undefined","isNaN","Date"],"sourceRoot":"../../../src","sources":["mdoc/converters.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,yBAAyBA,CAACC,YAAoB,EAAe;EAC3E,IAAI,OAAOA,YAAY,KAAK,QAAQ,EAAE;IACpC,MAAMC,SAAS,GAAGD,YAAY,CAACE,KAAK,CAAC,GAAG,CAAC;IACzC,IAAID,SAAS,CAACE,MAAM,KAAK,CAAC,EAAE;MAC1B,MAAM,CAACC,GAAG,EAAEC,KAAK,EAAEC,IAAI,CAAC,GAAGL,SAAS,CAACM,GAAG,CAAEC,IAAI,IAAKC,MAAM,CAACD,IAAI,CAAC,CAAC;MAChE,IACEJ,GAAG,KAAKM,SAAS,IACjBL,KAAK,KAAKK,SAAS,IACnBJ,IAAI,KAAKI,SAAS,IAClB,CAACC,KAAK,CAACP,GAAG,CAAC,IACX,CAACO,KAAK,CAACN,KAAK,CAAC,IACb,CAACM,KAAK,CAACL,IAAI,CAAC,EACZ;QACA,OAAO,IAAIM,IAAI,CAACN,IAAI,EAAED,KAAK,GAAG,CAAC,EAAED,GAAG,CAAC,CAAC,CAAC;MACzC;IACF;EACF;;EAEA,OAAO,IAAI,CAAC,CAAC;AACf"}
@@ -1,68 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.verify = exports.prepareVpTokenMdoc = void 0;
7
- var _ioReactNativeCbor = require("@pagopa/io-react-native-cbor");
8
- var _jsrsasign = require("jsrsasign");
9
- var _crypto = require("../utils/crypto");
10
- var _string = require("../utils/string");
11
- const verify = async (token, _) => {
12
- var _issuerSigned$issuerA;
13
- // get decoded data
14
- const issuerSigned = await _ioReactNativeCbor.CBOR.decodeIssuerSigned(token);
15
- if (!issuerSigned) {
16
- throw new Error("Invalid mDoc");
17
- }
18
- const cert = (_issuerSigned$issuerA = issuerSigned.issuerAuth.unprotectedHeader[0]) === null || _issuerSigned$issuerA === void 0 || (_issuerSigned$issuerA = _issuerSigned$issuerA.x5chain) === null || _issuerSigned$issuerA === void 0 ? void 0 : _issuerSigned$issuerA[0];
19
- if (!cert) throw new Error("Certificate not present in credential");
20
- const pemcert = (0, _crypto.convertCertToPem)((0, _jsrsasign.b64utob64)(cert));
21
- const publickey = (0, _crypto.parsePublicKey)(pemcert);
22
- if (!publickey) throw new Error("Certificate not present in credential");
23
- const jwk = (0, _crypto.getSigningJwk)(publickey);
24
- jwk.x = (0, _jsrsasign.b64utob64)(jwk.x);
25
- jwk.y = (0, _jsrsasign.b64utob64)(jwk.y);
26
- const signatureCorrect = await _ioReactNativeCbor.COSE.verify((0, _jsrsasign.b64utob64)(issuerSigned.issuerAuth.rawValue), jwk).catch(() => false);
27
- if (!signatureCorrect) throw new Error("Invalid mDoc signature");
28
- return {
29
- issuerSigned
30
- };
31
- };
32
- exports.verify = verify;
33
- const prepareVpTokenMdoc = async (requestNonce, generatedNonce, clientId, responseUri, docType, keyTag, _ref) => {
34
- let [verifiableCredential, requestedClaims, _] = _ref;
35
- /* verifiableCredential is a IssuerSigned structure */
36
- const documents = [{
37
- issuerSignedContent: verifiableCredential,
38
- alias: keyTag,
39
- docType
40
- }];
41
-
42
- /* we map each requested claim as for ex. { "org.iso.18013.5.1.mDL": { "org.iso.18013.5.1": { <claim-name>: true, ... }}} for selective disclosure */
43
- const fieldRequestedAndAccepted = JSON.stringify({
44
- [docType]: requestedClaims.reduce((acc, _ref2) => {
45
- let {
46
- name,
47
- namespace
48
- } = _ref2;
49
- if (namespace) {
50
- acc[namespace] ??= {};
51
- const existingNamespace = acc[namespace];
52
- existingNamespace[name] = true;
53
- } else {
54
- acc[name] = true;
55
- }
56
- return acc;
57
- }, {})
58
- });
59
-
60
- /* clientId,responseUri,requestNonce are retrieved by Auth Request Object */
61
- /* create DeviceResponse as { documents: { docType, issuerSigned, deviceSigned }, version, status } */
62
- const vp_token = await _ioReactNativeCbor.ISO18013.generateOID4VPDeviceResponse(clientId, responseUri, requestNonce, generatedNonce, documents, fieldRequestedAndAccepted);
63
- return {
64
- vp_token: (0, _string.base64ToBase64Url)(vp_token)
65
- };
66
- };
67
- exports.prepareVpTokenMdoc = prepareVpTokenMdoc;
68
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_ioReactNativeCbor","require","_jsrsasign","_crypto","_string","verify","token","_","_issuerSigned$issuerA","issuerSigned","CBOR","decodeIssuerSigned","Error","cert","issuerAuth","unprotectedHeader","x5chain","pemcert","convertCertToPem","b64utob64","publickey","parsePublicKey","jwk","getSigningJwk","x","y","signatureCorrect","COSE","rawValue","catch","exports","prepareVpTokenMdoc","requestNonce","generatedNonce","clientId","responseUri","docType","keyTag","_ref","verifiableCredential","requestedClaims","documents","issuerSignedContent","alias","fieldRequestedAndAccepted","JSON","stringify","reduce","acc","_ref2","name","namespace","existingNamespace","vp_token","ISO18013","generateOID4VPDeviceResponse","base64ToBase64Url"],"sourceRoot":"../../../src","sources":["mdoc/index.ts"],"mappings":";;;;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AAGA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAMA,IAAAG,OAAA,GAAAH,OAAA;AAEO,MAAMI,MAAM,GAAG,MAAAA,CACpBC,KAAa,EACbC,CAAc,KACmC;EAAA,IAAAC,qBAAA;EACjD;EACA,MAAMC,YAAY,GAAG,MAAMC,uBAAI,CAACC,kBAAkB,CAACL,KAAK,CAAC;EACzD,IAAI,CAACG,YAAY,EAAE;IACjB,MAAM,IAAIG,KAAK,CAAC,cAAc,CAAC;EACjC;EAEA,MAAMC,IAAI,IAAAL,qBAAA,GAAGC,YAAY,CAACK,UAAU,CAACC,iBAAiB,CAAC,CAAC,CAAC,cAAAP,qBAAA,gBAAAA,qBAAA,GAA5CA,qBAAA,CAA8CQ,OAAO,cAAAR,qBAAA,uBAArDA,qBAAA,CAAwD,CAAC,CAAC;EACvE,IAAI,CAACK,IAAI,EAAE,MAAM,IAAID,KAAK,CAAC,uCAAuC,CAAC;EAEnE,MAAMK,OAAO,GAAG,IAAAC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