Skip to main content

Secrets

Function secrets are encrypted at rest and injected as environment variables at runtime. The function reads them via process.env.<KEY> just like in any Node program.

Setting secrets

Inline

The value is in your shell history — fine for non-secret config, not great for real keys.

From a file

Reads the file as UTF-8. Trailing whitespace is stripped. Useful for multi-line values (PEM keys, JSON service accounts).

From stdin (safest)

Nothing touches disk or shell history. The - placeholder tells the CLI to read from stdin until EOF.

Listing

Only the last 4 characters of each value are shown. Plaintext is never returned by the API — even from the dashboard, only the same last-4 is visible.

Removing

When changes take effect

Setting / unsetting a secret marks the function as out of sync. The next npx zavudev deploy rebuilds the function with the new env vars. Until then, the running function still has the old environment.
You can batch secret changes before a single deploy. Setting 5 secrets in a row results in 1 sync (the next deploy), not 5.

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 by npx 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

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.
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:
Use ZAVUDEV_API_KEY env var so the CLI uses your CI’s key:

API equivalence

For automation, the secret endpoints are part of the public API:
See the API reference for full schemas.