Expand description
App-scoped secret storage: one API on Linux, macOS, Windows and the web.
A SecretStore belongs to one app (SecretStore::for_app), and its keys name
that app’s secrets and no other app’s. SecretStore::memory keeps them in the
process, for tests.
| Target | Backend | Protection |
|---|---|---|
| Linux | the freedesktop Secret Service over D-Bus (GNOME Keyring, KWallet) | Protection::OsKeychain |
| Linux, in Tilo’s sandbox | sealed files in the app’s directory, keyed by the Secret portal | Protection::OsKeychain |
| macOS | the login Keychain’s generic passwords | Protection::OsKeychain |
| Windows | generic credentials in the user’s Credential Manager (DPAPI-encrypted, this machine only) | Protection::OsKeychain |
| Web | AES-GCM under a non-extractable CryptoKey; key and ciphertext in IndexedDB | Protection::BrowserWrapped |
Linux, macOS with TILO_SECRETS_DIR | sealed owner-only files in that directory | Protection::LocalFile |
SECRETS_DIR_ENV serves machines with no keychain to unlock: every process
given it keeps its secrets in that directory instead of the system store.
BrowserWrapped does not protect against script running in the page’s origin
or an attacker holding the browser profile.
The API is async because the browser’s is, and its futures are Send on the
desktop only: spawn them on tilo_rt::app(), which accepts both. Desktop code
may use the *_blocking methods; the web answers them once the host has loaded
the page’s secrets (web::mirror), and otherwise with Feature::Blocking
unsupported.
Modules§
- conformance
- The contract every
SecretStorekeeps, as checks a backend’s tests (and a host’s own backend’s tests) run. They write, overwrite and delete one key,tilo-conformance, of the store they are given.
Structs§
- Item
Secret - PutOptions
- Secret
- Secret bytes: wiped from memory on drop and never printed by
Debug. - Secret
Store - Secrets
Scope - Keeps a thread’s stores in one backend until it is dropped: see
scope_thread.
Enums§
Constants§
Traits§
Functions§
- arm_
device_ proof - Arm this process with the device secret it just read; only the key derived for proofs is kept.
- availability
- available
- items_
outlive_ rebuilds - Whether what this build puts in the system store stays readable by later builds of the same program. On macOS only a Developer ID signature does; an ad-hoc or dev signature’s items are readable by that build alone.
- keep_
in_ memory_ for_ process - From now on, every
SecretStore::for_appin this process shares one in-memory store and never reaches the platform’s, which may prompt and holds the user’s real secrets. - memory_
backend - scope_
thread - From now until the guard drops, every
SecretStore::for_appthis thread creates keeps its secrets inbackend, never the platform’s store. - unscoped