Skip to content

Commit

Permalink
chore: bump oid4vc and did_manager dependencies (#44)
Browse files Browse the repository at this point in the history
* WIP

* WIP

* feat: re-introduce generics

* WIP

* feat: introduce `AppState`

* style: rename `ApplicationState` and `AppState`

* feat: add `Domain` trait

* WIP

* WIP

* style: remove unused code

* fix: fix some `unwrap`s, clean code

* refactor: simplify agent_store

* feat: add `CommandHandlers` struct

* style: fix clippy warnings

* refactor: simplify Commands

* style: change name

* chore: add log messages

* fix: only update view when `CredentialOfferCreated`

* chore: add comments and logging

* refactor: separate queries

* fix: several fixes

* test: update postman collection

* fix: set `oid4vc` dependencies to specific `rev`

* chore: set `rust-version` and use `workspace.package` settings

* feat: add `GET` method for `credentials` endpoint

* test: add `GET` method for `credentials` endpoint in postman collection

This includes a test for the `POST` method for the `credentials`
endpoint that updates the `CREDENTIAL_LOCATION` environment variable

* chore: add `/v1/credentials/{credential_id}` to `openapi.yaml` file

* chore: bump `axum` dependency to `0.7`

* chore: update `axum` related code to version `0.7`

* feat: add `log_error_response` macro for cleaner logging of error responses

* chore: update POST request to a valid OBv3 `credentialSubject`

* chore: use `TraceLayer` for proper tracing in `agent_api_rest`

* `on_request` makes sure that each request is traced
* `on_response` makes sure that each response is traced
* `on_body_chunk` makes sure that each response body is traced

`TraceLayer` only accepts `Request<axum::body::Body` which is not `Serialize`,
therefore, we still need to explicitly trace the request body in each route.

* fix: remove obsolete `log_error_response` macro

The `log_error_response` macro is replaced by the `TraceLayer`.`

* refactor: use `if` + `is_err()` rather than `match` for `command_handler` useage

* feat: add `NOT_FOUND` response option

* fix: set tokio version to `1`

* feat: initialize module

* WIP

* refactor: move `ApplicationState` to `agent_shared`

* feat: add `agent_verification`

* style: rename `AuthorizationRequestTestFramework` to `ConnectionTestFramework`

* feat: add `VerificationState` to `ApplicationState`

* chore: add `Cargo.lock` file

* feat: add verification endpoints

* 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.

* feat: add `VerificationState` to `ApplicationState`

* feat: add `authorization_request` and `connection` tables to `init.sql`

* feat: add `EventPublisherHttp`

* feat: add `OutboundAdapter` trait

* test: add default parameters to tests  in `agent_api_rest`

* feat: make `EventPublisherHttp` support all different aggregates

* test: adjust test for `EventPublisherHttp`

* feat: add `EventPublisherHttp` to `agent_application`

* test: fix `Mutex`

* chore: remove unused environment variables from `.env.example`

* fix: rename aggregate event publishers

* test: improve tests for Verification in  `agent_api_rest`

* fix: rename siopv2 endpoints, add `path`

* feat: move `client_metadata` to `VerificationServices`

* docs: add `README.md` file for `agent_event_publisher`, remove `config.yaml`

* fix: default to empty `EventPublisherHttp` when `config.yml` does not exist

* fix: use `client_id` for the `connection_id`

* fix: return `text/plain` instead of `application/json`

* fix: add `InvalidSIOPv2AuthorizationResponse` error

* docs: add comments to Verification endpoints

* fix: fix the path to the `config.yml` file

* test: fix test

* feat: enable `agent_event_publisher_http` in docker environment

* docs: add documentation for `SecretManager` and `EventPublisherHttp`

* style: use `pub type`s for adapters

* feat: change content-type to application/json

* style: replace closure for enum variant

* fix: change `authorization_requests` endpoints response content-type to `text/plain`

* docs: add verification related endpoints to `openapi.yml`

* style: rename `OutboundAdapter` to `EventPublisher`

* docs: specify that the default Stronghold option is temporary

* refactor: move `secret_manager` function to `agent_secret_manager`

* feat: add `get_authorization_requests` endpoint

* docs: fix example link

* fix: fix `SecretManager` import

* chore: update `did-manager` and `oid4vc` dependencies

* fix: reset `format-lint-test` workflow

* test: add verification endpoints to Postman collection

* WIP

* feat: add `default_did_method`

* style: remove unnecessary `let` binding

* chore: update `did_manager` dependency

* chore: update `did_manager` dependency

* chore: bump `rustls`

---------

Co-authored-by: Daniel Mader <daniel.mader@impierce.com>
  • Loading branch information
nanderstabel and daniel-mader authored Apr 24, 2024
1 parent bbf42d0 commit e858118
Show file tree
Hide file tree
Showing 28 changed files with 499 additions and 300 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ AGENT_SECRET_MANAGER_STRONGHOLD_PASSWORD="secure_password"
AGENT_SECRET_MANAGER_ISSUER_DID="did:key:z6Mkv5KkqNHuR6bPVT8fud3m9JaHBSEjEmiLp7HuGAwtbkk6"
AGENT_SECRET_MANAGER_ISSUER_FRAGMENT="key-0"
AGENT_SECRET_MANAGER_ISSUER_KEY_ID="9O66nzWqYYy1LmmiOudOlh2SMIaUWoTS"
AGENT_CONFIG_DEFAULT_DID_METHOD="did:key"
AGENT_STORE_DB_CONNECTION_STRING=postgresql://demo_user:demo_pass@localhost:5432/demo
85 changes: 66 additions & 19 deletions Cargo.lock

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

11 changes: 6 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,18 @@ edition = "2021"
rust-version = "1.76.0"

[workspace.dependencies]
did_manager = { git = "https://git@github.com/impierce/did-manager.git", rev = "2765aca" }
siopv2 = { git = "https://git@github.com/impierce/openid4vc.git", rev = "0c5526c" }
oid4vci = { git = "https://git@github.com/impierce/openid4vc.git", rev = "0c5526c" }
oid4vc-core = { git = "https://git@github.com/impierce/openid4vc.git", rev = "0c5526c" }
oid4vc-manager = { git = "https://git@github.com/impierce/openid4vc.git", rev = "0c5526c" }
did_manager = { git = "https://git@github.com/impierce/did-manager.git", rev = "11ce737" }
siopv2 = { git = "https://git@github.com/impierce/openid4vc.git", rev = "a932af7" }
oid4vci = { git = "https://git@github.com/impierce/openid4vc.git", rev = "a932af7" }
oid4vc-core = { git = "https://git@github.com/impierce/openid4vc.git", rev = "a932af7" }
oid4vc-manager = { git = "https://git@github.com/impierce/openid4vc.git", rev = "a932af7" }

async-trait = "0.1"
axum = { version = "0.7", features = ["tracing"] }
cqrs-es = "0.4.2"
futures = "0.3"
lazy_static = "1.4"
rstest = "0.19"
serde = { version = "1.0", default-features = false, features = ["derive"] }
serde_json = { version = "1.0" }
serde_with = "3.7"
Expand Down
9 changes: 6 additions & 3 deletions agent_api_rest/src/issuance/credential_issuer/credential.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ mod tests {

use super::*;
use agent_issuance::{startup_commands::startup_commands, state::initialize};
use agent_shared::config;
use agent_store::in_memory;
use agent_verification::services::test_utils::test_verification_services;
use axum::{
Expand All @@ -104,8 +105,11 @@ mod tests {
#[tracing_test::traced_test]
async fn test_credential_endpoint() {
let issuance_state = in_memory::issuance_state().await;
let verification_state = in_memory::verification_state(test_verification_services(), Default::default()).await;

let verification_state = in_memory::verification_state(
test_verification_services(&config!("default_did_method").unwrap_or("did:key".to_string())),
Default::default(),
)
.await;
initialize(&issuance_state, startup_commands(BASE_URL.clone())).await;

let mut app = app((issuance_state, verification_state));
Expand Down Expand Up @@ -159,7 +163,6 @@ mod tests {
assert_eq!(
body,
json!({
"format": "jwt_vc_json",
"credential": "eyJ0eXAiOiJKV1QiLCJhbGciOiJFZERTQSIsImtpZCI6ImRpZDprZXk6ejZNa2lp\
ZXlvTE1TVnNKQVp2N0pqZTV3V1NrREV5bVVna3lGOGtiY3JqWnBYM3FkI3o2TWtp\
aWV5b0xNU1ZzSkFadjdKamU1d1dTa0RFeW1VZ2t5RjhrYmNyalpwWDNxZCJ9.eyJ\
Expand Down
8 changes: 6 additions & 2 deletions agent_api_rest/src/issuance/credential_issuer/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ pub mod tests {

use super::*;
use agent_issuance::{startup_commands::startup_commands, state::initialize};
use agent_shared::config;
use agent_store::in_memory;
use agent_verification::services::test_utils::test_verification_services;
use axum::{
Expand Down Expand Up @@ -104,8 +105,11 @@ pub mod tests {
#[tokio::test]
async fn test_token_endpoint() {
let issuance_state = in_memory::issuance_state().await;
let verification_state = in_memory::verification_state(test_verification_services(), Default::default()).await;

let verification_state = in_memory::verification_state(
test_verification_services(&config!("default_did_method").unwrap_or("did:key".to_string())),
Default::default(),
)
.await;
initialize(&issuance_state, startup_commands(BASE_URL.clone())).await;

let mut app = app((issuance_state, verification_state));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ mod tests {

use super::*;
use agent_issuance::{startup_commands::startup_commands, state::initialize};
use agent_shared::config;
use agent_store::in_memory;
use agent_verification::services::test_utils::test_verification_services;
use axum::{
Expand Down Expand Up @@ -71,8 +72,11 @@ mod tests {
#[tokio::test]
async fn test_oauth_authorization_server_endpoint() {
let issuance_state = in_memory::issuance_state().await;
let verification_state = in_memory::verification_state(test_verification_services(), Default::default()).await;

let verification_state = in_memory::verification_state(
test_verification_services(&config!("default_did_method").unwrap_or("did:key".to_string())),
Default::default(),
)
.await;
initialize(&issuance_state, startup_commands(BASE_URL.clone())).await;

let mut app = app((issuance_state, verification_state));
Expand Down
Loading

0 comments on commit e858118

Please sign in to comment.