Skip to content

Commit

Permalink
feat: add agent_verification (#35)
Browse files Browse the repository at this point in the history
* refactor: move `ApplicationState` to `agent_shared`

* feat: add `agent_verification`

* style: rename `AuthorizationRequestTestFramework` to `ConnectionTestFramework`

* refactor: remove `ApplicationState` struct and replace it for a tuple

* fix: remove `ConnectionNotificationSent`

Instead of using the `VerificationServices` for sending connection notifications
we will probably need to utilize a `Query` that will function as an
outgoing adapter.

* fix: set `AGENT_VERIFICATION_URL` env variable using `AGENT_APPLICATION_URL`

* fix: remove println statement

* fix: fix `event_type` for `SIOPv2AuthorizationResponseVerified`
  • Loading branch information
nanderstabel authored Mar 22, 2024
1 parent 7fb19fa commit a5b723e
Show file tree
Hide file tree
Showing 23 changed files with 757 additions and 25 deletions.
142 changes: 118 additions & 24 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ members = [
"agent_secret_manager",
"agent_shared",
"agent_store",
"agent_verification",
]

[workspace.package]
Expand All @@ -16,13 +17,15 @@ rust-version = "1.76.0"

[workspace.dependencies]
did_manager = { git = "https://git@github.com/impierce/did-manager.git", rev = "60ba7c0" }
siopv2 = { git = "https://git@github.com/impierce/openid4vc.git", rev = "10a6bd7" }
oid4vci = { git = "https://git@github.com/impierce/openid4vc.git", rev = "10a6bd7" }
oid4vc-core = { git = "https://git@github.com/impierce/openid4vc.git", rev = "10a6bd7" }
oid4vc-manager = { git = "https://git@github.com/impierce/openid4vc.git", rev = "10a6bd7" }

async-trait = "0.1"
axum = { version = "0.7", features = ["tracing"] }
cqrs-es = "0.4.2"
futures = "0.3"
lazy_static = "1.4"
serde = { version = "1.0", default-features = false, features = ["derive"] }
serde_json = { version = "1.0" }
Expand Down
2 changes: 2 additions & 0 deletions agent_application/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ async fn main() {
};

let url = config!("url").expect("AGENT_APPLICATION_URL is not set");
// TODO: Temporary solution. In the future we need to read these kinds of values from a config file.
std::env::set_var("AGENT_VERIFICATION_URL", &url);

info!("Application url: {:?}", url);

Expand Down
3 changes: 2 additions & 1 deletion agent_shared/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ rust-version.workspace = true
[dependencies]
async-trait.workspace = true
axum.workspace = true
config = { version = "0.13" }
config = { version = "0.14" }
cqrs-es.workspace = true
did_manager.workspace = true
dotenvy = { version = "0.15" }
rand = "0.8"
time = { version = "0.3" }
Expand Down
3 changes: 3 additions & 0 deletions agent_shared/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ pub mod generic_query;
pub mod handlers;
pub mod url_utils;

#[cfg(feature = "test")]
pub mod secret_manager;

pub use ::config::ConfigError;
use rand::Rng;
pub use url_utils::UrlAppendHelpers;
Expand Down
14 changes: 14 additions & 0 deletions agent_shared/src/secret_manager.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use crate::config::config;
use did_manager::SecretManager;

pub async fn secret_manager() -> SecretManager {
let snapshot_path = config(std::env!("CARGO_PKG_NAME"))
.get_string("stronghold_path")
.unwrap();
let password = config(std::env!("CARGO_PKG_NAME"))
.get_string("stronghold_password")
.unwrap();
let key_id = config(std::env!("CARGO_PKG_NAME")).get_string("issuer_key_id").unwrap();

SecretManager::load(snapshot_path, password, key_id).await.unwrap()
}
3 changes: 3 additions & 0 deletions agent_shared/tests/.env.test
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ TEST_CREDENTIAL_LOGO_URL=https://my-domain.example.org/credential_logo.png
TEST_STRONGHOLD_PATH="../agent_secret_manager/tests/res/test.stronghold"
TEST_STRONGHOLD_PASSWORD="secure_password"
TEST_ISSUER_KEY_ID="9O66nzWqYYy1LmmiOudOlh2SMIaUWoTS"

# AGENT_VERIFICATION
TEST_URL=https://my-domain.example.org
31 changes: 31 additions & 0 deletions agent_verification/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[package]
name = "agent_verification"
version.workspace = true
edition.workspace = true
rust-version.workspace = true

[dependencies]
agent_shared = { path = "../agent_shared" }

async-trait.workspace = true
axum.workspace = true
cqrs-es.workspace = true
futures.workspace = true
oid4vc-core.workspace = true
oid4vc-manager.workspace = true
serde.workspace = true
siopv2.workspace = true
thiserror.workspace = true
tracing.workspace = true
url.workspace = true
tokio.workspace = true

[dev-dependencies]
agent_verification = { path = ".", features = ["test"] }
agent_shared = { path = "../agent_shared", features = ["test"] }
did_manager.workspace = true
lazy_static.workspace = true
serial_test = "3.0"

[features]
test = []
Loading

0 comments on commit a5b723e

Please sign in to comment.