use std::sync::Arc;
use bytes::Bytes;
use thiserror::Error;
use url::Url;
use crate::misc::{DynErr, DynFut, DynFutRes};
#[derive(Debug, Error)]
pub enum FetchError {
#[error(transparent)]
Store(DynErr),
#[error(transparent)]
Fetch(Arc<DynErr>),
}
pub trait Store: Send + Sync + 'static {
fn fetch(&self, url: Url) -> DynFut<Result<Bytes, FetchError>>;
fn new_nonce(&self, email: String) -> DynFutRes<String>;
fn consume_nonce(&self, nonce: String, email: String) -> DynFutRes<bool>;
}
#[cfg(feature = "simple-store")]
mod simple;
#[cfg(feature = "simple-store")]
pub use simple::*;