Skip to content

Commit

Permalink
feat: add defatul_did_method
Browse files Browse the repository at this point in the history
  • Loading branch information
nanderstabel committed Apr 19, 2024
1 parent 6a79666 commit ade49f2
Show file tree
Hide file tree
Showing 21 changed files with 280 additions and 104 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
84 changes: 71 additions & 13 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 = "54959ac" }
siopv2 = { git = "https://git@github.com/impierce/openid4vc.git", rev = "13f24f5" }
oid4vci = { git = "https://git@github.com/impierce/openid4vc.git", rev = "13f24f5" }
oid4vc-core = { git = "https://git@github.com/impierce/openid4vc.git", rev = "13f24f5" }
oid4vc-manager = { git = "https://git@github.com/impierce/openid4vc.git", rev = "13f24f5" }
did_manager = { git = "https://git@github.com/impierce/did-manager.git", rev = "bbc06826" }
siopv2 = { git = "https://git@github.com/impierce/openid4vc.git", rev = "6b078e2" }
oid4vci = { git = "https://git@github.com/impierce/openid4vc.git", rev = "6b078e2" }
oid4vc-core = { git = "https://git@github.com/impierce/openid4vc.git", rev = "6b078e2" }
oid4vc-manager = { git = "https://git@github.com/impierce/openid4vc.git", rev = "6b078e2" }

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
8 changes: 6 additions & 2 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
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
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ mod tests {
credential_issuer: BASE_URL.clone(),
credential_endpoint: BASE_URL.append_path_segment("openid4vci/credential"),
credential_configurations_supported: vec![(
"temp".to_string(),
"badge".to_string(),
CredentialConfigurationsSupportedObject {
credential_format: CredentialFormats::JwtVcJson(Parameters {
parameters: (
Expand Down Expand Up @@ -110,8 +110,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
8 changes: 6 additions & 2 deletions agent_api_rest/src/issuance/credentials.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ pub mod tests {
tests::{BASE_URL, SUBJECT_ID},
};
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 @@ -197,8 +198,11 @@ pub mod tests {
#[tokio::test]
async fn test_credentials_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
8 changes: 7 additions & 1 deletion agent_api_rest/src/issuance/offers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,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 @@ -134,7 +135,12 @@ pub mod tests {
#[tokio::test]
async fn test_offers_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;

Expand Down
Loading

0 comments on commit ade49f2

Please sign in to comment.