MCPcopy Create free account
hub / github.com/continuedev/continue / isValidAnthropicApiKey

Function isValidAnthropicApiKey

extensions/cli/src/util/apiKeyValidation.ts:6–15  ·  view source on GitHub ↗
(
  apiKey: string | null | undefined,
)

Source from the content-addressed store, hash-verified

4 * @returns true if the API key is valid, false otherwise
5 */
6export function isValidAnthropicApiKey(
7 apiKey: string | null | undefined,
8): boolean {
9 if (!apiKey || typeof apiKey !== "string") {
10 return false;
11 }
12
13 // Anthropic API keys must start with "sk-ant-" and have additional characters
14 return apiKey.startsWith("sk-ant-") && apiKey.length > "sk-ant-".length;
15}
16
17/**
18 * Gets a user-friendly error message for invalid API keys

Callers 2

runOnboardingFlowFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected