Documentation

Secrets, credentials and keys, decrypted only in your infrastructure

Keywheel stores your app configuration, issues short-lived credentials and certificates, and rotates, revokes and limits the third-party keys your apps use. Values are encrypted in the browser to an open-source agent you run; the dashboard and our servers only ever see ciphertext.

Quickstart

  1. 1Create an account. Sign up and turn on two-factor authentication (required).
  2. 2Start the agent. Keywheel → Agent → Create agent token, then run the Docker command it shows. Any host with outbound HTTPS works.
  3. 3Confirm its fingerprint. The agent prints a fingerprint on startup. Check it matches the one in the dashboard and activate.
  4. 4Connect a provider and a destination. Use the least-privilege steps shown on each connect page. Credentials are sealed to your agent in the browser.
  5. 5Add a key. Pick the provider, the interval, and where the new value goes (a platform variable or a secrets manager path).

Secrets manager

A project holds one app’s configuration. Each project has environments (dev, staging, prod by default, or your own via templates) and folders. Values are sealed in your browser to your agent’s public key, bound to the secret’s id, so the server can’t read them or move them to another secret.

  • References: ${DB_HOST} in the same folder, ${prod.shared.DB_HOST} across environments and folders. Resolved by the agent, five levels deep, with cycle detection.
  • Imports: include another folder; this folder’s own keys win.
  • Versions: every change is a version; roll one back, or restore a whole folder to a point in time.
  • Personal overrides: a value only you see; apps and syncs keep using the shared one.
  • Honey tokens: tag a secret canary and any read by an app raises an alert.
  • Change requests: protect a folder so changes need N approvals before they merge.
  • Syncs: push a folder to Vercel, AWS Secrets Manager / Parameter Store, GitHub, GitLab, Azure Key Vault, Kubernetes and 50+ more.
  • Share links: one-time links encrypted in the browser; the key stays in the link’s #fragment.

CLI

npm run build:cli                 # → dist/cli/keywheel.mjs (single file, no dependencies)
keywheel login --url http://127.0.0.1:8787 --client-id … --client-secret …
keywheel run --project backend --env prod -- npm start     # secrets as environment variables
keywheel export --project backend --env dev --format dotenv > .env
keywheel secrets set API_URL https://api.example.com --env dev
keywheel import --from infisical export.json --project backend --env dev   # also doppler, vault, dotenv
keywheel scan install-hook                                   # pre-commit secret scanning

Identities & SDKs

Apps, CI jobs and servers authenticate to your agent as machine identities: universal auth (client id + secret), tokens, Kubernetes, AWS IAM, GCP, Azure, OIDC/JWT, LDAP, TLS certificates, OCI and Alibaba Cloud. Grants are per project, environment and folder glob, with trusted IPs and token lifetimes. With passkey approvals on, an identity can’t log in until the owner signs its exact access.

import { KeywheelClient } from "@keywheel/sdk";
const keywheel = new KeywheelClient({
  agentUrl: "http://127.0.0.1:8787",
  auth: { universal: { clientId: process.env.KEYWHEEL_CLIENT_ID!, clientSecret: process.env.KEYWHEEL_CLIENT_SECRET! } },
  project: "backend",
  env: "prod",
});
const db = await keywheel.getSecret({ key: "DATABASE_URL" });
await keywheel.loadIntoEnv({ path: "/" });

SDKs for Node, Python and Go live in sdk/; all of them cache, refresh tokens and refuse redirects.

Dynamic secrets

Credentials minted per request and revoked when the lease ends: Postgres, MySQL, MariaDB, SQL Server, Oracle, MongoDB and Atlas, Redis, ElastiCache, MemoryDB, ClickHouse, Couchbase, Elasticsearch, RabbitMQ, Snowflake, Milvus, AWS IAM, GCP IAM, Azure Entra ID, Kubernetes, LDAP, GitHub, Tailscale, TOTP and OAuth2. The admin connection is sealed to your agent together with the folder it may be served from, so the server can’t point it somewhere else.

curl -X POST http://127.0.0.1:8787/v1/dynamic-secrets/leases -H "authorization: Bearer $TOKEN"   -d '{"project":"backend","env":"prod","path":"/","name":"app-readonly","ttl":900}'
curl -X POST   http://127.0.0.1:8787/v1/dynamic-secrets/leases/<id>/renew -H "authorization: Bearer $TOKEN"
curl -X DELETE http://127.0.0.1:8787/v1/dynamic-secrets/leases/<id>       -H "authorization: Bearer $TOKEN"

Certificates, SSH & KMS

Private certificate authorities (root and intermediate, or signed by an external parent), deny-by-default templates, ACME, EST and SCEP enrollment, CRLs and OCSP; an SSH certificate authority for users and hosts; and a KMS for encrypt, sign and MAC with versioned keys and KMIP. Every private key is generated by your agent and sealed to it. CRLs are published by Keywheel; OCSP, ACME, EST, SCEP, signing and KMS operations are served by your agent’s local API.

Privileged access (PAM)

Just-in-time SSH, Postgres and MySQL sessions through your agent (KEYWHEEL_PAM_SSH_PORT, KEYWHEEL_PAM_PG_PORT, KEYWHEEL_PAM_MYSQL_PORT). Users get a one-time credential; the real one stays sealed to the agent. Sessions are recorded, masked, encrypted to the agent’s key and replayable; deny rules block commands and statements.

Honey tokens

Tag a secret canary to alert on any read through Keywheel, or create AWS decoy keys (deny-all IAM users) that your agent watches for use anywhere.

SSO & SCIM

SAML 2.0, OIDC and LDAP sign-in per workspace (Settings → SSO), with domain claims, optional enforcement and group sync. SCIM 2.0 provisioning for Okta and Entra ID. Owners always keep password + 2FA as a way back in.

Operator & Terraform

apiVersion: secrets.keywheel.dev/v1alpha1
kind: KeywheelSecret
metadata: { name: api, namespace: team-a }
spec:
  agentUrl: https://keywheel-agent.keywheel.svc:8787
  project: backend
  env: prod
  auth: { kubernetes: { clientId: 6f1c0e0a-…, serviceAccountName: api } }
  managedSecret: { name: api-secrets }
  rolloutRestart: [{ kind: Deployment, name: api }]
  resyncSeconds: 60

Helm charts for the agent and the operator are in deploy/helm; the Terraform provider (keywheel_secrets data source, keywheel_secret resource with write-only values) is in terraform/.

Run the agent

The agent is a single Node.js process with no inbound ports. It needs outbound HTTPS to Keywheel and to the providers and platforms you connect, plus a small volume for its key.

docker run -d --name keywheel-agent --restart unless-stopped \
  --read-only --cap-drop ALL --security-opt no-new-privileges --ulimit core=0 \
  -e KEYWHEEL_AGENT_TOKEN=kwa_… \
  -e KEYWHEEL_KEY_WRAP=aws-kms:alias/keywheel-agent \
  -v keywheel-agent:/data \
  ghcr.io/trenchersio/agent:0.3.0

From source instead: npm ci && npm run build:agent, then node dist/agent/keywheel-agent.mjs with the same environment variables.

On first start it generates its keypair, registers the public half, and waits. Activate it in Keywheel → Agent by confirming the fingerprint from docker logs keywheel-agent. Credentials you connected before activating are sealed to a different key; the Agent page lists them so you can reconnect.

Kubernetes

Run exactly one replica per agent token. Keep the key on a persistent volume or inject it with KEYWHEEL_PRIVATE_KEY.

apiVersion: v1
kind: Secret
metadata: { name: keywheel-agent }
stringData:
  KEYWHEEL_AGENT_TOKEN: kwa_…
  # Optional: keep the agent's private key in your secret store instead of a volume
  # KEYWHEEL_PRIVATE_KEY: <base64url>
---
apiVersion: apps/v1
kind: Deployment
metadata: { name: keywheel-agent }
spec:
  replicas: 1
  selector: { matchLabels: { app: keywheel-agent } }
  template:
    metadata: { labels: { app: keywheel-agent } }
    spec:
      securityContext: { runAsNonRoot: true, runAsUser: 65532, fsGroup: 65532, seccompProfile: { type: RuntimeDefault } }
      containers:
        - name: agent
          image: ghcr.io/trenchersio/agent:0.3.0   # pin by @sha256 digest after cosign verify
          securityContext: { readOnlyRootFilesystem: true, allowPrivilegeEscalation: false, capabilities: { drop: [ALL] } }
          envFrom: [{ secretRef: { name: keywheel-agent } }]
          env:
            - { name: KEYWHEEL_ALLOW, value: "railway:projectId=abc123,vault" }
          volumeMounts: [{ name: data, mountPath: /data }]
          resources: { requests: { cpu: 20m, memory: 96Mi }, limits: { memory: 256Mi } }
      volumes:
        - name: data
          persistentVolumeClaim: { claimName: keywheel-agent }

Agent configuration

KEYWHEEL_AGENT_TOKENRequired. Shown once when you create the agent in Keywheel → Agent.
KEYWHEEL_URLControl plane URL. Defaults to https://app.keywheel.dev.
KEYWHEEL_KEY_FILEWhere the agent keeps its private key. Default /data/agent.key, created with mode 0600. Back it up: without it, credentials sealed to this agent can't be opened.
KEYWHEEL_PRIVATE_KEYAlternative to the key file: the private key itself (base64url), injected from your own secret store.
KEYWHEEL_KEY_WRAPWrap the private key with your KMS so it's never stored in plaintext: aws-kms:…, gcp-kms:…, azure-kv:… or vault-transit:…. Recommended.
KEYWHEEL_ALLOWAllowlist of destinations the agent may write to. See below.
KEYWHEEL_APPROVERSPasskeys whose signatures the agent requires before it uses a credential, writes anywhere, changes limits or revokes anything. Copy it from Keywheel → Agent.
KEYWHEEL_GATEWAY_FILE / KEYWHEEL_GATEWAYKey gateway routes (JSON). Also read from /data/gateway.json if present.
KEYWHEEL_GATEWAY_PORT / _HOSTGateway listener. Default 8787 on 127.0.0.1; set the host to 0.0.0.0 on a private network.
KEYWHEEL_GATEWAY_TLS_CERT / _KEYServe the gateway over TLS (PEM files).
KEYWHEEL_MAX_CREATES_PER_HOURCircuit breaker caps: also KEYWHEEL_MAX_REVOKES_PER_HOUR, KEYWHEEL_MAX_WRITES_PER_HOUR and KEYWHEEL_BREAKER_COOLDOWN_MIN. Defaults 60, 120, 240 and 60; 0 disables a cap.
KEYWHEEL_TICK_MSHow often the scheduler checks for due keys. Default 15000.
KEYWHEEL_CONCURRENCYRotations run in parallel. Default 2.
KEYWHEEL_HEALTH_PORTOptional liveness endpoint (binds to 127.0.0.1 unless KEYWHEEL_HEALTH_HOST is set).

Pin destinations

With KEYWHEEL_ALLOW set, the agent refuses to write a key anywhere you haven’t listed, even if the control plane asks. A refused write rolls the rotation back and revokes the unused new key.

# platform                      any target on that platform
# platform:key=value&key=value  only targets whose fields match
KEYWHEEL_ALLOW="railway:projectId=abc123&environmentId=prod,vercel:projectId=prj_9,vault"

Fields are matched against the destination’s target (for example Railway’s projectId, serviceId, environmentId) and its non-secret connection settings. The Agent page generates a list from what you’ve configured.

Hardening checklist

Each layer covers a different failure. Keywheel → Agent shows which ones your agent has on, as reported at its last heartbeat.

  • KMS-wrapped key: a stolen disk, image or backup is useless.
  • Passkey approvals: a compromised Keywheel can’t add a credential, redirect a key, weaken a limit or revoke anything.
  • Destination allowlist: keys can only be written to the places you listed.
  • Key gateway: apps never hold the real key, so a leaked env var is worthless.
  • Circuit breaker: bursts of creates, revokes or writes pause the agent and alert you.
  • Signed image: verify it and pin it by digest. Run it read-only, as non-root, on its own host.

Ready-made, locked-down Docker Compose and Kubernetes files (read-only filesystem, no capabilities, a NetworkPolicy that only allows DNS and HTTPS out) are in deploy/agent/ in the repository.

Wrap the key with KMS

With KEYWHEEL_KEY_WRAP set, the agent generates its private key in memory, has your KMS encrypt it and writes only the ciphertext (/data/agent.key.sealed). On every start it asks the KMS to decrypt it, using the machine’s own cloud identity. If you already have a plaintext key, the agent wraps it and deletes the plaintext.

KEYWHEEL_KEY_WRAP=aws-kms:alias/keywheel-agent          # IAM role: kms:Encrypt + kms:Decrypt on this key, condition kms:EncryptionContext:app = keywheel-agent
KEYWHEEL_KEY_WRAP=gcp-kms:projects/acme/locations/global/keyRings/keywheel/cryptoKeys/agent   # roles/cloudkms.cryptoKeyEncrypterDecrypter
KEYWHEEL_KEY_WRAP=azure-kv:https://acme.vault.azure.net/keys/keywheel-agent                 # managed identity: wrapKey + unwrapKey
KEYWHEEL_KEY_WRAP=vault-transit:https://vault.internal:8200/transit/keywheel-agent          # VAULT_TOKEN with encrypt/decrypt on this key only

Give only the agent’s identity access to that key, and alert on decrypt calls from anything else. Losing access to the KMS key means losing the agent key: reconnect your providers to a new agent if that happens.

Passkey approvals

Approvals move trust from Keywheel’s servers to a passkey you hold. Add one or more passkeys in Keywheel → Agent, then copy the KEYWHEEL_APPROVERS line into the agent’s environment and restart it. From then on the agent only uses:

  • provider and platform connections whose sealed credential you signed;
  • keys whose provider connection, settings, limits and “revoke this existing key” choice you signed;
  • write targets (platform, project, variable names) you signed;
  • kill switch, revoke now, inventory revokes and pasted keys with a fresh signature for exactly that action (valid 15 minutes, single use).

The agent checks each WebAuthn signature itself: the passkey must be one it pins, the signature must be for Keywheel’s domain, and it must include user verification (PIN or biometric). Anything changed since you signed it stops until you approve it again on the Approvals page. The agent also remembers the newest approval it has seen for each item (in /data/state.json), so an older signature can’t bring back a replaced credential or a looser limit. It only revokes, restores or serves key versions it created itself (each carries the agent’s own tag) unless you sign for that exact key ID. Pin at least two passkeys (say a laptop and a hardware key) so losing one doesn’t lock you out.

Key gateway

Instead of writing a key into your platform, serve it through the agent. Your app gets a gateway token as its “API key” and a base URL pointing at the agent. The agent checks the token, the method and path, and the rate, then swaps in the live key and forwards the request over TLS. The key never leaves the agent, so rotation needs no redeploys and a leaked token is useless outside your network.

// /data/gateway.json
{ "routes": [ { "name": "openai", "provider": "openai", "secret": "<key id from Keywheel>", "clients": ["api"],
                "allow": ["POST /v1/chat/completions", "POST /v1/responses", "GET /v1/models"], "rpm": 600 } ] }

# Token for one client (derived from the agent's key, nothing stored):
docker exec keywheel-agent /nodejs/bin/node /app/keywheel-agent.mjs gateway-token openai api

# In the app:
OPENAI_BASE_URL=http://keywheel-agent:8787/openai/v1
OPENAI_API_KEY=kwg_openai.api.…

Supported: OpenAI, OpenRouter, Anthropic, Gemini, Pinecone, Stripe, Cloudflare, GitHub, SendGrid, Resend, Mailgun, Datadog and Twilio. Remove the key’s platform bindings once apps use the gateway; the agent warns while both exist. To revoke a client, remove it from clients; to invalidate every token, raise epoch.

Circuit breaker

Rotation is predictable. If the agent is asked to create, revoke or write far more than usual in an hour, it stops all changes for the cool-down, alerts you, and leaves the current keys working. Set the caps a little above your normal hourly volume.

Verify the image

Release images are built by a public workflow, signed with Sigstore cosign (keyless) and published with SLSA provenance and an SBOM. Verify, then pin the digest:

cosign verify ghcr.io/trenchersio/agent:0.3.0 \
  --certificate-identity-regexp '^https://github.com/keywheel/keywheel/.github/workflows/agent-release.yml@refs/tags/agent-v' \
  --certificate-oidc-issuer https://token.actions.githubusercontent.com
gh attestation verify oci://ghcr.io/trenchersio/agent:0.3.0 --owner trenchersio

Add a key

A key in Keywheel is one credential at a provider, the interval it rotates on, and the variables it’s written to. Each rotation runs in a fixed order: mint, verify, write everywhere, redeploy, then revoke the previous key after a grace period. If any write fails, everything written so far is restored and the new key is revoked.

To retire a key you created by hand, paste its ID under “Also revoke this existing key” when adding it. Keywheel revokes it after the first successful rotation.

Revoke tools

  • Key inventory

    Providers → Inventory lists every key that exists at the provider for that connection, with names, redacted hints and last use. Keys Keywheel doesn’t manage are marked, and each has a revoke button. Live managed keys can’t be revoked from here; rotate them instead.

  • Revoke now

    An old version in its grace period can be revoked immediately from the key’s Versions list.

  • Rotate + revoke now

    Mints a replacement and revokes the old key the moment the new one is live (Pro and Team).

  • Revoke without replacing

    The kill switch: revokes the live key and pauses rotation. Apps using it lose access immediately.

  • Rotate everything

    After a breach, replaces every key in the workspace with no grace period (Pro and Team).

Every revoke needs a fresh two-factor code and is recorded in the tamper-evident activity log.

Limits

Limits are enforced by the provider, so they hold even if a key leaks and even if Keywheel is down. Set them per key; Keywheel applies them to every key it creates and, where the provider allows it, to the live key right away. Limits marked “new keys” can only be set at creation, and “whole project” limits apply to everything in that project.

Provider support

ProviderRotationInventoryLimits
OpenAI OpenAIAutomaticYesKey expires after, Permissions, Project hard spend limit
OpenRouter OpenRouterAutomaticYesSpend cap, Reset the cap, Count your own provider keys, Key expires after
Google Gemini Google GeminiAutomaticYesOnly allow these IPs
Anthropic AnthropicPaste inYesIn Anthropic’s dashboard
Pinecone PineconeAutomatic——
AWS IAM AWS IAMAutomatic—In AWS IAM’s dashboard
Cloudflare CloudflareAutomaticYesKey expires after, Only allow these IPs
GitHub App token GitHub App tokenAutomatic——
Supabase SupabaseAutomatic——
PostgreSQL PostgreSQLAutomatic——
MongoDB Atlas MongoDB AtlasAutomatic——
Twilio TwilioAutomaticYes—
SendGrid SendGridAutomaticYes—
Resend ResendAutomaticYes—
Mailgun MailgunAutomaticYesKey expires after
Datadog DatadogAutomaticYes—
Alchemy AlchemyAutomatic—Only allow these IPs
QuickNode QuickNodeAutomatic—Requests per second, Requests per minute, Requests per day
Stripe StripePaste in—In Stripe’s dashboard
Auth0 client secret Auth0 client secretAutomatic——
Microsoft Entra ID client secret Microsoft Entra ID client secretAutomaticYesKey expires after
Okta client secret Okta client secretAutomaticYes—
Salesforce OAuth credentials Salesforce OAuth credentialsAutomaticYes—
Google Cloud service account key Google Cloud service account keyAutomaticYes—
Cloudflare R2 access key Cloudflare R2 access keyAutomaticYesKey expires after
Datadog application key Datadog application keyAutomaticYes—
dbt Cloud service token dbt Cloud service tokenAutomaticYes—
Databricks service principal secret Databricks service principal secretAutomaticYesKey expires after
Fireworks AI Fireworks AIAutomaticYesKey expires after
LiteLLM virtual key LiteLLM virtual keyAutomaticYesKey expires after, Max budget
Convex deploy key Convex deploy keyAutomaticYes—
Redis ACL user Redis ACL userAutomaticYes—
Snowflake key pair Snowflake key pairAutomaticYes—
MySQL MySQLAutomaticYes—
Microsoft SQL Server Microsoft SQL ServerAutomaticYes—
MongoDB (self-managed) MongoDB (self-managed)AutomaticYes—
LDAP service account LDAP service accountAutomatic——
Oracle Database Oracle DatabaseAutomaticYes—

Destinations: Railway, Render, Vercel, Netlify, Fly.io, Heroku, DigitalOcean App Platform, Coolify, GitHub Actions, Cloudflare Workers, Supabase Edge Functions, Doppler, Infisical, HashiCorp Vault, AWS Secrets Manager, Google Secret Manager, Kubernetes, AWS Parameter Store, Azure Key Vault, Azure App Configuration, OCI Vault, Cloudflare Pages, Cloudflare Secrets Store, Databricks, OVHcloud Secret Manager, GitLab CI/CD, Azure DevOps, Bitbucket Pipelines, CircleCI, Travis CI, TeamCity, HCP Terraform, Spacelift, Octopus Deploy, Rundeck, Hasura Cloud, Humanitec, Northflank, Qovery, Laravel Forge, Windmill, Checkly, Zabbix, Camunda, Portainer, Cloud 66, Trigger.dev, 1Password, Keeper, Chef Infra, Keywheel Secrets Manager.

Security model

With the agent, Keywheel’s cloud never holds a key that can open your credentials. It stores ciphertext, names, schedules, which variables a key is written to, redacted hints and run logs with secret values scrubbed. The agent API only lets an agent touch its own workspace, only accepts new key versions sealed to that agent’s key, and never lets it write a value back except to delete one. Full security model

Docs · Keywheel