MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / promptForKey

Function promptForKey

packages/cli/src/commands/auth/login.ts:280–295  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

278}
279
280async 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}

Callers 1

collectApiKeyFunction · 0.85

Calls 2

isHeaderSafeFunction · 0.85
errorMethod · 0.80

Tested by

no test coverage detected