pub trait SecureStorage {
// Required methods
fn store(&self, key: &str, value: &[u8]) -> Result<(), PersistenceError>;
fn retrieve(&self, key: &str) -> Result<Option<Vec<u8>>, PersistenceError>;
fn delete(&self, key: &str) -> Result<(), PersistenceError>;
// Provided method
fn exists(&self, key: &str) -> Result<bool, PersistenceError> { ... }
}Expand description
Platform-agnostic secure storage abstraction.
Implementations should use platform-specific secure storage:
- Android: EncryptedSharedPreferences / Keystore
- iOS: Keychain Services
- Linux: Encrypted file in XDG data directory
- ESP32: Encrypted NVS partition
- Windows: DPAPI
Required Methods§
Sourcefn store(&self, key: &str, value: &[u8]) -> Result<(), PersistenceError>
fn store(&self, key: &str, value: &[u8]) -> Result<(), PersistenceError>
Store bytes under the given key.
The implementation should encrypt the data at rest using platform-appropriate mechanisms.
Provided Methods§
Implementors§
impl SecureStorage for MemoryStorage
Available on crate features
std only.