Overview
ClawControl provides a secrets management system to securely store and reuse API keys across multiple deployments. Instead of entering the same API key every time you create a deployment, you can save it once and select it from a list. Secrets are stored locally in~/.clawcontrol/secrets/ and organized by service type.
How Secrets Work
Secrets are managed by the service insrc/services/secrets.ts. Each secret:
- Has a unique ID generated from its name
- Belongs to a specific service (e.g.,
hetzner,anthropic,telegram) - Stores the actual API key/token value
- Includes a creation timestamp
Storage Location
Secrets are stored in JSON files organized by service:src/types/index.ts:244-247):
Secret Schema
Secrets follow theSavedSecretSchema defined in src/types/index.ts:236-242:
Unique identifier for the secret. Auto-generated from the name using lowercase letters, numbers, and hyphens.If a secret with the same ID already exists, a numeric suffix is added (e.g.,
my-key-1, my-key-2).Human-readable name for the secret. Displayed in the UI when selecting secrets.
The actual API key or token value. This is what gets used in your deployments.
ISO 8601 timestamp of when the secret was saved.
Using Secrets
When creating a new deployment, ClawControl prompts you to either:- Select a saved secret from your existing secrets for that service
- Enter a new API key and optionally save it for future use
- Cloud provider API keys (Hetzner, DigitalOcean)
- AI provider API keys (Anthropic, OpenAI, OpenRouter)
- Telegram bot tokens
Saving Secrets
Secrets are saved using thesaveSecret() function in src/services/secrets.ts:41-53:
Retrieving Secrets
Retrieve all secrets for a service usinggetSecretsForService() in src/services/secrets.ts:37-39:
Secret ID Generation
Secret IDs are auto-generated from the name to create URL-safe, filesystem-friendly identifiers. The logic insrc/services/secrets.ts:68-81:
- Convert name to lowercase
- Replace non-alphanumeric characters with hyphens
- Remove leading/trailing hyphens
- Add numeric suffix if ID already exists
"Production Key"→"production-key""My API Key"→"my-api-key""Production Key"(duplicate) →"production-key-1"
Deleting Secrets
Delete a secret by service and ID usingdeleteSecret() in src/services/secrets.ts:55-62:
true if the secret was found and deleted, false otherwise.
Supported Services
ClawControl supports saving secrets for:Cloud Providers
- hetzner - Hetzner Cloud API keys
- digitalocean - DigitalOcean API tokens
- vultr - Vultr API keys (when supported)
AI Providers
- anthropic - Anthropic API keys (Claude)
- openai - OpenAI API keys (GPT)
- openrouter - OpenRouter API keys (multi-provider gateway)
Communication Channels
- telegram - Telegram Bot API tokens
Security Considerations
Best Practices:- Use appropriate filesystem permissions on
~/.clawcontrol/(default: user-only access) - Don’t commit secrets to version control
- Rotate API keys regularly
- Delete unused secrets to minimize exposure
Example: Managing Secrets
Example Secret File
~/.clawcontrol/secrets/anthropic.json:
Programmatic Access
If you need to access secrets programmatically:Related Files
- Type Definition:
src/types/index.ts:236-247-SavedSecretSchemaandSecretFileSchema - Secrets Service:
src/services/secrets.ts- All secret management functions - Config Service:
src/services/config.ts:253-257- Secret storage paths