#[non_exhaustive]pub enum SecretStorage {
Auto,
Mock,
System,
}Expand description
Which key Chromium uses to encrypt the little it stores encrypted.
Chromium’s os_crypt layer encrypts cookies and saved passwords only. Every
other piece of web storage — localStorage, IndexedDB, Cache Storage, service worker
registrations — is written to the cache directory unencrypted whichever variant you
pick here, exactly as it is under wry’s WebKitGTK and WebView2 backends.
The default, SecretStorage::Auto, skips the OS secret store in development builds
(tauri::is_dev()) and keeps it in release builds. What it skips differs per
platform:
- on macOS,
os_cryptstores a random key in a shared “Chromium Safe Storage” keychain item whose ACL is bound to the code signature of the process that reads it. Ad-hoc-signed development builds get a new signature on every rebuild, so macOS puts up the keychain password prompt again after everycargo build. - on Linux,
os_cryptasks the D-Bus secret portal, libsecret or KWallet for the key, which pops a keyring-unlock dialog the first time an app runs.
A release build that has to run where there is no secret store at all — a headless
session, a container, a CI image — needs SecretStorage::Mock, because there Auto
asks for a store that is not there.
§Security
The mock keychain (--use-mock-keychain) and the Linux basic password store do not
derive a secret key: they encrypt with a key derived from a hard-coded constant
compiled into Chromium (mock_password and peanuts respectively). Both constants
are public, so cookies encrypted with them have no meaningful protection at rest —
anyone who can read the cache directory can decrypt them.
§Switching modes invalidates stored cookies
Cookies encrypted with one key cannot be read back with another, and development and
release builds share the same default cache directory
({user cache}/{identifier}/cef). Moving an app between SecretStorage::Mock and
SecretStorage::System — including the implicit move SecretStorage::Auto makes
when a dev build is followed by a release build — therefore drops the cookies stored
under the previous key, logging users out. Set Cef::root_cache_path to separate
the two if that matters.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Auto
Skip the OS secret store in development builds (tauri::is_dev()) and use it in
release builds: --use-mock-keychain on macOS and --password-store=basic on
Linux, in development only. Windows is untouched and keeps using DPAPI.
Mock
Always encrypt with Chromium’s hard-coded constant: --use-mock-keychain on macOS,
--password-store=basic on Linux. Windows is untouched and keeps using DPAPI.
Read the security note on SecretStorage before shipping this in a release
build: the key is a public constant, so the cookie jar is effectively unprotected.
System
Always use the operating system secret store, on every platform and in every build profile. Appends no switch at all.
Trait Implementations§
Source§impl Clone for SecretStorage
impl Clone for SecretStorage
impl Copy for SecretStorage
Source§impl Debug for SecretStorage
impl Debug for SecretStorage
Source§impl Default for SecretStorage
impl Default for SecretStorage
impl Eq for SecretStorage
Source§impl PartialEq for SecretStorage
impl PartialEq for SecretStorage
impl StructuralPartialEq for SecretStorage
Auto Trait Implementations§
impl Freeze for SecretStorage
impl RefUnwindSafe for SecretStorage
impl Send for SecretStorage
impl Sync for SecretStorage
impl Unpin for SecretStorage
impl UnsafeUnpin for SecretStorage
impl UnwindSafe for SecretStorage
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, U> ConvertReturnValue<U> for Twhere
T: Into<U>,
impl<T, U> ConvertReturnValue<U> for Twhere
T: Into<U>,
fn wrap_result(self) -> U
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.