@getpara/cli 2.15.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 (331) hide show
  1. package/README.md +97 -0
  2. package/dist/api/client.d.ts +49 -0
  3. package/dist/api/client.d.ts.map +1 -0
  4. package/dist/api/client.js +247 -0
  5. package/dist/api/errors.d.ts +9 -0
  6. package/dist/api/errors.d.ts.map +1 -0
  7. package/dist/api/errors.js +29 -0
  8. package/dist/api/types.d.ts +155 -0
  9. package/dist/api/types.d.ts.map +1 -0
  10. package/dist/api/types.js +58 -0
  11. package/dist/auth/polling-flow.d.ts +7 -0
  12. package/dist/auth/polling-flow.d.ts.map +1 -0
  13. package/dist/auth/polling-flow.js +94 -0
  14. package/dist/auth/session-manager.d.ts +7 -0
  15. package/dist/auth/session-manager.d.ts.map +1 -0
  16. package/dist/auth/session-manager.js +42 -0
  17. package/dist/cli.d.ts +16 -0
  18. package/dist/cli.d.ts.map +1 -0
  19. package/dist/cli.js +151 -0
  20. package/dist/commands/auth/index.d.ts +3 -0
  21. package/dist/commands/auth/index.d.ts.map +1 -0
  22. package/dist/commands/auth/index.js +18 -0
  23. package/dist/commands/auth/login.d.ts +3 -0
  24. package/dist/commands/auth/login.d.ts.map +1 -0
  25. package/dist/commands/auth/login.js +70 -0
  26. package/dist/commands/auth/logout.d.ts +3 -0
  27. package/dist/commands/auth/logout.d.ts.map +1 -0
  28. package/dist/commands/auth/logout.js +45 -0
  29. package/dist/commands/auth/status.d.ts +3 -0
  30. package/dist/commands/auth/status.d.ts.map +1 -0
  31. package/dist/commands/auth/status.js +54 -0
  32. package/dist/commands/config.d.ts +3 -0
  33. package/dist/commands/config.d.ts.map +1 -0
  34. package/dist/commands/config.js +122 -0
  35. package/dist/commands/create.d.ts +3 -0
  36. package/dist/commands/create.d.ts.map +1 -0
  37. package/dist/commands/create.js +587 -0
  38. package/dist/commands/doctor.d.ts +3 -0
  39. package/dist/commands/doctor.d.ts.map +1 -0
  40. package/dist/commands/doctor.js +67 -0
  41. package/dist/commands/init.d.ts +3 -0
  42. package/dist/commands/init.d.ts.map +1 -0
  43. package/dist/commands/init.js +45 -0
  44. package/dist/commands/keys/archive.d.ts +3 -0
  45. package/dist/commands/keys/archive.d.ts.map +1 -0
  46. package/dist/commands/keys/archive.js +49 -0
  47. package/dist/commands/keys/config/branding.d.ts +23 -0
  48. package/dist/commands/keys/config/branding.d.ts.map +1 -0
  49. package/dist/commands/keys/config/branding.js +246 -0
  50. package/dist/commands/keys/config/categories.d.ts +15 -0
  51. package/dist/commands/keys/config/categories.d.ts.map +1 -0
  52. package/dist/commands/keys/config/categories.js +67 -0
  53. package/dist/commands/keys/config/index.d.ts +3 -0
  54. package/dist/commands/keys/config/index.d.ts.map +1 -0
  55. package/dist/commands/keys/config/index.js +56 -0
  56. package/dist/commands/keys/config/ramps.d.ts +18 -0
  57. package/dist/commands/keys/config/ramps.d.ts.map +1 -0
  58. package/dist/commands/keys/config/ramps.js +185 -0
  59. package/dist/commands/keys/config/security.d.ts +15 -0
  60. package/dist/commands/keys/config/security.d.ts.map +1 -0
  61. package/dist/commands/keys/config/security.js +212 -0
  62. package/dist/commands/keys/config/setup.d.ts +16 -0
  63. package/dist/commands/keys/config/setup.d.ts.map +1 -0
  64. package/dist/commands/keys/config/setup.js +235 -0
  65. package/dist/commands/keys/config/webhooks.d.ts +18 -0
  66. package/dist/commands/keys/config/webhooks.d.ts.map +1 -0
  67. package/dist/commands/keys/config/webhooks.js +279 -0
  68. package/dist/commands/keys/create.d.ts +3 -0
  69. package/dist/commands/keys/create.d.ts.map +1 -0
  70. package/dist/commands/keys/create.js +64 -0
  71. package/dist/commands/keys/get.d.ts +3 -0
  72. package/dist/commands/keys/get.d.ts.map +1 -0
  73. package/dist/commands/keys/get.js +91 -0
  74. package/dist/commands/keys/index.d.ts +3 -0
  75. package/dist/commands/keys/index.d.ts.map +1 -0
  76. package/dist/commands/keys/index.js +22 -0
  77. package/dist/commands/keys/list.d.ts +3 -0
  78. package/dist/commands/keys/list.d.ts.map +1 -0
  79. package/dist/commands/keys/list.js +66 -0
  80. package/dist/commands/keys/rotate.d.ts +3 -0
  81. package/dist/commands/keys/rotate.d.ts.map +1 -0
  82. package/dist/commands/keys/rotate.js +59 -0
  83. package/dist/commands/orgs/index.d.ts +3 -0
  84. package/dist/commands/orgs/index.d.ts.map +1 -0
  85. package/dist/commands/orgs/index.js +15 -0
  86. package/dist/commands/orgs/list.d.ts +3 -0
  87. package/dist/commands/orgs/list.d.ts.map +1 -0
  88. package/dist/commands/orgs/list.js +53 -0
  89. package/dist/commands/orgs/switch.d.ts +3 -0
  90. package/dist/commands/orgs/switch.d.ts.map +1 -0
  91. package/dist/commands/orgs/switch.js +61 -0
  92. package/dist/commands/projects/archive.d.ts +3 -0
  93. package/dist/commands/projects/archive.d.ts.map +1 -0
  94. package/dist/commands/projects/archive.js +51 -0
  95. package/dist/commands/projects/create.d.ts +3 -0
  96. package/dist/commands/projects/create.d.ts.map +1 -0
  97. package/dist/commands/projects/create.js +48 -0
  98. package/dist/commands/projects/index.d.ts +3 -0
  99. package/dist/commands/projects/index.d.ts.map +1 -0
  100. package/dist/commands/projects/index.js +25 -0
  101. package/dist/commands/projects/list.d.ts +3 -0
  102. package/dist/commands/projects/list.d.ts.map +1 -0
  103. package/dist/commands/projects/list.js +52 -0
  104. package/dist/commands/projects/restore.d.ts +3 -0
  105. package/dist/commands/projects/restore.d.ts.map +1 -0
  106. package/dist/commands/projects/restore.js +36 -0
  107. package/dist/commands/projects/switch.d.ts +3 -0
  108. package/dist/commands/projects/switch.d.ts.map +1 -0
  109. package/dist/commands/projects/switch.js +57 -0
  110. package/dist/commands/projects/update.d.ts +3 -0
  111. package/dist/commands/projects/update.d.ts.map +1 -0
  112. package/dist/commands/projects/update.js +67 -0
  113. package/dist/commands/whoami.d.ts +3 -0
  114. package/dist/commands/whoami.d.ts.map +1 -0
  115. package/dist/commands/whoami.js +61 -0
  116. package/dist/config/config-manager.d.ts +3 -0
  117. package/dist/config/config-manager.d.ts.map +1 -0
  118. package/dist/config/config-manager.js +32 -0
  119. package/dist/config/config-store.d.ts +10 -0
  120. package/dist/config/config-store.d.ts.map +1 -0
  121. package/dist/config/config-store.js +37 -0
  122. package/dist/config/credential-store.d.ts +12 -0
  123. package/dist/config/credential-store.d.ts.map +1 -0
  124. package/dist/config/credential-store.js +94 -0
  125. package/dist/config/paths.d.ts +5 -0
  126. package/dist/config/paths.d.ts.map +1 -0
  127. package/dist/config/paths.js +29 -0
  128. package/dist/config/project-config.d.ts +8 -0
  129. package/dist/config/project-config.d.ts.map +1 -0
  130. package/dist/config/project-config.js +41 -0
  131. package/dist/core/constants.d.ts +27 -0
  132. package/dist/core/constants.d.ts.map +1 -0
  133. package/dist/core/constants.js +60 -0
  134. package/dist/core/error-handler.d.ts +24 -0
  135. package/dist/core/error-handler.d.ts.map +1 -0
  136. package/dist/core/error-handler.js +83 -0
  137. package/dist/core/types.d.ts +21 -0
  138. package/dist/core/types.d.ts.map +1 -0
  139. package/dist/core/types.js +0 -0
  140. package/dist/core/update-check.d.ts +6 -0
  141. package/dist/core/update-check.d.ts.map +1 -0
  142. package/dist/core/update-check.js +78 -0
  143. package/dist/diagnostics/checks/chain-dependencies.d.ts +2 -0
  144. package/dist/diagnostics/checks/chain-dependencies.d.ts.map +1 -0
  145. package/dist/diagnostics/checks/chain-dependencies.js +130 -0
  146. package/dist/diagnostics/checks/css-import.d.ts +2 -0
  147. package/dist/diagnostics/checks/css-import.d.ts.map +1 -0
  148. package/dist/diagnostics/checks/css-import.js +57 -0
  149. package/dist/diagnostics/checks/deprecated-packages.d.ts +2 -0
  150. package/dist/diagnostics/checks/deprecated-packages.d.ts.map +1 -0
  151. package/dist/diagnostics/checks/deprecated-packages.js +93 -0
  152. package/dist/diagnostics/checks/env-api-key.d.ts +2 -0
  153. package/dist/diagnostics/checks/env-api-key.d.ts.map +1 -0
  154. package/dist/diagnostics/checks/env-api-key.js +75 -0
  155. package/dist/diagnostics/checks/env-var-prefix.d.ts +2 -0
  156. package/dist/diagnostics/checks/env-var-prefix.d.ts.map +1 -0
  157. package/dist/diagnostics/checks/env-var-prefix.js +52 -0
  158. package/dist/diagnostics/checks/index.d.ts +13 -0
  159. package/dist/diagnostics/checks/index.d.ts.map +1 -0
  160. package/dist/diagnostics/checks/index.js +32 -0
  161. package/dist/diagnostics/checks/para-provider.d.ts +2 -0
  162. package/dist/diagnostics/checks/para-provider.d.ts.map +1 -0
  163. package/dist/diagnostics/checks/para-provider.js +42 -0
  164. package/dist/diagnostics/checks/query-client.d.ts +2 -0
  165. package/dist/diagnostics/checks/query-client.d.ts.map +1 -0
  166. package/dist/diagnostics/checks/query-client.js +58 -0
  167. package/dist/diagnostics/checks/use-client-directive.d.ts +2 -0
  168. package/dist/diagnostics/checks/use-client-directive.d.ts.map +1 -0
  169. package/dist/diagnostics/checks/use-client-directive.js +81 -0
  170. package/dist/diagnostics/checks/version-consistency.d.ts +2 -0
  171. package/dist/diagnostics/checks/version-consistency.d.ts.map +1 -0
  172. package/dist/diagnostics/checks/version-consistency.js +93 -0
  173. package/dist/diagnostics/context.d.ts +3 -0
  174. package/dist/diagnostics/context.d.ts.map +1 -0
  175. package/dist/diagnostics/context.js +56 -0
  176. package/dist/diagnostics/detectors/framework.d.ts +5 -0
  177. package/dist/diagnostics/detectors/framework.d.ts.map +1 -0
  178. package/dist/diagnostics/detectors/framework.js +73 -0
  179. package/dist/diagnostics/detectors/package-manager.d.ts +3 -0
  180. package/dist/diagnostics/detectors/package-manager.d.ts.map +1 -0
  181. package/dist/diagnostics/detectors/package-manager.js +17 -0
  182. package/dist/diagnostics/detectors/sdk.d.ts +7 -0
  183. package/dist/diagnostics/detectors/sdk.d.ts.map +1 -0
  184. package/dist/diagnostics/detectors/sdk.js +48 -0
  185. package/dist/diagnostics/runner.d.ts +3 -0
  186. package/dist/diagnostics/runner.d.ts.map +1 -0
  187. package/dist/diagnostics/runner.js +44 -0
  188. package/dist/diagnostics/types.d.ts +70 -0
  189. package/dist/diagnostics/types.d.ts.map +1 -0
  190. package/dist/diagnostics/types.js +14 -0
  191. package/dist/diagnostics/utils/code-search.d.ts +10 -0
  192. package/dist/diagnostics/utils/code-search.d.ts.map +1 -0
  193. package/dist/diagnostics/utils/code-search.js +98 -0
  194. package/dist/diagnostics/utils/file-system.d.ts +7 -0
  195. package/dist/diagnostics/utils/file-system.d.ts.map +1 -0
  196. package/dist/diagnostics/utils/file-system.js +72 -0
  197. package/dist/diagnostics/utils/package-json.d.ts +12 -0
  198. package/dist/diagnostics/utils/package-json.d.ts.map +1 -0
  199. package/dist/diagnostics/utils/package-json.js +51 -0
  200. package/dist/index.d.ts +2 -0
  201. package/dist/index.d.ts.map +1 -0
  202. package/dist/index.js +20 -0
  203. package/dist/output/formatter.d.ts +25 -0
  204. package/dist/output/formatter.d.ts.map +1 -0
  205. package/dist/output/formatter.js +76 -0
  206. package/dist/output/mask.d.ts +2 -0
  207. package/dist/output/mask.d.ts.map +1 -0
  208. package/dist/output/mask.js +15 -0
  209. package/dist/output/prompts.d.ts +25 -0
  210. package/dist/output/prompts.d.ts.map +1 -0
  211. package/dist/output/prompts.js +86 -0
  212. package/dist/output/spinner.d.ts +6 -0
  213. package/dist/output/spinner.d.ts.map +1 -0
  214. package/dist/output/spinner.js +7 -0
  215. package/dist/output/table.d.ts +9 -0
  216. package/dist/output/table.d.ts.map +1 -0
  217. package/dist/output/table.js +21 -0
  218. package/dist/scaffolding/scaffolder.d.ts +3 -0
  219. package/dist/scaffolding/scaffolder.d.ts.map +1 -0
  220. package/dist/scaffolding/scaffolder.js +78 -0
  221. package/dist/scaffolding/strategies/expo-template.d.ts +16 -0
  222. package/dist/scaffolding/strategies/expo-template.d.ts.map +1 -0
  223. package/dist/scaffolding/strategies/expo-template.js +160 -0
  224. package/dist/scaffolding/strategies/index.d.ts +5 -0
  225. package/dist/scaffolding/strategies/index.d.ts.map +1 -0
  226. package/dist/scaffolding/strategies/index.js +25 -0
  227. package/dist/scaffolding/strategies/nextjs-template.d.ts +12 -0
  228. package/dist/scaffolding/strategies/nextjs-template.d.ts.map +1 -0
  229. package/dist/scaffolding/strategies/nextjs-template.js +122 -0
  230. package/dist/scaffolding/template-renderer.d.ts +11 -0
  231. package/dist/scaffolding/template-renderer.d.ts.map +1 -0
  232. package/dist/scaffolding/template-renderer.js +99 -0
  233. package/dist/scaffolding/types.d.ts +69 -0
  234. package/dist/scaffolding/types.d.ts.map +1 -0
  235. package/dist/scaffolding/types.js +21 -0
  236. package/dist/scaffolding/utils/detect-package-manager.d.ts +23 -0
  237. package/dist/scaffolding/utils/detect-package-manager.d.ts.map +1 -0
  238. package/dist/scaffolding/utils/detect-package-manager.js +57 -0
  239. package/dist/scaffolding/utils/fs.d.ts +11 -0
  240. package/dist/scaffolding/utils/fs.d.ts.map +1 -0
  241. package/dist/scaffolding/utils/fs.js +45 -0
  242. package/dist/scaffolding/utils/resolve-para-version.d.ts +7 -0
  243. package/dist/scaffolding/utils/resolve-para-version.d.ts.map +1 -0
  244. package/dist/scaffolding/utils/resolve-para-version.js +21 -0
  245. package/dist/validation/auth-methods.d.ts +14 -0
  246. package/dist/validation/auth-methods.d.ts.map +1 -0
  247. package/dist/validation/auth-methods.js +23 -0
  248. package/dist/validation/cidr.d.ts +11 -0
  249. package/dist/validation/cidr.d.ts.map +1 -0
  250. package/dist/validation/cidr.js +35 -0
  251. package/dist/validation/hex-color.d.ts +7 -0
  252. package/dist/validation/hex-color.d.ts.map +1 -0
  253. package/dist/validation/hex-color.js +10 -0
  254. package/dist/validation/index.d.ts +9 -0
  255. package/dist/validation/index.d.ts.map +1 -0
  256. package/dist/validation/index.js +49 -0
  257. package/dist/validation/native-passkey.d.ts +31 -0
  258. package/dist/validation/native-passkey.d.ts.map +1 -0
  259. package/dist/validation/native-passkey.js +45 -0
  260. package/dist/validation/session-length.d.ts +18 -0
  261. package/dist/validation/session-length.d.ts.map +1 -0
  262. package/dist/validation/session-length.js +30 -0
  263. package/dist/validation/url.d.ts +26 -0
  264. package/dist/validation/url.d.ts.map +1 -0
  265. package/dist/validation/url.js +50 -0
  266. package/dist/validation/wallet-types.d.ts +14 -0
  267. package/dist/validation/wallet-types.d.ts.map +1 -0
  268. package/dist/validation/wallet-types.js +22 -0
  269. package/dist/validation/webhook.d.ts +4 -0
  270. package/dist/validation/webhook.d.ts.map +1 -0
  271. package/dist/validation/webhook.js +33 -0
  272. package/package.json +60 -0
  273. package/templates/expo/_env.example +3 -0
  274. package/templates/expo/_gitignore +48 -0
  275. package/templates/expo/_yarnrc.yml +1 -0
  276. package/templates/expo/app/(auth)/_layout.tsx +12 -0
  277. package/templates/expo/app/(auth)/index.tsx.template +86 -0
  278. package/templates/expo/app/(tabs)/_layout.tsx +16 -0
  279. package/templates/expo/app/(tabs)/index.tsx +112 -0
  280. package/templates/expo/app/(tabs)/send.tsx +111 -0
  281. package/templates/expo/app/_layout.tsx +17 -0
  282. package/templates/expo/app/index.tsx +22 -0
  283. package/templates/expo/app.json.template +32 -0
  284. package/templates/expo/assets/adaptive-icon.png +0 -0
  285. package/templates/expo/assets/favicon.png +0 -0
  286. package/templates/expo/assets/icon.png +0 -0
  287. package/templates/expo/assets/splash.png +0 -0
  288. package/templates/expo/babel.config.cjs +12 -0
  289. package/templates/expo/components/features/AuthForm.tsx.template +138 -0
  290. package/templates/expo/components/features/OAuthButtons.tsx.template +27 -0
  291. package/templates/expo/components/features/index.ts.template +4 -0
  292. package/templates/expo/components/ui/Button.tsx +58 -0
  293. package/templates/expo/components/ui/Card.tsx +11 -0
  294. package/templates/expo/components/ui/Divider.tsx +19 -0
  295. package/templates/expo/components/ui/Input.tsx +23 -0
  296. package/templates/expo/components/ui/WalletCard.tsx +44 -0
  297. package/templates/expo/components/ui/index.ts +5 -0
  298. package/templates/expo/eslint.config.cjs +15 -0
  299. package/templates/expo/global.css +3 -0
  300. package/templates/expo/hooks/useOneClickLogin.ts.template +161 -0
  301. package/templates/expo/hooks/useViemClient.ts +118 -0
  302. package/templates/expo/hooks/useWallets.ts +52 -0
  303. package/templates/expo/index.js +2 -0
  304. package/templates/expo/lib/auth.ts +54 -0
  305. package/templates/expo/lib/constants.ts.template +2 -0
  306. package/templates/expo/lib/para.ts +14 -0
  307. package/templates/expo/metro.config.cjs +14 -0
  308. package/templates/expo/nativewind-env.d.ts +2 -0
  309. package/templates/expo/prettier.config.cjs +10 -0
  310. package/templates/expo/providers/ParaProvider.tsx +140 -0
  311. package/templates/expo/tailwind.config.cjs +23 -0
  312. package/templates/expo/tsconfig.json +11 -0
  313. package/templates/expo/types/index.ts +28 -0
  314. package/templates/nextjs/README.md +69 -0
  315. package/templates/nextjs/_env.example +8 -0
  316. package/templates/nextjs/_gitignore +36 -0
  317. package/templates/nextjs/_yarnrc.yml +1 -0
  318. package/templates/nextjs/eslint.config.mjs +10 -0
  319. package/templates/nextjs/next.config.ts +5 -0
  320. package/templates/nextjs/postcss.config.mjs +7 -0
  321. package/templates/nextjs/public/para.svg +3 -0
  322. package/templates/nextjs/src/app/layout.tsx +30 -0
  323. package/templates/nextjs/src/app/page.tsx +40 -0
  324. package/templates/nextjs/src/components/ParaProvider.tsx +116 -0
  325. package/templates/nextjs/src/components/layout/Header.tsx +44 -0
  326. package/templates/nextjs/src/components/ui/ConnectCard.tsx +24 -0
  327. package/templates/nextjs/src/components/ui/SignMessage.tsx +53 -0
  328. package/templates/nextjs/src/components/ui/WalletInfo.tsx +22 -0
  329. package/templates/nextjs/src/hooks/useSignHelloWorld.ts +23 -0
  330. package/templates/nextjs/src/styles/globals.css +1 -0
  331. package/templates/nextjs/tsconfig.json +27 -0
@@ -0,0 +1,18 @@
1
+ import type { Command } from 'commander';
2
+ import { ParaApiClient } from '../../../api/client.js';
3
+ import type { ApiKey } from '../../../api/types.js';
4
+ import type { OutputFormatter } from '../../../output/formatter.js';
5
+ interface WebhooksFlags {
6
+ url?: string;
7
+ events?: string;
8
+ enabled?: boolean;
9
+ status?: boolean;
10
+ test?: boolean;
11
+ rotateSecret?: boolean;
12
+ delete?: boolean;
13
+ yes?: boolean;
14
+ }
15
+ export declare function registerWebhooksConfigCommand(parent: Command): void;
16
+ export declare function runWebhooksAction(client: ParaApiClient, orgId: string, projectId: string, environment: string, keyId: string, _currentKey: ApiKey, formatter: OutputFormatter, flags?: WebhooksFlags): Promise<void>;
17
+ export {};
18
+ //# sourceMappingURL=webhooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhooks.d.ts","sourceRoot":"","sources":["../../../../src/commands/keys/config/webhooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIzC,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,uBAAuB,CAAC;AAEnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAKpE,UAAU,aAAa;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAgEnE;AA0BD,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,aAAa,EACrB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,eAAe,EAC1B,KAAK,CAAC,EAAE,aAAa,GACpB,OAAO,CAAC,IAAI,CAAC,CA6Of"}
@@ -0,0 +1,279 @@
1
+ import { getGlobalOptions, createFormatter, helpText } from "../../../cli.js";
2
+ import { ensureAuthenticated } from "../../../auth/session-manager.js";
3
+ import { resolveConfig } from "../../../config/config-manager.js";
4
+ import { ParaApiClient } from "../../../api/client.js";
5
+ import { CliError } from "../../../core/error-handler.js";
6
+ import { SUBSCRIBABLE_WEBHOOK_EVENTS } from "../../../api/types.js";
7
+ import { text, multiselect, select, confirm, p } from "../../../output/prompts.js";
8
+ import { resolveKeyId } from "./categories.js";
9
+ import { validateWebhookUrl, validateWebhookEvents } from "../../../validation/index.js";
10
+ function registerWebhooksConfigCommand(parent) {
11
+ parent.command("webhooks").description("Configure webhook settings for an API key").argument("[key-id]", "API key ID (prompted if not given)").option("--url <url>", "Webhook endpoint URL (HTTPS)").option("--events <types>", "Comma-separated event types").option("--enabled", "Enable the webhook").option("--no-enabled", "Disable the webhook").option("--status", "Show current webhook configuration").option("--test", "Send a test webhook to the configured URL").option("--rotate-secret", "Rotate the webhook signing secret").option("--delete", "Remove webhook configuration").option("-y, --yes", "Skip confirmation for destructive operations").addHelpText(
12
+ "after",
13
+ helpText(`Examples:
14
+ $ para keys config webhooks Interactive webhook settings
15
+ $ para keys config webhooks --status Show current config
16
+ $ para keys config webhooks --url "https://example.com/hook" --events "user.created,wallet.created" --enabled
17
+ $ para keys config webhooks --no-enabled Disable webhook
18
+ $ para keys config webhooks --test Send test webhook
19
+ $ para keys config webhooks --rotate-secret Rotate signing secret
20
+ $ para keys config webhooks --delete Remove webhook config
21
+
22
+ Event types: user.created, wallet.created, transaction.signed, send.broadcasted,
23
+ send.confirmed, send.failed, wallet.pregen_claimed, user.external_wallet_verified`)
24
+ ).action(async (keyIdArg, cmdOpts, cmd) => {
25
+ const opts = await getGlobalOptions(cmd);
26
+ const formatter = createFormatter(opts);
27
+ const config = await resolveConfig(opts);
28
+ const session = await ensureAuthenticated(config.environment);
29
+ if (!config.organizationId || !config.projectId) {
30
+ throw new CliError(
31
+ "Organization and project required. Run `para orgs switch` and `para projects switch`, or pass --org and --project."
32
+ );
33
+ }
34
+ const client = new ParaApiClient({
35
+ environment: config.environment,
36
+ sessionId: session.sessionId
37
+ });
38
+ const { keyId, key } = await resolveKeyId(
39
+ client,
40
+ config.organizationId,
41
+ config.projectId,
42
+ config.environment,
43
+ keyIdArg
44
+ );
45
+ await runWebhooksAction(
46
+ client,
47
+ config.organizationId,
48
+ config.projectId,
49
+ config.environment,
50
+ keyId,
51
+ key,
52
+ formatter,
53
+ cmdOpts
54
+ );
55
+ });
56
+ }
57
+ function hasConfigFlag(flags) {
58
+ if (!flags) return false;
59
+ return flags.url !== void 0 || flags.events !== void 0;
60
+ }
61
+ function hasOperationFlag(flags) {
62
+ if (!flags) return false;
63
+ return flags.status === true || flags.test === true || flags.rotateSecret === true || flags.delete === true;
64
+ }
65
+ function hasAnyFlag(flags) {
66
+ return hasConfigFlag(flags) || hasOperationFlag(flags) || flags?.enabled !== void 0;
67
+ }
68
+ function formatWebhookStatus(webhook) {
69
+ if (!webhook) {
70
+ p.log.info("No webhook configured.");
71
+ return;
72
+ }
73
+ p.log.info(`URL: ${webhook.url}`);
74
+ p.log.info(`Enabled: ${webhook.enabled ? "yes" : "no"}`);
75
+ p.log.info(`Events: ${webhook.events.length ? webhook.events.join(", ") : "(none)"}`);
76
+ }
77
+ async function runWebhooksAction(client, orgId, projectId, environment, keyId, _currentKey, formatter, flags) {
78
+ const isInteractive = !hasAnyFlag(flags);
79
+ if (hasOperationFlag(flags)) {
80
+ const ops = [flags?.status, flags?.test, flags?.rotateSecret, flags?.delete].filter(Boolean);
81
+ if (ops.length > 1) {
82
+ throw new CliError("Only one operation flag can be used at a time (--status, --test, --rotate-secret, --delete).");
83
+ }
84
+ if (flags?.status) {
85
+ const webhook2 = await client.getWebhookConfig(orgId, projectId, environment, keyId);
86
+ if (formatter["opts"]?.json) {
87
+ formatter.json({ webhook: webhook2 });
88
+ formatter.flush();
89
+ } else {
90
+ formatWebhookStatus(webhook2);
91
+ }
92
+ return;
93
+ }
94
+ if (flags?.test) {
95
+ const result = await client.testWebhook(orgId, projectId, environment, keyId);
96
+ formatter.json({ success: result.success, timestamp: result.timestamp });
97
+ if (result.success) {
98
+ formatter.success("Test webhook sent successfully.");
99
+ } else {
100
+ formatter.error("Test webhook delivery failed.");
101
+ }
102
+ formatter.flush();
103
+ return;
104
+ }
105
+ if (flags?.rotateSecret) {
106
+ if (!flags.yes) {
107
+ const confirmed = await confirm("Rotate webhook signing secret? The old secret will remain valid for 24 hours.");
108
+ if (!confirmed) {
109
+ formatter.info("Cancelled.");
110
+ return;
111
+ }
112
+ }
113
+ const result = await client.rotateWebhookSecret(orgId, projectId, environment, keyId);
114
+ formatter.json({ secret: result.secret });
115
+ formatter.success("Rotated webhook signing secret.");
116
+ p.log.warn(`New secret: ${result.secret}`);
117
+ p.log.warn("Save this now \u2014 it will not be shown again.");
118
+ formatter.flush();
119
+ return;
120
+ }
121
+ if (flags?.delete) {
122
+ if (!flags.yes) {
123
+ const confirmed = await confirm("Delete webhook configuration? This is irreversible.");
124
+ if (!confirmed) {
125
+ formatter.info("Cancelled.");
126
+ return;
127
+ }
128
+ }
129
+ await client.deleteWebhookConfig(orgId, projectId, environment, keyId);
130
+ formatter.json({ deleted: true });
131
+ formatter.success("Deleted webhook configuration.");
132
+ formatter.flush();
133
+ return;
134
+ }
135
+ }
136
+ if (hasConfigFlag(flags) || flags?.enabled !== void 0 && !isInteractive) {
137
+ const existing = await client.getWebhookConfig(orgId, projectId, environment, keyId);
138
+ let url = existing?.url ?? "";
139
+ let events = existing?.events ?? [];
140
+ let enabled = existing?.enabled ?? false;
141
+ if (flags?.url !== void 0) {
142
+ const err = validateWebhookUrl(flags.url);
143
+ if (err) throw new CliError(err);
144
+ url = flags.url;
145
+ }
146
+ if (flags?.events !== void 0) {
147
+ const parsed = flags.events.split(",").map((s) => s.trim()).filter(Boolean);
148
+ const err = validateWebhookEvents(parsed);
149
+ if (err) throw new CliError(err);
150
+ events = parsed;
151
+ }
152
+ if (flags?.enabled !== void 0) {
153
+ enabled = flags.enabled;
154
+ }
155
+ if (enabled && !url) {
156
+ throw new CliError("A webhook URL is required when enabling the webhook. Pass --url.");
157
+ }
158
+ if (enabled && events.length === 0) {
159
+ throw new CliError("At least one event type is required when enabling the webhook. Pass --events.");
160
+ }
161
+ const result = await client.updateWebhookConfig(orgId, projectId, environment, keyId, { url, events, enabled });
162
+ formatter.json({ webhook: result.webhook, ...result.secret ? { secret: result.secret } : {} });
163
+ formatter.success("Updated webhook settings.");
164
+ if (result.secret) {
165
+ p.log.warn(`Webhook signing secret: ${result.secret}`);
166
+ p.log.warn("Save this now \u2014 it will not be shown again.");
167
+ }
168
+ formatter.flush();
169
+ return;
170
+ }
171
+ const webhook = await client.getWebhookConfig(orgId, projectId, environment, keyId);
172
+ formatWebhookStatus(webhook);
173
+ console.log("");
174
+ if (!webhook) {
175
+ const shouldSetup = await confirm("Set up a webhook?");
176
+ if (!shouldSetup) return;
177
+ const url = await text("Webhook URL (HTTPS):", {
178
+ placeholder: "https://example.com/webhook",
179
+ validate: (v) => validateWebhookUrl(v)
180
+ });
181
+ const events = await multiselect(
182
+ "Event types to subscribe:",
183
+ SUBSCRIBABLE_WEBHOOK_EVENTS.map((e) => ({ value: e, label: e }))
184
+ );
185
+ if (events.length === 0) {
186
+ throw new CliError("At least one event type is required.");
187
+ }
188
+ const enabled = await confirm("Enable webhook now?");
189
+ const result = await client.updateWebhookConfig(orgId, projectId, environment, keyId, {
190
+ url,
191
+ events,
192
+ enabled
193
+ });
194
+ formatter.json({ webhook: result.webhook, ...result.secret ? { secret: result.secret } : {} });
195
+ formatter.success("Created webhook configuration.");
196
+ if (result.secret) {
197
+ p.log.warn(`Webhook signing secret: ${result.secret}`);
198
+ p.log.warn("Save this now \u2014 it will not be shown again.");
199
+ }
200
+ formatter.flush();
201
+ return;
202
+ }
203
+ while (true) {
204
+ const action = await select("Webhook action:", [
205
+ { value: "configure", label: "Configure", hint: "Edit URL, events, enabled" },
206
+ { value: "test", label: "Test", hint: "Send a test webhook" },
207
+ { value: "rotate", label: "Rotate secret", hint: "Generate new signing secret" },
208
+ { value: "delete", label: "Delete", hint: "Remove webhook configuration" },
209
+ { value: "done", label: "Done", hint: "Exit" }
210
+ ]);
211
+ if (action === "done") break;
212
+ if (action === "configure") {
213
+ const currentWebhook = await client.getWebhookConfig(orgId, projectId, environment, keyId);
214
+ if (!currentWebhook) {
215
+ p.log.warn("Webhook was deleted externally.");
216
+ break;
217
+ }
218
+ const url = await text("Webhook URL (HTTPS):", {
219
+ placeholder: "https://example.com/webhook",
220
+ initialValue: currentWebhook.url,
221
+ validate: (v) => validateWebhookUrl(v)
222
+ });
223
+ const events = await multiselect(
224
+ "Event types to subscribe:",
225
+ SUBSCRIBABLE_WEBHOOK_EVENTS.map((e) => ({
226
+ value: e,
227
+ label: e
228
+ })),
229
+ { initialValues: currentWebhook.events }
230
+ );
231
+ if (events.length === 0) {
232
+ throw new CliError("At least one event type is required.");
233
+ }
234
+ const enabled = await confirm("Enable webhook?");
235
+ const result = await client.updateWebhookConfig(orgId, projectId, environment, keyId, {
236
+ url,
237
+ events,
238
+ enabled
239
+ });
240
+ formatter.success("Updated webhook settings.");
241
+ if (result.secret) {
242
+ p.log.warn(`Webhook signing secret: ${result.secret}`);
243
+ p.log.warn("Save this now \u2014 it will not be shown again.");
244
+ }
245
+ }
246
+ if (action === "test") {
247
+ const result = await client.testWebhook(orgId, projectId, environment, keyId);
248
+ if (result.success) {
249
+ formatter.success("Test webhook sent successfully.");
250
+ } else {
251
+ formatter.error("Test webhook delivery failed.");
252
+ }
253
+ }
254
+ if (action === "rotate") {
255
+ p.log.warn("The old secret will remain valid for 24 hours.");
256
+ const confirmed = await confirm("Rotate webhook signing secret?");
257
+ if (confirmed) {
258
+ const result = await client.rotateWebhookSecret(orgId, projectId, environment, keyId);
259
+ formatter.success("Rotated webhook signing secret.");
260
+ p.log.warn(`New secret: ${result.secret}`);
261
+ p.log.warn("Save this now \u2014 it will not be shown again.");
262
+ }
263
+ }
264
+ if (action === "delete") {
265
+ p.log.warn("This will permanently remove your webhook configuration.");
266
+ const confirmed = await confirm("Delete webhook?");
267
+ if (confirmed) {
268
+ await client.deleteWebhookConfig(orgId, projectId, environment, keyId);
269
+ formatter.success("Deleted webhook configuration.");
270
+ break;
271
+ }
272
+ }
273
+ console.log("");
274
+ }
275
+ }
276
+ export {
277
+ registerWebhooksConfigCommand,
278
+ runWebhooksAction
279
+ };
@@ -0,0 +1,3 @@
1
+ import type { Command } from 'commander';
2
+ export declare function registerKeysCreateCommand(parent: Command): void;
3
+ //# sourceMappingURL=create.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/commands/keys/create.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQzC,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAoE/D"}
@@ -0,0 +1,64 @@
1
+ import { getGlobalOptions, createFormatter, helpText } from "../../cli.js";
2
+ import { ensureAuthenticated } from "../../auth/session-manager.js";
3
+ import { resolveConfig } from "../../config/config-manager.js";
4
+ import { ParaApiClient } from "../../api/client.js";
5
+ import { CliError } from "../../core/error-handler.js";
6
+ import { text } from "../../output/prompts.js";
7
+ function registerKeysCreateCommand(parent) {
8
+ parent.command("create").description("Create a new API key").option("-n, --name <name>", "Internal key name").option("--display-name <name>", "Display name shown to users").addHelpText(
9
+ "after",
10
+ helpText(`Examples:
11
+ $ para keys create Prompts for a key name, then shows the new key pair
12
+ $ para keys create -n "prod-key" Skip the prompt and name it directly
13
+
14
+ The secret key is only shown once on creation \u2014 save it immediately.`)
15
+ ).action(async (cmdOpts, cmd) => {
16
+ const opts = await getGlobalOptions(cmd);
17
+ const formatter = createFormatter(opts);
18
+ const config = await resolveConfig(opts);
19
+ const session = await ensureAuthenticated(config.environment);
20
+ if (!config.organizationId || !config.projectId) {
21
+ throw new CliError(
22
+ "Organization and project required. Run `para orgs switch` and `para projects switch`, or pass --org and --project."
23
+ );
24
+ }
25
+ const name = cmdOpts.name || await text("Key name:", {
26
+ validate: (v) => {
27
+ if (!v.trim()) return "Name is required.";
28
+ }
29
+ });
30
+ const client = new ParaApiClient({
31
+ environment: config.environment,
32
+ sessionId: session.sessionId
33
+ });
34
+ const key = await client.createApiKey(config.organizationId, config.projectId, config.environment, {
35
+ name,
36
+ displayName: cmdOpts.displayName
37
+ });
38
+ if (opts.json) {
39
+ formatter.json({
40
+ id: key.id,
41
+ name: key.name,
42
+ displayName: key.displayName,
43
+ apiKey: key.apiKey,
44
+ secretApiKey: key.secretApiKey,
45
+ environment: key.environment
46
+ });
47
+ } else {
48
+ formatter.success(`Created API key "${key.name}"`);
49
+ formatter.detail([
50
+ { label: "ID", value: key.id },
51
+ { label: "API Key", value: key.apiKey },
52
+ {
53
+ label: "Secret Key",
54
+ value: key.secretApiKey || "N/A"
55
+ }
56
+ ]);
57
+ formatter.warn("Save the secret key now -- it will be masked in future commands.");
58
+ }
59
+ formatter.flush();
60
+ });
61
+ }
62
+ export {
63
+ registerKeysCreateCommand
64
+ };
@@ -0,0 +1,3 @@
1
+ import type { Command } from 'commander';
2
+ export declare function registerKeysGetCommand(parent: Command): void;
3
+ //# sourceMappingURL=get.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../src/commands/keys/get.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA2BzC,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CA+E5D"}
@@ -0,0 +1,91 @@
1
+ import { getGlobalOptions, createFormatter, helpText } from "../../cli.js";
2
+ import { ensureAuthenticated } from "../../auth/session-manager.js";
3
+ import { resolveConfig } from "../../config/config-manager.js";
4
+ import { ParaApiClient } from "../../api/client.js";
5
+ import { CliError } from "../../core/error-handler.js";
6
+ import { maskSecret } from "../../output/mask.js";
7
+ async function copyToClipboard(value) {
8
+ try {
9
+ const { execFileSync } = await import("node:child_process");
10
+ if (process.platform === "darwin") {
11
+ execFileSync("pbcopy", [], { input: value });
12
+ return true;
13
+ } else if (process.platform === "win32") {
14
+ execFileSync("clip", [], { input: value });
15
+ return true;
16
+ } else if (process.platform === "linux") {
17
+ execFileSync("xclip", ["-selection", "clipboard"], { input: value });
18
+ return true;
19
+ }
20
+ return false;
21
+ } catch {
22
+ return false;
23
+ }
24
+ }
25
+ function registerKeysGetCommand(parent) {
26
+ parent.command("get").description("Get details of a specific API key").argument("<key-id>", "API key ID").option("--show-secret", "Show the full secret API key").option("--copy", "Copy the public API key to clipboard").option("--copy-secret", "Copy the secret API key to clipboard").addHelpText(
27
+ "after",
28
+ helpText(`Examples:
29
+ $ para keys get abc-123 Show name, public key, masked secret, env, origins
30
+ $ para keys get abc-123 --copy Copy the public API key to your clipboard
31
+ $ para keys get abc-123 --copy-secret Copy the secret key (for .env files)
32
+ $ para keys get abc-123 --show-secret Print the full unmasked secret key`)
33
+ ).action(async (keyId, cmdOpts, cmd) => {
34
+ const opts = await getGlobalOptions(cmd);
35
+ const formatter = createFormatter(opts);
36
+ const config = await resolveConfig(opts);
37
+ const session = await ensureAuthenticated(config.environment);
38
+ if (!config.organizationId || !config.projectId) {
39
+ throw new CliError(
40
+ "Organization and project required. Run `para orgs switch` and `para projects switch`, or pass --org and --project."
41
+ );
42
+ }
43
+ const client = new ParaApiClient({
44
+ environment: config.environment,
45
+ sessionId: session.sessionId
46
+ });
47
+ const key = await client.getApiKey(config.organizationId, config.projectId, config.environment, keyId);
48
+ if (cmdOpts.copy || cmdOpts.copySecret) {
49
+ const valueToCopy = cmdOpts.copySecret ? key.secretApiKey : key.apiKey;
50
+ if (valueToCopy) {
51
+ const copied = await copyToClipboard(valueToCopy);
52
+ if (copied) {
53
+ formatter.success(`${cmdOpts.copySecret ? "Secret API key" : "API key"} copied to clipboard.`);
54
+ formatter.flush();
55
+ return;
56
+ }
57
+ formatter.warn("Could not copy to clipboard. Displaying instead.");
58
+ }
59
+ }
60
+ if (opts.json) {
61
+ formatter.json({
62
+ id: key.id,
63
+ name: key.name,
64
+ displayName: key.displayName,
65
+ apiKey: key.apiKey,
66
+ secretApiKey: cmdOpts.showSecret ? key.secretApiKey : key.secretApiKey ? maskSecret(key.secretApiKey) : void 0,
67
+ environment: key.environment,
68
+ archived: key.archived,
69
+ origins: key.origins
70
+ });
71
+ } else {
72
+ formatter.detail([
73
+ { label: "Name", value: key.displayName || key.name },
74
+ { label: "ID", value: key.id },
75
+ { label: "API Key", value: key.apiKey },
76
+ {
77
+ label: "Secret Key",
78
+ value: key.secretApiKey || "N/A",
79
+ mask: !cmdOpts.showSecret
80
+ },
81
+ { label: "Environment", value: key.environment },
82
+ { label: "Status", value: key.archived ? "archived" : "active" },
83
+ ...key.origins?.length ? [{ label: "Origins", value: key.origins.join(", ") }] : []
84
+ ]);
85
+ }
86
+ formatter.flush();
87
+ });
88
+ }
89
+ export {
90
+ registerKeysGetCommand
91
+ };
@@ -0,0 +1,3 @@
1
+ import type { Command } from 'commander';
2
+ export declare function registerKeysCommands(program: Command): void;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/keys/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQzC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAgB3D"}
@@ -0,0 +1,22 @@
1
+ import { registerKeysListCommand } from "./list.js";
2
+ import { registerKeysGetCommand } from "./get.js";
3
+ import { registerKeysCreateCommand } from "./create.js";
4
+ import { registerKeysRotateCommand } from "./rotate.js";
5
+ import { registerKeysArchiveCommand } from "./archive.js";
6
+ import { registerKeysConfigCommand } from "./config/index.js";
7
+ function registerKeysCommands(program) {
8
+ const keys = program.command("keys").description("API key management").addHelpText(
9
+ "after",
10
+ `
11
+ Requires an active org and project. Run "para orgs switch" and "para projects switch" first.`
12
+ );
13
+ registerKeysListCommand(keys);
14
+ registerKeysGetCommand(keys);
15
+ registerKeysCreateCommand(keys);
16
+ registerKeysRotateCommand(keys);
17
+ registerKeysArchiveCommand(keys);
18
+ registerKeysConfigCommand(keys);
19
+ }
20
+ export {
21
+ registerKeysCommands
22
+ };
@@ -0,0 +1,3 @@
1
+ import type { Command } from 'commander';
2
+ export declare function registerKeysListCommand(parent: Command): void;
3
+ //# sourceMappingURL=list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/keys/list.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQzC,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAkE7D"}
@@ -0,0 +1,66 @@
1
+ import { getGlobalOptions, createFormatter, helpText } from "../../cli.js";
2
+ import { ensureAuthenticated } from "../../auth/session-manager.js";
3
+ import { resolveConfig } from "../../config/config-manager.js";
4
+ import { ParaApiClient } from "../../api/client.js";
5
+ import { CliError } from "../../core/error-handler.js";
6
+ import { maskSecret } from "../../output/mask.js";
7
+ function registerKeysListCommand(parent) {
8
+ parent.command("list").description("List API keys for the active project").option("--include-archived", "Include archived keys").addHelpText(
9
+ "after",
10
+ helpText(`Examples:
11
+ $ para keys list Show active keys (name, ID, masked key, env)
12
+ $ para keys list --include-archived Also show archived/revoked keys
13
+ $ para keys list --json Output as JSON for scripting
14
+
15
+ Requires an active org and project. Run "para orgs switch" and "para projects switch" first.`)
16
+ ).action(async (cmdOpts, cmd) => {
17
+ const opts = await getGlobalOptions(cmd);
18
+ const formatter = createFormatter(opts);
19
+ const config = await resolveConfig(opts);
20
+ const session = await ensureAuthenticated(config.environment);
21
+ if (!config.organizationId || !config.projectId) {
22
+ throw new CliError(
23
+ "Organization and project required. Run `para orgs switch` and `para projects switch`, or pass --org and --project."
24
+ );
25
+ }
26
+ const client = new ParaApiClient({
27
+ environment: config.environment,
28
+ sessionId: session.sessionId
29
+ });
30
+ const keys = await client.getApiKeys(config.organizationId, config.projectId, config.environment);
31
+ const filtered = cmdOpts.includeArchived ? keys : keys.filter((k) => !k.archived);
32
+ if (opts.json) {
33
+ formatter.json(
34
+ filtered.map((k) => ({
35
+ id: k.id,
36
+ name: k.displayName || k.name,
37
+ apiKey: maskSecret(k.apiKey),
38
+ secretApiKey: k.secretApiKey ? maskSecret(k.secretApiKey) : void 0,
39
+ environment: k.environment,
40
+ archived: k.archived
41
+ }))
42
+ );
43
+ } else {
44
+ formatter.table(
45
+ [
46
+ { key: "name", header: "Name" },
47
+ { key: "id", header: "ID" },
48
+ { key: "apiKey", header: "API Key" },
49
+ { key: "environment", header: "Env" },
50
+ { key: "status", header: "Status" }
51
+ ],
52
+ filtered.map((k) => ({
53
+ name: k.displayName || k.name,
54
+ id: k.id,
55
+ apiKey: maskSecret(k.apiKey),
56
+ environment: k.environment,
57
+ status: k.archived ? "archived" : "active"
58
+ }))
59
+ );
60
+ }
61
+ formatter.flush();
62
+ });
63
+ }
64
+ export {
65
+ registerKeysListCommand
66
+ };
@@ -0,0 +1,3 @@
1
+ import type { Command } from 'commander';
2
+ export declare function registerKeysRotateCommand(parent: Command): void;
3
+ //# sourceMappingURL=rotate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rotate.d.ts","sourceRoot":"","sources":["../../../src/commands/keys/rotate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQzC,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAiE/D"}
@@ -0,0 +1,59 @@
1
+ import { getGlobalOptions, createFormatter, helpText } from "../../cli.js";
2
+ import { ensureAuthenticated } from "../../auth/session-manager.js";
3
+ import { resolveConfig } from "../../config/config-manager.js";
4
+ import { ParaApiClient } from "../../api/client.js";
5
+ import { CliError } from "../../core/error-handler.js";
6
+ import { confirm } from "../../output/prompts.js";
7
+ function registerKeysRotateCommand(parent) {
8
+ parent.command("rotate").description("Rotate an API key").argument("<key-id>", "API key ID to rotate").option("--secret", "Rotate the secret key instead of the public key").option("-y, --yes", "Skip confirmation prompt").addHelpText(
9
+ "after",
10
+ helpText(`Examples:
11
+ $ para keys rotate abc-123 Generates a new public key (asks for confirmation)
12
+ $ para keys rotate abc-123 --secret Rotate the secret key instead of the public key
13
+ $ para keys rotate abc-123 -y Skip the confirmation prompt (for scripts)
14
+
15
+ This is irreversible \u2014 the old key stops working immediately.`)
16
+ ).action(async (keyId, cmdOpts, cmd) => {
17
+ const opts = await getGlobalOptions(cmd);
18
+ const formatter = createFormatter(opts);
19
+ const config = await resolveConfig(opts);
20
+ const session = await ensureAuthenticated(config.environment);
21
+ if (!config.organizationId || !config.projectId) {
22
+ throw new CliError(
23
+ "Organization and project required. Run `para orgs switch` and `para projects switch`, or pass --org and --project."
24
+ );
25
+ }
26
+ const keyType = cmdOpts.secret ? "secret" : "public";
27
+ if (!cmdOpts.yes) {
28
+ const confirmed = await confirm(`Are you sure you want to rotate the ${keyType} API key? This cannot be undone.`);
29
+ if (!confirmed) {
30
+ formatter.info("Rotation cancelled.");
31
+ return;
32
+ }
33
+ }
34
+ const client = new ParaApiClient({
35
+ environment: config.environment,
36
+ sessionId: session.sessionId
37
+ });
38
+ const result = cmdOpts.secret ? await client.rotateSecretApiKey(config.organizationId, config.projectId, config.environment, keyId) : await client.rotateApiKey(config.organizationId, config.projectId, config.environment, keyId);
39
+ if (opts.json) {
40
+ formatter.json({
41
+ id: keyId,
42
+ newKey: result.newKey,
43
+ keyType
44
+ });
45
+ } else if (opts.quiet) {
46
+ console.log(result.newKey);
47
+ } else {
48
+ formatter.success(`Rotated ${keyType} API key`);
49
+ formatter.detail([
50
+ { label: "Key ID", value: keyId },
51
+ { label: `New ${keyType} key`, value: result.newKey }
52
+ ]);
53
+ }
54
+ formatter.flush();
55
+ });
56
+ }
57
+ export {
58
+ registerKeysRotateCommand
59
+ };
@@ -0,0 +1,3 @@
1
+ import type { Command } from 'commander';
2
+ export declare function registerOrgsCommands(program: Command): void;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/orgs/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIzC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAa3D"}