Skip to main content

Module keys

Module keys 

Source
Expand description

Generating and recognising API keys. A key is cdo_ and 43 characters of URL-safe base64 (256 random bits). Only its SHA-256 hash and a 12-character prefix are stored, so the key exists in the clear once, in the response that creates it.

Structs§

NewKey
A new key: the plaintext (show once, never store), its hash and its display prefix.

Constants§

DISPLAY_PREFIX_LEN
Characters of the key kept (unhashed) to tell keys apart on the settings screen.
KEY_PREFIX
Every key starts with this.

Functions§

claude_command
claude mcp add ... for the key (or a placeholder).
generate
hash_key
What is stored and looked up instead of the key.
is_well_formed
Whether key has the shape of a key we hand out. A value that doesn’t is rejected before any lookup.
mcp_servers_json
A mcpServers entry for MCP clients that take JSON, written out so the keys stay in the order a person reads them.
mcp_url
The MCP server’s address, {BASE_URL}/mcp.