Secrets Management
Why Use Secrets (Instead of Plain apiKey in Config)
If you put keys directly in ~/.nextclaw/config.json, they are easy to leak in:
- screenshots
- copied config files
- accidental git commits
With secrets management, config only stores references. Real values stay in external sources.
Where Real Secret Values Are Stored
env: operating system environment variablesfile: an external JSON file you controlexec: output of a command (for vault-like integrations)
config.json stores only:
secrets.providerssecrets.defaultssecrets.refs
Real-World Scenarios
Team sharing one config template: Use refs in config, each teammate keeps real keys in local env variables.
Dev / staging / prod switching: Keep the same refs, switch only environment variable values per environment.
Key rotation: Update external key value, run reload, no need to rewrite business config.
Quick Start (Beginner-Friendly)
- Create an env provider alias:
bash
nextclaw secrets configure --provider env-main --source env --prefix APP_ --set-default- Bind OpenAI API key path to a secret ref:
bash
nextclaw secrets apply \
--path providers.openai.apiKey \
--source env \
--provider env-main \
--id OPENAI_API_KEY- Set real key and audit:
bash
export APP_OPENAI_API_KEY=sk-xxxxx
nextclaw secrets audit --strict- Reload:
bash
nextclaw secrets reloadUI Workflow
Open /secrets in the Web UI:
- edit
enabled - manage
defaults - manage
providers - manage
refs
Then run nextclaw secrets audit --strict as final acceptance.
Is Old Style Still Valid?
Yes. Direct providers.<name>.apiKey still works.
Use direct key for quick local experiments. Use secrets refs for team use, production, and safer operations.