@europeum-ebsi/cli 0.0.0 → 1.0.0-rc.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 (384) hide show
  1. package/LICENSE.txt +289 -289
  2. package/LICENSES.txt +538 -0
  3. package/README.md +1140 -98
  4. package/dist/api/client.d.ts +4 -0
  5. package/dist/api/client.d.ts.map +1 -0
  6. package/dist/api/client.js +14 -0
  7. package/dist/api/client.js.map +1 -0
  8. package/dist/api/fetch.d.ts +13 -0
  9. package/dist/api/fetch.d.ts.map +1 -0
  10. package/dist/api/fetch.js +30 -0
  11. package/dist/api/fetch.js.map +1 -0
  12. package/dist/api/params.d.ts +4 -0
  13. package/dist/api/params.d.ts.map +1 -0
  14. package/dist/api/params.js +9 -0
  15. package/dist/api/params.js.map +1 -0
  16. package/dist/auth/dcql.d.ts +5 -0
  17. package/dist/auth/dcql.d.ts.map +1 -0
  18. package/dist/auth/dcql.js +41 -0
  19. package/dist/auth/dcql.js.map +1 -0
  20. package/dist/auth/presentation.d.ts +30 -0
  21. package/dist/auth/presentation.d.ts.map +1 -0
  22. package/dist/auth/presentation.js +99 -0
  23. package/dist/auth/presentation.js.map +1 -0
  24. package/dist/auth/token.d.ts +11 -0
  25. package/dist/auth/token.d.ts.map +1 -0
  26. package/dist/auth/token.js +116 -0
  27. package/dist/auth/token.js.map +1 -0
  28. package/dist/cli.d.ts +3 -0
  29. package/dist/cli.d.ts.map +1 -0
  30. package/dist/cli.js +96 -10
  31. package/dist/cli.js.map +1 -1
  32. package/dist/commands/auth.d.ts +3 -0
  33. package/dist/commands/auth.d.ts.map +1 -0
  34. package/dist/commands/auth.js +99 -0
  35. package/dist/commands/auth.js.map +1 -0
  36. package/dist/commands/config-cmd.d.ts +3 -0
  37. package/dist/commands/config-cmd.d.ts.map +1 -0
  38. package/dist/commands/config-cmd.js +86 -0
  39. package/dist/commands/config-cmd.js.map +1 -0
  40. package/dist/commands/contracts-registry.d.ts +3 -0
  41. package/dist/commands/contracts-registry.d.ts.map +1 -0
  42. package/dist/commands/contracts-registry.js +132 -0
  43. package/dist/commands/contracts-registry.js.map +1 -0
  44. package/dist/commands/did-registry.d.ts +3 -0
  45. package/dist/commands/did-registry.d.ts.map +1 -0
  46. package/dist/commands/did-registry.js +110 -0
  47. package/dist/commands/did-registry.js.map +1 -0
  48. package/dist/commands/faucet.d.ts +3 -0
  49. package/dist/commands/faucet.d.ts.map +1 -0
  50. package/dist/commands/faucet.js +78 -0
  51. package/dist/commands/faucet.js.map +1 -0
  52. package/dist/commands/health.d.ts +3 -0
  53. package/dist/commands/health.d.ts.map +1 -0
  54. package/dist/commands/health.js +20 -0
  55. package/dist/commands/health.js.map +1 -0
  56. package/dist/commands/issuers-registry.d.ts +3 -0
  57. package/dist/commands/issuers-registry.d.ts.map +1 -0
  58. package/dist/commands/issuers-registry.js +340 -0
  59. package/dist/commands/issuers-registry.js.map +1 -0
  60. package/dist/commands/ledger.d.ts +3 -0
  61. package/dist/commands/ledger.d.ts.map +1 -0
  62. package/dist/commands/ledger.js +549 -372
  63. package/dist/commands/ledger.js.map +1 -1
  64. package/dist/commands/onboarding.d.ts +3 -0
  65. package/dist/commands/onboarding.d.ts.map +1 -0
  66. package/dist/commands/onboarding.js +301 -0
  67. package/dist/commands/onboarding.js.map +1 -0
  68. package/dist/commands/openapi.d.ts +3 -0
  69. package/dist/commands/openapi.d.ts.map +1 -0
  70. package/dist/commands/openapi.js +37 -0
  71. package/dist/commands/openapi.js.map +1 -0
  72. package/dist/commands/policies-registry.d.ts +3 -0
  73. package/dist/commands/policies-registry.d.ts.map +1 -0
  74. package/dist/commands/policies-registry.js +198 -0
  75. package/dist/commands/policies-registry.js.map +1 -0
  76. package/dist/commands/registry.d.ts +27 -0
  77. package/dist/commands/registry.d.ts.map +1 -0
  78. package/dist/commands/registry.js +62 -0
  79. package/dist/commands/registry.js.map +1 -0
  80. package/dist/commands/schemas-registry.d.ts +3 -0
  81. package/dist/commands/schemas-registry.d.ts.map +1 -0
  82. package/dist/commands/schemas-registry.js +231 -0
  83. package/dist/commands/schemas-registry.js.map +1 -0
  84. package/dist/commands/shared/args.d.ts +2 -0
  85. package/dist/commands/shared/args.d.ts.map +1 -0
  86. package/dist/commands/shared/args.js +4 -0
  87. package/dist/commands/shared/args.js.map +1 -0
  88. package/dist/commands/shared/wallet-opts.d.ts +9 -0
  89. package/dist/commands/shared/wallet-opts.d.ts.map +1 -0
  90. package/dist/commands/shared/wallet-opts.js +44 -0
  91. package/dist/commands/shared/wallet-opts.js.map +1 -0
  92. package/dist/commands/timestamp.d.ts +3 -0
  93. package/dist/commands/timestamp.d.ts.map +1 -0
  94. package/dist/commands/timestamp.js +250 -0
  95. package/dist/commands/timestamp.js.map +1 -0
  96. package/dist/commands/track-and-trace.d.ts +3 -0
  97. package/dist/commands/track-and-trace.d.ts.map +1 -0
  98. package/dist/commands/track-and-trace.js +235 -0
  99. package/dist/commands/track-and-trace.js.map +1 -0
  100. package/dist/commands/wallet.d.ts +3 -0
  101. package/dist/commands/wallet.d.ts.map +1 -0
  102. package/dist/commands/wallet.js +123 -0
  103. package/dist/commands/wallet.js.map +1 -0
  104. package/dist/config/config.d.ts +45 -0
  105. package/dist/config/config.d.ts.map +1 -0
  106. package/dist/config/config.js +111 -0
  107. package/dist/config/config.js.map +1 -0
  108. package/dist/config/ebsi-env.d.ts +4 -0
  109. package/dist/config/ebsi-env.d.ts.map +1 -0
  110. package/dist/config/ebsi-env.js +37 -0
  111. package/dist/config/ebsi-env.js.map +1 -0
  112. package/dist/crypto/wallet.d.ts +34 -0
  113. package/dist/crypto/wallet.d.ts.map +1 -0
  114. package/dist/crypto/wallet.js +100 -0
  115. package/dist/crypto/wallet.js.map +1 -0
  116. package/dist/index.d.ts +3 -0
  117. package/dist/index.d.ts.map +1 -0
  118. package/dist/index.js +15 -6
  119. package/dist/index.js.map +1 -1
  120. package/dist/ledger/read.d.ts +11 -0
  121. package/dist/ledger/read.d.ts.map +1 -0
  122. package/dist/ledger/read.js +24 -0
  123. package/dist/ledger/read.js.map +1 -0
  124. package/dist/ledger/registries.d.ts +25 -0
  125. package/dist/ledger/registries.d.ts.map +1 -0
  126. package/dist/ledger/registries.js +111 -0
  127. package/dist/ledger/registries.js.map +1 -0
  128. package/dist/ledger/write.d.ts +43 -0
  129. package/dist/ledger/write.d.ts.map +1 -0
  130. package/dist/ledger/write.js +119 -0
  131. package/dist/ledger/write.js.map +1 -0
  132. package/dist/onboarding/vc.d.ts +18 -0
  133. package/dist/onboarding/vc.d.ts.map +1 -0
  134. package/dist/onboarding/vc.js +72 -0
  135. package/dist/onboarding/vc.js.map +1 -0
  136. package/dist/output/format.d.ts +7 -0
  137. package/dist/output/format.d.ts.map +1 -0
  138. package/dist/output/format.js +94 -0
  139. package/dist/output/format.js.map +1 -0
  140. package/dist/tui/App.d.ts +3 -0
  141. package/dist/tui/App.d.ts.map +1 -0
  142. package/dist/tui/App.js +99 -0
  143. package/dist/tui/App.js.map +1 -0
  144. package/dist/tui/CommandPalette.d.ts +8 -0
  145. package/dist/tui/CommandPalette.d.ts.map +1 -0
  146. package/dist/tui/CommandPalette.js +105 -0
  147. package/dist/tui/CommandPalette.js.map +1 -0
  148. package/package.json +66 -108
  149. package/src/api/client.ts +26 -0
  150. package/src/api/fetch.ts +53 -0
  151. package/src/api/params.ts +17 -0
  152. package/src/auth/dcql.ts +84 -0
  153. package/src/auth/presentation.ts +255 -0
  154. package/src/auth/token.ts +244 -0
  155. package/src/cli.ts +164 -0
  156. package/src/commands/auth.ts +119 -0
  157. package/src/commands/config-cmd.ts +122 -0
  158. package/src/commands/contracts-registry.ts +156 -0
  159. package/src/commands/did-registry.ts +126 -0
  160. package/src/commands/faucet.ts +112 -0
  161. package/src/commands/health.ts +21 -0
  162. package/src/commands/issuers-registry.ts +385 -0
  163. package/src/commands/ledger.ts +777 -0
  164. package/src/commands/onboarding.ts +411 -0
  165. package/src/commands/openapi.ts +42 -0
  166. package/src/commands/policies-registry.ts +218 -0
  167. package/src/commands/registry.ts +152 -0
  168. package/src/commands/schemas-registry.ts +255 -0
  169. package/src/commands/shared/args.ts +14 -0
  170. package/src/commands/shared/wallet-opts.ts +85 -0
  171. package/src/commands/timestamp.ts +272 -0
  172. package/src/commands/track-and-trace.ts +263 -0
  173. package/src/commands/wallet.ts +175 -0
  174. package/src/config/config.ts +275 -0
  175. package/src/config/ebsi-env.ts +67 -0
  176. package/src/crypto/wallet.ts +291 -0
  177. package/src/index.ts +24 -0
  178. package/src/ledger/read.ts +70 -0
  179. package/src/ledger/registries.ts +285 -0
  180. package/src/ledger/write.ts +381 -0
  181. package/src/onboarding/vc.ts +205 -0
  182. package/src/output/format.ts +157 -0
  183. package/src/tui/App.tsx +282 -0
  184. package/src/tui/CommandPalette.tsx +223 -0
  185. package/bin/cli.js +0 -13
  186. package/dist/abi/pilot/DidRegistry.js +0 -568
  187. package/dist/abi/pilot/DidRegistry.js.map +0 -1
  188. package/dist/abi/pilot/Ptr.js +0 -666
  189. package/dist/abi/pilot/Ptr.js.map +0 -1
  190. package/dist/abi/pilot/SchemaSCRegistry.js +0 -264
  191. package/dist/abi/pilot/SchemaSCRegistry.js.map +0 -1
  192. package/dist/abi/pilot/Tcr.js +0 -715
  193. package/dist/abi/pilot/Tcr.js.map +0 -1
  194. package/dist/abi/pilot/Timestamp.js +0 -658
  195. package/dist/abi/pilot/Timestamp.js.map +0 -1
  196. package/dist/abi/pilot/Tir.js +0 -428
  197. package/dist/abi/pilot/Tir.js.map +0 -1
  198. package/dist/abi/pilot/TnT.js +0 -842
  199. package/dist/abi/pilot/TnT.js.map +0 -1
  200. package/dist/abi/pilot/Tpr.js +0 -492
  201. package/dist/abi/pilot/Tpr.js.map +0 -1
  202. package/dist/abi/test/DidRegistry.js +0 -568
  203. package/dist/abi/test/DidRegistry.js.map +0 -1
  204. package/dist/abi/test/Ptr.js +0 -666
  205. package/dist/abi/test/Ptr.js.map +0 -1
  206. package/dist/abi/test/SchemaSCRegistry.js +0 -300
  207. package/dist/abi/test/SchemaSCRegistry.js.map +0 -1
  208. package/dist/abi/test/Tcr.js +0 -715
  209. package/dist/abi/test/Tcr.js.map +0 -1
  210. package/dist/abi/test/Timestamp.js +0 -658
  211. package/dist/abi/test/Timestamp.js.map +0 -1
  212. package/dist/abi/test/Tir.js +0 -428
  213. package/dist/abi/test/Tir.js.map +0 -1
  214. package/dist/abi/test/TnT.js +0 -842
  215. package/dist/abi/test/TnT.js.map +0 -1
  216. package/dist/abi/test/Tpr.js +0 -492
  217. package/dist/abi/test/Tpr.js.map +0 -1
  218. package/dist/app.js +0 -659
  219. package/dist/app.js.map +0 -1
  220. package/dist/buildParam/didr.js +0 -374
  221. package/dist/buildParam/didr.js.map +0 -1
  222. package/dist/buildParam/index.js +0 -53
  223. package/dist/buildParam/index.js.map +0 -1
  224. package/dist/buildParam/ptr.js +0 -80
  225. package/dist/buildParam/ptr.js.map +0 -1
  226. package/dist/buildParam/tcr.js +0 -36
  227. package/dist/buildParam/tcr.js.map +0 -1
  228. package/dist/buildParam/timestamp.js +0 -350
  229. package/dist/buildParam/timestamp.js.map +0 -1
  230. package/dist/buildParam/tir.js +0 -110
  231. package/dist/buildParam/tir.js.map +0 -1
  232. package/dist/buildParam/tnt.js +0 -214
  233. package/dist/buildParam/tnt.js.map +0 -1
  234. package/dist/buildParam/tpr.js +0 -91
  235. package/dist/buildParam/tpr.js.map +0 -1
  236. package/dist/buildParam/tsr.js +0 -115
  237. package/dist/buildParam/tsr.js.map +0 -1
  238. package/dist/commands/authorisation.js +0 -144
  239. package/dist/commands/authorisation.js.map +0 -1
  240. package/dist/commands/compute.js +0 -680
  241. package/dist/commands/compute.js.map +0 -1
  242. package/dist/commands/conformance.js +0 -813
  243. package/dist/commands/conformance.js.map +0 -1
  244. package/dist/commands/hardwarewallet.js +0 -41
  245. package/dist/commands/hardwarewallet.js.map +0 -1
  246. package/dist/commands/index.js +0 -8
  247. package/dist/commands/index.js.map +0 -1
  248. package/dist/commands/ptr.js +0 -54
  249. package/dist/commands/ptr.js.map +0 -1
  250. package/dist/commands/tcr.js +0 -50
  251. package/dist/commands/tcr.js.map +0 -1
  252. package/dist/commands/tir.js +0 -64
  253. package/dist/commands/tir.js.map +0 -1
  254. package/dist/commands/tnl.js +0 -81
  255. package/dist/commands/tnl.js.map +0 -1
  256. package/dist/commands/tsr.js +0 -45
  257. package/dist/commands/tsr.js.map +0 -1
  258. package/dist/commands/view.js +0 -53
  259. package/dist/commands/view.js.map +0 -1
  260. package/dist/config.js +0 -497
  261. package/dist/config.js.map +0 -1
  262. package/dist/interfaces/context.js +0 -2
  263. package/dist/interfaces/context.js.map +0 -1
  264. package/dist/interfaces/contracts/ProxyFactory.js +0 -2
  265. package/dist/interfaces/contracts/ProxyFactory.js.map +0 -1
  266. package/dist/interfaces/contracts/ProxyTemplateRegistry.js +0 -2
  267. package/dist/interfaces/contracts/ProxyTemplateRegistry.js.map +0 -1
  268. package/dist/interfaces/contracts/SchemaSCRegistry.js +0 -2
  269. package/dist/interfaces/contracts/SchemaSCRegistry.js.map +0 -1
  270. package/dist/interfaces/contracts/common.js +0 -2
  271. package/dist/interfaces/contracts/common.js.map +0 -1
  272. package/dist/interfaces/index.js +0 -5
  273. package/dist/interfaces/index.js.map +0 -1
  274. package/dist/interfaces/jsonrpc.interface.js +0 -2
  275. package/dist/interfaces/jsonrpc.interface.js.map +0 -1
  276. package/dist/interfaces/paginated-list.interface.js +0 -2
  277. package/dist/interfaces/paginated-list.interface.js.map +0 -1
  278. package/dist/interfaces/unsigned-transaction.interface.js +0 -2
  279. package/dist/interfaces/unsigned-transaction.interface.js.map +0 -1
  280. package/dist/interfaces/utils.interface.js +0 -2
  281. package/dist/interfaces/utils.interface.js.map +0 -1
  282. package/dist/programs/migrateDid.js +0 -159
  283. package/dist/programs/migrateDid.js.map +0 -1
  284. package/dist/programs/migrateDids.js +0 -232
  285. package/dist/programs/migrateDids.js.map +0 -1
  286. package/dist/programs/migrateTsr.js +0 -201
  287. package/dist/programs/migrateTsr.js.map +0 -1
  288. package/dist/scripts/accreditAndAuthorize/conformance/step1 +0 -34
  289. package/dist/scripts/accreditAndAuthorize/conformance/step2 +0 -18
  290. package/dist/scripts/accreditAndAuthorize/conformance/step3 +0 -9
  291. package/dist/scripts/accreditAndAuthorize/conformance/step4 +0 -27
  292. package/dist/scripts/accreditAndAuthorize/conformance/step5 +0 -13
  293. package/dist/scripts/accreditAndAuthorize/conformance/step6 +0 -14
  294. package/dist/scripts/accreditAndAuthorize/conformance/step7 +0 -7
  295. package/dist/scripts/accreditAndAuthorize/test/step1 +0 -34
  296. package/dist/scripts/accreditAndAuthorize/test/step2 +0 -18
  297. package/dist/scripts/accreditAndAuthorize/test/step3 +0 -9
  298. package/dist/scripts/accreditAndAuthorize/test/step4 +0 -27
  299. package/dist/scripts/accreditAndAuthorize/test/step5 +0 -13
  300. package/dist/scripts/accreditAndAuthorize/test/step6 +0 -14
  301. package/dist/scripts/accreditAndAuthorize/test/step7 +0 -7
  302. package/dist/scripts/accreditTI +0 -21
  303. package/dist/scripts/assets/Nodes.json +0 -27
  304. package/dist/scripts/assets/vcdm1.1/CTRevocableCredential.json +0 -30
  305. package/dist/scripts/assets/vcdm1.1/CredentialToAttestVerifiableAuthorisationForTrustChain.json +0 -29
  306. package/dist/scripts/assets/vcdm1.1/Nodes.json +0 -27
  307. package/dist/scripts/assets/vcdm1.1/TrustedNodesList.json +0 -35
  308. package/dist/scripts/assets/vcdm1.1/VerifiableAccreditationToAccredit.json +0 -35
  309. package/dist/scripts/assets/vcdm1.1/VerifiableAccreditationToAttest.json +0 -33
  310. package/dist/scripts/assets/vcdm1.1/VerifiableAuthorisationForTrustChain.json +0 -22
  311. package/dist/scripts/assets/vcdm1.1/VerifiableAuthorisationToInvoke.json +0 -24
  312. package/dist/scripts/assets/vcdm1.1/VerifiableAuthorisationToOnboard.json +0 -24
  313. package/dist/scripts/assets/vcdm2.0/CredentialToAttestVerifiableAuthorisationForTrustChain.json +0 -29
  314. package/dist/scripts/assets/vcdm2.0/TrustedNodesList.json +0 -36
  315. package/dist/scripts/assets/vcdm2.0/VerifiableAccreditationToAccredit.json +0 -40
  316. package/dist/scripts/assets/vcdm2.0/VerifiableAccreditationToAttest.json +0 -38
  317. package/dist/scripts/assets/vcdm2.0/VerifiableAuthorisationForTrustChain.json +0 -30
  318. package/dist/scripts/assets/vcdm2.0/VerifiableAuthorisationToInvoke.json +0 -24
  319. package/dist/scripts/assets/vcdm2.0/VerifiableAuthorisationToOnboard.json +0 -23
  320. package/dist/scripts/bootstrap/0a-loadTPROperator +0 -5
  321. package/dist/scripts/bootstrap/0b-loadAdmin +0 -8
  322. package/dist/scripts/bootstrap/1-populateTPR +0 -92
  323. package/dist/scripts/bootstrap/2-populateDID +0 -6
  324. package/dist/scripts/bootstrap/3-populateTimestamp +0 -9
  325. package/dist/scripts/bootstrap/4-populateTIR +0 -8
  326. package/dist/scripts/bootstrap/5-populateTSR +0 -85
  327. package/dist/scripts/bootstrap/6-setupConformanceIssuer +0 -35
  328. package/dist/scripts/bootstrap/README.md +0 -218
  329. package/dist/scripts/issueVcInvoke +0 -10
  330. package/dist/scripts/issueVcOnboard +0 -9
  331. package/dist/scripts/issueVcRootTAO +0 -11
  332. package/dist/scripts/issueVcTAO +0 -12
  333. package/dist/scripts/issueVcTI +0 -12
  334. package/dist/scripts/issueVcTnl +0 -32
  335. package/dist/scripts/issue_CTRevocableCredential +0 -12
  336. package/dist/scripts/issue_SelfAttestationSupportOffice +0 -10
  337. package/dist/scripts/issue_VerifiableAccreditationToAccredit +0 -11
  338. package/dist/scripts/issue_VerifiableAccreditationToAttest +0 -11
  339. package/dist/scripts/issue_VerifiableAuthorisationForTrustChain +0 -10
  340. package/dist/scripts/issue_VerifiableAuthorisationToOnboard +0 -9
  341. package/dist/scripts/preregisterIssuer +0 -6
  342. package/dist/scripts/registerDidDocument +0 -15
  343. package/dist/scripts/registerIssuer +0 -6
  344. package/dist/scripts/updateVcRootTAO +0 -10
  345. package/dist/scripts/updateVcTAO +0 -11
  346. package/dist/scripts/updateVcTI +0 -11
  347. package/dist/scripts/vcdm2.0/issueSelfAttestationSupportOffice +0 -10
  348. package/dist/scripts/vcdm2.0/issueVcInvoke +0 -12
  349. package/dist/scripts/vcdm2.0/issueVcOnboard +0 -11
  350. package/dist/scripts/vcdm2.0/issueVcRootTAO +0 -14
  351. package/dist/scripts/vcdm2.0/issueVcTAO +0 -15
  352. package/dist/scripts/vcdm2.0/issueVcTI +0 -15
  353. package/dist/scripts/vcdm2.0/issueVcTnl +0 -34
  354. package/dist/scripts/vcdm2.0/registerDidDocument +0 -15
  355. package/dist/scripts/vcdm2.0/updateVcRootTAO +0 -13
  356. package/dist/scripts/vcdm2.0/updateVcTAO +0 -14
  357. package/dist/scripts/vcdm2.0/updateVcTI +0 -14
  358. package/dist/scripts/vcdm2.0/verifyVcTnl +0 -10
  359. package/dist/scripts/verifyVcTnl +0 -10
  360. package/dist/scripts/wct/accreditAndAuthorize +0 -133
  361. package/dist/scripts/wct/accreditAndAuthorize2 +0 -89
  362. package/dist/scripts/wct/holderWallet +0 -39
  363. package/dist/scripts/wct/holderWallet2 +0 -39
  364. package/dist/scripts/wct/issueToHolder +0 -38
  365. package/dist/scripts/wct/issueToHolder2 +0 -38
  366. package/dist/scripts/wct/pda1 +0 -3
  367. package/dist/scripts/wct/verifier +0 -8
  368. package/dist/scripts/wct/verifier2 +0 -7
  369. package/dist/utils/Client.js +0 -155
  370. package/dist/utils/Client.js.map +0 -1
  371. package/dist/utils/HardwareWallet.js +0 -326
  372. package/dist/utils/HardwareWallet.js.map +0 -1
  373. package/dist/utils/http.js +0 -132
  374. package/dist/utils/http.js.map +0 -1
  375. package/dist/utils/index.js +0 -8
  376. package/dist/utils/index.js.map +0 -1
  377. package/dist/utils/jsonrpc.js +0 -38
  378. package/dist/utils/jsonrpc.js.map +0 -1
  379. package/dist/utils/print.js +0 -56
  380. package/dist/utils/print.js.map +0 -1
  381. package/dist/utils/utils.js +0 -427
  382. package/dist/utils/utils.js.map +0 -1
  383. package/dist/utils/vcdm.js +0 -47
  384. package/dist/utils/vcdm.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommandPalette.js","sourceRoot":"","sources":["../../src/tui/CommandPalette.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAC1C,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAI7D,OAAO,EACL,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,UAAU,GACX,MAAM,yBAAyB,CAAC;AAEjC,MAAM,WAAW,GAAG,CAAC,CAAC;AACtB,MAAM,UAAU,GAAG,MAAM,CAAC;AAC1B,MAAM,WAAW,GAAG,MAAM,CAAC;AAC3B,MAAM,SAAS,GAAG,QAAQ,CAAC;AAC3B,MAAM,WAAW,GAAG,MAAM,CAAC;AAe3B,MAAM,UAAU,cAAc,CAAC,EAC7B,QAAQ,GACY;IACpB,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IACvC,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IACtD,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAGpD,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAE5C,MAAM,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,YAAY,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,QAAQ,CAC1E,CAAC,CAAoB,EAAE,CAAoB,EAAE,EAAE,CAC7C,UAAU,CAAC,CA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face",
3
+ "version": "1.0.0-rc.0",
4
+ "description": "EBSI CLI",
5
5
  "license": "EUPL-1.2",
6
- "type": "module",
7
- "main": "dist/index.js",
8
- "types": "dist/index.d.ts",
9
- "files": [
10
- "bin",
11
- "dist"
12
- ],
13
- "publishConfig": {
14
- "access": "public"
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://gitlab.com/europeum/public/core.git",
9
+ "directory": "cli"
15
10
  },
11
+ "type": "module",
16
12
  "bin": {
17
- "cli": "bin/cli.js"
13
+ "ebsi": "./dist/index.js"
18
14
  },
19
- "scripts": {
20
- "audit": "audit-ci --config audit-ci.jsonc",
21
- "build": "rimraf dist && tsc --project tsconfig.build.json && cpy . ../../dist/scripts --cwd=src/scripts",
22
- "dev": "node --loader ts-node/esm src/cli.ts",
23
- "lint-staged": "lint-staged",
24
- "lint": "pnpm run lint:eslint && pnpm run lint:tsc && pnpm run lint:prettier",
25
- "lint:eslint": "eslint . --ext .js,.mjs,.cjs,.ts",
26
- "lint:tsc": "tsc --noEmit --incremental false",
27
- "lint:prettier": "prettier . --check",
28
- "prepare": "husky && pnpm run build",
29
- "prepare:release": "release-it --ci",
30
- "program:migrate": "ts-node --esm src/programs/migrateDids.ts",
31
- "program:migrateTsr": "node --loader ts-node/esm src/programs/migrateTsr.ts",
32
- "start": "node dist/cli",
33
- "test": "vitest --run",
34
- "test:ci": "vitest --run unit",
35
- "test:authorisation": "vitest --run authorisation.spec.ts",
36
- "test:did": "vitest --run did.spec.ts",
37
- "test:essentials": "vitest --run essentials.spec.ts",
38
- "test:ledger": "vitest --run ledger.spec.ts",
39
- "test:tar": "vitest --run tar.spec.ts",
40
- "test:timestamp": "vitest --run timestamp.spec.ts",
41
- "test:tir": "vitest --run tir.spec.ts",
42
- "test:tnt": "vitest --run tnt.spec.ts",
43
- "test:tpr": "vitest --run tpr.spec.ts",
44
- "test:tsr": "vitest --run tsr.spec.ts",
45
- "test:accredit-and-authorize": "vitest --run accredit-and-authorize.spec.ts",
46
- "test:holder-wallet": "vitest --run holder-wallet.spec.ts",
47
- "test:issue-to-holder": "vitest --run issue-to-holder.spec.ts",
48
- "test:verifier": "vitest --run verifier.spec.ts",
49
- "test:pda1": "vitest --run pda1.spec.ts",
50
- "test:trust-model": "vitest --run trust-model-vcdm2.spec.ts",
51
- "knip": "knip"
15
+ "publishConfig": {
16
+ "access": "public"
52
17
  },
18
+ "files": [
19
+ "dist",
20
+ "LICENSES.txt",
21
+ "src"
22
+ ],
23
+ "keywords": [
24
+ "europeum",
25
+ "ebsi",
26
+ "cli"
27
+ ],
53
28
  "dependencies": {
54
- "@apidevtools/json-schema-ref-parser": "11.5.4",
55
- "@europeum-ebsi/did-jwt": "0.0.0",
56
- "@europeum-ebsi/ebsi-did-resolver": "0.0.1",
57
- "@europeum-ebsi/key-did-resolver": "0.0.0",
58
- "@europeum-ebsi/verifiable-credential": "0.1.0",
59
- "@europeum-ebsi/verifiable-presentation": "0.1.0",
60
- "@europeum-ebsi/wallet-lib": "0.0.1",
61
- "@noble/curves": "2.0.1",
62
- "asn1js": "3.0.7",
63
- "axios": "1.15.0",
64
- "canonicalize": "2.1.0",
65
- "chalk": "5.6.2",
66
- "did-resolver": "4.1.0",
67
- "dotenv": "17.4.1",
68
- "ethers": "6.16.0",
69
- "form-data": "4.0.5",
70
- "https-proxy-agent": "9.0.0",
71
- "joi": "18.1.2",
72
- "jose": "6.2.2",
73
- "lodash.set": "4.3.2",
74
- "multiformats": "13.4.2",
75
- "pkijs": "3.4.0",
76
- "qs": "6.15.0"
77
- },
78
- "optionalDependencies": {
79
- "graphene-pk11": "2.3.6"
29
+ "@europeum-ebsi/api-contract": "1.0.0-rc.0",
30
+ "@europeum-ebsi/did-jwt": "1.0.0-rc.0",
31
+ "@europeum-ebsi/did-registry-contract": "1.0.0-rc.0",
32
+ "@europeum-ebsi/ebsi-uri": "1.0.0-rc.0",
33
+ "@europeum-ebsi/issuers-registry-contract": "1.0.0-rc.0",
34
+ "@europeum-ebsi/policies-registry-contract": "1.0.0-rc.0",
35
+ "@europeum-ebsi/schemas-registry-contract": "1.0.0-rc.0",
36
+ "@europeum-ebsi/timestamp-contract": "1.0.0-rc.0",
37
+ "@europeum-ebsi/track-and-trace-contract": "1.0.0-rc.0",
38
+ "@europeum-ebsi/vcdm1.1-attestation-schema": "0.0.0",
39
+ "@europeum-ebsi/verifiable-credential": "1.0.0-rc.0",
40
+ "@europeum-ebsi/verifiable-presentation": "1.0.0-rc.0",
41
+ "@europeum-ebsi/wallet": "1.0.0-rc.0",
42
+ "commander": "15.0.0",
43
+ "env-paths": "4.0.0",
44
+ "ethers": "6.17.0",
45
+ "ink": "7.1.1",
46
+ "ink-text-input": "6.0.0",
47
+ "jose": "5.10.0",
48
+ "openapi-fetch": "0.17.0",
49
+ "picocolors": "1.1.1",
50
+ "react": "19.3.0"
80
51
  },
81
52
  "devDependencies": {
82
- "@commitlint/cli": "20.5.0",
83
- "@commitlint/config-conventional": "20.5.0",
84
- "@eslint/js": "10.0.1",
85
- "@release-it/conventional-changelog": "10.0.6",
86
- "@sphereon/pex-models": "2.3.2",
87
- "@total-typescript/ts-reset": "0.6.1",
88
- "@tsconfig/node24": "24.0.4",
53
+ "@nomicfoundation/hardhat-ethers": "4.1.0",
54
+ "@tsconfig/node24": "24.0.5",
89
55
  "@tsconfig/strictest": "2.0.8",
90
- "@types/lodash.set": "4.3.9",
91
- "@types/node": "24.12.0",
92
- "@types/qs": "6.15.0",
93
- "@typescript-eslint/eslint-plugin": "8.58.0",
94
- "@typescript-eslint/parser": "8.58.0",
95
- "@vitest/eslint-plugin": "1.6.14",
96
- "audit-ci": "7.1.0",
97
- "cpy-cli": "7.0.0",
98
- "eslint": "10.2.0",
99
- "eslint-config-prettier": "10.1.8",
100
- "eslint-import-resolver-typescript": "4.4.4",
101
- "eslint-plugin-import-x": "4.16.2",
102
- "eslint-plugin-perfectionist": "5.8.0",
103
- "eslint-plugin-prettier": "5.5.5",
104
- "eslint-plugin-regexp": "3.1.0",
105
- "eslint-plugin-unicorn": "64.0.0",
106
- "globals": "17.4.0",
107
- "husky": "9.1.7",
108
- "knip": "6.3.0",
109
- "lint-staged": "16.4.0",
110
- "prettier": "3.8.1",
111
- "read-pkg": "10.1.0",
112
- "release-it": "19.2.4",
56
+ "@types/node": "24.13.6",
57
+ "@types/react": "19.3.0",
58
+ "@vitest/coverage-v8": "5.0.1",
59
+ "get-port": "7.2.0",
60
+ "hardhat": "3.17.0",
113
61
  "rimraf": "6.1.3",
114
- "spdx-license-list": "6.11.0",
115
- "ts-node": "10.9.2",
116
- "typescript": "6.0.2",
117
- "typescript-eslint": "8.58.0",
118
- "vitest": "4.1.2"
62
+ "typescript": "6.0.3",
63
+ "vite": "8.3.0",
64
+ "vitest": "5.0.1"
119
65
  },
120
- "packageManager": "pnpm@10.33.0+sha512.10568bb4a6afb58c9eb3630da90cc9516417abebd3fabbe6739f0ae795728da1491e9db5a544c76ad8eb7570f5c4bb3d6c637b2cb41bfdcdb47fa823c8649319"
121
- }
66
+ "scripts": {
67
+ "build": "tsc -p tsconfig/tsconfig.build.esm.json",
68
+ "clean": "rimraf coverage dist",
69
+ "coverage": "pnpm run test:unit --coverage --reporter=default",
70
+ "lint": "pnpm run lint:tsc",
71
+ "lint:tsc": "tsc --noEmit --incremental false",
72
+ "setup": "exit 0",
73
+ "test": "vitest --run",
74
+ "test:ci": "pnpm run coverage && pnpm run test:integration",
75
+ "test:e2e": "echo \"Info: there's no e2e tests for @europeum-ebsi/cli\" && exit 0",
76
+ "test:integration": "pnpm run test integration",
77
+ "test:unit": "pnpm run test unit"
78
+ }
79
+ }
@@ -0,0 +1,26 @@
1
+ import type { paths } from "@europeum-ebsi/api-contract/types";
2
+
3
+ import createClient from "openapi-fetch";
4
+
5
+ export type ApiClient = ReturnType<typeof makeClient>;
6
+
7
+ /**
8
+ * Creates a type-safe openapi-fetch client bound to the given base URL.
9
+ * The base URL must already include the `/v1` prefix (e.g. "https://api-test.testnode02.ebsi.eu/v1").
10
+ *
11
+ * When a Bearer `token` is provided every request will include an
12
+ * `Authorization: Bearer <token>` header. This is needed for write methods on
13
+ * `POST /ledger` (e.g. `eth_sendRawTransaction`).
14
+ */
15
+ export function makeClient(baseUrl: string, token?: string) {
16
+ const client = createClient<paths>({ baseUrl });
17
+ if (token) {
18
+ client.use({
19
+ onRequest({ request }) {
20
+ request.headers.set("Authorization", `Bearer ${token}`);
21
+ return request;
22
+ },
23
+ });
24
+ }
25
+ return client;
26
+ }
@@ -0,0 +1,53 @@
1
+ import type { CliConfig } from "../config/config.ts";
2
+
3
+ import { makeClient } from "./client.ts";
4
+
5
+ /**
6
+ * Cached client instances keyed by `baseUrl\0token`
7
+ */
8
+ const clients = new Map<string, ReturnType<typeof makeClient>>();
9
+
10
+ /**
11
+ * Represents a failed API response
12
+ */
13
+ export class ApiError extends Error {
14
+ readonly detail: unknown;
15
+ readonly status: number;
16
+
17
+ constructor(status: number, detail: unknown) {
18
+ const message =
19
+ typeof detail === "object" && detail !== null && "title" in detail
20
+ ? String((detail as Record<string, unknown>)["title"])
21
+ : `HTTP ${status}`;
22
+ super(message);
23
+ this.name = "ApiError";
24
+ this.status = status;
25
+ this.detail = detail;
26
+ }
27
+ }
28
+
29
+ export function getClient(config: CliConfig) {
30
+ const cacheKey = `${config.baseUrl}\0${config.token ?? ""}`;
31
+ const existing = clients.get(cacheKey);
32
+ if (existing) return existing;
33
+ const client = makeClient(config.baseUrl, config.token);
34
+ clients.set(cacheKey, client);
35
+ return client;
36
+ }
37
+
38
+ /**
39
+ * Unwraps an openapi-fetch result, throwing ApiError on any non-2xx response
40
+ * or network error.
41
+ */
42
+ export function unwrap<T>({
43
+ data,
44
+ error,
45
+ response,
46
+ }: {
47
+ data?: T;
48
+ error?: unknown;
49
+ response: Response;
50
+ }): T {
51
+ if (data !== undefined) return data;
52
+ throw new ApiError(response.status, error);
53
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Builds a clean query-params object by removing undefined values.
3
+ *
4
+ * With `exactOptionalPropertyTypes: true`, TypeScript disallows explicit
5
+ * `undefined` values in optional properties. This helper accepts an object
6
+ * that may contain `undefined` values and returns one that only contains
7
+ * the defined entries, satisfying the strict type check.
8
+ */
9
+ export function q<T extends Record<string, unknown>>(
10
+ obj: T,
11
+ ): { [K in keyof T]?: NonNullable<T[K]> } {
12
+ const result: Record<string, unknown> = {};
13
+ for (const [k, v] of Object.entries(obj)) {
14
+ if (v !== undefined && v !== "") result[k] = v;
15
+ }
16
+ return result as { [K in keyof T]?: NonNullable<T[K]> };
17
+ }
@@ -0,0 +1,84 @@
1
+ import { SELF_ATTESTATION_VC_TYPE } from "@europeum-ebsi/api-contract/scopes";
2
+ import { createJWT } from "@europeum-ebsi/did-jwt";
3
+ import { metadata as attestationMetadata } from "@europeum-ebsi/vcdm1.1-attestation-schema";
4
+ import { randomUUID } from "node:crypto";
5
+
6
+ import type { KeyMaterial } from "../crypto/wallet.ts";
7
+
8
+ // `SELF_ATTESTATION_VC_TYPE`/`dcqlCredentialQueryId` are shared with `api`
9
+ // via `@europeum-ebsi/api-contract/scopes` (the single source of truth for
10
+ // both), since the CLI must build a self-attestation credential and address
11
+ // it under the exact same DCQL credential-query id the server expects.
12
+ export { dcqlCredentialQueryId } from "@europeum-ebsi/api-contract/scopes";
13
+
14
+ /**
15
+ * Builds the `vp_token` for the OpenID4VP 1.0 (final)/DCQL grant: a
16
+ * JSON-encoded object keyed by DCQL credential-query id (see
17
+ * https://openid.net/specs/openid-4-verifiable-presentations-1_0-final.html#section-8.1),
18
+ * e.g. `{"self_attestation_credential": ["eyJ..."]}`.
19
+ */
20
+ export function buildDcqlVpToken(
21
+ credentialQueryId: string,
22
+ vpJwt: string,
23
+ ): string {
24
+ return JSON.stringify({ [credentialQueryId]: [vpJwt] });
25
+ }
26
+
27
+ /**
28
+ * Creates and signs the self-issued Verifiable Credential a combinable
29
+ * scope's DCQL query requires (see `SELF_ATTESTATION_VC_TYPE` above):
30
+ * `iss`/`vc.issuer` and `sub`/`credentialSubject.id` are both the wallet's
31
+ * own DID, deliberately with no `termsOfUse`. This carries no trust-chain
32
+ * meaning of its own, but the server's shared VP/VC verification pipeline
33
+ * still unconditionally structurally validates every embedded credential
34
+ * against the EBSI Verifiable Attestation schema, so `id`, `issuanceDate`,
35
+ * `issued`, `validFrom` and `credentialSchema` are all required even though
36
+ * this is a placeholder -- hence `createJWT` directly (rather than the full
37
+ * `createVerifiableCredentialJwt`) to control the `type` array precisely
38
+ * (DCQL matches on `SELF_ATTESTATION_VC_TYPE`, not `VerifiableAttestation`).
39
+ * `credentialSchema` references the generic "VerifiableAttestation" schema
40
+ * itself, bundled with and pre-registered by
41
+ * `@europeum-ebsi/vcdm1.1-attestation-schema`, so this validates with no
42
+ * network dependency and no new Schemas Registry entry.
43
+ */
44
+ export function createSelfAttestationVcJwt(signingKey: KeyMaterial): string {
45
+ const { alg, did, kid, signer } = signingKey.issuer;
46
+ const issuanceDate = new Date();
47
+ const issued = `${issuanceDate.toISOString().slice(0, -5)}Z`;
48
+ const iat = Math.floor(issuanceDate.getTime() / 1000);
49
+ const id = `urn:uuid:${randomUUID()}`;
50
+
51
+ return createJWT(
52
+ {
53
+ iat,
54
+ iss: did,
55
+ jti: id,
56
+ nbf: iat,
57
+ sub: did,
58
+ vc: {
59
+ "@context": ["https://www.w3.org/2018/credentials/v1"],
60
+ credentialSchema: {
61
+ // Must be a well-formed URI whose last path segment is the schema
62
+ // id ajv already has pre-registered (see `validateCredentialSchema`
63
+ // in `libs/verifiable-credential`) -- the host is never
64
+ // dereferenced since the lookup succeeds locally first.
65
+ id: `https://schemas-registry.example/schemas/${attestationMetadata.id.base16}`,
66
+ type: "FullJsonSchemaValidator2021",
67
+ },
68
+ credentialSubject: { id: did },
69
+ id,
70
+ issuanceDate: issued,
71
+ issued,
72
+ issuer: did,
73
+ type: [
74
+ "VerifiableCredential",
75
+ "VerifiableAttestation",
76
+ SELF_ATTESTATION_VC_TYPE,
77
+ ],
78
+ validFrom: issued,
79
+ },
80
+ },
81
+ { signer },
82
+ { alg, kid, typ: "JWT" },
83
+ );
84
+ }
@@ -0,0 +1,255 @@
1
+ import {
2
+ CUSTOM_SCOPES,
3
+ dcqlCredentialQueryId,
4
+ mergedPresentationDefinitionId,
5
+ parseScopeToken as parseSharedScopeToken,
6
+ COMBINABLE_SCOPES as SHARED_COMBINABLE_SCOPES,
7
+ } from "@europeum-ebsi/api-contract/scopes";
8
+
9
+ /**
10
+ * Derives the `presentation_submission` for each EBSI authorisation scope.
11
+ *
12
+ * The scope grammar itself -- known families, combinability, and token
13
+ * parsing -- is shared with the API via `@europeum-ebsi/api-contract/scopes` (the single
14
+ * source of truth for both, embedded in and exported by the API package).
15
+ * What's below is CLI-specific: which scopes need a VC in the VP, and how to
16
+ * build the actual `presentation_submission` payload.
17
+ *
18
+ * Rules:
19
+ * - Scopes that need a VC in the VP: did-registry:invite, ledger:invoke, issuers-registry:invite, track-and-trace:authorise
20
+ * - All others (write / create scopes): empty VP (verifiableCredential: [], descriptor_map: [])
21
+ *
22
+ * A single access token may also combine several "write" scopes (e.g.
23
+ * `"did-registry:write issuers-registry:write"`), in which case the API returns a merged
24
+ * Presentation Definition and expects the client to echo its `definition_id`
25
+ * back — see `mergedDefinitionId` below.
26
+ *
27
+ * Every scope may optionally be suffixed with `:<0x-address>` (e.g.
28
+ * `"track-and-trace:write:0x61c36a8d610163660E21a8b7359e1Cac0C9133e1"`) to target a
29
+ * specific deployed beacon-proxy instance of that scope's registry instead of
30
+ * the environment-configured default. The suffix is part of what gets sent to
31
+ * the API verbatim (see `getAccessToken` in `./token.ts`), but is stripped
32
+ * down to its "family" (`<registry>:<action>`) before deriving Presentation
33
+ * Definition ids and before running the rules below (unknown-scope,
34
+ * duplicate, combinability).
35
+ */
36
+
37
+ /**
38
+ * The set of scope families that require a real VC in the VP
39
+ */
40
+ const VC_REQUIRED_SCOPES = new Set([
41
+ "did-registry:invite",
42
+ "issuers-registry:invite",
43
+ "ledger:invoke",
44
+ "track-and-trace:authorise",
45
+ ]);
46
+
47
+ /**
48
+ * Scope families that can be combined together in a single access token
49
+ * request, e.g. `"did-registry:write issuers-registry:write"`. Every scope here uses the empty-VP
50
+ * pattern and gates an independent registry check, so combining them is a
51
+ * pure AND with no privilege escalation.
52
+ */
53
+ export const COMBINABLE_SCOPES = new Set<string>(SHARED_COMBINABLE_SCOPES);
54
+
55
+ /**
56
+ * All EBSI authorisation scope families the CLI knows about.
57
+ */
58
+ export const KNOWN_SCOPES = CUSTOM_SCOPES;
59
+
60
+ /**
61
+ * A single parsed scope token, e.g. `"track-and-trace:write:0xAbc..."` -> `{ family: "track-and-trace:write", targetAddress: "0xAbc..." }`.
62
+ */
63
+ export interface ParsedScope {
64
+ family: string;
65
+ targetAddress?: string;
66
+ }
67
+
68
+ export interface PresentationSubmission {
69
+ definition_id: string;
70
+ descriptor_map: PresentationDescriptor[];
71
+ id: string;
72
+ }
73
+
74
+ interface PresentationDescriptor {
75
+ format: string;
76
+ id: string;
77
+ path: string;
78
+ path_nested: {
79
+ format: string;
80
+ id: string;
81
+ path: string;
82
+ };
83
+ }
84
+
85
+ /**
86
+ * Builds the `presentation_submission` object for the given scope (single or
87
+ * space-separated multi-scope).
88
+ *
89
+ * For a single VC-required scope, the descriptor_map contains one entry
90
+ * pointing to `$.vp.verifiableCredential[0]`. For write/create scopes — and
91
+ * for any combined multi-scope request, which is always drawn from the
92
+ * combinable write scopes — the descriptor_map is empty (empty VP pattern).
93
+ */
94
+ export function buildPresentationSubmission(
95
+ scope: string,
96
+ submissionId: string,
97
+ ): PresentationSubmission {
98
+ const families = scopeFamilies(scope);
99
+ const definitionId = mergedDefinitionId(families);
100
+
101
+ if (families.length === 1 && requiresVc(scope)) {
102
+ const soleFamily = families[0]!;
103
+ const credentialId = dcqlCredentialQueryId(soleFamily);
104
+ return {
105
+ definition_id: definitionId,
106
+ descriptor_map: [
107
+ {
108
+ format: "jwt_vp",
109
+ id: credentialId,
110
+ path: "$",
111
+ path_nested: {
112
+ format: "jwt_vc",
113
+ id: credentialId,
114
+ path: "$.vp.verifiableCredential[0]",
115
+ },
116
+ },
117
+ ],
118
+ id: submissionId,
119
+ };
120
+ }
121
+
122
+ // Empty VP pattern (write/create scopes, including combined multi-scope requests)
123
+ return {
124
+ definition_id: definitionId,
125
+ descriptor_map: [],
126
+ id: submissionId,
127
+ };
128
+ }
129
+
130
+ /**
131
+ * Builds the `definition_id` of the (possibly merged) Presentation Definition
132
+ * for the given scope families, delegating to the shared
133
+ * `mergedPresentationDefinitionId`. Scopes are sorted alphabetically so the id
134
+ * doesn't depend on request order, and colons are mapped to underscores since
135
+ * Presentation Definition ids stay underscore-form even though scopes are
136
+ * colon-form (so a target instance address can be appended to a scope without
137
+ * ever touching the id). For a single scope this is the identity:
138
+ * `"<scope_with_underscores>_presentation"`.
139
+ */
140
+ export function mergedDefinitionId(families: string[]): string {
141
+ return mergedPresentationDefinitionId(
142
+ families as (typeof CUSTOM_SCOPES)[number][],
143
+ );
144
+ }
145
+
146
+ /**
147
+ * Splits a scope string into its individual scope tokens, e.g.
148
+ * `"openid did-registry:write issuers-registry:write"` or `"did-registry:write issuers-registry:write"` both yield
149
+ * `["did-registry:write", "issuers-registry:write"]` — a leading `"openid"` token is dropped when
150
+ * present. Each token may carry a `:<0x-address>` targeting suffix; this
151
+ * function does not parse or validate that — see `parseScopeToken` /
152
+ * `scopeFamilies` for that.
153
+ */
154
+ export function parseScopes(scope: string): string[] {
155
+ const tokens = scope.trim().split(/\s+/).filter(Boolean);
156
+ return tokens[0] === "openid" ? tokens.slice(1) : tokens;
157
+ }
158
+
159
+ /**
160
+ * Parses a single scope token (no leading "openid", no spaces). Delegates the
161
+ * actual grammar (2-or-3 colon-delimited segments, known family, valid
162
+ * Ethereum address suffix) to the shared `parseScopeToken`, adapting its
163
+ * `{ scope, targetAddress }` shape to this module's own `{ family,
164
+ * targetAddress }` `ParsedScope`.
165
+ */
166
+ export function parseScopeToken(token: string): ParsedScope | undefined {
167
+ const parsed = parseSharedScopeToken(token);
168
+ if (!parsed) {
169
+ return undefined;
170
+ }
171
+
172
+ return {
173
+ family: parsed.scope,
174
+ ...(parsed.targetAddress && { targetAddress: parsed.targetAddress }),
175
+ };
176
+ }
177
+
178
+ /**
179
+ * Returns true when the given scope requires a real VC to be placed in the
180
+ * VP. Only ever true for a single VC-required scope — a combined multi-scope
181
+ * request is always drawn from the combinable (empty-VP) write scopes, so it
182
+ * never requires a VC.
183
+ */
184
+ export function requiresVc(scope: string): boolean {
185
+ const tokens = parseScopes(scope);
186
+ if (tokens.length !== 1) {
187
+ return false;
188
+ }
189
+ const parsed = parseScopeToken(tokens[0]!);
190
+ return parsed !== undefined && VC_REQUIRED_SCOPES.has(parsed.family);
191
+ }
192
+
193
+ /**
194
+ * Splits a scope string into its scope *families* (targeting addresses
195
+ * stripped), e.g. `"track-and-trace:write:0xAbc..."` -> `"track-and-trace:write"`. Throws a
196
+ * descriptive `Error` if any token fails to parse (unknown family or a
197
+ * malformed address suffix).
198
+ */
199
+ export function scopeFamilies(scope: string): string[] {
200
+ return parseScopes(scope).map((token) => {
201
+ const parsed = parseScopeToken(token);
202
+ if (!parsed) {
203
+ throw new Error(
204
+ `Invalid scope token "${token}". Expected "<registry>:<action>", optionally ` +
205
+ `suffixed with ":<0x-address>" to target a specific contract instance. ` +
206
+ `Known scopes: ${KNOWN_SCOPES.join(", ")}`,
207
+ );
208
+ }
209
+ return parsed.family;
210
+ });
211
+ }
212
+
213
+ /**
214
+ * Validates a scope string against the same rules enforced by the
215
+ * Authorisation service's `IsScope` validator: every token must parse (known
216
+ * family, optionally a valid `:<0x-address>` suffix), no duplicate families
217
+ * (an address suffix doesn't distinguish a family — `did-registry:write` and
218
+ * `did-registry:write:0x...` collide), and — when more than one scope is requested —
219
+ * every family must be in `COMBINABLE_SCOPES` (the invite / `ledger:invoke`
220
+ * scopes can only ever be requested alone).
221
+ *
222
+ * Throws a descriptive `Error` when invalid; returns void otherwise.
223
+ */
224
+ export function validateScope(scope: string): void {
225
+ const tokens = parseScopes(scope);
226
+
227
+ if (tokens.length === 0) {
228
+ throw new Error(
229
+ `Missing scope. Provide one of: ${KNOWN_SCOPES.join(", ")}`,
230
+ );
231
+ }
232
+
233
+ // Throws with a descriptive message if any token is unknown or malformed.
234
+ const families = scopeFamilies(scope);
235
+
236
+ const seen = new Set<string>();
237
+ const duplicates = new Set<string>();
238
+ for (const family of families) {
239
+ if (seen.has(family)) duplicates.add(family);
240
+ seen.add(family);
241
+ }
242
+ if (duplicates.size > 0) {
243
+ throw new Error(`Duplicate scope(s): ${[...duplicates].join(", ")}`);
244
+ }
245
+
246
+ if (families.length <= 1) return;
247
+
248
+ const nonCombinable = families.filter((f) => !COMBINABLE_SCOPES.has(f));
249
+ if (nonCombinable.length > 0) {
250
+ throw new Error(
251
+ `Scope(s) "${nonCombinable.join(", ")}" cannot be combined with other scopes. ` +
252
+ `Only these scopes may be combined in a single token: ${[...COMBINABLE_SCOPES].join(", ")}.`,
253
+ );
254
+ }
255
+ }