use nym_store_cipher::ExportedStoreCipher;
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub(crate) enum StoredExportedStoreCipher {
NoEncryption,
Cipher(ExportedStoreCipher),
}
impl StoredExportedStoreCipher {
pub(crate) fn uses_encryption(&self) -> bool {
matches!(self, StoredExportedStoreCipher::Cipher(..))
}
}
impl From<Option<ExportedStoreCipher>> for StoredExportedStoreCipher {
fn from(value: Option<ExportedStoreCipher>) -> Self {
match value {
None => StoredExportedStoreCipher::NoEncryption,
Some(exported) => StoredExportedStoreCipher::Cipher(exported),
}
}
}