Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

docs(storage): document storage-backed secrets and credentials

Steven Enamakel0fed91114568
diff --git a/crates/openhuman-core/src/security/credentials/README.md b/crates/openhuman-core/src/security/credentials/README.md
index 4ec38efce9..977fded90d 100644
--- a/crates/openhuman-core/src/security/credentials/README.md
+++ b/crates/openhuman-core/src/security/credentials/README.md
@@ -82,6 +82,17 @@ Note: `list_provider_credentials_by_prefix` and the Composio-direct/secret helpe
- Loads migrate legacy `enc:`/`enc2:` cipher fields and promote secrets into the keychain; unrecoverable (un-decryptable / bad-`kind`) profiles are dropped rather than poisoning the whole store; unparseable files are quarantined to `auth-profiles.corrupt-<ts>.json` and reset to empty.
- Mutations are guarded by `auth-profiles.lock` (PID-stamped). Stale/leaked/malformed locks are reclaimed by liveness + age checks to avoid the "stuck on Initializing OpenHuman" hang.
+### On a storage backend
+
+With a storage backend configured (`crate::storage`), `auth-profiles.json`
+and `http-credentials.json` are not written to disk: the same JSON is kept as
+one encrypted secret each (`file:auth-profiles.json`,
+`file:http-credentials.json`) in the acting agent's scope
+(`storage::secrets`), and per-profile keychain secrets go there through the
+keyring. An unparseable record is an error rather than quarantined, so a
+write never replaces profiles it could not read. Writes are last-writer-wins
+across processes; the local file lock still serializes one host.
+
## Dependencies
- `crate::config`: `Config`, config load (`load_config_with_timeout`), user-dir activation (`default_root_openhuman_dir`, `user_openhuman_dir`, `read/write/clear_active_user`, `pre_login_user_dir`), onboarding state.
diff --git a/crates/openhuman-core/src/security/keyring/README.md b/crates/openhuman-core/src/security/keyring/README.md
index 80df6d774d..4625bde76c 100644
--- a/crates/openhuman-core/src/security/keyring/README.md
+++ b/crates/openhuman-core/src/security/keyring/README.md
@@ -68,6 +68,21 @@ The workspace dir resolves from `init_workspace`, else `OPENHUMAN_WORKSPACE`, el
Both file backends keep every secret in one file, so a `set` of one key rewrites all of them. That read-modify-write cycle is guarded by `file_store::lock_for_write`. An in-process mutex is not sufficient, because a desktop core, another process embedding the same core, and a `cargo test` run that inherited `OPENHUMAN_WORKSPACE` can all address the same path.
+### On a storage backend
+
+When the host configured a storage backend (`OPENHUMAN_STORAGE_URL` /
+`[storage] url`, see `crate::storage`), `get`, `set` and `delete` serve the
+secret from `storage::secrets` instead: one encrypted document per
+namespaced key in the acting agent's storage scope, under a per-scope key
+derived from the master key above. `is_available` reports `true` without
+probing. The app-level keys stay on the process backend: the availability
+probe, `get_or_create_random` and `migrate_from_file` (the config
+encryption key, `secretstore.master_key`) use `process_get` / `process_set` /
+`process_delete`. `backend_name` keeps naming the process backend, which is
+what the consent UI describes. The `enc2:` cipher itself is
+`tinystoragedrivers::secrets::crypto` (byte-compatible; its fixtures were
+written by this module), used by `crypto.rs` and `SecretStore`.
+
## Dependencies
Internal openhuman/core modules: none. The keyring module's own files only `use crate::security::keyring::*` (self-internal). It is a leaf infrastructure module. External crates: `keyring`, `chacha20poly1305`, `serde_json`, `parking_lot`, `thiserror`, `anyhow`, `chrono`, `dirs`.
diff --git a/crates/openhuman-core/src/storage/README.md b/crates/openhuman-core/src/storage/README.md
index 5a98b3884a..244c2a8984 100644
--- a/crates/openhuman-core/src/storage/README.md
+++ b/crates/openhuman-core/src/storage/README.md
@@ -38,6 +38,15 @@ on `storage-mongodb`.
- The session store: `openhuman_rpc::session_store::install_for_host` opens
the configured backend before boot and installs `DriverSessionStores`
over it. See that module's README.
+- Approvals (`security::approval`), through `store_documents.rs`.
+- Secrets (`storage::secrets`): the keyring's user secrets
+ (`security::keyring::get` / `set` / `delete`) and the credential stores'
+ files (`auth-profiles.json`, `http-credentials.json`) become encrypted
+ documents (`DocumentSecrets`, `enc2:`) in the acting agent's scope. Each
+ scope's data key is derived with HKDF-SHA256 from the keyring master key
+ (`OPENHUMAN_KEYRING_MASTER_KEY` / `_FILE`, else the OS keychain); with no
+ master key they fail closed. The config encryption key stays on the
+ process keyring, because `config.toml` is loaded before any agent acts.
## Boundaries