diff --git a/Cargo.toml b/Cargo.toml index fa02fc0..288cf11 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,29 +1,10 @@ -[package] +[workspace] +resolver = "2" +members = [ + "server", + "cli" +] + +[workspace.package] name = "bin" version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -tokio = { version = "1.33", features = ["full"] } -tokio-util = { version="0.7", features = ["io"]} -futures-util = "0.3" -axum = {version="0.6", features=["macros", "headers", "multipart"]} -serde = "1.0" -toml = "0.8" -duration-str = "0.7.0" -render = { git="https://github.com/render-rs/render.rs" } -thiserror = "1.0" -rand = "0.8" -dotenvy = "0.15" -markdown = "0.3" -axum_oidc = {git="https://git2.zettoit.eu/pfz4/axum_oidc"} -log = "0.4" -env_logger = "0.10" - -chacha20 = "0.9" -sha3 = "0.10" -hex = "0.4" -bytes = "1.5" -pin-project-lite = "0.2" diff --git a/cli/Cargo.toml b/cli/Cargo.toml new file mode 100644 index 0000000..4cd7e0a --- /dev/null +++ b/cli/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "binctl" +edition = "2021" +version.workspace = true + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +clap = { version="4.4", features = ["derive"] } +reqwest = { version="0.11", features = ["rustls-tls", "stream"], default-features=false} +openidconnect = "3.4" +thiserror = "1.0" +confy = "0.5" +serde = { version="1.0", features = [ "derive" ] } diff --git a/cli/src/main.rs b/cli/src/main.rs new file mode 100644 index 0000000..1fa186f --- /dev/null +++ b/cli/src/main.rs @@ -0,0 +1,57 @@ +use std::path::PathBuf; + +use clap::{Parser, Subcommand}; +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Serialize, Deserialize)] +pub struct Config { + server: String, + client_id: String, + client_secret: String, + claims: Vec, + challenge_port: u32, +} + +#[derive(Debug, Parser)] +pub struct Args { + #[arg(short, long, value_name = "FILE")] + config: Option, + + #[command(subcommand)] + command: Option, +} + +#[derive(Debug, Subcommand)] +pub enum Command { + Create { + #[arg(short, long, action)] + stdin: bool, + }, + Upload {}, + Login { + /// challenge port to listen to + #[arg(short, long, value_name = "PORT")] + port: Option, + + /// OIDC server + #[arg(long, value_name = "URL")] + server: Option, + + /// OIDC client id + #[arg(long)] + client: Option, + + /// OIDC client secret + #[arg(long)] + secret: Option, + + /// OIDC claims + #[arg(long)] + claims: Option>, + }, +} + +fn main() { + let args = Args::parse(); + dbg!(args); +} diff --git a/server/Cargo.toml b/server/Cargo.toml new file mode 100644 index 0000000..e6a3181 --- /dev/null +++ b/server/Cargo.toml @@ -0,0 +1,28 @@ +[package] +name = "bin" +version.workspace = true +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +tokio = { version = "1.33", features = ["full"] } +tokio-util = { version="0.7", features = ["io"]} +futures-util = "0.3" +axum = {version="0.6", features=["macros", "headers", "multipart"]} +serde = "1.0" +toml = "0.8" +render = { git="https://github.com/render-rs/render.rs" } +thiserror = "1.0" +rand = "0.8" +dotenvy = "0.15" +markdown = "0.3" +axum_oidc = {git="https://git2.zettoit.eu/pfz4/axum_oidc"} +log = "0.4" +env_logger = "0.10" + +chacha20 = "0.9" +sha3 = "0.10" +hex = "0.4" +bytes = "1.5" +pin-project-lite = "0.2" diff --git a/src/error.rs b/server/src/error.rs similarity index 100% rename from src/error.rs rename to server/src/error.rs diff --git a/src/garbage_collector.rs b/server/src/garbage_collector.rs similarity index 100% rename from src/garbage_collector.rs rename to server/src/garbage_collector.rs diff --git a/src/item_explanation.md b/server/src/item_explanation.md similarity index 100% rename from src/item_explanation.md rename to server/src/item_explanation.md diff --git a/src/main.rs b/server/src/main.rs similarity index 100% rename from src/main.rs rename to server/src/main.rs diff --git a/src/metadata.rs b/server/src/metadata.rs similarity index 100% rename from src/metadata.rs rename to server/src/metadata.rs diff --git a/src/util.rs b/server/src/util.rs similarity index 100% rename from src/util.rs rename to server/src/util.rs diff --git a/src/web_util.rs b/server/src/web_util.rs similarity index 100% rename from src/web_util.rs rename to server/src/web_util.rs