()
| 278 | } |
| 279 | |
| 280 | async function promptForKey(): Promise<string> { |
| 281 | const clack = await import("@clack/prompts"); |
| 282 | const value = await clack.password({ |
| 283 | message: "Enter HeyGen API key", |
| 284 | validate: (v) => { |
| 285 | if (!v || v.length < MIN_KEY_LENGTH) return "API key looks too short"; |
| 286 | if (!isHeaderSafe(v)) return "API key must not contain newline or control characters"; |
| 287 | return undefined; |
| 288 | }, |
| 289 | }); |
| 290 | if (clack.isCancel(value)) { |
| 291 | console.error("Aborted."); |
| 292 | process.exit(1); |
| 293 | } |
| 294 | return value.trim(); |
| 295 | } |
no test coverage detected