Secrets
Function secrets are encrypted at rest and injected as environment variables at runtime. The function reads them viaprocess.env.<KEY> just like in any
Node program.
Setting secrets
Inline
From a file
From stdin (safest)
- placeholder tells the CLI to
read from stdin until EOF.
Listing
Removing
When changes take effect
Setting / unsetting a secret marks the function as out of sync. The nextnpx zavudev deploy rebuilds the function with the new env vars. Until then, the
running function still has the old environment.
Constraints
For values larger than 4 KB (large JSON blobs, certificates), upload to S3 /
Convex storage and store a URL + auth header pair instead.
Auto-provisioned secrets
Every function created bynpx zavudev fn init gets these injected automatically —
you don’t set them yourself:
Use them directly:
ZAVUDEV_API_KEY is revoked automatically when you npx zavudev fn delete the
function. If you reset it manually from the dashboard’s API Keys page, the
function will start failing — redeploy to provision a new one.The auto-key has messages:send, messages:read, contacts:read scopes.
For other operations create a separate scoped key and inject it as a secret.Encryption
Values are encrypted with AES-256-GCM, key derived via PBKDF2 (100,000 iterations, SHA-256) from the platform encryption key. Encryption happens server-side before the value is persisted, so plaintext never lives in our database. Your function receives the value at deploy time as a standard environment variable, encrypted at rest by managed encryption keys. Inside the function,process.env.X returns the value.
Common patterns
Rotating an API key
Rotating an API key
Different secrets per environment
Different secrets per environment
Functions are project-scoped — if you have separate Zavu projects for
staging vs prod, each has its own secrets.
npx zavudev whoami shows the current project before each operation.Secrets in source control (don't)
Secrets in source control (don't)
Never commit secret values. Commit a
.zavu/secrets.example.yml style
file with key names + descriptions, and have a teammate’s setup script
prompt for actual values:CI / automation
CI / automation
Use
ZAVUDEV_API_KEY env var so the CLI uses your CI’s key: