taskwarrior/taskchampion/src/server/mod.rs
Dustin J. Mitchell a8d45c67c6 Encrypt content sent to the server
This implements client-side encryption, so that users' task information
is not availble to the server (or to anyone who does not have the
`encryption_secret`).
2020-12-27 18:51:41 +00:00

25 lines
629 B
Rust

use crate::ServerConfig;
use failure::Fallible;
#[cfg(test)]
pub(crate) mod test;
mod local;
mod remote;
mod types;
pub use local::LocalServer;
pub use remote::RemoteServer;
pub use types::*;
/// Create a new server based on the given configuration.
pub fn from_config(config: ServerConfig) -> Fallible<Box<dyn Server>> {
Ok(match config {
ServerConfig::Local { server_dir } => Box::new(LocalServer::new(server_dir)?),
ServerConfig::Remote {
origin,
client_id,
encryption_secret,
} => Box::new(RemoteServer::new(origin, client_id, encryption_secret)),
})
}