Private Alpha

Credential management

How Ethen manages API keys and provider credentials across the Gateway, Desktop, and local runtimes.

Raw

This page documents how Ethen handles API keys, provider credentials, and authentication secrets across product surfaces.

Credential stores

Ethen uses a provider credential store interface (ProviderCredentialStore) with two implementations:

ImplementationBacking storageUse case
Desktop (safeStorage)Electron safeStorage.encryptString/decryptString via IPCDesktop app local model runtime
Web (env-var)process.env resolutionGateway and web-mode operations

Both implementations follow these security rules:

  • No provider key is ever written to plaintext JSON settings.
  • Credential references (used for UI display) never include the raw secret value.
  • Renderer requests for secrets go through IPC or daemon boundary.
  • Web mode continues to resolve keys from environment variables only — setSecret and deleteSecret are no-ops.

Known provider credentials

The following provider credentials are recognised by the credential store:

ProviderEnvironment variable
OpenAIOPENAI_API_KEY
AnthropicANTHROPIC_API_KEY
DeepSeekDEEPSEEK_API_KEY
OpenAI-compatibleETHEN_OPENAI_COMPATIBLE_API_KEY
GoogleGOOGLE_API_KEY
GroqGROQ_API_KEY
MistralMISTRAL_API_KEY
CohereCOHERE_API_KEY
TogetherTOGETHER_API_KEY
FireworksFIREWORKS_API_KEY
PerplexityPERPLEXITY_API_KEY
xAIXAI_API_KEY

API key hashing

Gateway API keys are hashed using SHA-256 with a random salt before storage:

text
stored = "sha256:{salt}:{digest}"

Verification uses constant-time comparison (crypto.timingSafeEqual) to prevent timing side-channel attacks. Keys that were never created or have been revoked cannot be verified through the hash alone.

Key fingerprinting

For identification in dashboards and logs, keys are fingerprinted without exposing the full value:

  • Prefix: first 8 characters of the key beyond the environment prefix (ethen_live_ or ethen_test_).
  • Suffix: last 6 characters of the key.
  • Environment prefix: ethen_live_ for production keys, ethen_test_ for test keys.

The raw key is never displayed after creation.

Secret redaction

Before any content is stored, displayed, or exported, the centralised redaction layer scans for:

  • Well-known API key formats (OpenAI, Anthropic, AWS, SendGrid, Firebase, etc.)
  • Generic sk_/pk_ prefixed secrets
  • Sensitive metadata field names (secrets, tokens, keys, passwords, credentials)

Redacted content replaces matched values with placeholders such as [REDACTED_API_KEY] or [REDACTED_OPENAI_KEY].

Desktop credential store availability

The Desktop safeStorage-backed credential store is unavailable in:

  • Headless or test environments where Electron APIs are not loaded.
  • Environments where safeStorage.isEncryptionAvailable() returns false.

In these environments, Desktop mode falls back to environment variable resolution. The isAvailable() method on the store interface can be queried at runtime.

Managed vault (Connected Apps)

OAuth grants and connector secrets for Connected Apps live in the managed vault, not in the stores above:

  • The vault service is the only interface that may hold secret values. Production adapters are backed by a managed KMS/vault; database rows hold an opaque externalRef, never the value.
  • Flow grant secrets resolve to a sealed credential handle reachable only through reveal(); logs, errors, caches, and telemetry can only ever see redacted handles.
  • Secret kinds: provider, connector, webhook, desktop, oauth_client. Statuses: staged, active, superseded, revoked.
  • Every vault touch emits an audit event (created, read, rotated, revoked) with actor, purpose, reference, and version.

See also

Last verified 2026-10-03 · Owner gateway-team