From afa8eb79b3cee865ffb3d740c293baaf8340e5a1 Mon Sep 17 00:00:00 2001 From: Ty Date: Mon, 8 Jul 2024 16:15:44 -0400 Subject: [PATCH] Refactor the binary into a workspace crate, and document all of the crates in README.md --- Cargo.lock | 2 +- Cargo.toml | 46 +------------------ README.md | 16 ++++++- crates/aspm/Cargo.toml | 44 ++++++++++++++++++ .../aspm/src}/commands/aspe/create.rs | 0 {src => crates/aspm/src}/commands/aspe/mod.rs | 0 .../aspm/src}/commands/keys/delete.rs | 0 .../aspm/src}/commands/keys/export.rs | 0 .../aspm/src}/commands/keys/generate.rs | 0 .../aspm/src}/commands/keys/import.rs | 0 .../aspm/src}/commands/keys/list.rs | 0 {src => crates/aspm/src}/commands/keys/mod.rs | 0 {src => crates/aspm/src}/commands/mod.rs | 0 .../aspm/src}/commands/profiles/create.rs | 0 .../aspm/src}/commands/profiles/delete.rs | 0 .../aspm/src}/commands/profiles/edit.rs | 0 .../aspm/src}/commands/profiles/export.rs | 0 .../aspm/src}/commands/profiles/import.rs | 0 .../aspm/src}/commands/profiles/list.rs | 0 .../aspm/src}/commands/profiles/mod.rs | 0 {src => crates/aspm/src}/entities/claims.rs | 0 {src => crates/aspm/src}/entities/keys.rs | 0 {src => crates/aspm/src}/entities/mod.rs | 0 {src => crates/aspm/src}/entities/prelude.rs | 0 {src => crates/aspm/src}/entities/profiles.rs | 0 {src => crates/aspm/src}/main.rs | 0 {src => crates/aspm/src}/utils.rs | 0 {tests => crates/aspm/tests}/cli.rs | 0 28 files changed, 61 insertions(+), 47 deletions(-) create mode 100644 crates/aspm/Cargo.toml rename {src => crates/aspm/src}/commands/aspe/create.rs (100%) rename {src => crates/aspm/src}/commands/aspe/mod.rs (100%) rename {src => crates/aspm/src}/commands/keys/delete.rs (100%) rename {src => crates/aspm/src}/commands/keys/export.rs (100%) rename {src => crates/aspm/src}/commands/keys/generate.rs (100%) rename {src => crates/aspm/src}/commands/keys/import.rs (100%) rename {src => crates/aspm/src}/commands/keys/list.rs (100%) rename {src => crates/aspm/src}/commands/keys/mod.rs (100%) rename {src => crates/aspm/src}/commands/mod.rs (100%) rename {src => crates/aspm/src}/commands/profiles/create.rs (100%) rename {src => crates/aspm/src}/commands/profiles/delete.rs (100%) rename {src => crates/aspm/src}/commands/profiles/edit.rs (100%) rename {src => crates/aspm/src}/commands/profiles/export.rs (100%) rename {src => crates/aspm/src}/commands/profiles/import.rs (100%) rename {src => crates/aspm/src}/commands/profiles/list.rs (100%) rename {src => crates/aspm/src}/commands/profiles/mod.rs (100%) rename {src => crates/aspm/src}/entities/claims.rs (100%) rename {src => crates/aspm/src}/entities/keys.rs (100%) rename {src => crates/aspm/src}/entities/mod.rs (100%) rename {src => crates/aspm/src}/entities/prelude.rs (100%) rename {src => crates/aspm/src}/entities/profiles.rs (100%) rename {src => crates/aspm/src}/main.rs (100%) rename {src => crates/aspm/src}/utils.rs (100%) rename {tests => crates/aspm/tests}/cli.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index a788fc1..73c2ac2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -226,7 +226,7 @@ dependencies = [ ] [[package]] -name = "aspm" +name = "aspm-cli" version = "0.1.0" dependencies = [ "aes-gcm", diff --git a/Cargo.toml b/Cargo.toml index 4ca2e85..f26d23c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,52 +1,10 @@ -[package] -name = "aspm" -authors = ["Ty"] -description = "A tool to manage ariadne signature profiles, implementing v0 of the specification" -repository = "https://codeberg.org/tyy/aspm" -version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - [workspace] members = ["crates/*"] - -[dependencies] -anyhow = "1.0.86" -app_dirs2 = "2.5.5" -clap = { version = "4.5.8", features = ["derive", "unstable-styles", "env"] } -thiserror = "1.0.61" -asp = { path = "crates/asp" } -indoc = "2.0.5" -anstyle = "1.0.7" -dialoguer = { version = "0.11.0", features = ["password"] } -argon2 = { version = "0.5.3", features = ["std"] } -data-encoding = "2.6.0" -sea-orm = { version = "0.12.15", features = ["sqlx-sqlite", "runtime-tokio-rustls"] } -async-trait = "0.1.81" -tokio = "1.38.0" -clap-stdin = "0.5.0" -gpgme = { version = "0.11.0", optional = true } -sequoia-openpgp = { version = "1.21.1", optional = true } -josekit = { version = "0.8.6" } -aes-gcm = "0.10.3" -migrations = { path = "crates/migrations" } -scrypt = "0.11.0" -serde = { version = "1.0.204", features = ["derive"] } -serde_json = "1.0.120" - -[dev-dependencies] -assert_cmd = "2.0.14" -predicates = "3.1.0" -tempfile = "3.10.1" - -[features] -gpg-compat = ["dep:gpgme", "dep:sequoia-openpgp"] -default = ["gpg-compat"] +resolver = "2" [profile.release] strip = true opt-level = "z" lto = true codegen-units = 1 -panic = "abort" +panic = "abort" \ No newline at end of file diff --git a/README.md b/README.md index 671625b..d17312d 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,17 @@ # aspm -This is the **A**riadne **S**ignature **P**rofile **M**anager, a command line program and rust library implementing the [Ariadne Signature Profile specification v0](https://ariadne.id/related/ariadne-signature-profile-0/). Currently, it is updated to the latest version of the spec as of [ariadne/ariadne-identity-specification@92f280bf83](https://codeberg.org/ariadne/ariadne-identity-specification/commit/92f280bf83e2d5957e5a53a6f1b6974bc975517d). +This is the **A**riadne **S**ignature **P**rofile **M**anager, a command line program and rust library implementing the [Ariadne Signature Profile specification v0](https://ariadne.id/related/ariadne-signature-profile-0/). Currently, it is updated to the latest version of the spec as of [ariadne/ariadne-identity-specification@92f280bf83](https://codeberg.org/ariadne/ariadne-identity-specification/commit/92f280bf83e2d5957e5a53a6f1b6974bc975517d). This is setup as a cargo workspace with multiple crates, which are all explained below -The command line program is located in `src/`, and the library it uses to do ASP-related things (like creating and signing profiles, or generating keys) is located in `crates/asp`. \ No newline at end of file +# Crates + +## aspm + +The main binary crate, featuring all user-facing CLI code. This crate does not contain any actual ASP logic, but rather utilizes the `asp` crate for operations such as generating keys, signing profiles, etc. + +## asp + +The main libary crate, which provides APIs for interfacing with ASP keys, profiles, and exchange servers. This is mainly used by the `aspm` CLI crate, however it could hypothetically be used by other projects (or even a future GUI!) + +## migrations + +A crate which soley contains database migrations for the `aspm` CLI crate. It contains both a library interface and a binary which can be used to manipulate existing databases. \ No newline at end of file diff --git a/crates/aspm/Cargo.toml b/crates/aspm/Cargo.toml new file mode 100644 index 0000000..2eb1420 --- /dev/null +++ b/crates/aspm/Cargo.toml @@ -0,0 +1,44 @@ +[package] +name = "aspm-cli" +authors = ["Ty"] +description = "A tool to manage ariadne signature profiles, implementing v0 of the specification" +repository = "https://codeberg.org/tyy/aspm" +version = "0.1.0" +edition = "2021" + +[[bin]] +name = "aspm" +path = "src/main.rs" + +[dependencies] +anyhow = "1.0.86" +app_dirs2 = "2.5.5" +clap = { version = "4.5.8", features = ["derive", "unstable-styles", "env"] } +thiserror = "1.0.61" +asp = { path = "../asp" } +indoc = "2.0.5" +anstyle = "1.0.7" +dialoguer = { version = "0.11.0", features = ["password"] } +argon2 = { version = "0.5.3", features = ["std"] } +data-encoding = "2.6.0" +sea-orm = { version = "0.12.15", features = ["sqlx-sqlite", "runtime-tokio-rustls"] } +async-trait = "0.1.81" +tokio = "1.38.0" +clap-stdin = "0.5.0" +gpgme = { version = "0.11.0", optional = true } +sequoia-openpgp = { version = "1.21.1", optional = true } +josekit = { version = "0.8.6" } +aes-gcm = "0.10.3" +migrations = { path = "../migrations" } +scrypt = "0.11.0" +serde = { version = "1.0.204", features = ["derive"] } +serde_json = "1.0.120" + +[dev-dependencies] +assert_cmd = "2.0.14" +predicates = "3.1.0" +tempfile = "3.10.1" + +[features] +gpg-compat = ["dep:gpgme", "dep:sequoia-openpgp"] +default = ["gpg-compat"] diff --git a/src/commands/aspe/create.rs b/crates/aspm/src/commands/aspe/create.rs similarity index 100% rename from src/commands/aspe/create.rs rename to crates/aspm/src/commands/aspe/create.rs diff --git a/src/commands/aspe/mod.rs b/crates/aspm/src/commands/aspe/mod.rs similarity index 100% rename from src/commands/aspe/mod.rs rename to crates/aspm/src/commands/aspe/mod.rs diff --git a/src/commands/keys/delete.rs b/crates/aspm/src/commands/keys/delete.rs similarity index 100% rename from src/commands/keys/delete.rs rename to crates/aspm/src/commands/keys/delete.rs diff --git a/src/commands/keys/export.rs b/crates/aspm/src/commands/keys/export.rs similarity index 100% rename from src/commands/keys/export.rs rename to crates/aspm/src/commands/keys/export.rs diff --git a/src/commands/keys/generate.rs b/crates/aspm/src/commands/keys/generate.rs similarity index 100% rename from src/commands/keys/generate.rs rename to crates/aspm/src/commands/keys/generate.rs diff --git a/src/commands/keys/import.rs b/crates/aspm/src/commands/keys/import.rs similarity index 100% rename from src/commands/keys/import.rs rename to crates/aspm/src/commands/keys/import.rs diff --git a/src/commands/keys/list.rs b/crates/aspm/src/commands/keys/list.rs similarity index 100% rename from src/commands/keys/list.rs rename to crates/aspm/src/commands/keys/list.rs diff --git a/src/commands/keys/mod.rs b/crates/aspm/src/commands/keys/mod.rs similarity index 100% rename from src/commands/keys/mod.rs rename to crates/aspm/src/commands/keys/mod.rs diff --git a/src/commands/mod.rs b/crates/aspm/src/commands/mod.rs similarity index 100% rename from src/commands/mod.rs rename to crates/aspm/src/commands/mod.rs diff --git a/src/commands/profiles/create.rs b/crates/aspm/src/commands/profiles/create.rs similarity index 100% rename from src/commands/profiles/create.rs rename to crates/aspm/src/commands/profiles/create.rs diff --git a/src/commands/profiles/delete.rs b/crates/aspm/src/commands/profiles/delete.rs similarity index 100% rename from src/commands/profiles/delete.rs rename to crates/aspm/src/commands/profiles/delete.rs diff --git a/src/commands/profiles/edit.rs b/crates/aspm/src/commands/profiles/edit.rs similarity index 100% rename from src/commands/profiles/edit.rs rename to crates/aspm/src/commands/profiles/edit.rs diff --git a/src/commands/profiles/export.rs b/crates/aspm/src/commands/profiles/export.rs similarity index 100% rename from src/commands/profiles/export.rs rename to crates/aspm/src/commands/profiles/export.rs diff --git a/src/commands/profiles/import.rs b/crates/aspm/src/commands/profiles/import.rs similarity index 100% rename from src/commands/profiles/import.rs rename to crates/aspm/src/commands/profiles/import.rs diff --git a/src/commands/profiles/list.rs b/crates/aspm/src/commands/profiles/list.rs similarity index 100% rename from src/commands/profiles/list.rs rename to crates/aspm/src/commands/profiles/list.rs diff --git a/src/commands/profiles/mod.rs b/crates/aspm/src/commands/profiles/mod.rs similarity index 100% rename from src/commands/profiles/mod.rs rename to crates/aspm/src/commands/profiles/mod.rs diff --git a/src/entities/claims.rs b/crates/aspm/src/entities/claims.rs similarity index 100% rename from src/entities/claims.rs rename to crates/aspm/src/entities/claims.rs diff --git a/src/entities/keys.rs b/crates/aspm/src/entities/keys.rs similarity index 100% rename from src/entities/keys.rs rename to crates/aspm/src/entities/keys.rs diff --git a/src/entities/mod.rs b/crates/aspm/src/entities/mod.rs similarity index 100% rename from src/entities/mod.rs rename to crates/aspm/src/entities/mod.rs diff --git a/src/entities/prelude.rs b/crates/aspm/src/entities/prelude.rs similarity index 100% rename from src/entities/prelude.rs rename to crates/aspm/src/entities/prelude.rs diff --git a/src/entities/profiles.rs b/crates/aspm/src/entities/profiles.rs similarity index 100% rename from src/entities/profiles.rs rename to crates/aspm/src/entities/profiles.rs diff --git a/src/main.rs b/crates/aspm/src/main.rs similarity index 100% rename from src/main.rs rename to crates/aspm/src/main.rs diff --git a/src/utils.rs b/crates/aspm/src/utils.rs similarity index 100% rename from src/utils.rs rename to crates/aspm/src/utils.rs diff --git a/tests/cli.rs b/crates/aspm/tests/cli.rs similarity index 100% rename from tests/cli.rs rename to crates/aspm/tests/cli.rs