mirror of
https://codeberg.org/tyy/aspm
synced 2024-12-23 09:29:29 -07:00
Compare commits
2 commits
cf6bbfeecf
...
afa8eb79b3
Author | SHA1 | Date | |
---|---|---|---|
afa8eb79b3 | |||
47b1753390 |
30 changed files with 1210 additions and 628 deletions
1670
Cargo.lock
generated
1670
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
41
Cargo.toml
41
Cargo.toml
|
@ -1,47 +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.79"
|
||||
app_dirs2 = "2.5.5"
|
||||
clap = { version = "4.4.18", features = ["derive", "unstable-styles", "env"] }
|
||||
thiserror = "1.0.56"
|
||||
asp = { path = "crates/asp" }
|
||||
indoc = "2.0.4"
|
||||
anstyle = "1.0.4"
|
||||
dialoguer = { version = "0.11.0", features = ["password"] }
|
||||
argon2 = { version = "0.5.3", features = ["std"] }
|
||||
data-encoding = "2.5.0"
|
||||
sea-orm = { version = "0.12.12", features = ["sqlx-sqlite", "runtime-tokio-rustls"] }
|
||||
async-trait = "0.1.77"
|
||||
tokio = "1.35.1"
|
||||
clap-stdin = "0.4.0"
|
||||
gpgme = { version = "0.11.0", optional = true }
|
||||
sequoia-openpgp = { version = "1.18.0", optional = true }
|
||||
josekit = { version = "0.8.5" }
|
||||
aes-gcm = "0.10.3"
|
||||
migrations = { path = "crates/migrations" }
|
||||
scrypt = "0.11.0"
|
||||
serde = { version = "1.0.197", features = ["derive"] }
|
||||
serde_json = "1.0.114"
|
||||
|
||||
[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"
|
16
README.md
16
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`.
|
||||
# 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.
|
|
@ -7,16 +7,16 @@ edition = "2021"
|
|||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1.0.71"
|
||||
data-encoding = "2.4.0"
|
||||
hex_color = { version = "2.0.0", features = ["serde"] }
|
||||
josekit = "0.8.3"
|
||||
openssl = "0.10.55"
|
||||
reqwest = "0.11.18"
|
||||
serde = { version = "1.0.164", features = ["derive"] }
|
||||
serde-email = "2.0.0"
|
||||
serde_json = { version = "1.0.99", features = ["preserve_order"] }
|
||||
sha2 = "0.10.7"
|
||||
thiserror = "1.0.40"
|
||||
tokio = { version = "1.28.2", features = ["macros", "rt-multi-thread"] }
|
||||
url = { version = "2.4.0", features = ["serde"] }
|
||||
anyhow = "1.0.86"
|
||||
data-encoding = "2.6.0"
|
||||
hex_color = { version = "3.0.0", features = ["serde"] }
|
||||
josekit = "0.8.6"
|
||||
openssl = "0.10.64"
|
||||
reqwest = "0.12.5"
|
||||
serde = { version = "1.0.204", features = ["derive"] }
|
||||
serde-email = "3.0.1"
|
||||
serde_json = { version = "1.0.120", features = ["preserve_order"] }
|
||||
sha2 = "0.10.8"
|
||||
thiserror = "1.0.61"
|
||||
tokio = { version = "1.38.0", features = ["macros", "rt-multi-thread"] }
|
||||
url = { version = "2.5.2", features = ["serde"] }
|
||||
|
|
44
crates/aspm/Cargo.toml
Normal file
44
crates/aspm/Cargo.toml
Normal file
|
@ -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"]
|
|
@ -130,7 +130,7 @@ impl AspmSubcommand for ProfilesCreateCommand {
|
|||
avatar_url: ActiveValue::Set(
|
||||
profile.avatar_url.map(|avatar_url| avatar_url.to_string()),
|
||||
),
|
||||
color: ActiveValue::Set(profile.color.map(|color| color.to_string())),
|
||||
color: ActiveValue::Set(profile.color.map(|color| color.display_rgb().to_string())),
|
||||
key: ActiveValue::Set(keys[key_index].fingerprint.clone()),
|
||||
})
|
||||
.exec(&state.db)
|
|
@ -76,7 +76,7 @@ impl AspmSubcommand for ProfilesImportCommand {
|
|||
.into_active_value(),
|
||||
color: profile
|
||||
.color
|
||||
.map(|color| color.to_string())
|
||||
.map(|color| color.display_rgb().to_string())
|
||||
.into_active_value(),
|
||||
})
|
||||
.exec(&txn)
|
33
crates/aspm/tests/cli.rs
Normal file
33
crates/aspm/tests/cli.rs
Normal file
|
@ -0,0 +1,33 @@
|
|||
use anyhow::Context;
|
||||
use assert_cmd::prelude::*;
|
||||
use predicates::prelude::*;
|
||||
use tempfile::TempDir;
|
||||
use std::process::Command;
|
||||
|
||||
#[test]
|
||||
fn help_prints_correctly() -> Result<(), anyhow::Error> {
|
||||
let tempdir = TempDir::new()?;
|
||||
let datadir = tempdir.path().to_str().context("Tempdir path was not valid utf8")?;
|
||||
|
||||
Command::cargo_bin("aspm")?
|
||||
.env("ASPM_DATA_DIR", datadir)
|
||||
.arg("--help")
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(predicate::str::starts_with(env!("CARGO_PKG_DESCRIPTION")));
|
||||
|
||||
Command::cargo_bin("aspm")?
|
||||
.env("ASPM_DATA_DIR", datadir)
|
||||
.arg("-h")
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(predicate::str::starts_with(env!("CARGO_PKG_DESCRIPTION")));
|
||||
|
||||
Command::cargo_bin("aspm")?
|
||||
.env("ASPM_DATA_DIR", datadir)
|
||||
.assert()
|
||||
.code(2)
|
||||
.stderr(predicate::str::starts_with(env!("CARGO_PKG_DESCRIPTION")));
|
||||
|
||||
Ok(())
|
||||
}
|
|
@ -6,5 +6,5 @@ edition = "2021"
|
|||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
sea-orm-migration = { version = "0.12.14", features = ["sqlx-sqlite", "runtime-tokio-rustls"] }
|
||||
tokio = { version = "1.36.0", features = ["rt-multi-thread", "macros"] }
|
||||
sea-orm-migration = { version = "0.12.15", features = ["sqlx-sqlite", "runtime-tokio-rustls"] }
|
||||
tokio = { version = "1.38.0", features = ["rt-multi-thread", "macros"] }
|
||||
|
|
Loading…
Reference in a new issue