bitwarden_crypto/store/backend/implementation/
mod.rs1use super::StoreBackend;
2use crate::store::KeyId;
3
4mod basic;
5
6pub fn create_store<Key: KeyId>() -> Box<dyn StoreBackend<Key>> {
8 Box::new(basic::BasicBackend::<Key>::new())
9}
10
11#[cfg(test)]
12mod tests {
13 use super::*;
14 use crate::{traits::tests::TestSymmKey, SymmetricCryptoKey};
15
16 #[test]
17 fn test_creates_a_valid_store() {
18 let mut store = create_store::<TestSymmKey>();
19
20 let key = SymmetricCryptoKey::make_aes256_cbc_hmac_key();
21 store.upsert(TestSymmKey::A(0), key.clone());
22
23 assert_eq!(
24 store.get(TestSymmKey::A(0)).unwrap().to_base64(),
25 key.to_base64()
26 );
27 }
28}