use std::collections::HashMap;
pub struct SecureStorage {
data: HashMap<String, Vec<u8>>,
}
impl SecureStorage {
pub fn new() -> Self {
Self {
data: HashMap::new(),
}
}
pub fn set(&mut self, key: &str, value: Vec<u8>) {
self.data.insert(key.to_string(), value);
}
pub fn get(&self, key: &str) -> Option<Vec<u8>> {
self.data.get(key).cloned()
}
pub fn has(&self, key: &str) -> bool {
self.data.contains_key(key)
}
pub fn delete(&mut self, key: &str) -> Option<Vec<u8>> {
self.data.remove(key)
}
pub fn clear(&mut self) {
self.data.clear();
}
}
impl Default for SecureStorage {
fn default() -> Self {
Self::new()
}
}