use crate::{
backend::WrappedKey,
error::Result,
};
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum RecoveryType {
Passphrase,
RecoveryKey,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BackupBundle {
pub recovery_type: RecoveryType,
pub data: Vec<u8>,
#[serde(skip_serializing_if = "Option::is_none")]
pub user_secret: Option<Vec<u8>>,
}
pub trait RecoveryStrategy: Send + Sync {
fn backup(&self, key: &WrappedKey, secret: Option<&[u8]>) -> Result<BackupBundle>;
fn restore(&self, bundle: &BackupBundle, secret: &[u8]) -> Result<WrappedKey>;
fn recovery_type(&self) -> RecoveryType;
}