Encryption & plaintext storage
Configure whether the server stores session content end-to-end encrypted or as plaintext.
Happier is designed around end-to-end encryption (E2EE): clients encrypt session content locally and the server stores ciphertext.
For some self-hosted or enterprise deployments, you may want to opt out of E2EE for storage so the server can store session content as plaintext (for example to enable future server-side indexing/search).
This page explains the server operator configuration and what it means for end users.
What changes when plaintext storage is enabled?
- E2EE storage (default): the server cannot read session transcripts (it stores encrypted blobs).
- Plaintext storage: the server can read and process new session content stored in plaintext.
Important: plaintext storage is a storage mode, not an authentication mode.
- Phase 1 plaintext storage still uses the normal Happier login model (device-key accounts).
- Users can choose plaintext for new sessions only when the server policy allows it.
Storage policy (server-wide)
Configure one of three storage policies:
required_e2ee(default): encrypted-only; plaintext writes are rejected.optional: encrypted or plaintext is allowed depending on account/session mode.plaintext_only: plaintext-only; encrypted writes are rejected.
Env var:
HAPPIER_FEATURE_ENCRYPTION__STORAGE_POLICY=required_e2ee|optional|plaintext_onlyRecommended configurations
Default E2EE server:
HAPPIER_FEATURE_ENCRYPTION__STORAGE_POLICY=required_e2eeAllow plaintext storage (opt-in per account):
HAPPIER_FEATURE_ENCRYPTION__STORAGE_POLICY=optional
HAPPIER_FEATURE_ENCRYPTION__ALLOW_ACCOUNT_OPTOUT=1Force plaintext-only (for “server-side features first” deployments):
HAPPIER_FEATURE_ENCRYPTION__STORAGE_POLICY=plaintext_onlyAccount encryption mode (end-user toggle)
When the server policy is optional and account opt-out is enabled, the UI can expose an account-level toggle:
e2ee: new sessions default to encrypted storageplain: new sessions default to plaintext storage
Env vars:
HAPPIER_FEATURE_ENCRYPTION__ALLOW_ACCOUNT_OPTOUT=0|1
HAPPIER_FEATURE_ENCRYPTION__DEFAULT_ACCOUNT_MODE=e2ee|plainNotes:
- Switching account mode affects new sessions created after the change.
- Existing sessions are not migrated (no retroactive decrypt/re-encrypt).
- Switching account mode is an atomic migration-backed transition (clients call
POST /v1/account/encryption/migrate).
Plaintext accounts and account-scoped data
For plaintext accounts to work across devices (including keyless login), clients must not assume “device-key ciphertext” for account-scoped blobs.
- Plaintext accounts use settings v2 (
GET/POST /v2/account/settings) and store settings as a plaintext envelope. - The legacy settings route (
/v1/account/settings) is rejected for plaintext accounts with400 { error: "plain_account_requires_settings_v2" }.
Plaintext at-rest sealing (recommended)
Plaintext accounts are server-readable by definition, but you can still reduce disk/backups exposure by sealing sensitive account-scoped blobs at rest using the server master secret.
Env vars:
# Defaults are server_sealed
HAPPIER_FEATURE_ENCRYPTION__PLAIN_ACCOUNT_SETTINGS_AT_REST=none|server_sealed
HAPPIER_FEATURE_ENCRYPTION__PLAIN_ACCOUNT_CREDENTIALS_AT_REST=none|server_sealedNotes:
- These affect DB storage only. Wire payloads remain plaintext envelopes for plaintext accounts.
- For connected services, the v3 plaintext credential endpoints store credentials as plaintext envelopes and seal them at rest when configured.
Per-session encryption mode
Each session has a stable encryptionMode (e2ee or plain) chosen at creation time.
This prevents “mixed-mode” content inside one session and makes it predictable for clients (and for future server-side features).
Sharing behavior
- Encrypted (E2EE) sessions: sharing requires distributing a session data key to recipients (still E2EE).
- Plaintext sessions: sharing is purely server-side authorization (no encrypted data key is needed).
Public share links also work for plaintext sessions (the server returns plaintext envelopes).
Plain Machine control (development only)
Current development source extends plaintext mode to Machine metadata, daemon state, and Machine control requests and responses. This is unreleased behavior; released 0.2 clients still encrypt Machine content even when their account stores new sessions as plaintext.
Updated clients require the server's encryption.plaintextMachine feature bit.
The server advertises it when plaintext storage is supported and its build feature
policy allows it. Plain Machines belong to plaintext accounts and use an explicit
plain format. Token-only login can use them without creating substitute encryption
keys. Refreshing a login for the same account preserves genuine keys already held
on that device.
Plain Machine content and control traffic are readable by the server. Choose this mode only when you trust the server with both session content and Machine control content. E2EE Machines continue to require genuine encryption keys.
Historical encrypted Machines require the genuine old keys for conversion. A missing key produces an explicit operation failure; it does not authorize replacing Machine settings or daemon state. Updated clients preserve complete stored content during conversion. Account mode changes that convert Machines commit them together with the account mode; an incomplete or stale conversion is rejected. A released client's opt-out can leave historical Machines encrypted until a capable client converts them. After an explicit conversion, restart an older running daemon so it refetches the new Machine context. Upgrading the server alone does not convert historical records or give older clients the new format.
Client compatibility
- Older clients that only support encrypted writes continue to work when:
- policy is
required_e2ee, or - policy is
optionaland they create encrypted sessions.
- policy is
- Under
plaintext_only, older clients will fail because encrypted writes are rejected.
Where clients learn the policy
Clients use GET /v1/features:
- gates:
features.encryption.plaintextStorage.enabled,features.encryption.accountOptOut.enabled - development Machine support:
features.encryption.plaintextMachine.enabled - details:
capabilities.encryption.storagePolicy,capabilities.encryption.defaultAccountMode
Security checklist (plaintext mode)
If you store plaintext session content on the server, treat it as sensitive application data:
- Enforce HTTPS/TLS end-to-end (including between proxies and the server).
- Encrypt disks and backups at rest.
- Restrict database access and enable audit logging where possible.
- Define retention and deletion policies appropriate for your org.