use self::authentication::Authentication;
pub mod authentication;
pub mod backends;
pub mod storage;
#[derive(thiserror::Error, Debug)]
pub enum AuthenticationStorageError {
#[error("FileStorageError")]
FileStorageError(#[from] crate::authentication_storage::backends::file::FileStorageError),
#[error("KeyringStorageError")]
KeyringStorageError(
#[from] crate::authentication_storage::backends::keyring::KeyringAuthenticationStorageError,
),
#[error("NetRcStorageError")]
NetRcStorageError(#[from] crate::authentication_storage::backends::netrc::NetRcStorageError),
#[error("MemoryStorageError")]
MemoryStorageError(#[from] crate::authentication_storage::backends::memory::MemoryStorageError),
}
pub trait StorageBackend: std::fmt::Debug {
fn store(
&self,
host: &str,
authentication: &Authentication,
) -> Result<(), AuthenticationStorageError>;
fn get(&self, host: &str) -> Result<Option<Authentication>, AuthenticationStorageError>;
fn delete(&self, host: &str) -> Result<(), AuthenticationStorageError>;
}