ai_agent/utils/
secure_storage.rs1use std::collections::HashMap;
4
5pub struct SecureStorage {
7 data: HashMap<String, Vec<u8>>,
8}
9
10impl SecureStorage {
11 pub fn new() -> Self {
12 Self {
13 data: HashMap::new(),
14 }
15 }
16
17 pub fn set(&mut self, key: &str, value: Vec<u8>) {
19 self.data.insert(key.to_string(), value);
20 }
21
22 pub fn get(&self, key: &str) -> Option<Vec<u8>> {
24 self.data.get(key).cloned()
25 }
26
27 pub fn has(&self, key: &str) -> bool {
29 self.data.contains_key(key)
30 }
31
32 pub fn delete(&mut self, key: &str) -> Option<Vec<u8>> {
34 self.data.remove(key)
35 }
36
37 pub fn clear(&mut self) {
39 self.data.clear();
40 }
41}
42
43impl Default for SecureStorage {
44 fn default() -> Self {
45 Self::new()
46 }
47}