From 31d28a85c13a60a5bb606ad81172945fe51c450b Mon Sep 17 00:00:00 2001 From: Hermann Core Date: Fri, 20 Jun 2025 13:01:51 +0100 Subject: [PATCH 01/25] feat: refactor DID document handling to use a centralized database repository --- crates/web-plugins/did-endpoint/Cargo.toml | 9 +- crates/web-plugins/did-endpoint/README.md | 28 ++- crates/web-plugins/did-endpoint/src/didgen.rs | 191 ++++++++---------- crates/web-plugins/did-endpoint/src/lib.rs | 5 +- .../did-endpoint/src/persistence.rs | 88 ++++++++ crates/web-plugins/did-endpoint/src/plugin.rs | 34 ++-- crates/web-plugins/did-endpoint/src/web.rs | 98 ++++----- 7 files changed, 242 insertions(+), 211 deletions(-) create mode 100644 crates/web-plugins/did-endpoint/src/persistence.rs diff --git a/crates/web-plugins/did-endpoint/Cargo.toml b/crates/web-plugins/did-endpoint/Cargo.toml index 5ce0b11c..d33ba9a1 100644 --- a/crates/web-plugins/did-endpoint/Cargo.toml +++ b/crates/web-plugins/did-endpoint/Cargo.toml @@ -13,12 +13,15 @@ edition = "2021" keystore.workspace = true plugin-api.workspace = true did-utils.workspace = true -filesystem.workspace = true +database.workspace = true +async-trait.workspace = true +bson.workspace = true cfg-if.workspace = true mongodb.workspace = true chrono.workspace = true thiserror.workspace = true +serde = { workspace = true, features = ["derive"] } serde_json.workspace = true dotenv-flow.workspace = true multibase.workspace = true @@ -32,6 +35,8 @@ axum = { workspace = true, features = ["macros"] } [dev-dependencies] mockall = "0.13.1" json-canon = "0.1.3" -filesystem = { workspace = true, features = ["test-utils"] } keystore = { workspace = true, features = ["test-utils"] } tower = { version = "0.5.2", features = ["util"] } + +[features] +test-utils = [] diff --git a/crates/web-plugins/did-endpoint/README.md b/crates/web-plugins/did-endpoint/README.md index f94e2f32..252032e5 100644 --- a/crates/web-plugins/did-endpoint/README.md +++ b/crates/web-plugins/did-endpoint/README.md @@ -12,24 +12,22 @@ The `did-endpoint` plugin crate provides a set of tools for generating and valid Here’s a simple example of how you can generate and validate a DID document: ```rust -use did_endpoint::{didgen, validate_diddoc}; -use filesystem::{FileSystem, StdFileSystem}; -use keystore::KeyStore; - -let storage_dirpath = std::env::var("STORAGE_DIRPATH").unwrap(), +use did_endpoint::{ + didgen, + persistence::DidDocumentRepository, +}; +use database::get_or_init_database; +use keystore::Keystore; + +// This requires MONGODB_URI and MONGODB_DATABASE environment variables to be set. +let db = get_or_init_database(); +let repository = DidDocumentRepository::from_db(&db); +let keystore = Keystore::with_mongodb(); let server_public_domain = std::env::var("SERVER_PUBLIC_DOMAIN").unwrap(); -let mut filesystem = filesystem::StdFileSystem; -let keystore = keystore::KeyStore::with_mongodb(); - // Generate and persist a new DID document -didgen::didgen( - storage_dirpath, - server_public_domain, - &keystore, - &mut filesystem, -)?; +didgen::didgen(&server_public_domain, &keystore, &repository)?; // Validate the integrity of the persisted DID document -didgen::validate_diddoc(storage_dirpath, &keystore, &mut filesystem)?; +didgen::validate_diddoc(&keystore, &repository)?; ``` diff --git a/crates/web-plugins/did-endpoint/src/didgen.rs b/crates/web-plugins/did-endpoint/src/didgen.rs index d2988d5d..65d998b0 100644 --- a/crates/web-plugins/did-endpoint/src/didgen.rs +++ b/crates/web-plugins/did-endpoint/src/didgen.rs @@ -1,17 +1,16 @@ +use crate::persistence::MediatorDidDocument; +use database::{Repository, RepositoryError}; use did_utils::{ crypto::{Ed25519KeyPair, Generate, PublicKeyFormat, ToMultikey, X25519KeyPair}, didcore::{Document, KeyFormat, Service, VerificationMethodType}, jwk::Jwk, methods::{DidPeer, Purpose, PurposedKey}, }; -use filesystem::FileSystem; use keystore::Keystore; +use mongodb::bson::doc; use serde_json::json; -use std::path::Path; use tokio::{runtime::Handle, task}; -use crate::util; - #[allow(dead_code)] #[derive(Debug, thiserror::Error)] pub enum Error { @@ -27,17 +26,18 @@ pub enum Error { PersistenceError, #[error("Generic: {0}")] Generic(String), + #[error(transparent)] + Repository(#[from] RepositoryError), } /// Generates keys and forward them for DID generation -pub fn didgen( - storage_dirpath: &Path, +pub fn didgen( server_public_domain: &str, keystore: &Keystore, - filesystem: &mut F, + repository: &R, ) -> Result where - F: FileSystem, + R: Repository + ?Sized, { // Generate keys for did:peer generation let (auth_keys, agreem_keys) = generate_keys()?; @@ -79,8 +79,8 @@ where store_key(auth_keys_jwk, &diddoc, &diddoc.authentication, keystore)?; store_key(agreem_keys_jwk, &diddoc, &diddoc.key_agreement, keystore)?; - // Serialize DID document and persist to filesystem - persist_did_document(storage_dirpath, &diddoc, filesystem)?; + // Persist the diddoc + persist_did_document(&diddoc, repository)?; tracing::info!("DID generation and persistence successful"); Ok(diddoc) @@ -113,7 +113,7 @@ fn store_key( VerificationMethodType::Reference(kid) => kid, VerificationMethodType::Embedded(method) => method.id, }; - let kid = util::handle_vm_id(&kid, diddoc); + let kid = crate::util::handle_vm_id(&kid, diddoc); // Store the secret in the keystore task::block_in_place(move || { @@ -128,63 +128,46 @@ fn store_key( Ok(()) } -fn persist_did_document( - storage_dirpath: &Path, - diddoc: &Document, - filesystem: &mut F, -) -> Result<(), Error> +fn persist_did_document(diddoc: &Document, repository: &R) -> Result<(), Error> where - F: FileSystem, + R: Repository + ?Sized, { - // Serialize DID document - let pretty_diddoc = serde_json::to_string_pretty(&diddoc).unwrap(); - - // Create directory and write the DID document - filesystem - .create_dir_all(storage_dirpath) - .map_err(|_| Error::PersistenceError)?; - filesystem - .write(&storage_dirpath.join("did.json"), &pretty_diddoc) - .map_err(|_| Error::PersistenceError)?; - + let doc = MediatorDidDocument { + id: None, + diddoc: diddoc.clone(), + }; + task::block_in_place(move || { + Handle::current().block_on(async move { repository.store(doc).await }) + })?; Ok(()) } /// Validates the integrity of the persisted diddoc -pub fn validate_diddoc( - storage_dirpath: &Path, - keystore: &Keystore, - filesystem: &mut F, -) -> Result<(), String> +pub fn validate_diddoc(keystore: &Keystore, repository: &R) -> Result<(), String> where - F: FileSystem, + R: Repository + ?Sized, { - cfg_if::cfg_if! { - if #[cfg(not(test))] { - // Validate that did.json exists - let didpath = storage_dirpath.join("did.json"); - if !didpath.exists() { - return Err(String::from("Missing did.json")); - }; - } - } + // Find from repository + let result = task::block_in_place(move || { + Handle::current().block_on(async move { repository.find_one_by(doc! {}).await }) + }); - // Load the DID document - let diddoc: Document = filesystem - .read_to_string(&storage_dirpath.join("did.json")) - .map_err(|_| String::from("Unreadable did.json")) - .and_then(|content| { - serde_json::from_str(&content).map_err(|_| String::from("Unparseable did.json")) - })?; + let diddoc_entity = result + .map_err(|e| e.to_string())? + .ok_or_else(|| "Missing did.json from repository".to_string())?; - // Validate the keys in the DID document + let diddoc: Document = serde_json::from_value(json!(diddoc_entity.diddoc)) + .map_err(|e| format!("Failed to deserialize DID document: {e}"))?; + + // Validate that verification methods are present if let Some(verification_methods) = &diddoc.verification_method { + // Validate that each key is present in the keystore for method in verification_methods { let pubkey = method .public_key .as_ref() .ok_or(String::from("Missing key"))?; - let kid = util::handle_vm_id(&method.id, &diddoc); + let kid = crate::util::handle_vm_id(&method.id, &diddoc); match pubkey { KeyFormat::Jwk(_) => validate_key(&kid, keystore)?, _ => return Err(String::from("Unsupported key format")), @@ -209,24 +192,7 @@ fn validate_key(kid: &str, keystore: &Keystore) -> Result<(), String> { #[cfg(test)] pub(crate) mod tests { use super::*; - use filesystem::FileSystem; - use mockall::{ - mock, - predicate::{self, *}, - }; - use std::io::Result as IoResult; - - // Mock the FileSystem trait - mock! { - pub FileSystem {} - impl FileSystem for FileSystem { - fn read_to_string(&self, path: &Path) -> IoResult; - fn write(&mut self, path: &Path, content: &str) -> IoResult<()>; - fn read_dir_files(&self, path: &Path) -> IoResult>; - fn create_dir_all(&mut self, path: &Path) -> IoResult<()>; - fn write_with_lock(&self, path: &Path, content: &str) -> IoResult<()>; - } - } + use crate::persistence::tests::MockDidDocumentRepository; pub(crate) fn setup() -> Jwk { serde_json::from_str( @@ -245,57 +211,58 @@ pub(crate) mod tests { #[tokio::test(flavor = "multi_thread")] async fn test_did_generation() { let kid = "did:peer:123#key-1".to_string(); - let mut mock_fs = MockFileSystem::new(); + let repository = MockDidDocumentRepository::new(); let mock_keystore = Keystore::with_mock_configs(vec![(kid, setup())]); - let path = Path::new("/mock/dir"); - - // Mock the file system write call - mock_fs - .expect_create_dir_all() - .with(predicate::eq(path)) - .times(1) - .returning(|_| Ok(())); - - mock_fs.expect_write().times(1).returning(|_, _| Ok(())); - let result = didgen(path, "https://example.com", &mock_keystore, &mut mock_fs); + let result = didgen("https://example.com", &mock_keystore, &repository); assert!(result.is_ok()); + let stored_diddoc = repository + .find_one_by(doc! {}) + .await + .unwrap() + .expect("diddoc should be stored"); + + let result_diddoc: Document = serde_json::from_value(json!(result.unwrap())).unwrap(); + let stored_diddoc: Document = serde_json::from_value(json!(stored_diddoc.diddoc)).unwrap(); + assert_eq!(result_diddoc.id, stored_diddoc.id); } #[tokio::test(flavor = "multi_thread")] async fn test_did_validation() { let kid = "did:peer:123#key-1".to_string(); - let mut mock_fs = MockFileSystem::new(); - let mock_keystore = Keystore::with_mock_configs(vec![(kid, setup())]); - let path = Path::new("/mock/dir"); - - // Mock read from filesystem - mock_fs - .expect_read_to_string() - .withf(|path| path.ends_with("did.json")) - .times(1) - .returning(|_| { - Ok(r##"{ - "@context": ["https://www.w3.org/ns/did/v1"], - "id": "did:peer:123", - "verificationMethod": [ - { - "id": "#key-1", - "type": "JsonWebKey2020", - "controller": "did:peer:123", - "publicKeyJwk": { - "kty": "OKP", - "crv": "Ed25519", - "x": "PuG2L5um-tAnHlvT29gTm9Wj9fZca16vfBCPKsHB5cA" - } - } - ] - }"## - .to_string()) - }); - - let result = validate_diddoc(path, &mock_keystore, &mut mock_fs); + let repository = MockDidDocumentRepository::new(); + let mock_keystore = Keystore::with_mock_configs(vec![(kid.clone(), setup())]); + + // Mock read from store + let diddoc: Document = serde_json::from_str( + r##"{ + "@context": ["https://www.w3.org/ns/did/v1"], + "id": "did:peer:123", + "verificationMethod": [ + { + "id": "#key-1", + "type": "JsonWebKey2020", + "controller": "did:peer:123", + "publicKeyJwk": { + "kty": "OKP", + "crv": "Ed25519", + "x": "PuG2L5um-tAnHlvT29gTm9Wj9fZca16vfBCPKsHB5cA" + } + } + ] + }"##, + ) + .unwrap(); + repository + .store(MediatorDidDocument { + id: None, + diddoc, + }) + .await + .unwrap(); + + let result = validate_diddoc(&mock_keystore, &repository); assert!(result.is_ok()); } diff --git a/crates/web-plugins/did-endpoint/src/lib.rs b/crates/web-plugins/did-endpoint/src/lib.rs index a9a13def..83de31fa 100644 --- a/crates/web-plugins/did-endpoint/src/lib.rs +++ b/crates/web-plugins/did-endpoint/src/lib.rs @@ -1,8 +1,9 @@ -mod didgen; mod util; -mod web; +pub mod didgen; +pub mod persistence; pub mod plugin; +pub mod web; // Re-exports pub use didgen::{didgen, validate_diddoc, Error}; diff --git a/crates/web-plugins/did-endpoint/src/persistence.rs b/crates/web-plugins/did-endpoint/src/persistence.rs new file mode 100644 index 00000000..56176cc2 --- /dev/null +++ b/crates/web-plugins/did-endpoint/src/persistence.rs @@ -0,0 +1,88 @@ +use async_trait::async_trait; +use database::{Identifiable, Repository}; +use did_utils::didcore::Document as DidDocument; +use mongodb::{bson::oid::ObjectId, Collection, Database}; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct MediatorDidDocument { + #[serde(rename = "_id", skip_serializing_if = "Option::is_none")] + pub id: Option, + pub diddoc: DidDocument, +} + +impl Identifiable for MediatorDidDocument { + fn id(&self) -> Option { + self.id + } + + fn set_id(&mut self, id: ObjectId) { + self.id = Some(id); + } +} + +pub struct DidDocumentRepository { + collection: Collection, +} + +impl DidDocumentRepository { + pub fn from_db(db: &Database) -> Self { + Self { + collection: db.collection("mediator_diddoc"), + } + } +} + +#[async_trait] +impl Repository for DidDocumentRepository { + fn get_collection(&self) -> Collection { + self.collection.clone() + } +} + +#[cfg(any(test, feature = "test-utils"))] +pub mod tests { + use super::*; + use async_trait::async_trait; + use database::{Repository, RepositoryError}; + use mongodb::{bson::Document as BsonDocument, Collection}; + use std::sync::Arc; + use tokio::sync::RwLock; + + #[derive(Clone, Default)] + pub struct MockDidDocumentRepository { + diddoc: Arc>>, + } + + impl MockDidDocumentRepository { + pub fn new() -> Self { + Self { + diddoc: Arc::new(RwLock::new(None)), + } + } + } + + #[async_trait] + impl Repository for MockDidDocumentRepository { + fn get_collection(&self) -> Collection { + unimplemented!("This is a mock repository, no real collection exists.") + } + + async fn find_one_by( + &self, + _filter: BsonDocument, + ) -> Result, RepositoryError> { + let diddoc = self.diddoc.read().await; + Ok(diddoc.clone()) + } + + async fn store( + &self, + diddoc: MediatorDidDocument, + ) -> Result { + let mut lock = self.diddoc.write().await; + *lock = Some(diddoc.clone()); + Ok(diddoc) + } + } +} diff --git a/crates/web-plugins/did-endpoint/src/plugin.rs b/crates/web-plugins/did-endpoint/src/plugin.rs index 1bc00bdf..fdc55dd8 100644 --- a/crates/web-plugins/did-endpoint/src/plugin.rs +++ b/crates/web-plugins/did-endpoint/src/plugin.rs @@ -1,37 +1,34 @@ -use super::{didgen, web}; +use super::{didgen, persistence::*, web}; use axum::Router; -use filesystem::FileSystem; +use database::{get_or_init_database, Repository}; use keystore::Keystore; +use mongodb::Database; use plugin_api::{Plugin, PluginError}; -use std::sync::{Arc, Mutex}; +use std::sync::Arc; #[derive(Default)] pub struct DidEndpoint { env: Option, state: Option, + db: Option, } struct DidEndpointEnv { - storage_dirpath: String, server_public_domain: String, } #[derive(Clone)] pub(crate) struct DidEndPointState { pub(crate) keystore: Keystore, - pub(crate) filesystem: Arc>, + pub(crate) repository: Arc>, } fn get_env() -> Result { - let storage_dirpath = std::env::var("STORAGE_DIRPATH") - .map_err(|_| PluginError::InitError("STORAGE_DIRPATH env variable required".to_owned()))?; - let server_public_domain = std::env::var("SERVER_PUBLIC_DOMAIN").map_err(|_| { PluginError::InitError("SERVER_PUBLIC_DOMAIN env variable required".to_owned()) })?; Ok(DidEndpointEnv { - storage_dirpath, server_public_domain, }) } @@ -43,21 +40,16 @@ impl Plugin for DidEndpoint { fn mount(&mut self) -> Result<(), PluginError> { let env = get_env()?; - let mut filesystem = filesystem::StdFileSystem; + + self.db = Some(get_or_init_database()); + + let repository = DidDocumentRepository::from_db(self.db.as_ref().unwrap()); let keystore = Keystore::with_mongodb(); - if didgen::validate_diddoc(env.storage_dirpath.as_ref(), &keystore, &mut filesystem) - .is_err() - { + if didgen::validate_diddoc(&keystore, &repository).is_err() { tracing::debug!("diddoc validation failed, will generate one"); - didgen::didgen( - env.storage_dirpath.as_ref(), - &env.server_public_domain, - &keystore, - &mut filesystem, - ) - .map_err(|_| { + didgen::didgen(&env.server_public_domain, &keystore, &repository).map_err(|_| { PluginError::InitError( "failed to generate an initial keystore and its DID document".to_owned(), ) @@ -67,7 +59,7 @@ impl Plugin for DidEndpoint { self.env = Some(env); self.state = Some(DidEndPointState { keystore, - filesystem: Arc::new(Mutex::new(filesystem)), + repository: Arc::new(repository), }); Ok(()) diff --git a/crates/web-plugins/did-endpoint/src/web.rs b/crates/web-plugins/did-endpoint/src/web.rs index 56553dab..158eae19 100644 --- a/crates/web-plugins/did-endpoint/src/web.rs +++ b/crates/web-plugins/did-endpoint/src/web.rs @@ -1,48 +1,39 @@ -use crate::{plugin::DidEndPointState, util}; +use super::plugin::DidEndPointState; use axum::{ extract::{Query, State}, - response::Json, + http::StatusCode, + response::{IntoResponse, Json}, routing::get, Router, }; use chrono::Utc; + use did_utils::{ didcore::{Document, KeyFormat, Proofs}, jwk::Jwk, proof::{CryptoProof, EdDsaJcs2022, Proof, PROOF_TYPE_DATA_INTEGRITY_PROOF}, vc::{VerifiableCredential, VerifiablePresentation}, }; - -#[allow(unused_imports)] -use hyper::StatusCode; +use mongodb::bson::doc; use multibase::Base; use serde_json::{json, Value}; -use std::{collections::HashMap, path::Path, sync::Arc}; +use std::{collections::HashMap, convert::TryInto, sync::Arc}; use tokio::{runtime::Handle, task}; const DEFAULT_CONTEXT_V2: &str = "https://www.w3.org/ns/credentials/v2"; pub(crate) fn routes(state: Arc) -> Router { - Router::new() // + Router::new() .route("/.well-known/did.json", get(diddoc)) .route("/.well-known/did/pop.json", get(didpop)) .with_state(state) } -async fn diddoc(State(state): State>) -> Result, StatusCode> { - let storage_dirpath = std::env::var("STORAGE_DIRPATH").map_err(|_| { - tracing::error!("STORAGE_DIRPATH env variable required"); - StatusCode::NOT_FOUND - })?; - let filesystem = state.filesystem.lock().unwrap(); - let did_path = Path::new(&storage_dirpath).join("did.json"); - - match filesystem.read_to_string(&did_path).as_ref() { - Ok(content) => Ok(Json(serde_json::from_str(content).map_err(|_| { - tracing::error!("Unparseable did.json"); - StatusCode::NOT_FOUND - })?)), - Err(_) => Err(StatusCode::NOT_FOUND), +pub(crate) async fn diddoc(State(state): State>) -> impl IntoResponse { + match state.repository.find_one_by(doc! {}).await { + Ok(Some(diddoc_entity)) => (StatusCode::OK, Json(diddoc_entity.diddoc)).into_response(), + Ok(None) => (StatusCode::NOT_FOUND, "DIDDoc not found").into_response(), + Err(_) => (StatusCode::INTERNAL_SERVER_ERROR, "Internal Server Error").into_response(), } } @@ -53,9 +44,17 @@ async fn didpop( ) -> Result, StatusCode> { let challenge = params.get("challenge").ok_or(StatusCode::BAD_REQUEST)?; - // Load DID document and its verification methods - let diddoc_value = diddoc(State(state.clone())).await?.0; - let diddoc: Document = serde_json::from_value(diddoc_value.clone()).unwrap(); + // Retrieve the DID document from the repository + let diddoc_entity = state + .repository + .find_one_by(doc! {}) + .await + .map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)? + .ok_or(StatusCode::NOT_FOUND)?; + + let diddoc_value = diddoc_entity.diddoc; + let diddoc: Document = + serde_json::from_value(json!(diddoc_value)).map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)?; let did_address = diddoc.id.clone(); let methods = diddoc.verification_method.clone().unwrap_or_default(); @@ -68,7 +67,7 @@ async fn didpop( "validFrom": Utc::now(), "credentialSubject": diddoc_value, })) - .unwrap(); + .map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)?; // Embed VC into a verifiable presentation (VP) let mut vp: VerifiablePresentation = serde_json::from_value(json!({ @@ -78,7 +77,7 @@ async fn didpop( "holder": &did_address, "verifiableCredential": [vc], })) - .unwrap(); + .map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)?; // Generate proofs of possession let mut vec_proof: Vec = vec![]; @@ -89,7 +88,7 @@ async fn didpop( "proofPurpose": "", "verificationMethod": "", })) - .unwrap(); + .map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)?; let keystore = state.keystore.clone(); @@ -100,7 +99,7 @@ async fn didpop( .as_ref() .expect("Verification methods should embed public keys."); - let kid = util::handle_vm_id(&method.id, &diddoc); + let kid = crate::util::handle_vm_id(&method.id, &diddoc); let jwk: Jwk = match pubkey { KeyFormat::Jwk(_) => task::block_in_place(|| { @@ -109,10 +108,10 @@ async fn didpop( .retrieve(&kid) .await .expect("Error fetching secret") - .expect("Missing key") + .expect("Secret not found") }) }), - _ => panic!("Unexpected key format"), + _ => panic!("Unsupported key format"), }; // Amend options for linked data proof with method-specific attributes @@ -183,15 +182,14 @@ fn inspect_vm_relationship(diddoc: &Document, vm_id: &str) -> Option { #[cfg(test)] mod tests { - use std::{sync::Mutex, vec}; - use super::*; - use crate::didgen::tests::*; + use crate::{didgen::tests::*, persistence::{tests::MockDidDocumentRepository, MediatorDidDocument}}; use axum::{ body::Body, http::{Request, StatusCode}, }; + use database::Repository; use did_utils::{ didcore::{Document, KeyFormat, Proofs}, jwk::Jwk, @@ -229,38 +227,20 @@ mod tests { .unwrap(); let kid = "did:peer:123#key-1".to_string(); - let mut mock_fs = MockFileSystem::new(); + let repository = MockDidDocumentRepository::new(); let mock_keystore = Keystore::with_mock_configs(vec![(kid, setup())]); - // Simulate reading the did.json file - mock_fs - .expect_read_to_string() - .withf(|path| path.to_str().unwrap().ends_with("did.json")) - .returning(|_| { - Ok(r##"{ - "@context": ["https://www.w3.org/ns/did/v1"], - "id": "did:peer:123", - "verificationMethod": [ - { - "id": "#key-1", - "type": "JsonWebKey2020", - "controller": "did:peer:123", - "publicKeyJwk": { - "kty": "OKP", - "crv": "Ed25519", - "x": "PuG2L5um-tAnHlvT29gTm9Wj9fZca16vfBCPKsHB5cA" - } - } - ], - "authentication": ["#key-1"] - }"## - .to_string()) - }); + repository.store(MediatorDidDocument { + id: None, + diddoc: expected_diddoc.clone(), + }) + .await + .unwrap(); // Setup state with mocks let state = DidEndPointState { - filesystem: Arc::new(Mutex::new(mock_fs)), keystore: mock_keystore, + repository: Arc::new(repository), }; let app = routes(Arc::new(state)); From 9e3b3498af1072d62c314dfeb51c5f687b7c500f Mon Sep 17 00:00:00 2001 From: Hermann Core Date: Fri, 20 Jun 2025 13:02:34 +0100 Subject: [PATCH 02/25] feat: implement in-memory store for OOB messages and refactor handlers to use it --- crates/web-plugins/oob-messages/Cargo.toml | 20 +- crates/web-plugins/oob-messages/src/lib.rs | 1 + crates/web-plugins/oob-messages/src/models.rs | 226 +++++------------- crates/web-plugins/oob-messages/src/plugin.rs | 62 +++-- crates/web-plugins/oob-messages/src/store.rs | 24 ++ crates/web-plugins/oob-messages/src/web.rs | 11 +- .../oob-messages/src/web/handler.rs | 109 ++++----- 7 files changed, 177 insertions(+), 276 deletions(-) create mode 100644 crates/web-plugins/oob-messages/src/store.rs diff --git a/crates/web-plugins/oob-messages/Cargo.toml b/crates/web-plugins/oob-messages/Cargo.toml index 2a2bb479..de269112 100644 --- a/crates/web-plugins/oob-messages/Cargo.toml +++ b/crates/web-plugins/oob-messages/Cargo.toml @@ -1,17 +1,12 @@ [package] -name = "oob-messages" -version = "0.1.0" -authors = ["adorsys GmbH Co. KG"] -license = "Apache-2.0" -description = "A Rust library for implementing out of band messages for DID-based applications." -repository = "https://github.com/adorsys/didcomm-mediator-rs/tree/main/crates/web-plugins/oob-messages" -keywords = ["out-of-band", "oob", "obb-message", "didcomm", "Mediator"] -categories = ["cryptography"] +name = "oob-messages" +version = "0.1.0" edition = "2021" [dependencies] +database.workspace = true did-utils.workspace = true -filesystem.workspace = true +did-endpoint.workspace = true plugin-api.workspace = true multibase.workspace = true @@ -21,12 +16,13 @@ tracing.workspace = true qrcode.workspace = true image.workspace = true base64.workspace = true -lazy_static.workspace = true serde = { workspace = true, features = ["derive"] } uuid = { workspace = true, features = ["fast-rng", "v4"] } +tokio = { workspace = true, features = ["macros", "rt-multi-thread"] } +mongodb.workspace = true [dev-dependencies] -filesystem = { workspace = true, features = ["test-utils"] } +tower = "0.5" mockall = "0.13.1" tokio = { version = "1.42.0", features = ["full"] } -tower = "0.5" +did-endpoint = { workspace = true, features = ["test-utils"] } diff --git a/crates/web-plugins/oob-messages/src/lib.rs b/crates/web-plugins/oob-messages/src/lib.rs index f7603491..7fe6f3b8 100644 --- a/crates/web-plugins/oob-messages/src/lib.rs +++ b/crates/web-plugins/oob-messages/src/lib.rs @@ -3,3 +3,4 @@ mod models; mod web; pub mod plugin; +pub mod store; diff --git a/crates/web-plugins/oob-messages/src/models.rs b/crates/web-plugins/oob-messages/src/models.rs index c9afe51a..8eec2c2b 100644 --- a/crates/web-plugins/oob-messages/src/models.rs +++ b/crates/web-plugins/oob-messages/src/models.rs @@ -1,20 +1,14 @@ use crate::constants::OOB_INVITATION_2_0; +use crate::store::Store; use base64::engine::general_purpose::STANDARD; use base64::Engine; use did_utils::didcore::Document; -use filesystem::FileSystem; -use image::{DynamicImage, Luma}; -use lazy_static::lazy_static; +use image::{ImageFormat, Luma}; use multibase::Base::Base64Url; use qrcode::QrCode; use serde::{Deserialize, Serialize}; use serde_json::to_string; -use std::collections::HashMap; use std::io::Cursor; -use std::sync::RwLock; - -#[cfg(test)] -use std::io::Result as IoResult; // region: --- Model @@ -85,142 +79,60 @@ impl OobMessage { } } -// Receives server path/port and local storage path and returns a String with the OOB URL. -pub(crate) fn retrieve_or_generate_oob_inv( - fs: &mut F, +// Receives server path/port and returns a String with the OOB URL. +pub(crate) fn retrieve_or_generate_oob_inv( + store: &mut S, + diddoc: &Document, server_public_domain: &str, - storage_dirpath: &str, ) -> Result where - F: FileSystem + ?Sized, + S: Store + ?Sized, { - // Construct the file path - let file_path = format!("{}/oob_invitation.txt", storage_dirpath); - - // Attempt to read the file directly - if let Ok(content) = fs.read_to_string(file_path.as_ref()) { - // If successful, return the content - tracing::info!("OOB Invitation successfully retrieved from file"); + if let Some(content) = store.get("oob_invitation") { + tracing::info!("OOB Invitation successfully retrieved from store"); return Ok(content); } - // If the file doesn't exist, proceed with creating and storing it - let diddoc_path = format!("{}/did.json", storage_dirpath); - let diddoc: Document = fs - .read_to_string(diddoc_path.as_ref()) - .map(|content| serde_json::from_str(&content).unwrap()) - .map_err(|err| format!("Failed to read DID document: {err}"))?; - let did = diddoc.id.clone(); let oob_message = OobMessage::new(&did); let oob_url = OobMessage::serialize_oob_message(&oob_message, server_public_domain) .map_err(|err| format!("Serialization error: {err}"))?; - // Attempt to create the file and write the string - to_local_storage(fs, &oob_url, storage_dirpath)?; + store.set("oob_invitation", &oob_url); Ok(oob_url) } -lazy_static! { - static ref CACHE: RwLock> = RwLock::new(HashMap::new()); -} - // Function to generate and save a QR code image with caching -pub(crate) fn retrieve_or_generate_qr_image( - fs: &mut F, - base_path: &str, - url: &str, -) -> Result +pub(crate) fn retrieve_or_generate_qr_image(store: &mut S, url: &str) -> Result where - F: FileSystem + ?Sized, + S: Store + ?Sized, { - let path = format!("{}/qrcode.txt", base_path); - - // Check the cache first - { - let cache = CACHE.read().map_err(|err| format!("Cache error: {err}"))?; - if let Some(existing_image) = cache.get(&path) { - return Ok(existing_image.clone()); - } - } - - // Check if the file exists in the specified path, otherwise create it - if let Ok(existing_image) = fs.read_to_string(path.as_ref()) { - // Update the cache with the retrieved data - CACHE - .write() - .map_err(|err| format!("Cache error: {err}"))? - .insert(path.clone(), existing_image.clone()); - return Ok(existing_image); + if let Some(image_data) = store.get("qr_code_image") { + tracing::info!("QR code image successfully retrieved from store"); + return Ok(image_data); } - // Generate QR code - let qr_code = QrCode::new(url.as_bytes()) - .map_err(|error| format!("Failed to generate QR code: {error:?}"))?; - - let image = qr_code.render::>().build(); + let code = + QrCode::new(url.as_bytes()).map_err(|err| format!("QR code generation error: {err}"))?; + let image = code.render::>().build(); - // Convert the image to a PNG-encoded byte vector - let dynamic_image = DynamicImage::ImageLuma8(image); - let mut buffer = Cursor::new(Vec::new()); - dynamic_image - .write_to(&mut buffer, image::ImageFormat::Png) - .map_err(|err| format!("Error encoding image to PNG: {err}"))?; + let mut buffer = Vec::new(); + image + .write_to(&mut Cursor::new(&mut buffer), ImageFormat::Png) + .map_err(|err| format!("Image write error: {err}"))?; - // Get the encoded bytes from the cursor - let buffer = buffer.into_inner(); + let image_data = STANDARD.encode(&buffer); + store.set("qr_code_image", &image_data); - // Save the PNG-encoded byte vector as a base64-encoded string - let base64_string = STANDARD.encode(&buffer); - - // Save to file - fs.write_with_lock(path.as_ref(), &base64_string) - .map_err(|err| format!("Error writing: {err:?}"))?; - CACHE - .write() - .map_err(|err| format!("Cache error: {err:?}"))? - .insert(path.clone(), base64_string.clone()); - - Ok(base64_string) + Ok(image_data) } -fn to_local_storage(fs: &mut F, oob_url: &str, storage_dirpath: &str) -> Result<(), String> -where - F: FileSystem + ?Sized, -{ - // Ensure the parent directory ('storage') exists - fs.create_dir_all(storage_dirpath.as_ref()) - .map_err(|err| format!("Error creating directory: {err}"))?; - - let file_path = format!("{}/oob_invitation.txt", storage_dirpath); - - // Attempt to write the string directly to the file - fs.write(file_path.as_ref(), oob_url) - .map_err(|err| format!("Error writing to file: {err}"))?; - tracing::info!("String successfully written to file."); - - Ok(()) -} - -#[cfg(test)] -use std::path::Path; - #[cfg(test)] mod tests { use super::*; - use mockall::{predicate::*, *}; - - mock! { - pub FileSystem {} - impl FileSystem for FileSystem { - fn read_to_string(&self, path: &Path) -> IoResult; - fn write(&mut self, path: &Path, content: &str) -> IoResult<()>; - fn read_dir_files(&self, path: &Path) -> IoResult>; - fn create_dir_all(&mut self, path: &Path) -> IoResult<()>; - fn write_with_lock(&self, path: &Path, content: &str) -> IoResult<()>; - } - } + use crate::store::InMemoryStore; + use did_utils::didcore::Document; #[test] fn test_create_oob_message() { @@ -260,71 +172,41 @@ mod tests { fn test_retrieve_or_generate_oob_inv() { // Test data let server_public_domain = "https://example.com"; - let storage_dirpath = "testpath"; - - let mut mock_fs = MockFileSystem::new(); - - // Set expectation for reading DID document - mock_fs - .expect_read_to_string() - .with(eq(Path::new("testpath/oob_invitation.txt"))) - .returning(|_| { - Err(std::io::Error::new( - std::io::ErrorKind::NotFound, - "NotFound", - )) - }); - - mock_fs - .expect_read_to_string() - .with(eq(Path::new("testpath/did.json"))) - .returning(|_| { - Ok(r##"{ - "@context": ["https://www.w3.org/ns/did/v1"], - "id": "did:peer:123" - }"## - .to_string()) - }); - - mock_fs - .expect_create_dir_all() - .with(eq(Path::new("testpath"))) - .returning(|_| Ok(())); - - // Set expectation for writing the oob_invitation.txt file - mock_fs - .expect_write() - .withf(|path, _content| path == Path::new("testpath/oob_invitation.txt")) - .returning(|_, _| Ok(())); - - let result = - retrieve_or_generate_oob_inv(&mut mock_fs, server_public_domain, storage_dirpath); + let diddoc: Document = serde_json::from_str( + r##"{ + "@context": ["https://www.w3.org/ns/did/v1"], + "id": "did:peer:123" + }"##, + ) + .unwrap(); + + let mut store = InMemoryStore::default(); + + let result = retrieve_or_generate_oob_inv(&mut store, &diddoc, server_public_domain); assert!(result.is_ok()); + let oob_inv = result.unwrap(); + assert!(oob_inv.starts_with("https://example.com?_oob=")); + + // test retrieval + let result2 = retrieve_or_generate_oob_inv(&mut store, &diddoc, server_public_domain); + assert!(result2.is_ok()); + assert_eq!(oob_inv, result2.unwrap()); } #[test] fn test_retrieve_or_generate_qr_image() { - let mut mock_fs = MockFileSystem::new(); + let mut store = InMemoryStore::default(); let url = "https://example.com"; - let storage_dirpath = "testpath"; - let expected_image_data = "expected_base64_image_data"; - - // Mock read_to_string to return expected_image_data when called. - mock_fs - .expect_read_to_string() - .withf(move |path| path == Path::new("testpath/qrcode.txt")) - .returning(move |_| Ok(expected_image_data.to_string())); - - // Mock writing with lock to do nothing. - mock_fs - .expect_write_with_lock() - .withf(|path, _| path == Path::new("testpath/qrcode.txt")) - .returning(|_, _| Ok(())); - - let result = retrieve_or_generate_qr_image(&mut mock_fs, storage_dirpath, url); + + let result = retrieve_or_generate_qr_image(&mut store, url); assert!(result.is_ok()); + let image_data = result.unwrap(); + assert!(!image_data.is_empty()); - assert_eq!(result.unwrap(), expected_image_data); + // test retrieval + let result2 = retrieve_or_generate_qr_image(&mut store, url); + assert!(result2.is_ok()); + assert_eq!(image_data, result2.unwrap()); } } diff --git a/crates/web-plugins/oob-messages/src/plugin.rs b/crates/web-plugins/oob-messages/src/plugin.rs index d114254a..be91ba3d 100644 --- a/crates/web-plugins/oob-messages/src/plugin.rs +++ b/crates/web-plugins/oob-messages/src/plugin.rs @@ -1,12 +1,17 @@ +use super::store::{InMemoryStore, Store}; +use axum::Router; +use did_endpoint::persistence::DidDocumentRepository; +use did_utils::didcore::Document; +use mongodb::bson::doc; +use plugin_api::{Plugin, PluginError}; use std::sync::{Arc, Mutex}; +use tokio::{runtime::Handle, task}; use super::{ models::{retrieve_or_generate_oob_inv, retrieve_or_generate_qr_image}, web, }; -use axum::Router; -use filesystem::{FileSystem, StdFileSystem}; -use plugin_api::{Plugin, PluginError}; +use database::Repository; #[derive(Default)] pub struct OOBMessages { @@ -15,25 +20,22 @@ pub struct OOBMessages { } struct OOBMessagesEnv { - storage_dirpath: String, server_public_domain: String, } #[derive(Clone)] pub(crate) struct OOBMessagesState { - pub(crate) filesystem: Arc>, + pub(crate) store: Arc>, + pub(crate) diddoc: Document, + pub(crate) server_public_domain: String, } fn get_env() -> Result { - let storage_dirpath = std::env::var("STORAGE_DIRPATH") - .map_err(|_| PluginError::InitError("STORAGE_DIRPATH env variable required".to_owned()))?; - let server_public_domain = std::env::var("SERVER_PUBLIC_DOMAIN").map_err(|_| { PluginError::InitError("SERVER_PUBLIC_DOMAIN env variable required".to_owned()) })?; Ok(OOBMessagesEnv { - storage_dirpath, server_public_domain, }) } @@ -45,27 +47,47 @@ impl Plugin for OOBMessages { fn mount(&mut self) -> Result<(), PluginError> { let env = get_env()?; - let mut fs = StdFileSystem; - - let oob_inv = - retrieve_or_generate_oob_inv(&mut fs, &env.server_public_domain, &env.storage_dirpath) - .map_err(|err| { - PluginError::InitError(format!( - "Error retrieving or generating OOB invitation: {err}" - )) - })?; + let mut store = InMemoryStore::default(); + + let db = database::get_or_init_database(); + let repository = DidDocumentRepository::from_db(&db); + + let diddoc = task::block_in_place(move || { + Handle::current().block_on(async move { + repository + .find_one_by(doc! {}) + .await + .map_err(|e| PluginError::Other(e.to_string()))? + .ok_or_else(|| PluginError::Other("Missing did.json from repository".to_string())) + }) + })?; + let diddoc = diddoc.diddoc; + + let oob_inv = retrieve_or_generate_oob_inv( + &mut store, + &diddoc, + &env.server_public_domain, + ) + .map_err(|err| { + PluginError::InitError(format!( + "Error retrieving or generating OOB invitation: {err}" + )) + })?; tracing::debug!("Out Of Band Invitation: {}", oob_inv); - retrieve_or_generate_qr_image(&mut fs, &env.storage_dirpath, &oob_inv).map_err(|err| { + retrieve_or_generate_qr_image(&mut store, &oob_inv).map_err(|err| { PluginError::InitError(format!( "Error retrieving or generating QR code image: {err}" )) })?; + let server_public_domain = env.server_public_domain.clone(); self.env = Some(env); self.state = Some(OOBMessagesState { - filesystem: Arc::new(Mutex::new(fs)), + store: Arc::new(Mutex::new(store)), + diddoc, + server_public_domain, }); Ok(()) diff --git a/crates/web-plugins/oob-messages/src/store.rs b/crates/web-plugins/oob-messages/src/store.rs new file mode 100644 index 00000000..da84ed61 --- /dev/null +++ b/crates/web-plugins/oob-messages/src/store.rs @@ -0,0 +1,24 @@ +use std::collections::HashMap; +use std::sync::{Arc, RwLock}; + +pub(crate) trait Store: Send + Sync { + fn get(&self, key: &str) -> Option; + fn set(&mut self, key: &str, value: &str); +} + +#[derive(Clone, Default)] +pub(crate) struct InMemoryStore { + state: Arc>>, +} + +impl Store for InMemoryStore { + fn get(&self, key: &str) -> Option { + let state = self.state.read().unwrap(); + state.get(key).cloned() + } + + fn set(&mut self, key: &str, value: &str) { + let mut state = self.state.write().unwrap(); + state.insert(key.to_string(), value.to_string()); + } +} diff --git a/crates/web-plugins/oob-messages/src/web.rs b/crates/web-plugins/oob-messages/src/web.rs index a74e8916..2353dca6 100644 --- a/crates/web-plugins/oob-messages/src/web.rs +++ b/crates/web-plugins/oob-messages/src/web.rs @@ -17,23 +17,24 @@ pub(crate) fn routes(state: Arc) -> Router { #[cfg(test)] mod tests { use super::*; + use crate::store::InMemoryStore; use axum::{ body::Body, http::{Request, StatusCode}, }; - use filesystem::MockFileSystem; + use did_utils::didcore::Document; use std::sync::Mutex; use tower::util::ServiceExt; #[tokio::test] async fn test_routes() { - std::env::set_var("STORAGE_DIRPATH", "tmp"); std::env::set_var("SERVER_PUBLIC_DOMAIN", "example.com"); - std::env::set_var("SERVER_LOCAL_PORT", "8080"); + std::env::remove_var("STORAGE_DIRPATH"); - let fs = MockFileSystem; let state = Arc::new(OOBMessagesState { - filesystem: Arc::new(Mutex::new(fs)), + store: Arc::new(Mutex::new(InMemoryStore::default())), + diddoc: Document::default(), + server_public_domain: "example.com".to_string(), }); let app = routes(state.clone()); diff --git a/crates/web-plugins/oob-messages/src/web/handler.rs b/crates/web-plugins/oob-messages/src/web/handler.rs index 409e611e..8de3db39 100644 --- a/crates/web-plugins/oob-messages/src/web/handler.rs +++ b/crates/web-plugins/oob-messages/src/web/handler.rs @@ -5,58 +5,48 @@ use axum::{ http::{header, StatusCode}, response::{Html, IntoResponse, Response}, }; -use std::{error::Error, sync::Arc}; +use std::sync::Arc; pub(crate) async fn handler_oob_inv(State(state): State>) -> Response { - let mut fs = state.filesystem.lock().unwrap(); - let (server_public_domain, storage_dirpath) = match get_environment_variables() { - Ok(result) => result, + let mut store = state.store.lock().unwrap(); + let content = match retrieve_or_generate_oob_inv( + &mut *store, + &state.diddoc, + &state.server_public_domain, + ) { + Ok(oob_inv) => oob_inv, Err(err) => { - tracing::error!("Error: {err:?}"); - return (StatusCode::INTERNAL_SERVER_ERROR, "Internal server error").into_response(); + tracing::error!("Failed to retrieve or generate oob invitation: {err:?}"); + return ( + StatusCode::SERVICE_UNAVAILABLE, + "Could not process request at this time. Please try again later", + ) + .into_response(); } }; - let content = - match retrieve_or_generate_oob_inv(&mut *fs, &server_public_domain, &storage_dirpath) { - Ok(oob_inv) => oob_inv, - Err(err) => { - tracing::error!("Failed to retrieve or generate oob invitation: {err:?}"); - return ( - StatusCode::SERVICE_UNAVAILABLE, - "Could not process request at this time. Please try again later", - ) - .into_response(); - } - }; - content.into_response() } pub(crate) async fn handler_oob_qr(State(state): State>) -> Response { - let mut fs = state.filesystem.lock().unwrap(); - let (server_public_domain, storage_dirpath) = match get_environment_variables() { - Ok(result) => result, + let mut store = state.store.lock().unwrap(); + let oob_inv = match retrieve_or_generate_oob_inv( + &mut *store, + &state.diddoc, + &state.server_public_domain, + ) { + Ok(oob_inv) => oob_inv, Err(err) => { - tracing::error!("Error: {err:?}"); - return (StatusCode::INTERNAL_SERVER_ERROR, "Internal server error").into_response(); + tracing::error!("Failed to retrieve or generate oob invitation: {err:?}"); + return ( + StatusCode::SERVICE_UNAVAILABLE, + "Could not process request at this time. Please try again later", + ) + .into_response(); } }; - let oob_inv = - match retrieve_or_generate_oob_inv(&mut *fs, &server_public_domain, &storage_dirpath) { - Ok(oob_inv) => oob_inv, - Err(err) => { - tracing::error!("Failed to retrieve or generate oob invitation: {err:?}"); - return ( - StatusCode::SERVICE_UNAVAILABLE, - "Could not process request at this time. Please try again later", - ) - .into_response(); - } - }; - - let image_data = match retrieve_or_generate_qr_image(&mut *fs, &storage_dirpath, &oob_inv) { + let image_data = match retrieve_or_generate_qr_image(&mut *store, &oob_inv) { Ok(data) => data, Err(err) => { tracing::error!("Failed to retrieve or generate QR code image: {err:?}"); @@ -93,29 +83,24 @@ pub(crate) async fn handler_oob_qr(State(state): State>) - pub(crate) async fn handler_landing_page_oob( State(state): State>, ) -> Response { - let mut fs = state.filesystem.lock().unwrap(); - let (server_public_domain, storage_dirpath) = match get_environment_variables() { - Ok(result) => result, + let mut store = state.store.lock().unwrap(); + let oob_inv = match retrieve_or_generate_oob_inv( + &mut *store, + &state.diddoc, + &state.server_public_domain, + ) { + Ok(oob_inv) => oob_inv, Err(err) => { - tracing::error!("Error: {err:?}"); - return (StatusCode::INTERNAL_SERVER_ERROR, "Internal server error").into_response(); + tracing::error!("Failed to retrieve or generate oob invitation: {err:?}"); + return ( + StatusCode::SERVICE_UNAVAILABLE, + "Could not process request at this time. Please try again later", + ) + .into_response(); } }; - let oob_inv = - match retrieve_or_generate_oob_inv(&mut *fs, &server_public_domain, &storage_dirpath) { - Ok(oob_inv) => oob_inv, - Err(err) => { - tracing::error!("Failed to retrieve or generate oob invitation: {err:?}"); - return ( - StatusCode::SERVICE_UNAVAILABLE, - "Could not process request at this time. Please try again later", - ) - .into_response(); - } - }; - - let image_data = match retrieve_or_generate_qr_image(&mut *fs, &storage_dirpath, &oob_inv) { + let image_data = match retrieve_or_generate_qr_image(&mut *store, &oob_inv) { Ok(data) => data, Err(err) => { tracing::error!("Failed to retrieve or generate QR code image: {err:?}"); @@ -161,13 +146,3 @@ pub(crate) async fn handler_landing_page_oob( ) .into_response() } - -fn get_environment_variables() -> Result<(String, String), Box> { - let server_public_domain = std::env::var("SERVER_PUBLIC_DOMAIN") - .map_err(|_| "SERVER_PUBLIC_DOMAIN env variable required")?; - - let storage_dirpath = - std::env::var("STORAGE_DIRPATH").map_err(|_| "STORAGE_DIRPATH env variable required")?; - - Ok((server_public_domain, storage_dirpath)) -} From 3e65e24ac02bc36230c4241d0869a72242972013 Mon Sep 17 00:00:00 2001 From: Hermann Core Date: Fri, 20 Jun 2025 13:02:50 +0100 Subject: [PATCH 03/25] refactor: remove filesystem dependency and update DID document handling to use database repository --- .../didcomm-messaging/shared/src/utils.rs | 8 --- .../didcomm-messaging/src/midlw.rs | 3 - .../didcomm-messaging/src/plugin.rs | 68 +++++++++---------- 3 files changed, 33 insertions(+), 46 deletions(-) diff --git a/crates/web-plugins/didcomm-messaging/shared/src/utils.rs b/crates/web-plugins/didcomm-messaging/shared/src/utils.rs index 70e01cdf..78b421d8 100644 --- a/crates/web-plugins/didcomm-messaging/shared/src/utils.rs +++ b/crates/web-plugins/didcomm-messaging/shared/src/utils.rs @@ -5,7 +5,6 @@ use did_utils::{ didcore::{Document, KeyFormat, VerificationMethod, VerificationMethodType}, jwk::Jwk, }; -use filesystem::FileSystem; use serde_json::Error as SerdeError; use std::io; @@ -30,13 +29,6 @@ impl From for DidDocError { } } -/// Parse DID document expected to exist on filesystem. -pub fn read_diddoc(fs: &dyn FileSystem, storage_dirpath: &str) -> Result { - let didpath = format!("{storage_dirpath}/did.json"); - let content = fs.read_to_string(didpath.as_ref())?; - serde_json::from_str(&content).map_err(Into::into) -} - /// Generic macro function to look for a key in a DID document. /// /// if present, return its verification method ID and JWK representation. diff --git a/crates/web-plugins/didcomm-messaging/src/midlw.rs b/crates/web-plugins/didcomm-messaging/src/midlw.rs index ac8dfcfe..8004d196 100644 --- a/crates/web-plugins/didcomm-messaging/src/midlw.rs +++ b/crates/web-plugins/didcomm-messaging/src/midlw.rs @@ -191,8 +191,6 @@ pub async fn pack_response_message( #[cfg(test)] mod tests { - use std::env; - use super::*; use shared::utils::tests_utils::tests::*; @@ -200,7 +198,6 @@ mod tests { #[tokio::test] async fn test_pack_response_message_works() { - env::set_var("MASTER_KEY", "1234567890qwertyuiopasdfghjklxzc"); let state = setup(); let msg = Message::build( diff --git a/crates/web-plugins/didcomm-messaging/src/plugin.rs b/crates/web-plugins/didcomm-messaging/src/plugin.rs index 9fc2cf1d..ce188095 100644 --- a/crates/web-plugins/didcomm-messaging/src/plugin.rs +++ b/crates/web-plugins/didcomm-messaging/src/plugin.rs @@ -1,8 +1,12 @@ use crate::{manager::MessagePluginContainer, web}; use axum::Router; use dashmap::DashMap; -use filesystem::StdFileSystem; -use mongodb::Database; +use database::get_or_init_database; +use database::Repository; +use did_endpoint::persistence::DidDocumentRepository; +use did_utils::didcore::Document as DidDocument; +use keystore::Keystore; +use mongodb::{bson::doc, Database}; use once_cell::sync::OnceCell; use plugin_api::{Plugin, PluginError}; use shared::{ @@ -11,7 +15,9 @@ use shared::{ state::{AppState, AppStateRepository}, }; use std::{sync::Arc, time::Duration}; +use tokio::runtime::Handle; use tokio::sync::RwLock; +use tokio::task; pub(crate) static MESSAGE_CONTAINER: OnceCell> = OnceCell::new(); @@ -19,12 +25,12 @@ pub(crate) static MESSAGE_CONTAINER: OnceCell> = pub struct DidcommMessaging { env: Option, db: Option, + diddoc: Option, msg_types: Option>, } struct DidcommMessagingPluginEnv { public_domain: String, - storage_dirpath: String, } /// Loads environment variables required for this plugin @@ -36,14 +42,7 @@ fn load_plugin_env() -> Result { )) })?; - let storage_dirpath = std::env::var("STORAGE_DIRPATH").map_err(|err| { - PluginError::InitError(format!("STORAGE_DIRPATH env variable required: {:?}", err)) - })?; - - Ok(DidcommMessagingPluginEnv { - public_domain, - storage_dirpath, - }) + Ok(DidcommMessagingPluginEnv { public_domain }) } impl Plugin for DidcommMessaging { @@ -54,19 +53,31 @@ impl Plugin for DidcommMessaging { fn mount(&mut self) -> Result<(), PluginError> { let env = load_plugin_env()?; - let mut filesystem = filesystem::StdFileSystem; - let keystore = keystore::Keystore::with_mongodb(); + let db = get_or_init_database(); + let repository = DidDocumentRepository::from_db(&db); + let keystore = Keystore::with_mongodb(); - // Expect DID document from file system - if let Err(err) = - did_endpoint::validate_diddoc(env.storage_dirpath.as_ref(), &keystore, &mut filesystem) - { + // Expect DID document from the repository + if let Err(err) = did_endpoint::validate_diddoc(&keystore, &repository) { return Err(PluginError::InitError(format!( "DID document validation failed: {:?}", err ))); } + let diddoc = task::block_in_place(move || { + Handle::current().block_on(async move { + repository + .find_one_by(doc! {}) + .await + .map_err(|e| PluginError::Other(e.to_string()))? + .ok_or_else(|| { + PluginError::Other("Missing did.json from repository".to_string()) + }) + }) + })?; + let diddoc = diddoc.diddoc; + // Load message container let mut container = MessagePluginContainer::new(); if let Err(err) = container.load() { @@ -87,18 +98,10 @@ impl Plugin for DidcommMessaging { .set(RwLock::new(container)) .map_err(|_| PluginError::InitError("Container already initialized".to_owned()))?; - // Check connectivity to database - let db = tokio::task::block_in_place(|| { - let rt = tokio::runtime::Handle::current(); - rt.block_on(async { - let db_instance = database::get_or_init_database(); - db_instance.clone() - }) - }); - // Save the environment,MongoDB connection and didcomm message types in the struct self.env = Some(env); self.db = Some(db); + self.diddoc = Some(diddoc); self.msg_types = Some(msg_types); Ok(()) @@ -119,15 +122,10 @@ impl Plugin for DidcommMessaging { let msg_types = self.msg_types.as_ref().ok_or(PluginError::Other( "Failed to get message types. Check if the plugin is mounted".to_owned(), ))?; + let diddoc = self.diddoc.as_ref().ok_or(PluginError::Other( + "Failed to get diddoc. Check if the plugin is mounted".to_owned(), + ))?; - // Load crypto identity - let fs = StdFileSystem; - let diddoc = shared::utils::read_diddoc(&fs, &env.storage_dirpath).map_err(|err| { - PluginError::Other(format!( - "This should not occur following successful mounting: {:?}", - err - )) - })?; let keystore = keystore::Keystore::with_mongodb(); // Load persistence layer @@ -154,7 +152,7 @@ impl Plugin for DidcommMessaging { // Compile state let state = AppState::from( env.public_domain.clone(), - diddoc, + diddoc.clone(), Some(msg_types.clone()), Some(repository), breaker_acc, From 580a210af41d8765c43aeb2dd72a2cd450173938 Mon Sep 17 00:00:00 2001 From: Hermann Core Date: Fri, 20 Jun 2025 15:31:53 +0100 Subject: [PATCH 04/25] refactor: remove filesystem module and its dependencies --- crates/filesystem/Cargo.toml | 10 --- crates/filesystem/src/lib.rs | 158 ----------------------------------- 2 files changed, 168 deletions(-) delete mode 100644 crates/filesystem/Cargo.toml delete mode 100644 crates/filesystem/src/lib.rs diff --git a/crates/filesystem/Cargo.toml b/crates/filesystem/Cargo.toml deleted file mode 100644 index 4db32f60..00000000 --- a/crates/filesystem/Cargo.toml +++ /dev/null @@ -1,10 +0,0 @@ -[package] -name = "filesystem" -version = "0.1.0" -edition = "2021" - -[dependencies] -nix ={ workspace = true, features = ["fs"] } - -[features] -test-utils = [] diff --git a/crates/filesystem/src/lib.rs b/crates/filesystem/src/lib.rs deleted file mode 100644 index ddc4066d..00000000 --- a/crates/filesystem/src/lib.rs +++ /dev/null @@ -1,158 +0,0 @@ -use nix::fcntl::{Flock, FlockArg}; -use std::{ - fs::OpenOptions, - io::{Error as IoError, ErrorKind, Result as IoResult}, - path::Path, -}; - -#[doc(hidden)] -// Define a trait for file system operations -pub trait FileSystem: Send + 'static { - fn read_to_string(&self, path: &Path) -> IoResult; - fn write(&mut self, path: &Path, content: &str) -> IoResult<()>; - fn read_dir_files(&self, path: &Path) -> IoResult>; - fn create_dir_all(&mut self, path: &Path) -> IoResult<()>; - fn write_with_lock(&self, path: &Path, content: &str) -> IoResult<()>; - // Add other file system operations as needed -} - -// Implement the trait for the actual file system -#[derive(Clone, Copy, Default)] -pub struct StdFileSystem; - -impl FileSystem for StdFileSystem { - fn read_to_string(&self, path: &Path) -> IoResult { - std::fs::read_to_string(path) - } - - fn write(&mut self, path: &Path, content: &str) -> IoResult<()> { - std::fs::write(path, content) - } - - fn read_dir_files(&self, path: &Path) -> IoResult> { - let mut files = vec![]; - for entry in std::fs::read_dir(path)? { - let path = entry?.path(); - if path.is_file() { - files.push( - path.to_str() - .ok_or(IoError::new(ErrorKind::Other, "InvalidPath"))? - .to_string(), - ) - } - } - - Ok(files) - } - - fn create_dir_all(&mut self, path: &Path) -> IoResult<()> { - std::fs::create_dir_all(path) - } - - fn write_with_lock(&self, path: &Path, content: &str) -> IoResult<()> { - let file = OpenOptions::new() - .read(true) - .write(true) - .truncate(true) - .create(true) - .open(path)?; - - // Acquire an exclusive lock before writing to the file - let file = Flock::lock(file, FlockArg::LockExclusive) - .map_err(|_| IoError::new(ErrorKind::Other, "Error acquiring file lock"))?; - - std::fs::write(path, content).map_err(|_| { - IoError::new( - ErrorKind::Other, - "Error saving base64-encoded image to file", - ) - })?; - - // Release the lock after writing to the file - file.unlock() - .map_err(|_| IoError::new(ErrorKind::Other, "Error releasing file lock"))?; - - Ok(()) - } - - // Implement other file system operations as needed -} - -#[cfg(any(test, feature = "test-utils"))] -#[derive(Default)] -pub struct MockFileSystem; - -#[cfg(any(test, feature = "test-utils"))] -impl FileSystem for MockFileSystem { - fn read_to_string(&self, _path: &Path) -> IoResult { - Ok("".to_string()) - } - - fn write(&mut self, _path: &Path, _content: &str) -> IoResult<()> { - Ok(()) - } - - fn read_dir_files(&self, _path: &Path) -> IoResult> { - Ok(vec!["/secrets.json".to_string()]) - } - - fn create_dir_all(&mut self, _path: &Path) -> IoResult<()> { - Ok(()) - } - - fn write_with_lock(&self, _path: &Path, _content: &str) -> IoResult<()> { - Ok(()) - } -} - -#[cfg(test)] -mod tests { - use std::collections::HashMap; - - use super::*; - - // Now, for testing, create a mock implementation of the trait - #[derive(Default)] - struct MockFileSystem { - map: HashMap, - } - - impl FileSystem for MockFileSystem { - fn read_to_string(&self, path: &Path) -> IoResult { - Ok(self - .map - .get(path.to_str().unwrap()) - .cloned() - .unwrap_or_default()) - } - - fn write(&mut self, path: &Path, content: &str) -> IoResult<()> { - self.map - .insert(path.to_str().unwrap().to_string(), content.to_string()); - Ok(()) - } - - fn read_dir_files(&self, _path: &Path) -> IoResult> { - Ok(vec![]) - } - - fn create_dir_all(&mut self, _path: &Path) -> IoResult<()> { - Ok(()) - } - - fn write_with_lock(&self, _path: &Path, _content: &str) -> IoResult<()> { - Ok(()) - } - } - - #[test] - fn can_mock_fs_operations() { - let mut mock_fs = MockFileSystem::default(); - - let res = mock_fs.write("/file.txt".as_ref(), "2456535e-a316-4d9e-8ab4-74a33d75d1fa"); - assert!(res.is_ok()); - - let content = mock_fs.read_to_string("/file.txt".as_ref()).unwrap(); - assert_eq!(&content, "2456535e-a316-4d9e-8ab4-74a33d75d1fa"); - } -} From 35647ac4a9e46ad960ecc9efd542d9c545b5bfcd Mon Sep 17 00:00:00 2001 From: Hermann Core Date: Fri, 20 Jun 2025 15:34:08 +0100 Subject: [PATCH 05/25] refactor: update Dockerfile and docker-compose.yml for improved build process --- Dockerfile | 73 +++++++++--------------- README.md | 7 +-- docker-compose.yml | 138 +++++++++++++++++++++++---------------------- 3 files changed, 101 insertions(+), 117 deletions(-) diff --git a/Dockerfile b/Dockerfile index 31e58d88..8445ab4e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,50 +1,33 @@ -# syntax=docker/dockerfile:1.4 +ARG APP_NAME=didcomm-mediator -# Stage 1: Build -FROM rust:1.85-alpine AS builder +# Use buildx's automatic platform detection +FROM --platform=$BUILDPLATFORM blackdex/rust-musl:x86_64-musl AS builder-amd64 +FROM --platform=$BUILDPLATFORM blackdex/rust-musl:aarch64-musl AS builder-arm64 +# Select the appropriate builder based on target platform +FROM builder-${TARGETARCH} AS builder +ARG APP_NAME +ARG TARGETPLATFORM +ARG TARGETARCH WORKDIR /app -# Install required build dependencies, including OpenSSL development files -RUN apk add --no-cache \ - build-base \ - pkgconf \ - openssl-dev \ - musl-dev \ - ca-certificates \ - postgresql-dev \ - musl-utils \ - llvm-libunwind-dev - -# Set environment variables (disable static linking for OpenSSL) -ENV OPENSSL_STATIC=0 -ENV OPENSSL_DIR=/usr - -# Copy Cargo files separately to optimize caching -COPY Cargo.toml Cargo.lock ./ -COPY crates ./crates - -# Dummy build to cache dependencies -RUN mkdir src && echo "fn main() {}" > src/main.rs && \ - cargo build --release - -# Copy the actual source code -COPY src ./src - -# Build the project (using the host's default target) -RUN cargo build --release && \ - strip target/release/didcomm-mediator - -# Stage 2: Runtime using a distroless image -FROM gcr.io/distroless/static-debian12:latest - -WORKDIR /app - -# Copy the built binary from the builder stage -COPY --from=builder /app/target/release/didcomm-mediator /usr/local/bin/didcomm-mediator - -# Expose the port +# Set the Rust target and build the application +RUN --mount=type=bind,source=src,target=src \ + --mount=type=bind,source=crates,target=crates \ + --mount=type=bind,source=Cargo.toml,target=Cargo.toml \ + --mount=type=bind,source=Cargo.lock,target=Cargo.lock \ + --mount=type=cache,target=/app/target,id=target-cache-${TARGETPLATFORM} \ + --mount=type=cache,target=/root/.cargo/registry,id=registry-cache-${TARGETPLATFORM} \ + case "$TARGETARCH" in \ + amd64) RUST_TARGET="x86_64-unknown-linux-musl" ;; \ + arm64) RUST_TARGET="aarch64-unknown-linux-musl" ;; \ + *) echo "Unsupported architecture: $TARGETARCH" && exit 1 ;; \ + esac; \ + cargo build --locked --release --target=${RUST_TARGET}; \ + mv target/${RUST_TARGET}/release/${APP_NAME} . + +FROM gcr.io/distroless/static-debian12 AS runtime +ARG APP_NAME +COPY --from=builder --chown=nonroot:nonroot /app/${APP_NAME} /app/${APP_NAME} EXPOSE 3000 - -# Set the entrypoint -ENTRYPOINT ["/usr/local/bin/didcomm-mediator"] +ENTRYPOINT ["/app/didcomm-mediator"] \ No newline at end of file diff --git a/README.md b/README.md index 947d5c9a..ba1761c7 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ +# DIDComm-Mediator + [![CI](https://github.com/adorsys/didcomm-mediator-rs/actions/workflows/rust.yml/badge.svg)](https://github.com/adorsys/didcomm-mediator-rs/actions/workflows/rust.yml) [![DIDComm Messaging Clients Utilities](https://img.shields.io/badge/DIDComm%20Messaging%20Clients%20Utilities-repo-blue.svg)](https://github.com/adorsys/didcomm-messaging-clients-utilities) [![DIDComm Messaging Spec](https://img.shields.io/badge/DIDComm%20Messaging-Specification-blue.svg)](https://identity.foundation/didcomm-messaging/spec/) [![License](https://img.shields.io/badge/license-Apache%202.0-brightgreen.svg)](https://github.com/adorsys/didcomm-mediator-rs/blob/main/LICENSE) -# DIDComm-Mediator - A DIDComm mediator is a cloud agent that facilitates secure, decentralized communication between mobile agents in the self-sovereign identity (SSI) ecosystem. This mediator acts as a cloud-based intermediary, enabling mobile agents to communicate without reliance on centralized infrastructures like Facebook, Signal, or Telegram. For further understanding checkout the [docs](docs/mediator-doc.md) @@ -19,7 +19,7 @@ For further understanding checkout the [docs](docs/mediator-doc.md) |[Cross-Domain Messaging/ Routing Protocol](https://identity.foundation/didcomm-messaging/spec/#routing-protocol-20) | ADOPTED | ✅| |[Trust Ping Ptotocol](https://identity.foundation/didcomm-messaging/spec/#trust-ping-protocol-20) | ADOPTED|✅| |[Discover Features Protocol](https://didcomm.org/discover-features/2.0/) | ADOPTED | ✅ | -|[Out of band Messaging](https://identity.foundation/didcomm-messaging/spec/#out-of-band-messages) | ADOPTED | ✅ +|[Out of band Messaging](https://identity.foundation/didcomm-messaging/spec/#out-of-band-messages) | ADOPTED | ✅| |[Basic Message Protocol](https://didcomm.org/basicmessage/2.0/#:~:text=The%20BasicMessage%20protocol%20describes%20a,message%20type%20used%20to%20communicate.) | ADOPTED|⚪| |[Acks](https://github.com/hyperledger/aries-rfcs/tree/main/features/0015-acks)| ADOPTED |❌ | |[Present Proof Protocol](https://didcomm.org/present-proof/3.0/)| ADOPTED | ❌| @@ -70,7 +70,6 @@ You need to create a **`.env`** file in the root directory of the project and ad ```sh SERVER_PUBLIC_DOMAIN="http://localhost:8080" -STORAGE_DIRPATH="./storage" MONGO_DBN="DIDComm_DB" MONGO_URI="mongodb://localhost:27017" ``` diff --git a/docker-compose.yml b/docker-compose.yml index aa5d3cf3..2efb0666 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,84 +1,84 @@ version: '3.8' services: - prometheus: - image: prom/prometheus - container_name: prometheus - ports: - - 9090:9090 - command: --config.file=/etc/prometheus/prometheus.yml - volumes: - - ./prometheus.yml:/etc/prometheus/prometheus.yml - - ./alert.rules.yml:/etc/prometheus/alert.rules.yml - extra_hosts: - - "host.docker.internal:host-gateway" - restart: always - networks: - - mediator-network + # prometheus: + # image: prom/prometheus + # container_name: prometheus + # ports: + # - 9090:9090 + # command: --config.file=/etc/prometheus/prometheus.yml + # volumes: + # - ./prometheus.yml:/etc/prometheus/prometheus.yml + # - ./alert.rules.yml:/etc/prometheus/alert.rules.yml + # extra_hosts: + # - "host.docker.internal:host-gateway" + # restart: always + # networks: + # - mediator-network - grafana: - image: grafana/grafana - container_name: grafana - ports: - - 3001:3000 - volumes: - - grafana-storage:/var/lib/grafana - depends_on: - - prometheus - restart: always - networks: - - mediator-network + # grafana: + # image: grafana/grafana + # container_name: grafana + # ports: + # - 3001:3000 + # volumes: + # - grafana-storage:/var/lib/grafana + # depends_on: + # - prometheus + # restart: always + # networks: + # - mediator-network - alertmanager: - image: prom/alertmanager - container_name: alertmanager - ports: - - 9093:9093 - volumes: - - ./alertmanager.yml:/etc/alertmanager/alertmanager.yml - command: - - --config.file=/etc/alertmanager/alertmanager.yml - restart: always - depends_on: - - prometheus - networks: - - mediator-network + # alertmanager: + # image: prom/alertmanager + # container_name: alertmanager + # ports: + # - 9093:9093 + # volumes: + # - ./alertmanager.yml:/etc/alertmanager/alertmanager.yml + # command: + # - --config.file=/etc/alertmanager/alertmanager.yml + # restart: always + # depends_on: + # - prometheus + # networks: + # - mediator-network - discord-alerts: - image: benjojo/alertmanager-discord - container_name: discord-alerts - restart: always - environment: - - DISCORD_WEBHOOK=${DISCORD_WEBHOOK_URL} - ports: - - 9091:9094 - networks: - - mediator-network + # discord-alerts: + # image: benjojo/alertmanager-discord + # container_name: discord-alerts + # restart: always + # environment: + # - DISCORD_WEBHOOK=${DISCORD_WEBHOOK_URL} + # ports: + # - 9091:9094 + # networks: + # - mediator-network - node_exporter: - image: prom/node-exporter - container_name: node_exporter - ports: - - "9100:9100" - volumes: - - /proc:/host/proc:ro - - /sys:/host/sys:ro - - /run/udev:/run/udev:ro - - /:/rootfs:ro - command: - - '--path.procfs=/host/proc' - - '--path.sysfs=/host/sys' - - '--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)' - restart: always - networks: - - mediator-network + # node_exporter: + # image: prom/node-exporter + # container_name: node_exporter + # ports: + # - "9100:9100" + # volumes: + # - /proc:/host/proc:ro + # - /sys:/host/sys:ro + # - /run/udev:/run/udev:ro + # - /:/rootfs:ro + # command: + # - '--path.procfs=/host/proc' + # - '--path.sysfs=/host/sys' + # - '--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)' + # restart: always + # networks: + # - mediator-network mediator: build: context: . container_name: didcomm-mediator ports: - - "8080:8080" + - "3000:3000" env_file: - .env depends_on: @@ -89,6 +89,8 @@ services: mongodb: image: mongo:latest container_name: mongodb + ports: + - "27017:27017" volumes: - mongo-data:/data/db networks: From 22fa154a9e9ffc33b10a5ebc3bf5e6679e5e9851 Mon Sep 17 00:00:00 2001 From: Hermann Core Date: Fri, 20 Jun 2025 15:35:38 +0100 Subject: [PATCH 06/25] refactor: remove filesystem dependency from workspace --- Cargo.toml | 7 +++++-- crates/web-plugins/didcomm-messaging/Cargo.toml | 1 - crates/web-plugins/didcomm-messaging/shared/Cargo.toml | 1 - 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 29c70b7b..e71a053d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,7 +20,6 @@ path = "src/main.rs" [workspace] members = [ "crates/database", - "crates/filesystem", "crates/keystore", "crates/plugin-api", "crates/web-plugins/*", @@ -31,7 +30,6 @@ members = [ [workspace.dependencies] database = { path = "./crates/database", version = "0.1.0" } -filesystem = { path = "./crates/filesystem", version = "0.1.0" } keystore = { path = "./crates/keystore", version = "0.1.0" } plugin-api = { path = "./crates/plugin-api", version = "0.1.0" } did-endpoint = { path = "./crates/web-plugins/did-endpoint", version = "0.1.0" } @@ -49,6 +47,7 @@ mediator-coordination = { path = "./crates/web-plugins/didcomm-messaging/protoco # Other common dependencies +bson = { version = "2.7.0", features = ["serde_with"] } serde = "1.0" sha2 = "0.10" cfg-if = "1.0" @@ -101,6 +100,7 @@ tower-http = "0.6.2" aws-config = "1.1" axum-prometheus = "0.8.0" prometheus-client = "0.23.1" +tikv-jemallocator = "0.6" aws-sdk-kms = "1.49" base64ct = { version = "1.6.0", default-features = false } zeroize = { version = "1.8.1", default-features = false } @@ -128,6 +128,9 @@ did-endpoint = { workspace = true, optional = true } oob-messages = { workspace = true, optional = true } didcomm-messaging = { workspace = true, optional = true } +[target.'cfg(not(target_env = "msvc"))'.dependencies] +tikv-jemallocator.workspace = true + [features] default = [ diff --git a/crates/web-plugins/didcomm-messaging/Cargo.toml b/crates/web-plugins/didcomm-messaging/Cargo.toml index 53cc03fd..2335d869 100644 --- a/crates/web-plugins/didcomm-messaging/Cargo.toml +++ b/crates/web-plugins/didcomm-messaging/Cargo.toml @@ -17,7 +17,6 @@ did-endpoint.workspace = true keystore.workspace = true shared.workspace = true plugin-api.workspace = true -filesystem.workspace = true message-api.workspace = true # optional dependencies diff --git a/crates/web-plugins/didcomm-messaging/shared/Cargo.toml b/crates/web-plugins/didcomm-messaging/shared/Cargo.toml index 90086180..ad0084e4 100644 --- a/crates/web-plugins/didcomm-messaging/shared/Cargo.toml +++ b/crates/web-plugins/didcomm-messaging/shared/Cargo.toml @@ -6,7 +6,6 @@ edition = "2021" [dependencies] did-utils.workspace = true database.workspace = true -filesystem = { workspace = true, features = ["test-utils"] } keystore = { workspace = true, features = ["test-utils"] } json-canon.workspace = true From d926f1a86a73b2c657bebf9e0b300b18e51d742f Mon Sep 17 00:00:00 2001 From: Hermann Core Date: Fri, 20 Jun 2025 15:36:41 +0100 Subject: [PATCH 07/25] refactor: move global allocator definition for Jemalloc to improve memory performance --- src/main.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main.rs b/src/main.rs index 8b80f389..bee541a5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,8 +2,14 @@ use axum::routing::get; use didcomm_mediator::{app, health, metrics}; use eyre::{Result, WrapErr}; use std::net::SocketAddr; +#[cfg(not(target_env = "msvc"))] +use tikv_jemallocator::Jemalloc; use tokio::net::TcpListener; +#[cfg(not(target_env = "msvc"))] +#[global_allocator] +static GLOBAL: Jemalloc = Jemalloc; + #[tokio::main] async fn main() -> Result<()> { // Load dotenv-flow variables From e0dbc10f97cb49873b9cde1e35f720e5ba8344da Mon Sep 17 00:00:00 2001 From: Hermann Core Date: Fri, 20 Jun 2025 15:37:15 +0100 Subject: [PATCH 08/25] refactor: update dependencies --- Cargo.lock | 130 +++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 96 insertions(+), 34 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c0c4c09d..521019c3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -964,6 +964,7 @@ dependencies = [ "serde", "serde_bytes", "serde_json", + "serde_with 1.14.0", "time", "uuid 1.16.0", ] @@ -1050,12 +1051,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "cfg_aliases" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" - [[package]] name = "chacha20" version = "0.7.1" @@ -1368,6 +1363,16 @@ dependencies = [ "darling_macro 0.12.4", ] +[[package]] +name = "darling" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" +dependencies = [ + "darling_core 0.13.4", + "darling_macro 0.13.4", +] + [[package]] name = "darling" version = "0.20.10" @@ -1391,6 +1396,20 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "darling_core" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim 0.10.0", + "syn 1.0.109", +] + [[package]] name = "darling_core" version = "0.20.10" @@ -1401,7 +1420,7 @@ dependencies = [ "ident_case", "proc-macro2", "quote", - "strsim", + "strsim 0.11.1", "syn 2.0.100", ] @@ -1416,6 +1435,17 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "darling_macro" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" +dependencies = [ + "darling_core 0.13.4", + "quote", + "syn 1.0.109", +] + [[package]] name = "darling_macro" version = "0.20.10" @@ -1547,12 +1577,14 @@ dependencies = [ name = "did-endpoint" version = "0.1.0" dependencies = [ + "async-trait", "axum 0.7.9", + "bson", "cfg-if", "chrono", + "database", "did-utils", "dotenv-flow", - "filesystem", "http-body-util", "hyper 1.6.0", "json-canon", @@ -1561,6 +1593,7 @@ dependencies = [ "mongodb", "multibase", "plugin-api", + "serde", "serde_json", "thiserror 2.0.12", "tokio", @@ -1642,6 +1675,7 @@ dependencies = [ "prometheus-client", "serde_json", "thiserror 2.0.12", + "tikv-jemallocator", "tokio", "tower", "tower-http", @@ -1661,7 +1695,6 @@ dependencies = [ "did-utils", "didcomm", "discover-features", - "filesystem", "forward", "http-body-util", "hyper 1.6.0", @@ -1949,13 +1982,6 @@ version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" -[[package]] -name = "filesystem" -version = "0.1.0" -dependencies = [ - "nix", -] - [[package]] name = "flate2" version = "1.1.0" @@ -3303,12 +3329,12 @@ dependencies = [ "rustls-pemfile", "serde", "serde_bytes", - "serde_with", + "serde_with 3.12.0", "sha-1", "sha2 0.10.8", "socket2", "stringprep", - "strsim", + "strsim 0.11.1", "take_mut", "thiserror 1.0.69", "tokio", @@ -3365,18 +3391,6 @@ version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" -[[package]] -name = "nix" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" -dependencies = [ - "bitflags 2.9.0", - "cfg-if", - "cfg_aliases", - "libc", -] - [[package]] name = "nom" version = "7.1.3" @@ -3480,11 +3494,12 @@ version = "0.1.0" dependencies = [ "axum 0.7.9", "base64 0.22.1", + "database", + "did-endpoint", "did-utils", - "filesystem", "image", - "lazy_static", "mockall", + "mongodb", "multibase", "plugin-api", "qrcode", @@ -4495,6 +4510,16 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_with" +version = "1.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "678b5a069e50bf00ecd22d0cd8ddf7c236f68581b03db652061ed5eb13a312ff" +dependencies = [ + "serde", + "serde_with_macros 1.5.2", +] + [[package]] name = "serde_with" version = "3.12.0" @@ -4509,10 +4534,22 @@ dependencies = [ "serde", "serde_derive", "serde_json", - "serde_with_macros", + "serde_with_macros 3.12.0", "time", ] +[[package]] +name = "serde_with_macros" +version = "1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e182d6ec6f05393cc0e5ed1bf81ad6db3a8feedf8ee515ecdd369809bcce8082" +dependencies = [ + "darling 0.13.4", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "serde_with_macros" version = "3.12.0" @@ -4579,7 +4616,6 @@ dependencies = [ "did-utils", "didcomm", "eyre", - "filesystem", "json-canon", "keystore", "mongodb", @@ -4698,6 +4734,12 @@ dependencies = [ "unicode-properties", ] +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + [[package]] name = "strsim" version = "0.11.1" @@ -4861,6 +4903,26 @@ dependencies = [ "weezl", ] +[[package]] +name = "tikv-jemalloc-sys" +version = "0.6.0+5.3.0-1-ge13ca993e8ccb9ba9847cc330696e02839f328f7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd3c60906412afa9c2b5b5a48ca6a5abe5736aec9eb48ad05037a677e52e4e2d" +dependencies = [ + "cc", + "libc", +] + +[[package]] +name = "tikv-jemallocator" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cec5ff18518d81584f477e9bfdf957f5bb0979b0bac3af4ca30b5b3ae2d2865" +dependencies = [ + "libc", + "tikv-jemalloc-sys", +] + [[package]] name = "time" version = "0.3.40" From d8feca72519db45786231cd25ff6cc3bf30d9bdb Mon Sep 17 00:00:00 2001 From: Hermann Core Date: Fri, 20 Jun 2025 15:42:28 +0100 Subject: [PATCH 09/25] style: apply code formatting --- crates/web-plugins/did-endpoint/src/didgen.rs | 5 +- crates/web-plugins/did-endpoint/src/web.rs | 22 +++-- crates/web-plugins/oob-messages/src/plugin.rs | 20 ++--- .../oob-messages/src/web/handler.rs | 84 +++++++++---------- 4 files changed, 62 insertions(+), 69 deletions(-) diff --git a/crates/web-plugins/did-endpoint/src/didgen.rs b/crates/web-plugins/did-endpoint/src/didgen.rs index 65d998b0..e7b9effe 100644 --- a/crates/web-plugins/did-endpoint/src/didgen.rs +++ b/crates/web-plugins/did-endpoint/src/didgen.rs @@ -255,10 +255,7 @@ pub(crate) mod tests { ) .unwrap(); repository - .store(MediatorDidDocument { - id: None, - diddoc, - }) + .store(MediatorDidDocument { id: None, diddoc }) .await .unwrap(); diff --git a/crates/web-plugins/did-endpoint/src/web.rs b/crates/web-plugins/did-endpoint/src/web.rs index 158eae19..45c7303f 100644 --- a/crates/web-plugins/did-endpoint/src/web.rs +++ b/crates/web-plugins/did-endpoint/src/web.rs @@ -53,8 +53,8 @@ async fn didpop( .ok_or(StatusCode::NOT_FOUND)?; let diddoc_value = diddoc_entity.diddoc; - let diddoc: Document = - serde_json::from_value(json!(diddoc_value)).map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)?; + let diddoc: Document = serde_json::from_value(json!(diddoc_value)) + .map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)?; let did_address = diddoc.id.clone(); let methods = diddoc.verification_method.clone().unwrap_or_default(); @@ -183,7 +183,10 @@ fn inspect_vm_relationship(diddoc: &Document, vm_id: &str) -> Option { #[cfg(test)] mod tests { use super::*; - use crate::{didgen::tests::*, persistence::{tests::MockDidDocumentRepository, MediatorDidDocument}}; + use crate::{ + didgen::tests::*, + persistence::{tests::MockDidDocumentRepository, MediatorDidDocument}, + }; use axum::{ body::Body, @@ -230,12 +233,13 @@ mod tests { let repository = MockDidDocumentRepository::new(); let mock_keystore = Keystore::with_mock_configs(vec![(kid, setup())]); - repository.store(MediatorDidDocument { - id: None, - diddoc: expected_diddoc.clone(), - }) - .await - .unwrap(); + repository + .store(MediatorDidDocument { + id: None, + diddoc: expected_diddoc.clone(), + }) + .await + .unwrap(); // Setup state with mocks let state = DidEndPointState { diff --git a/crates/web-plugins/oob-messages/src/plugin.rs b/crates/web-plugins/oob-messages/src/plugin.rs index be91ba3d..1b53c6c2 100644 --- a/crates/web-plugins/oob-messages/src/plugin.rs +++ b/crates/web-plugins/oob-messages/src/plugin.rs @@ -58,21 +58,19 @@ impl Plugin for OOBMessages { .find_one_by(doc! {}) .await .map_err(|e| PluginError::Other(e.to_string()))? - .ok_or_else(|| PluginError::Other("Missing did.json from repository".to_string())) + .ok_or_else(|| { + PluginError::Other("Missing did.json from repository".to_string()) + }) }) })?; let diddoc = diddoc.diddoc; - let oob_inv = retrieve_or_generate_oob_inv( - &mut store, - &diddoc, - &env.server_public_domain, - ) - .map_err(|err| { - PluginError::InitError(format!( - "Error retrieving or generating OOB invitation: {err}" - )) - })?; + let oob_inv = retrieve_or_generate_oob_inv(&mut store, &diddoc, &env.server_public_domain) + .map_err(|err| { + PluginError::InitError(format!( + "Error retrieving or generating OOB invitation: {err}" + )) + })?; tracing::debug!("Out Of Band Invitation: {}", oob_inv); diff --git a/crates/web-plugins/oob-messages/src/web/handler.rs b/crates/web-plugins/oob-messages/src/web/handler.rs index 8de3db39..411f7579 100644 --- a/crates/web-plugins/oob-messages/src/web/handler.rs +++ b/crates/web-plugins/oob-messages/src/web/handler.rs @@ -9,42 +9,38 @@ use std::sync::Arc; pub(crate) async fn handler_oob_inv(State(state): State>) -> Response { let mut store = state.store.lock().unwrap(); - let content = match retrieve_or_generate_oob_inv( - &mut *store, - &state.diddoc, - &state.server_public_domain, - ) { - Ok(oob_inv) => oob_inv, - Err(err) => { - tracing::error!("Failed to retrieve or generate oob invitation: {err:?}"); - return ( - StatusCode::SERVICE_UNAVAILABLE, - "Could not process request at this time. Please try again later", - ) - .into_response(); - } - }; + let content = + match retrieve_or_generate_oob_inv(&mut *store, &state.diddoc, &state.server_public_domain) + { + Ok(oob_inv) => oob_inv, + Err(err) => { + tracing::error!("Failed to retrieve or generate oob invitation: {err:?}"); + return ( + StatusCode::SERVICE_UNAVAILABLE, + "Could not process request at this time. Please try again later", + ) + .into_response(); + } + }; content.into_response() } pub(crate) async fn handler_oob_qr(State(state): State>) -> Response { let mut store = state.store.lock().unwrap(); - let oob_inv = match retrieve_or_generate_oob_inv( - &mut *store, - &state.diddoc, - &state.server_public_domain, - ) { - Ok(oob_inv) => oob_inv, - Err(err) => { - tracing::error!("Failed to retrieve or generate oob invitation: {err:?}"); - return ( - StatusCode::SERVICE_UNAVAILABLE, - "Could not process request at this time. Please try again later", - ) - .into_response(); - } - }; + let oob_inv = + match retrieve_or_generate_oob_inv(&mut *store, &state.diddoc, &state.server_public_domain) + { + Ok(oob_inv) => oob_inv, + Err(err) => { + tracing::error!("Failed to retrieve or generate oob invitation: {err:?}"); + return ( + StatusCode::SERVICE_UNAVAILABLE, + "Could not process request at this time. Please try again later", + ) + .into_response(); + } + }; let image_data = match retrieve_or_generate_qr_image(&mut *store, &oob_inv) { Ok(data) => data, @@ -84,21 +80,19 @@ pub(crate) async fn handler_landing_page_oob( State(state): State>, ) -> Response { let mut store = state.store.lock().unwrap(); - let oob_inv = match retrieve_or_generate_oob_inv( - &mut *store, - &state.diddoc, - &state.server_public_domain, - ) { - Ok(oob_inv) => oob_inv, - Err(err) => { - tracing::error!("Failed to retrieve or generate oob invitation: {err:?}"); - return ( - StatusCode::SERVICE_UNAVAILABLE, - "Could not process request at this time. Please try again later", - ) - .into_response(); - } - }; + let oob_inv = + match retrieve_or_generate_oob_inv(&mut *store, &state.diddoc, &state.server_public_domain) + { + Ok(oob_inv) => oob_inv, + Err(err) => { + tracing::error!("Failed to retrieve or generate oob invitation: {err:?}"); + return ( + StatusCode::SERVICE_UNAVAILABLE, + "Could not process request at this time. Please try again later", + ) + .into_response(); + } + }; let image_data = match retrieve_or_generate_qr_image(&mut *store, &oob_inv) { Ok(data) => data, From 9dd7fab8a8f98eecd31ee78d92f4767eca3a3e5f Mon Sep 17 00:00:00 2001 From: Hermann Core Date: Fri, 20 Jun 2025 16:09:59 +0100 Subject: [PATCH 10/25] refactor: remove unused DashMap import --- crates/web-plugins/didcomm-messaging/src/plugin.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/crates/web-plugins/didcomm-messaging/src/plugin.rs b/crates/web-plugins/didcomm-messaging/src/plugin.rs index d69bd5e2..0ef07308 100644 --- a/crates/web-plugins/didcomm-messaging/src/plugin.rs +++ b/crates/web-plugins/didcomm-messaging/src/plugin.rs @@ -1,6 +1,5 @@ use crate::{manager::MessagePluginContainer, web}; use axum::Router; -use dashmap::DashMap; use database::get_or_init_database; use database::Repository; use did_endpoint::persistence::DidDocumentRepository; From 8ebf2d0ba12a2ee2b4723b43f32aca4d8925e74f Mon Sep 17 00:00:00 2001 From: Hermann Core Date: Fri, 20 Jun 2025 16:10:22 +0100 Subject: [PATCH 11/25] refactor: remove obsolete version specification from docker-compose.yml --- docker-compose.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 2781f53d..4b33a6ae 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,3 @@ -version: '3.8' - services: mediator: build: From 5aa44c79b3d692d0691c09ccf5d9acbfe9731806 Mon Sep 17 00:00:00 2001 From: Hermann Core Date: Fri, 20 Jun 2025 16:10:47 +0100 Subject: [PATCH 12/25] refactor: remove unused dependencies from Cargo.toml files --- Cargo.lock | 154 +-------------------- crates/web-plugins/did-endpoint/Cargo.toml | 5 +- crates/web-plugins/oob-messages/Cargo.toml | 1 - 3 files changed, 6 insertions(+), 154 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ba4ff414..9e2afc96 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -95,12 +95,6 @@ dependencies = [ "libc", ] -[[package]] -name = "anstyle" -version = "1.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" - [[package]] name = "anyhow" version = "1.0.97" @@ -963,7 +957,6 @@ dependencies = [ "serde", "serde_bytes", "serde_json", - "serde_with 1.14.0", "time", "uuid 1.16.0", ] @@ -1362,16 +1355,6 @@ dependencies = [ "darling_macro 0.12.4", ] -[[package]] -name = "darling" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" -dependencies = [ - "darling_core 0.13.4", - "darling_macro 0.13.4", -] - [[package]] name = "darling" version = "0.20.10" @@ -1395,20 +1378,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "darling_core" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim 0.10.0", - "syn 1.0.109", -] - [[package]] name = "darling_core" version = "0.20.10" @@ -1419,7 +1388,7 @@ dependencies = [ "ident_case", "proc-macro2", "quote", - "strsim 0.11.1", + "strsim", "syn 2.0.100", ] @@ -1434,17 +1403,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "darling_macro" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" -dependencies = [ - "darling_core 0.13.4", - "quote", - "syn 1.0.109", -] - [[package]] name = "darling_macro" version = "0.20.10" @@ -1564,17 +1522,14 @@ version = "0.1.0" dependencies = [ "async-trait", "axum 0.7.9", - "bson", - "cfg-if", "chrono", "database", "did-utils", "dotenv-flow", "http-body-util", - "hyper 1.6.0", "json-canon", "keystore", - "mockall", + "mongodb", "multibase", "plugin-api", "serde", @@ -1754,12 +1709,6 @@ version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ccff2060df2e1a42732ab1e7af8c5f930ed3d0255aaadfae66e032781e8d271a" -[[package]] -name = "downcast" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1435fa1053d8b2fbbe9be7e97eca7f33d37b28409959813daefc1446a14247f1" - [[package]] name = "dtoa" version = "1.0.10" @@ -2032,12 +1981,6 @@ dependencies = [ "uuid 1.16.0", ] -[[package]] -name = "fragile" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa" - [[package]] name = "fs_extra" version = "1.3.0" @@ -3246,32 +3189,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "mockall" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39a6bfcc6c8c7eed5ee98b9c3e33adc726054389233e201c95dab2d41a3839d2" -dependencies = [ - "cfg-if", - "downcast", - "fragile", - "mockall_derive", - "predicates", - "predicates-tree", -] - -[[package]] -name = "mockall_derive" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25ca3004c2efe9011bd4e461bd8256445052b9615405b4f7ea43fc8ca5c20898" -dependencies = [ - "cfg-if", - "proc-macro2", - "quote", - "syn 2.0.100", -] - [[package]] name = "mongodb" version = "3.2.1" @@ -3305,12 +3222,12 @@ dependencies = [ "rustls-pemfile", "serde", "serde_bytes", - "serde_with 3.12.0", + "serde_with", "sha-1", "sha2 0.10.8", "socket2", "stringprep", - "strsim 0.11.1", + "strsim", "take_mut", "thiserror 1.0.69", "tokio", @@ -3474,7 +3391,6 @@ dependencies = [ "did-endpoint", "did-utils", "image", - "mockall", "mongodb", "multibase", "plugin-api", @@ -3768,32 +3684,6 @@ dependencies = [ "zerocopy 0.8.23", ] -[[package]] -name = "predicates" -version = "3.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d19ee57562043d37e82899fade9a22ebab7be9cef5026b07fda9cdd4293573" -dependencies = [ - "anstyle", - "predicates-core", -] - -[[package]] -name = "predicates-core" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "727e462b119fe9c93fd0eb1429a5f7647394014cf3c04ab2c0350eeb09095ffa" - -[[package]] -name = "predicates-tree" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72dd2d6d381dfb73a193c7fca536518d7caee39fc8503f74e7dc0be0531b425c" -dependencies = [ - "predicates-core", - "termtree", -] - [[package]] name = "prettyplease" version = "0.2.31" @@ -4486,16 +4376,6 @@ dependencies = [ "serde", ] -[[package]] -name = "serde_with" -version = "1.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "678b5a069e50bf00ecd22d0cd8ddf7c236f68581b03db652061ed5eb13a312ff" -dependencies = [ - "serde", - "serde_with_macros 1.5.2", -] - [[package]] name = "serde_with" version = "3.12.0" @@ -4510,22 +4390,10 @@ dependencies = [ "serde", "serde_derive", "serde_json", - "serde_with_macros 3.12.0", + "serde_with_macros", "time", ] -[[package]] -name = "serde_with_macros" -version = "1.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e182d6ec6f05393cc0e5ed1bf81ad6db3a8feedf8ee515ecdd369809bcce8082" -dependencies = [ - "darling 0.13.4", - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "serde_with_macros" version = "3.12.0" @@ -4709,12 +4577,6 @@ dependencies = [ "unicode-properties", ] -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - [[package]] name = "strsim" version = "0.11.1" @@ -4811,12 +4673,6 @@ dependencies = [ "windows-sys 0.59.0", ] -[[package]] -name = "termtree" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f50febec83f5ee1df3015341d8bd429f2d1cc62bcba7ea2076759d315084683" - [[package]] name = "thiserror" version = "1.0.69" diff --git a/crates/web-plugins/did-endpoint/Cargo.toml b/crates/web-plugins/did-endpoint/Cargo.toml index b23468d9..e87c5a5a 100644 --- a/crates/web-plugins/did-endpoint/Cargo.toml +++ b/crates/web-plugins/did-endpoint/Cargo.toml @@ -15,9 +15,7 @@ plugin-api.workspace = true did-utils.workspace = true database.workspace = true async-trait.workspace = true -bson.workspace = true -cfg-if.workspace = true chrono.workspace = true thiserror.workspace = true serde = { workspace = true, features = ["derive"] } @@ -25,14 +23,13 @@ serde_json.workspace = true dotenv-flow.workspace = true multibase.workspace = true tracing.workspace = true +mongodb.workspace = true http-body-util.workspace = true uuid = { workspace = true, features = ["v4"] } -hyper = { workspace = true, features = ["full"] } tokio = { workspace = true, features = ["full"] } axum = { workspace = true, features = ["macros"] } [dev-dependencies] -mockall = "0.13.1" json-canon = "0.1.3" keystore = { workspace = true, features = ["test-utils"] } tower = { version = "0.5.2", features = ["util"] } diff --git a/crates/web-plugins/oob-messages/Cargo.toml b/crates/web-plugins/oob-messages/Cargo.toml index de269112..7b582c78 100644 --- a/crates/web-plugins/oob-messages/Cargo.toml +++ b/crates/web-plugins/oob-messages/Cargo.toml @@ -23,6 +23,5 @@ mongodb.workspace = true [dev-dependencies] tower = "0.5" -mockall = "0.13.1" tokio = { version = "1.42.0", features = ["full"] } did-endpoint = { workspace = true, features = ["test-utils"] } From 8f1ab89c169ed723e4d40c36cfa3fab14ecd006b Mon Sep 17 00:00:00 2001 From: Hermann Core Date: Mon, 30 Jun 2025 10:44:15 +0100 Subject: [PATCH 13/25] fix: fix deps conflicts in the lock file --- Cargo.lock | 1120 +++++++++++++++++++++++++++++----------------------- 1 file changed, 624 insertions(+), 496 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fc36dcd6..889224f5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -13,9 +13,9 @@ dependencies = [ [[package]] name = "adler2" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" [[package]] name = "aead" @@ -54,15 +54,15 @@ dependencies = [ [[package]] name = "ahash" -version = "0.8.11" +version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" dependencies = [ "cfg-if", - "getrandom 0.2.15", + "getrandom 0.3.3", "once_cell", "version_check", - "zerocopy 0.7.35", + "zerocopy", ] [[package]] @@ -76,9 +76,12 @@ dependencies = [ [[package]] name = "aligned-vec" -version = "0.5.0" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4aa90d7ce82d4be67b64039a3d588d38dbcc6736577de4a847025ce5b0c468d1" +checksum = "dc890384c8602f339876ded803c97ad529f3842aba97f6392b3dba0dd171769b" +dependencies = [ + "equator", +] [[package]] name = "android-tzdata" @@ -97,9 +100,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.97" +version = "1.0.98" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcfed56ad506cb2c684a14971b8861fdc3baaaae314b9e5f9bb532cbe3ba7a4f" +checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487" [[package]] name = "arbitrary" @@ -115,7 +118,7 @@ checksum = "0ae92a5119aa49cdbcf6b9f893fe4e1d98b04ccbf82ee0584ad948a44a734dea" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.104", ] [[package]] @@ -152,7 +155,7 @@ dependencies = [ "rand 0.8.5", "serde", "serde-json-core", - "sha2 0.10.8", + "sha2 0.10.9", "subtle", "x25519-dalek 1.1.1", "zeroize", @@ -193,14 +196,15 @@ dependencies = [ [[package]] name = "async-executor" -version = "1.13.1" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30ca9a001c1e8ba5149f91a74362376cc6bc5b919d92d988668657bd570bdcec" +checksum = "bb812ffb58524bdd10860d7d974e2f01cc0950c2438a74ee5ec2e2280c6c4ffa" dependencies = [ "async-task", "concurrent-queue", "fastrand", "futures-lite", + "pin-project-lite", "slab", ] @@ -221,9 +225,9 @@ dependencies = [ [[package]] name = "async-io" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a2b323ccce0a1d90b449fd71f2a06ca7faa7c54c2751f06c9bd851fc061059" +checksum = "1237c0ae75a0f3765f58910ff9cdd0a12eeb39ab2f4c7de23262f337f0aacbb3" dependencies = [ "async-lock", "cfg-if", @@ -232,7 +236,7 @@ dependencies = [ "futures-lite", "parking", "polling", - "rustix", + "rustix 1.0.7", "slab", "tracing", "windows-sys 0.59.0", @@ -290,7 +294,7 @@ checksum = "e539d3fca749fcee5236ab05e93a52867dd549cc157c8cb7f99595f3cedffdb5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.104", ] [[package]] @@ -301,15 +305,15 @@ checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" [[package]] name = "autocfg" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" [[package]] name = "av1-grain" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6678909d8c5d46a42abcf571271e15fdbc0a225e3646cf23762cd415046c78bf" +checksum = "4f3efb2ca85bc610acfa917b5aaa36f3fcbebed5b3182d7f877b02531c4b80c8" dependencies = [ "anyhow", "arrayvec", @@ -321,9 +325,9 @@ dependencies = [ [[package]] name = "avif-serialize" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98922d6a4cfbcb08820c69d8eeccc05bb1f29bfa06b4f5b1dbfe9a868bd7608e" +checksum = "19135c0c7a60bfee564dbe44ab5ce0557c6bf3884e5291a50be76a15640c4fbd" dependencies = [ "arrayvec", ] @@ -372,9 +376,9 @@ dependencies = [ [[package]] name = "aws-lc-rs" -version = "1.12.6" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dabb68eb3a7aa08b46fddfd59a3d55c978243557a90ab804769f7e20e67d2b01" +checksum = "93fcc8f365936c834db5514fc45aee5b1202d677e6b40e48468aaaa8183ca8c7" dependencies = [ "aws-lc-sys", "zeroize", @@ -382,9 +386,9 @@ dependencies = [ [[package]] name = "aws-lc-sys" -version = "0.27.1" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77926887776171ced7d662120a75998e444d3750c951abfe07f90da130514b1f" +checksum = "61b1d86e7705efe1be1b569bab41d4fa1e14e220b60a160f78de2db687add079" dependencies = [ "bindgen", "cc", @@ -414,14 +418,14 @@ dependencies = [ "percent-encoding", "pin-project-lite", "tracing", - "uuid 1.16.0", + "uuid 1.17.0", ] [[package]] name = "aws-sdk-kms" -version = "1.76.0" +version = "1.76.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8565497721d9f18fa29a68bc5d8225b39e1cc7399d7fc6f1ad803ca934341804" +checksum = "ddea79bde6e73fdcba2f9f9640cb0402948d5679fd92ab49d3296a9ce5d1bfa9" dependencies = [ "aws-credential-types", "aws-runtime", @@ -507,9 +511,9 @@ dependencies = [ [[package]] name = "aws-sdk-sts" -version = "1.74.0" +version = "1.75.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19d440e1d368759bd10df0dbdddbfff6473d7cd73e9d9ef2363dc9995ac2d711" +checksum = "e3258fa707f2f585ee3049d9550954b959002abd59176975150a01d5cf38ae3f" dependencies = [ "aws-credential-types", "aws-runtime", @@ -545,7 +549,7 @@ dependencies = [ "http 0.2.12", "http 1.3.1", "percent-encoding", - "sha2 0.10.8", + "sha2 0.10.9", "time", "tracing", ] @@ -583,26 +587,26 @@ dependencies = [ [[package]] name = "aws-smithy-http-client" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f491388e741b7ca73b24130ff464c1478acc34d5b331b7dd0a2ee4643595a15" +checksum = "f108f1ca850f3feef3009bdcc977be201bca9a91058864d9de0684e64514bee0" dependencies = [ "aws-smithy-async", "aws-smithy-runtime-api", "aws-smithy-types", "h2 0.3.26", - "h2 0.4.8", + "h2 0.4.10", "http 0.2.12", "http 1.3.1", "http-body 0.4.6", "hyper 0.14.32", "hyper 1.6.0", "hyper-rustls 0.24.2", - "hyper-rustls 0.27.5", + "hyper-rustls 0.27.7", "hyper-util", "pin-project-lite", "rustls 0.21.12", - "rustls 0.23.25", + "rustls 0.23.28", "rustls-native-certs 0.8.1", "rustls-pki-types", "tokio", @@ -739,7 +743,7 @@ dependencies = [ "aws-smithy-runtime-api", "aws-smithy-types", "linked-hash-map", - "rustls 0.23.25", + "rustls 0.23.28", "serde", "serde_json", "serde_with", @@ -784,11 +788,11 @@ dependencies = [ [[package]] name = "axum" -version = "0.8.1" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d6fd624c75e18b3b4c6b9caf42b1afe24437daaee904069137d8bab077be8b8" +checksum = "021e862c184ae977658b36c4500f7feac3221ca5da43e3f25bd04ab6c79a29b5" dependencies = [ - "axum-core 0.5.0", + "axum-core 0.5.2", "bytes", "form_urlencoded", "futures-util", @@ -839,12 +843,12 @@ dependencies = [ [[package]] name = "axum-core" -version = "0.5.0" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df1362f362fd16024ae199c1970ce98f9661bf5ef94b9808fee734bc3698b733" +checksum = "68464cd0412f486726fb3373129ef5d2993f90c34bc2bc1c1e9943b2f4fc7ca6" dependencies = [ "bytes", - "futures-util", + "futures-core", "http 1.3.1", "http-body 1.0.1", "http-body-util", @@ -865,7 +869,7 @@ checksum = "57d123550fa8d071b7255cb0cc04dc302baa6c8c4a79f55701552684d8399bce" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.104", ] [[package]] @@ -874,7 +878,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42e1a6651f119707ec6c416f38fdb5be223707627fe6d47f912850634c106215" dependencies = [ - "axum 0.8.1", + "axum 0.8.4", "bytes", "futures-core", "http 1.3.1", @@ -890,9 +894,9 @@ dependencies = [ [[package]] name = "backtrace" -version = "0.3.74" +version = "0.3.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" +checksum = "6806a6321ec58106fea15becdad98371e28d92ccbc7c8f1b3b6dd724fe8f1002" dependencies = [ "addr2line", "cfg-if", @@ -945,9 +949,9 @@ dependencies = [ [[package]] name = "base64ct" -version = "1.7.3" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89e25b6adfb930f02d1981565a6e5d9c547ac15a96606256d3b59040e5cd4ca3" +checksum = "55248b47b0caf0546f7988906588779981c43bb1bc9d0c44087278f80cdb44ba" [[package]] name = "basic-message" @@ -968,7 +972,7 @@ version = "0.69.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.9.1", "cexpr", "clang-sys", "itertools", @@ -981,7 +985,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.100", + "syn 2.0.104", "which", ] @@ -1005,9 +1009,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.9.0" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" +checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" [[package]] name = "bitstream-io" @@ -1104,25 +1108,25 @@ checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" [[package]] name = "bson" -version = "2.14.0" +version = "2.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af8113ff51309e2779e8785a246c10fb783e8c2452f134d6257fd71cc03ccd6c" +checksum = "7969a9ba84b0ff843813e7249eed1678d9b6607ce5a3b8f0a47af3fcf7978e6e" dependencies = [ "ahash", "base64 0.22.1", "bitvec", - "getrandom 0.2.15", - "getrandom 0.3.2", + "getrandom 0.2.16", + "getrandom 0.3.3", "hex", - "indexmap 2.8.0", + "indexmap 2.10.0", "js-sys", "once_cell", - "rand 0.9.0", + "rand 0.9.1", "serde", "serde_bytes", "serde_json", "time", - "uuid 1.16.0", + "uuid 1.17.0", ] [[package]] @@ -1133,15 +1137,15 @@ checksum = "56ed6191a7e78c36abdb16ab65341eefd73d64d303fffccdbb00d51e4205967b" [[package]] name = "bumpalo" -version = "3.17.0" +version = "3.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf" +checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" [[package]] name = "bytemuck" -version = "1.22.0" +version = "1.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6b1fc10dbac614ebc03540c9dbd60e83887fda27794998c6528f1782047d540" +checksum = "5c76a5792e44e4abe34d3abf15636779261d45a7450612059293d1d2cfc63422" [[package]] name = "byteorder" @@ -1173,9 +1177,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.16" +version = "1.2.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be714c154be609ec7f5dad223a33bf1482fff90472de28f7362806e6d4832b8c" +checksum = "d487aa071b5f64da6f19a3e848e3578944b726ee5a4854b82172f02aa876bfdc" dependencies = [ "jobserver", "libc", @@ -1203,9 +1207,9 @@ dependencies = [ [[package]] name = "cfg-if" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" [[package]] name = "chacha20" @@ -1234,9 +1238,9 @@ dependencies = [ [[package]] name = "chrono" -version = "0.4.40" +version = "0.4.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a7964611d71df112cb1730f2ee67324fcf4d0fc6606acbbe9bfe06df124637c" +checksum = "c469d952047f47f91b68d1cba3f10d63c11d73e4636f24f08daf0278abf01c4d" dependencies = [ "android-tzdata", "iana-time-zone", @@ -1318,7 +1322,7 @@ version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9d839f2a20b0aee515dc581a6172f2321f96cab76c1a38a4c584a194955390e" dependencies = [ - "getrandom 0.2.15", + "getrandom 0.2.16", "once_cell", "tiny-keccak", ] @@ -1341,9 +1345,9 @@ dependencies = [ [[package]] name = "core-foundation" -version = "0.10.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b55271e5c8c478ad3f38ad24ef34923091e0548492a266d19b3c0b4d82574c63" +checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" dependencies = [ "core-foundation-sys", "libc", @@ -1409,9 +1413,9 @@ checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" [[package]] name = "crunchy" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43da5946c66ffcc7745f48db692ffbb10a83bfe0afd96235c5c2a4fb23994929" +checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" [[package]] name = "crypto-bigint" @@ -1506,7 +1510,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.104", ] [[package]] @@ -1521,12 +1525,12 @@ dependencies = [ [[package]] name = "darling" -version = "0.20.10" +version = "0.20.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" +checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" dependencies = [ - "darling_core 0.20.10", - "darling_macro 0.20.10", + "darling_core 0.20.11", + "darling_macro 0.20.11", ] [[package]] @@ -1544,16 +1548,16 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.20.10" +version = "0.20.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" +checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", "strsim", - "syn 2.0.100", + "syn 2.0.104", ] [[package]] @@ -1569,26 +1573,26 @@ dependencies = [ [[package]] name = "darling_macro" -version = "0.20.10" +version = "0.20.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" +checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" dependencies = [ - "darling_core 0.20.10", + "darling_core 0.20.11", "quote", - "syn 2.0.100", + "syn 2.0.104", ] [[package]] name = "data-encoding" -version = "2.8.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "575f75dfd25738df5b91b8e43e14d44bda14637a58fae779fd2b064f8bf3e010" +checksum = "2a2330da5de22e8a3cb63252ce2abb30116bf5265e89c0e01bc17015ce30a476" [[package]] name = "data-encoding-macro" -version = "0.1.17" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f9724adfcf41f45bf652b3995837669d73c4d49a1b5ac1ff82905ac7d9b5558" +checksum = "47ce6c96ea0102f01122a185683611bd5ac8d99e62bc59dd12e6bda344ee673d" dependencies = [ "data-encoding", "data-encoding-macro-internal", @@ -1596,12 +1600,12 @@ dependencies = [ [[package]] name = "data-encoding-macro-internal" -version = "0.1.15" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18e4fdb82bd54a12e42fb58a800dcae6b9e13982238ce2296dc3570b92148e1f" +checksum = "8d162beedaa69905488a8da94f5ac3edb4dd4788b732fadb7bd120b2625c1976" dependencies = [ "data-encoding", - "syn 2.0.100", + "syn 2.0.104", ] [[package]] @@ -1627,9 +1631,9 @@ dependencies = [ [[package]] name = "der" -version = "0.7.9" +version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" dependencies = [ "const-oid 0.9.6", "zeroize", @@ -1653,42 +1657,39 @@ checksum = "d65d7ce8132b7c0e54497a4d9a55a1c2a0912a0d786cf894472ba818fba45762" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.104", ] [[package]] name = "derive-where" -version = "1.2.7" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62d671cc41a825ebabc75757b62d3d168c577f9149b2d49ece1dad1f72119d25" +checksum = "510c292c8cf384b1a340b816a9a6cf2599eb8f566a44949024af88418000c50b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.104", ] [[package]] name = "derive_more" -version = "0.99.19" +version = "0.99.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3da29a38df43d6f156149c9b43ded5e018ddff2a855cf2cfd62e8cd7d079c69f" +checksum = "6edb4b64a43d977b8e99788fe3a04d483834fba1215a7e02caa415b626497f7f" dependencies = [ "convert_case", "proc-macro2", "quote", "rustc_version", - "syn 2.0.100", + "syn 2.0.104", ] [[package]] name = "did-endpoint" version = "0.1.0" dependencies = [ -<<<<<<< HEAD "async-trait", -======= "aws-config", ->>>>>>> origin/main "axum 0.7.9", "chrono", "database", @@ -1706,7 +1707,7 @@ dependencies = [ "tokio", "tower", "tracing", - "uuid 1.16.0", + "uuid 1.17.0", ] [[package]] @@ -1720,7 +1721,7 @@ dependencies = [ "chrono", "curve25519-dalek 4.1.3", "ed25519-dalek 2.1.1", - "getrandom 0.2.15", + "getrandom 0.2.16", "hex", "http-body-util", "hyper 1.6.0", @@ -1733,7 +1734,7 @@ dependencies = [ "regex", "serde", "serde_json", - "sha2 0.10.8", + "sha2 0.10.9", "subtle", "thiserror 2.0.12", "tokio", @@ -1820,7 +1821,7 @@ dependencies = [ "tower", "tracing", "trust-ping", - "uuid 1.16.0", + "uuid 1.17.0", ] [[package]] @@ -1858,7 +1859,7 @@ dependencies = [ "shared", "thiserror 2.0.12", "tokio", - "uuid 1.16.0", + "uuid 1.17.0", ] [[package]] @@ -1869,7 +1870,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.104", ] [[package]] @@ -1890,6 +1891,12 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" +[[package]] +name = "dyn-clone" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c7a8fb8a9fbf66c1f703fe16184d10ca0ee9d23be5b4436400408ba54a95005" + [[package]] name = "ecdsa" version = "0.13.4" @@ -1942,7 +1949,7 @@ dependencies = [ "curve25519-dalek 4.1.3", "ed25519 2.2.3", "serde", - "sha2 0.10.8", + "sha2 0.10.9", "subtle", "zeroize", ] @@ -1980,7 +1987,27 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.104", +] + +[[package]] +name = "equator" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4711b213838dfee0117e3be6ac926007d7f433d7bbe33595975d4190cb07e6fc" +dependencies = [ + "equator-macro", +] + +[[package]] +name = "equator-macro" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44f23cf4b44bfce11a86ace86f8a73ffdec849c9fd00a386a53d278bd9e81fb3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.104", ] [[package]] @@ -1991,12 +2018,12 @@ checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" [[package]] name = "errno" -version = "0.3.10" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" +checksum = "778e2ac28f6c47af28e4907f13ffd1e1ddbd400980a9abd7c8df189bf578a5ad" dependencies = [ "libc", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] @@ -2018,9 +2045,9 @@ dependencies = [ [[package]] name = "event-listener-strategy" -version = "0.5.3" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c3e4e0dd3673c1139bf041f3008816d9cf2946bbfac2945c09e523b8d7b05b2" +checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93" dependencies = [ "event-listener 5.4.0", "pin-project-lite", @@ -2084,9 +2111,9 @@ checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" [[package]] name = "flate2" -version = "1.1.0" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11faaf5a5236997af9848be0bef4db95824b1d534ebc64d0f0c6cf3e67bd38dc" +checksum = "4a3d7db9596fecd151c5f638c0ee5d5bd487b6e0ea232e5dc96d5250f6f94b1d" dependencies = [ "crc32fast", "miniz_oxide", @@ -2147,7 +2174,7 @@ dependencies = [ "thiserror 2.0.12", "tokio", "tracing", - "uuid 1.16.0", + "uuid 1.17.0", ] [[package]] @@ -2231,7 +2258,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.104", ] [[package]] @@ -2276,22 +2303,22 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" dependencies = [ "cfg-if", "js-sys", "libc", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasi 0.11.1+wasi-snapshot-preview1", "wasm-bindgen", ] [[package]] name = "getrandom" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73fea8450eea4bac3940448fb7ae50d91f034f941199fcd9d909a5a07aa455f0" +checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" dependencies = [ "cfg-if", "js-sys", @@ -2313,9 +2340,9 @@ dependencies = [ [[package]] name = "gif" -version = "0.13.1" +version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fb2d69b19215e18bb912fa30f7ce15846e301408695e44e0ef719f1da9e19f2" +checksum = "4ae047235e33e2829703574b54fdec96bfbad892062d97fed2f76022287de61b" dependencies = [ "color_quant", "weezl", @@ -2369,7 +2396,7 @@ dependencies = [ "futures-sink", "futures-util", "http 0.2.12", - "indexmap 2.8.0", + "indexmap 2.10.0", "slab", "tokio", "tokio-util", @@ -2378,9 +2405,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.4.8" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5017294ff4bb30944501348f6f8e42e6ad28f42c8bbef7a74029aff064a4e3c2" +checksum = "a9421a676d1b147b16b82c9225157dc629087ef8ec4d5e2960f9437a90dac0a5" dependencies = [ "atomic-waker", "bytes", @@ -2388,7 +2415,7 @@ dependencies = [ "futures-core", "futures-sink", "http 1.3.1", - "indexmap 2.8.0", + "indexmap 2.10.0", "slab", "tokio", "tokio-util", @@ -2397,9 +2424,9 @@ dependencies = [ [[package]] name = "half" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7db2ff139bba50379da6aa0766b52fdcb62cb5b263009b09ed58ba604e14bbd1" +checksum = "459196ed295495a68f7d7fe1d84f6c4b7ff0e21fe3017b2f283c6fac3ad803c9" dependencies = [ "cfg-if", "crunchy", @@ -2413,9 +2440,9 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "hashbrown" -version = "0.15.2" +version = "0.15.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" +checksum = "5971ac85611da7067dbfcabef3c70ebb5606018acd9e2a3903a0da507521e0d5" dependencies = [ "foldhash", ] @@ -2428,9 +2455,9 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "hermit-abi" -version = "0.4.0" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc" +checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c" [[package]] name = "hex" @@ -2520,17 +2547,6 @@ dependencies = [ "windows-sys 0.59.0", ] -[[package]] -name = "hostname" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9c7c7c8ac16c798734b8a24560c1362120597c40d5e1459f09498f8f6c8f2ba" -dependencies = [ - "cfg-if", - "libc", - "windows", -] - [[package]] name = "http" version = "0.2.12" @@ -2632,7 +2648,7 @@ dependencies = [ "bytes", "futures-channel", "futures-util", - "h2 0.4.8", + "h2 0.4.10", "http 1.3.1", "http-body 1.0.1", "httparse", @@ -2662,15 +2678,14 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.27.5" +version = "0.27.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d191583f3da1305256f22463b9bb0471acad48a4e534a5218b9963e9c1f59b2" +checksum = "e3c93eb611681b207e1fe55d5a71ecf91572ec8a6705cdb6857f7d8d5242cf58" dependencies = [ - "futures-util", "http 1.3.1", "hyper 1.6.0", "hyper-util", - "rustls 0.23.25", + "rustls 0.23.28", "rustls-native-certs 0.8.1", "rustls-pki-types", "tokio", @@ -2696,16 +2711,18 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.10" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df2dcfbe0677734ab2f3ffa7fa7bfd4706bfdc1ef393f2ee30184aed67e631b4" +checksum = "dc2fdfdbff08affe55bb779f33b053aa1fe5dd5b54c257343c17edfa55711bdb" dependencies = [ "bytes", "futures-channel", + "futures-core", "futures-util", "http 1.3.1", "http-body 1.0.1", "hyper 1.6.0", + "libc", "pin-project-lite", "socket2", "tokio", @@ -2715,14 +2732,15 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.61" +version = "0.1.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" +checksum = "b0c919e5debc312ad217002b8048a17b7d83f80703865bbfcfebb0458b0b27d8" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", + "log", "wasm-bindgen", "windows-core", ] @@ -2738,21 +2756,22 @@ dependencies = [ [[package]] name = "icu_collections" -version = "1.5.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" +checksum = "200072f5d0e3614556f94a9930d5dc3e0662a652823904c3a75dc3b0af7fee47" dependencies = [ "displaydoc", + "potential_utf", "yoke", "zerofrom", "zerovec", ] [[package]] -name = "icu_locid" -version = "1.5.0" +name = "icu_locale_core" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" +checksum = "0cde2700ccaed3872079a65fb1a78f6c0a36c91570f28755dda67bc8f7d9f00a" dependencies = [ "displaydoc", "litemap", @@ -2761,31 +2780,11 @@ dependencies = [ "zerovec", ] -[[package]] -name = "icu_locid_transform" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" -dependencies = [ - "displaydoc", - "icu_locid", - "icu_locid_transform_data", - "icu_provider", - "tinystr", - "zerovec", -] - -[[package]] -name = "icu_locid_transform_data" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" - [[package]] name = "icu_normalizer" -version = "1.5.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" +checksum = "436880e8e18df4d7bbc06d58432329d6458cc84531f7ac5f024e93deadb37979" dependencies = [ "displaydoc", "icu_collections", @@ -2793,67 +2792,54 @@ dependencies = [ "icu_properties", "icu_provider", "smallvec", - "utf16_iter", - "utf8_iter", - "write16", "zerovec", ] [[package]] name = "icu_normalizer_data" -version = "1.5.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" +checksum = "00210d6893afc98edb752b664b8890f0ef174c8adbb8d0be9710fa66fbbf72d3" [[package]] name = "icu_properties" -version = "1.5.1" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" +checksum = "016c619c1eeb94efb86809b015c58f479963de65bdb6253345c1a1276f22e32b" dependencies = [ "displaydoc", "icu_collections", - "icu_locid_transform", + "icu_locale_core", "icu_properties_data", "icu_provider", - "tinystr", + "potential_utf", + "zerotrie", "zerovec", ] [[package]] name = "icu_properties_data" -version = "1.5.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" +checksum = "298459143998310acd25ffe6810ed544932242d3f07083eee1084d83a71bd632" [[package]] name = "icu_provider" -version = "1.5.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" +checksum = "03c80da27b5f4187909049ee2d72f276f0d9f99a42c306bd0131ecfe04d8e5af" dependencies = [ "displaydoc", - "icu_locid", - "icu_provider_macros", + "icu_locale_core", "stable_deref_trait", "tinystr", "writeable", "yoke", "zerofrom", + "zerotrie", "zerovec", ] -[[package]] -name = "icu_provider_macros" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.100", -] - [[package]] name = "ident_case" version = "1.0.1" @@ -2873,9 +2859,9 @@ dependencies = [ [[package]] name = "idna_adapter" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" +checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" dependencies = [ "icu_normalizer", "icu_properties", @@ -2883,9 +2869,9 @@ dependencies = [ [[package]] name = "image" -version = "0.25.5" +version = "0.25.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd6f44aed642f18953a158afeb30206f4d50da59fbc66ecb53c66488de73563b" +checksum = "db35664ce6b9810857a38a906215e75a9c879f0696556a39f59c62829710251a" dependencies = [ "bytemuck", "byteorder-lite", @@ -2906,9 +2892,9 @@ dependencies = [ [[package]] name = "image-webp" -version = "0.2.1" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b77d01e822461baa8409e156015a1d91735549f0f2c17691bd2d996bef238f7f" +checksum = "f6970fe7a5300b4b42e62c52efa0187540a5bef546c60edaf554ef595d2e6f0b" dependencies = [ "byteorder-lite", "quick-error", @@ -2939,12 +2925,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.8.0" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3954d50fe15b02142bf25d3b8bdadb634ec3948f103d04ffe3031bc8fe9d7058" +checksum = "fe4cd85333e22411419a0bcae1297d25e58c9443848b11dc6a86fefe8c78a661" dependencies = [ "equivalent", - "hashbrown 0.15.2", + "hashbrown 0.15.4", "serde", ] @@ -2956,7 +2942,7 @@ checksum = "c34819042dc3d3971c46c2190835914dfbe0c3c13f61449b2997f4e9722dfa60" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.104", ] [[package]] @@ -2994,18 +2980,19 @@ checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" [[package]] name = "jobserver" -version = "0.1.32" +version = "0.1.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" +checksum = "38f262f097c174adebe41eb73d66ae9c06b2844fb0da69969647bbddd9b0538a" dependencies = [ + "getrandom 0.3.3", "libc", ] [[package]] name = "jpeg-decoder" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5d4a7da358eff58addd2877a45865158f0d78c911d43a5784ceb7bbf52833b0" +checksum = "00810f1d8b74be64b13dbf3db89ac67740615d6c891f0e7b6179326533011a07" [[package]] name = "js-sys" @@ -3091,9 +3078,9 @@ checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8" [[package]] name = "libc" -version = "0.2.171" +version = "0.2.174" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6" +checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776" [[package]] name = "libfuzzer-sys" @@ -3107,12 +3094,12 @@ dependencies = [ [[package]] name = "libloading" -version = "0.8.6" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34" +checksum = "07033963ba89ebaf1584d767badaa2e8fcec21aedea6b8c0346d487d49c28667" dependencies = [ "cfg-if", - "windows-targets 0.52.6", + "windows-targets 0.53.2", ] [[package]] @@ -3127,17 +3114,23 @@ version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" +[[package]] +name = "linux-raw-sys" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12" + [[package]] name = "litemap" -version = "0.7.5" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23fb14cb19457329c82206317a5663005a4d404783dc74f4252769b0d5f42856" +checksum = "241eaef5fd12c88705a01fc1066c48c4b36e0dd4377dcdc7ec3942cea7a69956" [[package]] name = "lock_api" -version = "0.4.12" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" +checksum = "96936507f153605bddfcda068dd804796c84324ed2510809e5b2a624c81da765" dependencies = [ "autocfg", "scopeguard", @@ -3145,9 +3138,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.26" +version = "0.4.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30bde2b3dc3671ae49d8e2e9f044c7c005836e7a023ee57cffa25ab82764bb9e" +checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" dependencies = [ "value-bag", ] @@ -3179,7 +3172,7 @@ dependencies = [ "macro_magic_core", "macro_magic_macros", "quote", - "syn 2.0.100", + "syn 2.0.104", ] [[package]] @@ -3193,7 +3186,7 @@ dependencies = [ "macro_magic_core_macros", "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.104", ] [[package]] @@ -3204,7 +3197,7 @@ checksum = "b02abfe41815b5bd98dbd4260173db2c116dda171dc0fe7838cb206333b83308" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.104", ] [[package]] @@ -3215,7 +3208,7 @@ checksum = "73ea28ee64b88876bf45277ed9a5817c1817df061a74f2b988971a12570e5869" dependencies = [ "macro_magic_core", "quote", - "syn 2.0.100", + "syn 2.0.104", ] [[package]] @@ -3270,14 +3263,14 @@ dependencies = [ "thiserror 2.0.12", "tokio", "tracing", - "uuid 1.16.0", + "uuid 1.17.0", ] [[package]] name = "memchr" -version = "2.7.4" +version = "2.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" +checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "message-api" @@ -3291,9 +3284,9 @@ dependencies = [ [[package]] name = "metrics" -version = "0.24.1" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a7deb012b3b2767169ff203fadb4c6b0b82b947512e5eb9e0b78c2e186ad9e3" +checksum = "25dea7ac8057892855ec285c440160265225438c3c45072613c25a4b26e98ef5" dependencies = [ "ahash", "portable-atomic", @@ -3306,7 +3299,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd7399781913e5393588a8d8c6a2867bf85fb38eaf2502fdce465aad2dc6f034" dependencies = [ "base64 0.22.1", - "indexmap 2.8.0", + "indexmap 2.10.0", "metrics", "metrics-util", "quanta", @@ -3315,16 +3308,16 @@ dependencies = [ [[package]] name = "metrics-util" -version = "0.19.0" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbd4884b1dd24f7d6628274a2f5ae22465c337c5ba065ec9b6edccddf8acc673" +checksum = "b8496cc523d1f94c1385dd8f0f0c2c480b2b8aeccb5b7e4485ad6365523ae376" dependencies = [ "crossbeam-epoch", "crossbeam-utils", - "hashbrown 0.15.2", + "hashbrown 0.15.4", "metrics", "quanta", - "rand 0.8.5", + "rand 0.9.1", "rand_xoshiro", "sketches-ddsketch", ] @@ -3343,9 +3336,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.8.5" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e3e04debbb59698c15bacbb6d93584a8c0ca9cc3213cb423d31f760d8843ce5" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" dependencies = [ "adler2", "simd-adler32", @@ -3353,20 +3346,20 @@ dependencies = [ [[package]] name = "mio" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" +checksum = "78bed444cc8a2160f01cbcf811ef18cac863ad68ae8ca62092e8db51d51c761c" dependencies = [ "libc", - "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.52.0", + "wasi 0.11.1+wasi-snapshot-preview1", + "windows-sys 0.59.0", ] [[package]] name = "mongodb" -version = "3.2.1" +version = "3.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a93560fa3ec754ed9aa0954ae8307c5997150dbba7aa735173b514660088475" +checksum = "fdf4261933e5113914caec01c4bb16a7502bdaa9cf80fd87191765e7d9ff16b2" dependencies = [ "async-trait", "base64 0.13.1", @@ -3397,7 +3390,7 @@ dependencies = [ "serde_bytes", "serde_with", "sha-1", - "sha2 0.10.8", + "sha2 0.10.9", "socket2", "stringprep", "strsim", @@ -3407,20 +3400,20 @@ dependencies = [ "tokio-rustls 0.24.1", "tokio-util", "typed-builder", - "uuid 1.16.0", + "uuid 1.17.0", "webpki-roots", ] [[package]] name = "mongodb-internal-macros" -version = "3.2.1" +version = "3.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79b3dace6c4f33db61d492b3d3b02f4358687a1eb59457ffef6f6cfe461cdb54" +checksum = "619176c99deef0d50be51ce3193e9efd6a56ab0f4e6a38d5fd614880d148c7ae" dependencies = [ "macro_magic", "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.104", ] [[package]] @@ -3507,7 +3500,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.104", ] [[package]] @@ -3550,9 +3543,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.21.1" +version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d75b0bedcc4fe52caa0e03d9f1151a323e4aa5e2d78ba3580400cd3c9e2bc4bc" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" [[package]] name = "oob-messages" @@ -3573,7 +3566,7 @@ dependencies = [ "tokio", "tower", "tracing", - "uuid 1.16.0", + "uuid 1.17.0", ] [[package]] @@ -3584,11 +3577,11 @@ checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" [[package]] name = "openssl" -version = "0.10.71" +version = "0.10.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e14130c6a98cd258fdcb0fb6d744152343ff729cbfcb28c656a9d12b999fbcd" +checksum = "8505734d46c8ab1e19a1dce3aef597ad87dcb4c37e7188231769bd6bd51cebf8" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.9.1", "cfg-if", "foreign-types", "libc", @@ -3605,7 +3598,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.104", ] [[package]] @@ -3616,9 +3609,9 @@ checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" [[package]] name = "openssl-sys" -version = "0.9.106" +version = "0.9.109" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bb61ea9811cc39e3c2069f40b8b8e2e70d8569b361f879786cc7ed48b777cdd" +checksum = "90096e2e47630d78b7d1c20952dc621f957103f8bc2c8359ec81290d75238571" dependencies = [ "cc", "libc", @@ -3658,9 +3651,9 @@ checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" [[package]] name = "parking_lot" -version = "0.12.3" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" +checksum = "70d58bf43669b5795d1576d0641cfb6fbb2057bf629506267a92807158584a13" dependencies = [ "lock_api", "parking_lot_core", @@ -3668,9 +3661,9 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.10" +version = "0.9.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" +checksum = "bc838d2a56b5b1a6c25f55575dfc605fabb63bb2365f6c2353ef9159aa69e4a5" dependencies = [ "cfg-if", "libc", @@ -3715,7 +3708,7 @@ dependencies = [ "thiserror 2.0.12", "tokio", "tracing", - "uuid 1.16.0", + "uuid 1.17.0", ] [[package]] @@ -3735,7 +3728,7 @@ checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.104", ] [[package]] @@ -3767,7 +3760,7 @@ version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" dependencies = [ - "der 0.7.9", + "der 0.7.10", "spki", ] @@ -3800,15 +3793,15 @@ dependencies = [ [[package]] name = "polling" -version = "3.7.4" +version = "3.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a604568c3202727d1507653cb121dbd627a58684eb09a820fd746bee38b4442f" +checksum = "b53a684391ad002dd6a596ceb6c74fd004fdce75f4be2e3f615068abbea5fd50" dependencies = [ "cfg-if", "concurrent-queue", "hermit-abi", "pin-project-lite", - "rustix", + "rustix 1.0.7", "tracing", "windows-sys 0.59.0", ] @@ -3838,9 +3831,18 @@ dependencies = [ [[package]] name = "portable-atomic" -version = "1.11.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "350e9b48cbc6b0e028b0473b114454c6316e57336ee184ceab6e53f72c178b3e" +checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483" + +[[package]] +name = "potential_utf" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5a7c30837279ca13e7c867e9e40053bc68740f988cb07f7ca6df43cc734b585" +dependencies = [ + "zerovec", +] [[package]] name = "powerfmt" @@ -3854,45 +3856,45 @@ version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" dependencies = [ - "zerocopy 0.8.23", + "zerocopy", ] [[package]] name = "prettyplease" -version = "0.2.31" +version = "0.2.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5316f57387668042f561aae71480de936257848f9c43ce528e311d89a07cadeb" +checksum = "061c1221631e079b26479d25bbf2275bfe5917ae8419cd7e34f13bfc2aa7539a" dependencies = [ "proc-macro2", - "syn 2.0.100", + "syn 2.0.104", ] [[package]] name = "proc-macro2" -version = "1.0.94" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84" +checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" dependencies = [ "unicode-ident", ] [[package]] name = "profiling" -version = "1.0.16" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afbdc74edc00b6f6a218ca6a5364d6226a259d4b8ea1af4a0ea063f27e179f4d" +checksum = "3eb8486b569e12e2c32ad3e204dbaba5e4b5b216e9367044f25f1dba42341773" dependencies = [ "profiling-procmacros", ] [[package]] name = "profiling-procmacros" -version = "1.0.16" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a65f2e60fbf1063868558d69c6beacf412dc755f9fc020f514b7955fc914fe30" +checksum = "52717f9a02b6965224f95ca2a81e2e0c5c43baacd28ca057577988930b6c3d5b" dependencies = [ "quote", - "syn 2.0.100", + "syn 2.0.104", ] [[package]] @@ -3915,7 +3917,7 @@ checksum = "440f724eba9f6996b75d63681b0a92b06947f1457076d503a4d2e2c8f56442b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.104", ] [[package]] @@ -3938,15 +3940,15 @@ dependencies = [ [[package]] name = "quanta" -version = "0.12.5" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bd1fe6824cea6538803de3ff1bc0cf3949024db3d43c9643024bfb33a807c0e" +checksum = "f3ab5a9d756f0d97bdc89019bd2e4ea098cf9cde50ee7564dde6b81ccc8f06c7" dependencies = [ "crossbeam-utils", "libc", "once_cell", "raw-cpuid", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasi 0.11.1+wasi-snapshot-preview1", "web-sys", "winapi", ] @@ -3968,9 +3970,9 @@ dependencies = [ [[package]] name = "r-efi" -version = "5.2.0" +version = "5.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" [[package]] name = "radium" @@ -3991,13 +3993,12 @@ dependencies = [ [[package]] name = "rand" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3779b94aeb87e8bd4e834cee3650289ee9e0d5677f976ecdb6d219e5f4f6cd94" +checksum = "9fbfd9d094a40bf3ae768db9361049ace4c0e04a4fd6b359518bd7b73a73dd97" dependencies = [ "rand_chacha 0.9.0", "rand_core 0.9.3", - "zerocopy 0.8.23", ] [[package]] @@ -4032,7 +4033,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.15", + "getrandom 0.2.16", ] [[package]] @@ -4041,16 +4042,16 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" dependencies = [ - "getrandom 0.3.2", + "getrandom 0.3.3", ] [[package]] name = "rand_xoshiro" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f97cdb2a36ed4183de61b2f824cc45c9f1037f28afe0a322e9fff4c108b5aaa" +checksum = "f703f4665700daf5512dcca5f43afa6af89f09db47fb56be587f80636bda2d41" dependencies = [ - "rand_core 0.6.4", + "rand_core 0.9.3", ] [[package]] @@ -4090,9 +4091,9 @@ dependencies = [ [[package]] name = "ravif" -version = "0.11.11" +version = "0.11.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2413fd96bd0ea5cdeeb37eaf446a22e6ed7b981d792828721e74ded1980a45c6" +checksum = "5825c26fddd16ab9f515930d49028a630efec172e903483c94796cfe31893e6b" dependencies = [ "avif-serialize", "imgref", @@ -4109,7 +4110,7 @@ version = "11.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c6df7ab838ed27997ba19a4664507e6f82b41fe6e20be42929332156e5e85146" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.9.1", ] [[package]] @@ -4134,11 +4135,31 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.10" +version = "0.5.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d04b7d0ee6b4a0207a0a7adb104d23ecb0b47d6beae7152d0fa34b692b29fd6" +dependencies = [ + "bitflags 2.9.1", +] + +[[package]] +name = "ref-cast" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a0ae411dbe946a674d89546582cea4ba2bb8defac896622d6496f14c23ba5cf" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b8c0c260b63a8219631167be35e6a988e9554dbd323f8bd08439c8ed1302bd1" +checksum = "1165225c21bff1f3bbce98f5a1f889949bc902d3575308cc7b0de30b4f6d27c7" dependencies = [ - "bitflags 2.9.0", + "proc-macro2", + "quote", + "syn 2.0.104", ] [[package]] @@ -4178,12 +4199,9 @@ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "resolv-conf" -version = "0.7.1" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48375394603e3dd4b2d64371f7148fd8c7baa2680e28741f2cb8d23b59e3d4c4" -dependencies = [ - "hostname", -] +checksum = "95325155c684b1c89f7765e30bc1c42e4a6da51ca513615660cb8a62ef9a88e3" [[package]] name = "rfc6979" @@ -4210,7 +4228,7 @@ checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" dependencies = [ "cc", "cfg-if", - "getrandom 0.2.15", + "getrandom 0.2.16", "libc", "untrusted", "windows-sys 0.52.0", @@ -4218,9 +4236,9 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.24" +version = "0.1.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" +checksum = "989e6739f80c4ad5b13e0fd7fe89531180375b18520cc8c82080e4dc4035b84f" [[package]] name = "rustc-hash" @@ -4253,10 +4271,23 @@ version = "0.38.44" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.9.1", "errno", "libc", - "linux-raw-sys", + "linux-raw-sys 0.4.15", + "windows-sys 0.59.0", +] + +[[package]] +name = "rustix" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c71e83d6afe7ff64890ec6b71d6a69bb8a610ab78ce364b3352876bb4c801266" +dependencies = [ + "bitflags 2.9.1", + "errno", + "libc", + "linux-raw-sys 0.9.4", "windows-sys 0.59.0", ] @@ -4274,15 +4305,15 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.25" +version = "0.23.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "822ee9188ac4ec04a2f0531e55d035fb2de73f18b41a63c70c2712503b6fb13c" +checksum = "7160e3e10bf4535308537f3c4e1641468cd0e485175d6163087c0393c7d46643" dependencies = [ "aws-lc-rs", "log", "once_cell", "rustls-pki-types", - "rustls-webpki 0.103.0", + "rustls-webpki 0.103.3", "subtle", "zeroize", ] @@ -4322,9 +4353,12 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.11.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "917ce264624a4b4db1c364dcc35bfca9ded014d0a958cd47ad3e960e988ea51c" +checksum = "229a4a4c221013e7e1f1a043678c5cc39fe5171437c88fb47151a21e6f5b5c79" +dependencies = [ + "zeroize", +] [[package]] name = "rustls-webpki" @@ -4338,9 +4372,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.103.0" +version = "0.103.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0aa4eeac2588ffff23e9d7a7e9b3f971c5fb5b7ebc9452745e0c232c64f83b2f" +checksum = "e4a72fe2bcf7a6ac6fd7d0b9e5cb68aeb7d4c0a0271730218b3e92d43b4eb435" dependencies = [ "aws-lc-rs", "ring", @@ -4350,9 +4384,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.20" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eded382c5f5f786b989652c49544c4877d9f015cc22e145a5ea8ea66c2921cd2" +checksum = "8a0d197bd2c9dc6e53b84da9556a69ba4cdfab8619eb41a8bd1cc2027a0f6b1d" [[package]] name = "ryu" @@ -4385,6 +4419,18 @@ dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "schemars" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd191f9397d57d581cddd31014772520aa448f65ef991055d7f61582c65165f" +dependencies = [ + "dyn-clone", + "ref-cast", + "serde", + "serde_json", +] + [[package]] name = "scopeguard" version = "1.2.0" @@ -4419,7 +4465,7 @@ version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.9.1", "core-foundation 0.9.4", "core-foundation-sys", "libc", @@ -4432,8 +4478,8 @@ version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "271720403f46ca04f7ba6f55d438f8bd878d6b8ca0a1046e8228c4145bcbb316" dependencies = [ - "bitflags 2.9.0", - "core-foundation 0.10.0", + "bitflags 2.9.1", + "core-foundation 0.10.1", "core-foundation-sys", "libc", "security-framework-sys", @@ -4503,7 +4549,7 @@ checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.104", ] [[package]] @@ -4512,7 +4558,7 @@ version = "1.0.140" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" dependencies = [ - "indexmap 2.8.0", + "indexmap 2.10.0", "itoa", "memchr", "ryu", @@ -4531,9 +4577,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "0.6.8" +version = "0.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" +checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3" dependencies = [ "serde", ] @@ -4552,15 +4598,16 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.12.0" +version = "3.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6b6f7f2fcb69f747921f79f3926bd1e203fce4fef62c268dd3abfb6d86029aa" +checksum = "bf65a400f8f66fb7b0552869ad70157166676db75ed8181f8104ea91cf9d0b42" dependencies = [ "base64 0.22.1", "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.8.0", + "indexmap 2.10.0", + "schemars", "serde", "serde_derive", "serde_json", @@ -4570,14 +4617,14 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.12.0" +version = "3.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d00caa5193a3c8362ac2b73be6b9e768aa5a4b2f721d8f4b339600c3cb51f8e" +checksum = "81679d9ed988d5e9a5e6531dc3f2c28efbd639cbd1dfb628df08edea6004da77" dependencies = [ - "darling 0.20.10", + "darling 0.20.11", "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.104", ] [[package]] @@ -4606,9 +4653,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.8" +version = "0.10.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" dependencies = [ "cfg-if", "cpufeatures 0.2.17", @@ -4652,9 +4699,9 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "signal-hook-registry" -version = "1.4.2" +version = "1.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" +checksum = "9203b8055f63a2a00e2f593bb0510367fe707d7ff1e5c872de2f537b339e5410" dependencies = [ "libc", ] @@ -4701,24 +4748,21 @@ checksum = "c1e9a774a6c28142ac54bb25d25562e6bcf957493a184f15ad4eebccb23e410a" [[package]] name = "slab" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" -dependencies = [ - "autocfg", -] +checksum = "04dc19736151f35336d325007ac991178d504a119863a2fcb3758cdb5e52c50d" [[package]] name = "smallvec" -version = "1.14.0" +version = "1.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcf8323ef1faaee30a44a340193b1ac6814fd9b7b4e88e9d4519a3e4abe1cfd" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" [[package]] name = "socket2" -version = "0.5.8" +version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c970269d99b64e60ec3bd6ad27270092a5394c4e309314b18ae3fe575695fbe8" +checksum = "e22376abed350d73dd1cd119b57ffccad95b4e585a7cda43e286245ce23c0678" dependencies = [ "libc", "windows-sys 0.52.0", @@ -4731,7 +4775,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" dependencies = [ "base64ct", - "der 0.7.9", + "der 0.7.10", ] [[package]] @@ -4776,9 +4820,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.100" +version = "2.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" +checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40" dependencies = [ "proc-macro2", "quote", @@ -4793,13 +4837,13 @@ checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" [[package]] name = "synstructure" -version = "0.13.1" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.104", ] [[package]] @@ -4835,15 +4879,14 @@ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" [[package]] name = "tempfile" -version = "3.17.1" +version = "3.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22e5a0acb1f3f55f65cc4a866c361b2fb2a0ff6366785ae6fbb5f85df07ba230" +checksum = "e8a64e3985349f2441a1a9ef0b853f869006c3855f2cda6862a94d26ebb9d6a1" dependencies = [ - "cfg-if", "fastrand", - "getrandom 0.3.2", + "getrandom 0.3.3", "once_cell", - "rustix", + "rustix 1.0.7", "windows-sys 0.59.0", ] @@ -4873,7 +4916,7 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.104", ] [[package]] @@ -4884,17 +4927,16 @@ checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.104", ] [[package]] name = "thread_local" -version = "1.1.8" +version = "1.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" +checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185" dependencies = [ "cfg-if", - "once_cell", ] [[package]] @@ -4930,9 +4972,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.40" +version = "0.3.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d9c75b47bdff86fa3334a3db91356b8d7d86a9b839dab7d0bdc5c3d3a077618" +checksum = "8a7619e19bc266e0f9c5e6686659d394bc57973859340060a69221e57dbc0c40" dependencies = [ "deranged", "itoa", @@ -4951,9 +4993,9 @@ checksum = "c9e9a38711f559d9e3ce1cdb06dd7c5b8ea546bc90052da6d06bb76da74bb07c" [[package]] name = "time-macros" -version = "0.2.21" +version = "0.2.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29aa485584182073ed57fd5004aa09c371f021325014694e432313345865fd04" +checksum = "3526739392ec93fd8b359c8e98514cb3e8e021beb4e5f597b00a0221f8ed8a49" dependencies = [ "num-conv", "time-core", @@ -4970,9 +5012,9 @@ dependencies = [ [[package]] name = "tinystr" -version = "0.7.6" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" +checksum = "5d4f6d1145dcb577acf783d4e601bc1d76a13337bb54e6233add580b07344c8b" dependencies = [ "displaydoc", "zerovec", @@ -4995,9 +5037,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.44.1" +version = "1.45.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f382da615b842244d4b8738c82ed1275e6c5dd90c459a30941cd07080b06c91a" +checksum = "75ef51a33ef1da925cea3e4eb122833cb377c61439ca401b770f54902b806779" dependencies = [ "backtrace", "bytes", @@ -5019,7 +5061,7 @@ checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.104", ] [[package]] @@ -5048,15 +5090,15 @@ version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e727b36a1a0e8b74c376ac2211e40c2c8af09fb4013c60d910495810f008e9b" dependencies = [ - "rustls 0.23.25", + "rustls 0.23.28", "tokio", ] [[package]] name = "tokio-util" -version = "0.7.14" +version = "0.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b9590b93e6fcc1739458317cccd391ad3955e2bde8913edf6f95f9e65a8f034" +checksum = "66a539a9ad6d5d281510d5bd368c973d636c02dbf8a67300bfb6b950696ad7df" dependencies = [ "bytes", "futures-core", @@ -5068,9 +5110,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.20" +version = "0.8.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd87a5cdd6ffab733b2f74bc4fd7ee5fff6634124999ac278c35fc78c6120148" +checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362" dependencies = [ "serde", "serde_spanned", @@ -5080,20 +5122,20 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.8" +version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" +checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c" dependencies = [ "serde", ] [[package]] name = "toml_edit" -version = "0.22.24" +version = "0.22.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17b4795ff5edd201c7cd6dca065ae59972ce77d1b80fa0a84d94950ece7d1474" +checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" dependencies = [ - "indexmap 2.8.0", + "indexmap 2.10.0", "serde", "serde_spanned", "toml_datetime", @@ -5118,11 +5160,11 @@ dependencies = [ [[package]] name = "tower-http" -version = "0.6.2" +version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "403fa3b783d4b626a8ad51d766ab03cb6d2dbfc46b1c5d4448395e6628dc9697" +checksum = "adc82fd73de2a9722ac5da747f12383d2bfdb93591ee6c58486e0097890f05f2" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.9.1", "bytes", "futures-util", "http 1.3.1", @@ -5160,20 +5202,20 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.28" +version = "0.1.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" +checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.104", ] [[package]] name = "tracing-core" -version = "0.1.33" +version = "0.1.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" +checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678" dependencies = [ "once_cell", "valuable", @@ -5230,7 +5272,7 @@ dependencies = [ "shared", "thiserror 2.0.12", "tokio", - "uuid 1.16.0", + "uuid 1.17.0", ] [[package]] @@ -5317,12 +5359,6 @@ version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" -[[package]] -name = "utf16_iter" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" - [[package]] name = "utf8_iter" version = "1.0.4" @@ -5335,27 +5371,27 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" dependencies = [ - "getrandom 0.2.15", + "getrandom 0.2.16", ] [[package]] name = "uuid" -version = "1.16.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "458f7a779bf54acc9f347480ac654f68407d3aab21269a6e3c9f922acd9e2da9" +checksum = "3cf4199d1e5d15ddd86a694e4d0dffa9c323ce759fea589f00fef9d81cc1931d" dependencies = [ - "getrandom 0.3.2", + "getrandom 0.3.3", "js-sys", - "rand 0.9.0", + "rand 0.9.1", "serde", "wasm-bindgen", ] [[package]] name = "v_frame" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6f32aaa24bacd11e488aa9ba66369c7cd514885742c9fe08cfe85884db3e92b" +checksum = "666b7727c8875d6ab5db9533418d7c764233ac9c0cff1d469aec8fa127597be2" dependencies = [ "aligned-vec", "num-traits", @@ -5370,9 +5406,9 @@ checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" [[package]] name = "value-bag" -version = "1.10.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ef4c4aa54d5d05a279399bfa921ec387b7aba77caf7a682ae8d86785b8fdad2" +checksum = "943ce29a8a743eb10d6082545d861b24f9d1b160b7d741e0f2cdf726bec909c5" [[package]] name = "varint" @@ -5418,9 +5454,9 @@ dependencies = [ [[package]] name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" +version = "0.11.1+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" [[package]] name = "wasi" @@ -5453,7 +5489,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.104", "wasm-bindgen-shared", ] @@ -5488,7 +5524,7 @@ checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.104", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -5520,9 +5556,9 @@ checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" [[package]] name = "weezl" -version = "0.1.8" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53a85b86a771b1c87058196170769dd264f66c0782acf1ae6cc51bfd64b39082" +checksum = "a751b3277700db47d3e574514de2eced5e54dc8a5436a3bf7a0b248b2cee16f3" [[package]] name = "which" @@ -5533,7 +5569,7 @@ dependencies = [ "either", "home", "once_cell", - "rustix", + "rustix 0.38.44", ] [[package]] @@ -5565,29 +5601,63 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] -name = "windows" -version = "0.52.0" +name = "windows-core" +version = "0.61.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" +checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" dependencies = [ - "windows-core", - "windows-targets 0.52.6", + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", ] [[package]] -name = "windows-core" -version = "0.52.0" +name = "windows-implement" +version = "0.60.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" dependencies = [ - "windows-targets 0.52.6", + "proc-macro2", + "quote", + "syn 2.0.104", +] + +[[package]] +name = "windows-interface" +version = "0.59.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.104", ] [[package]] name = "windows-link" -version = "0.1.1" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" + +[[package]] +name = "windows-result" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38" +checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" +dependencies = [ + "windows-link", +] [[package]] name = "windows-sys" @@ -5616,6 +5686,15 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-sys" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" +dependencies = [ + "windows-targets 0.53.2", +] + [[package]] name = "windows-targets" version = "0.48.5" @@ -5640,13 +5719,29 @@ dependencies = [ "windows_aarch64_gnullvm 0.52.6", "windows_aarch64_msvc 0.52.6", "windows_i686_gnu 0.52.6", - "windows_i686_gnullvm", + "windows_i686_gnullvm 0.52.6", "windows_i686_msvc 0.52.6", "windows_x86_64_gnu 0.52.6", "windows_x86_64_gnullvm 0.52.6", "windows_x86_64_msvc 0.52.6", ] +[[package]] +name = "windows-targets" +version = "0.53.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c66f69fcc9ce11da9966ddb31a40968cad001c5bedeb5c2b82ede4253ab48aef" +dependencies = [ + "windows_aarch64_gnullvm 0.53.0", + "windows_aarch64_msvc 0.53.0", + "windows_i686_gnu 0.53.0", + "windows_i686_gnullvm 0.53.0", + "windows_i686_msvc 0.53.0", + "windows_x86_64_gnu 0.53.0", + "windows_x86_64_gnullvm 0.53.0", + "windows_x86_64_msvc 0.53.0", +] + [[package]] name = "windows_aarch64_gnullvm" version = "0.48.5" @@ -5659,6 +5754,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" + [[package]] name = "windows_aarch64_msvc" version = "0.48.5" @@ -5671,6 +5772,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" + [[package]] name = "windows_i686_gnu" version = "0.48.5" @@ -5683,12 +5790,24 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" +[[package]] +name = "windows_i686_gnu" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3" + [[package]] name = "windows_i686_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +[[package]] +name = "windows_i686_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" + [[package]] name = "windows_i686_msvc" version = "0.48.5" @@ -5701,6 +5820,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +[[package]] +name = "windows_i686_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d" + [[package]] name = "windows_x86_64_gnu" version = "0.48.5" @@ -5713,6 +5838,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" +[[package]] +name = "windows_x86_64_gnu" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" + [[package]] name = "windows_x86_64_gnullvm" version = "0.48.5" @@ -5725,6 +5856,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" + [[package]] name = "windows_x86_64_msvc" version = "0.48.5" @@ -5737,11 +5874,17 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" +[[package]] +name = "windows_x86_64_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" + [[package]] name = "winnow" -version = "0.7.4" +version = "0.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e97b544156e9bebe1a0ffbc03484fc1ffe3100cbce3ffb17eac35f7cdd7ab36" +checksum = "74c7b26e3480b707944fc872477815d29a8e429d2f93a1ce000f5fa84a15cbcd" dependencies = [ "memchr", ] @@ -5762,20 +5905,14 @@ version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.9.1", ] -[[package]] -name = "write16" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" - [[package]] name = "writeable" -version = "0.5.5" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" +checksum = "ea2f10b9bb0928dfb1b42b65e1f9e36f7f54dbdf08457afefb38afcdec4fa2bb" [[package]] name = "wyz" @@ -5831,9 +5968,9 @@ dependencies = [ [[package]] name = "yoke" -version = "0.7.5" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40" +checksum = "5f41bb01b8226ef4bfd589436a297c53d118f65921786300e427be8d487695cc" dependencies = [ "serde", "stable_deref_trait", @@ -5843,54 +5980,34 @@ dependencies = [ [[package]] name = "yoke-derive" -version = "0.7.5" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" +checksum = "38da3c9736e16c5d3c8c597a9aaa5d1fa565d0532ae05e27c24aa62fb32c0ab6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.104", "synstructure", ] [[package]] name = "zerocopy" -version = "0.7.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" -dependencies = [ - "zerocopy-derive 0.7.35", -] - -[[package]] -name = "zerocopy" -version = "0.8.23" +version = "0.8.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd97444d05a4328b90e75e503a34bad781f14e28a823ad3557f0750df1ebcbc6" +checksum = "1039dd0d3c310cf05de012d8a39ff557cb0d23087fd44cad61df08fc31907a2f" dependencies = [ - "zerocopy-derive 0.8.23", + "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.35" +version = "0.8.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +checksum = "9ecf5b4cc5364572d7f4c329661bcc82724222973f2cab6f050a4e5c22f75181" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", -] - -[[package]] -name = "zerocopy-derive" -version = "0.8.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6352c01d0edd5db859a63e2605f4ea3183ddbd15e2c4a9e7d32184df75e4f154" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.100", + "syn 2.0.104", ] [[package]] @@ -5910,7 +6027,7 @@ checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.104", "synstructure", ] @@ -5932,14 +6049,25 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.104", +] + +[[package]] +name = "zerotrie" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36f0bbd478583f79edad978b407914f61b2972f5af6fa089686016be8f9af595" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", ] [[package]] name = "zerovec" -version = "0.10.4" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" +checksum = "4a05eb080e015ba39cc9e23bbe5e7fb04d5fb040350f99f34e338d5fdd294428" dependencies = [ "yoke", "zerofrom", @@ -5948,13 +6076,13 @@ dependencies = [ [[package]] name = "zerovec-derive" -version = "0.10.3" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" +checksum = "5b96237efa0c878c64bd89c436f661be4e46b2f3eff1ebb976f7ef2321d2f58f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.104", ] [[package]] @@ -5974,9 +6102,9 @@ dependencies = [ [[package]] name = "zune-jpeg" -version = "0.4.14" +version = "0.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99a5bab8d7dedf81405c4bb1f2b83ea057643d9cb28778cea9eecddeedd2e028" +checksum = "7384255a918371b5af158218d131530f694de9ad3815ebdd0453a940485cb0fa" dependencies = [ "zune-core", ] From 5665954e3a7577c9f1a98336fd5d67c1bf29eecf Mon Sep 17 00:00:00 2001 From: Hermann Core Date: Mon, 30 Jun 2025 11:17:50 +0100 Subject: [PATCH 14/25] fix: apply clippy suggestions --- .../didcomm-messaging/did-utils/examples/multibase.rs | 4 ++-- .../did-utils/src/methods/key/method.rs | 4 ++-- .../did-utils/src/methods/peer/errors.rs | 2 +- .../did-utils/src/methods/resolution.rs | 2 +- .../did-utils/src/methods/web/resolver.rs | 10 +++++----- .../didcomm-messaging/did-utils/src/vc/model.rs | 8 ++++---- .../protocols/discover-features/src/handler.rs | 4 ++-- .../protocols/forward/src/handler.rs | 2 +- .../protocols/mediator-coordination/src/client/dic.rs | 2 +- crates/web-plugins/didcomm-messaging/src/plugin.rs | 11 ++++------- crates/web-plugins/oob-messages/src/models.rs | 11 +++++------ src/plugins/manager.rs | 3 +-- 12 files changed, 29 insertions(+), 34 deletions(-) diff --git a/crates/web-plugins/didcomm-messaging/did-utils/examples/multibase.rs b/crates/web-plugins/didcomm-messaging/did-utils/examples/multibase.rs index ea52c746..5138270d 100644 --- a/crates/web-plugins/didcomm-messaging/did-utils/examples/multibase.rs +++ b/crates/web-plugins/didcomm-messaging/did-utils/examples/multibase.rs @@ -9,9 +9,9 @@ fn main() { let base58_public_key = Base::Base58Btc.encode(public_key); - println!("The base58 public key is: {}", base58_public_key); + println!("The base58 public key is: {base58_public_key}"); let base58_multi_public_key = multibase::encode(Base::Base58Btc, public_key); - println!("The base58 multi public key is: {}", base58_multi_public_key); + println!("The base58 multi public key is: {base58_multi_public_key}"); } diff --git a/crates/web-plugins/didcomm-messaging/did-utils/src/methods/key/method.rs b/crates/web-plugins/didcomm-messaging/did-utils/src/methods/key/method.rs index b43b8681..86c48eaa 100644 --- a/crates/web-plugins/didcomm-messaging/did-utils/src/methods/key/method.rs +++ b/crates/web-plugins/didcomm-messaging/did-utils/src/methods/key/method.rs @@ -81,7 +81,7 @@ impl DidKey { [&Algorithm::Ed25519.muticodec_prefix(), keypair.public_key_bytes()?.as_slice()].concat(), ); - Ok(format!("did:key:{}", multibase_value)) + Ok(format!("did:key:{multibase_value}")) } /// Converts a raw public key into a DID key. @@ -113,7 +113,7 @@ impl DidKey { let multibase_value = multibase::encode(Base58Btc, [&alg.muticodec_prefix(), bytes].concat()); - Ok(format!("did:key:{}", multibase_value)) + Ok(format!("did:key:{multibase_value}")) } /// Expands `did:key` address into DID document diff --git a/crates/web-plugins/didcomm-messaging/did-utils/src/methods/peer/errors.rs b/crates/web-plugins/didcomm-messaging/did-utils/src/methods/peer/errors.rs index aed377ed..5578df15 100644 --- a/crates/web-plugins/didcomm-messaging/did-utils/src/methods/peer/errors.rs +++ b/crates/web-plugins/didcomm-messaging/did-utils/src/methods/peer/errors.rs @@ -65,7 +65,7 @@ impl From for DIDResolutionError { impl std::fmt::Display for DIDPeerMethodError { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{:?}", self) + write!(f, "{self:?}") } } diff --git a/crates/web-plugins/didcomm-messaging/did-utils/src/methods/resolution.rs b/crates/web-plugins/didcomm-messaging/did-utils/src/methods/resolution.rs index c7b9be8c..f82d3e32 100644 --- a/crates/web-plugins/didcomm-messaging/did-utils/src/methods/resolution.rs +++ b/crates/web-plugins/didcomm-messaging/did-utils/src/methods/resolution.rs @@ -214,7 +214,7 @@ pub(super) fn dereference_did_document( let entries = diddoc.service.clone().unwrap_or_default(); let found: Vec<_> = entries .iter() - .filter(|entry| entry.id.ends_with(&format!("#{}", service))) + .filter(|entry| entry.id.ends_with(&format!("#{service}"))) .map(|entry| entry.service_endpoint.clone()) .collect(); diff --git a/crates/web-plugins/didcomm-messaging/did-utils/src/methods/web/resolver.rs b/crates/web-plugins/didcomm-messaging/did-utils/src/methods/web/resolver.rs index 8a9dfd3c..e77ec09e 100644 --- a/crates/web-plugins/didcomm-messaging/did-utils/src/methods/web/resolver.rs +++ b/crates/web-plugins/didcomm-messaging/did-utils/src/methods/web/resolver.rs @@ -111,7 +111,7 @@ fn parse_did_web_url(did: &str) -> Result<(String, String), DidWebError> { None => ".well-known".to_string(), }; - path = format!("/{}/did.json", path); + path = format!("/{path}/did.json"); Ok((path, domain_name)) } @@ -215,7 +215,7 @@ mod tests { let port = 3000; let host = create_mock_server(port).await; - let formatted_string = format!("did:web:{}%3A{}", host, port); + let formatted_string = format!("did:web:{host}%3A{port}"); let did: &str = &formatted_string; @@ -259,21 +259,21 @@ mod tests { fn test_parse_did_web_url() { let input_1 = "did:web:w3c-ccg.github.io"; let result_1 = resolver::parse_did_web_url(input_1); - assert!(result_1.is_ok(), "Expected Ok, got {:?}", result_1); + assert!(result_1.is_ok(), "Expected Ok, got {result_1:?}"); let (path_1, domain_name_1) = result_1.unwrap(); assert_eq!(domain_name_1, "w3c-ccg.github.io"); assert_eq!(path_1, "/.well-known/did.json"); let input_2 = "did:web:w3c-ccg.github.io:user:alice"; let result_2 = resolver::parse_did_web_url(input_2); - assert!(result_2.is_ok(), "Expected Ok, got {:?}", result_2); + assert!(result_2.is_ok(), "Expected Ok, got {result_2:?}"); let (path_2, domain_name_2) = result_2.unwrap(); assert_eq!(domain_name_2, "w3c-ccg.github.io"); assert_eq!(path_2, "/user/alice/did.json"); let input_3 = "did:web:example.com%3A3000:user:alice"; let result_3 = resolver::parse_did_web_url(input_3); - assert!(result_3.is_ok(), "Expected Ok, got {:?}", result_3); + assert!(result_3.is_ok(), "Expected Ok, got {result_3:?}"); let (path_3, domain_name_3) = result_3.unwrap(); assert_eq!(domain_name_3, "example.com:3000"); assert_eq!(path_3, "/user/alice/did.json"); diff --git a/crates/web-plugins/didcomm-messaging/did-utils/src/vc/model.rs b/crates/web-plugins/didcomm-messaging/did-utils/src/vc/model.rs index 7ed20001..b4a5b000 100644 --- a/crates/web-plugins/didcomm-messaging/did-utils/src/vc/model.rs +++ b/crates/web-plugins/didcomm-messaging/did-utils/src/vc/model.rs @@ -350,7 +350,7 @@ mod tests { let key_pair = issuer_key_pair(); let public_key = &key_pair.public_key.clone(); let public_key_multibase = multibase::encode(Base::Base58Btc, public_key.as_bytes()); - let issuer_vm = format!("did:key#{}", public_key_multibase); + let issuer_vm = format!("did:key#{public_key_multibase}"); let ed_dsa_jcs_2022_prover = EdDsaJcs2022 { proof: make_proof(&issuer_vm), key_pair, @@ -405,7 +405,7 @@ mod tests { let secured_vc: VerifiableCredential = from_str(SECURED_VC).unwrap(); let vp = make_vp(secured_vc); let vp_canon = json_canon::to_string(&vp).unwrap(); - println!("{}", vp_canon); + println!("{vp_canon}"); } const CONTEXTS: &[&str] = &["https://www.w3.org/ns/credentials/v2", "https://www.w3.org/ns/credentials/examples/v2"]; @@ -425,7 +425,7 @@ mod tests { // Prepare the alumni credential to be added as dynamic property. let mut alumni_of_map = HashMap::new(); alumni_of_map.insert("name".to_string(), Value::String("Example University".to_string())); - let did = format!("did:key#{}", subject_public_key_multibase); + let did = format!("did:key#{subject_public_key_multibase}"); alumni_of_map.insert("id".to_string(), Value::String(did.to_string())); let alumni_of_json_value = json!(alumni_of_map); let mut additional_properties: HashMap = HashMap::new(); @@ -434,7 +434,7 @@ mod tests { context: make_context(), id: Some("http://university.example/credentials/3732".to_string()), cred_type: vec!["VerifiableCredential".to_string(), "AlumniCredential".to_string()], - issuer: Issuers::Single(Box::new(Issuer::SingleString(format!("did:key#{}", issuer_pub_key_multibase)))), + issuer: Issuers::Single(Box::new(Issuer::SingleString(format!("did:key#{issuer_pub_key_multibase}")))), valid_from: Some(Utc.with_ymd_and_hms(2023, 3, 5, 19, 23, 24).unwrap()), valid_until: Some(Utc.with_ymd_and_hms(2023, 12, 31, 19, 23, 24).unwrap()), credential_subject: CredentialSubject { diff --git a/crates/web-plugins/didcomm-messaging/protocols/discover-features/src/handler.rs b/crates/web-plugins/didcomm-messaging/protocols/discover-features/src/handler.rs index 49cadf4f..01d2f9e3 100644 --- a/crates/web-plugins/didcomm-messaging/protocols/discover-features/src/handler.rs +++ b/crates/web-plugins/didcomm-messaging/protocols/discover-features/src/handler.rs @@ -209,7 +209,7 @@ mod test { assert_eq!(id, MEDIATION.to_string()); } Err(e) => { - panic!("This should not occur {:?}", e) + panic!("This should not occur {e:?}") } } } @@ -266,7 +266,7 @@ mod test { assert_eq!(id, MEDIATION.to_string()); } Err(e) => { - panic!("This should not occur {:?}", e) + panic!("This should not occur {e:?}") } } } diff --git a/crates/web-plugins/didcomm-messaging/protocols/forward/src/handler.rs b/crates/web-plugins/didcomm-messaging/protocols/forward/src/handler.rs index 2b49abed..826d8a26 100644 --- a/crates/web-plugins/didcomm-messaging/protocols/forward/src/handler.rs +++ b/crates/web-plugins/didcomm-messaging/protocols/forward/src/handler.rs @@ -201,7 +201,7 @@ mod test { .await .unwrap(); - println!("Mediator1 is forwarding message \n{:?}\n", msg); + println!("Mediator1 is forwarding message \n{msg:?}\n"); } pub fn _sender_did() -> String { diff --git a/crates/web-plugins/didcomm-messaging/protocols/mediator-coordination/src/client/dic.rs b/crates/web-plugins/didcomm-messaging/protocols/mediator-coordination/src/client/dic.rs index 07f29460..5d26eed9 100644 --- a/crates/web-plugins/didcomm-messaging/protocols/mediator-coordination/src/client/dic.rs +++ b/crates/web-plugins/didcomm-messaging/protocols/mediator-coordination/src/client/dic.rs @@ -43,7 +43,7 @@ pub fn make_compact_jwt_presentation( let header = JwsHeader { alg: JwsAlg::EdDSA, kid: holder_kid.map(String::from), - typ: Some(format!("{}+jwt", kind)), + typ: Some(format!("{kind}+jwt")), ..Default::default() }; diff --git a/crates/web-plugins/didcomm-messaging/src/plugin.rs b/crates/web-plugins/didcomm-messaging/src/plugin.rs index c8c11c48..05698b32 100644 --- a/crates/web-plugins/didcomm-messaging/src/plugin.rs +++ b/crates/web-plugins/didcomm-messaging/src/plugin.rs @@ -34,8 +34,7 @@ struct DidcommMessagingPluginEnv { fn load_plugin_env() -> Result { let public_domain = std::env::var("SERVER_PUBLIC_DOMAIN").map_err(|err| { PluginError::InitError(format!( - "SERVER_PUBLIC_DOMAIN env variable required: {:?}", - err + "SERVER_PUBLIC_DOMAIN env variable required: {err:?}" )) })?; @@ -65,8 +64,7 @@ impl Plugin for DidcommMessaging { // Expect DID document from the repository if let Err(err) = did_endpoint::validate_diddoc(&keystore, &repository) { return Err(PluginError::InitError(format!( - "DID document validation failed: {:?}", - err + "DID document validation failed: {err:?}" ))); } @@ -87,8 +85,7 @@ impl Plugin for DidcommMessaging { let mut container = MessagePluginContainer::new(); if let Err(err) = container.load() { return Err(PluginError::InitError(format!( - "Error loading didcomm messages container: {:?}", - err + "Error loading didcomm messages container: {err:?}" ))); } @@ -157,7 +154,7 @@ impl Plugin for DidcommMessaging { Some(repository), db_breaker, ) - .map_err(|err| PluginError::Other(format!("Failed to load app state: {:?}", err)))?; + .map_err(|err| PluginError::Other(format!("Failed to load app state: {err:?}")))?; // Build router Ok(web::routes(Arc::new(state))) diff --git a/crates/web-plugins/oob-messages/src/models.rs b/crates/web-plugins/oob-messages/src/models.rs index 8eec2c2b..23d290aa 100644 --- a/crates/web-plugins/oob-messages/src/models.rs +++ b/crates/web-plugins/oob-messages/src/models.rs @@ -71,11 +71,10 @@ impl OobMessage { } fn serialize_oob_message(oob_message: &OobMessage, url: &str) -> Result { - let plaintext = - to_string(oob_message).map_err(|e| format!("Serialization error: {}", e))?; + let plaintext = to_string(oob_message).map_err(|e| format!("Serialization error: {e}"))?; let encoded_jwm = Base64Url.encode(plaintext.as_bytes()); - Ok(format!("{}?_oob={}", url, encoded_jwm)) + Ok(format!("{url}?_oob={encoded_jwm}")) } } @@ -156,15 +155,15 @@ mod tests { let server_public_domain = "https://example.com"; let server_local_port = "8080"; - let url = format!("{}:{}", server_public_domain, server_local_port); + let url = format!("{server_public_domain}:{server_local_port}"); let oob_message = OobMessage::new(did); let oob_url = OobMessage::serialize_oob_message(&oob_message, &url) - .unwrap_or_else(|err| panic!("Failed to serialize oob message: {}", err)); + .unwrap_or_else(|err| panic!("Failed to serialize oob message: {err}")); assert!(!oob_url.is_empty()); - assert!(oob_url.starts_with(&format!("{}?_oob=", url))); + assert!(oob_url.starts_with(&format!("{url}?_oob="))); assert!(oob_url.contains("_oob=")); } diff --git a/src/plugins/manager.rs b/src/plugins/manager.rs index 7f4a3b0f..51ae4089 100644 --- a/src/plugins/manager.rs +++ b/src/plugins/manager.rs @@ -88,8 +88,7 @@ impl PluginContainer<'_> { self.mounted_plugins.push(plugin_clone); self.collected_routes.push(plugin.routes().map_err(|err| { PluginContainerError::ContainerError(format!( - "Error collecting routes for plugin {plugin_name}\n{:?}", - err + "Error collecting routes for plugin {plugin_name}\n{err:?}" )) })?); } From 54d560c072198f64a9cc66ca82825ab9338aa0f6 Mon Sep 17 00:00:00 2001 From: Hermann Core Date: Fri, 4 Jul 2025 08:56:07 +0100 Subject: [PATCH 15/25] docs: update README to clarify project setup and environmental variables --- README.md | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 1453f767..2d9e9f10 100644 --- a/README.md +++ b/README.md @@ -53,41 +53,47 @@ git clone git@github.com:adorsys/didcomm-mediator-rs.git ## Running the Project -### Mongo DB +### Environmental variables -This project uses MongoDB as the database. You need to have [MongoDB](https://www.mongodb.com) installed and running on your system. +You need to create a **`.env`** file in the root directory of the project. Take a look at the [.env.example](.env.example) file for more information about the needed variables. -Another option is to use [Docker](https://www.docker.com): +### Running with Docker Compose + +The easiest way to run the project is with [Docker Compose](https://docs.docker.com/compose/). + +Run the following command: ```sh -docker pull mongo -docker run --name mongodb -d mongo +docker-compose up --build ``` -### Environmental variables +This will build the docker image of the mediator server with all its prerequisites and run it. -You need to create a **`.env`** file in the root directory of the project. Take a look at the [example](.env.example) file for more information about the needed variables. +### Running with Cargo -You can now start the mediator server: +#### MongoDB + +This project uses MongoDB as the database. You need to have [MongoDB](https://www.mongodb.com) installed and running on your system. + +Another option is to use [Docker](https://www.docker.com): ```sh -cargo run +docker pull mongo +docker run --name mongodb -d mongo ``` -### Running with Docker Compose +#### AWS Secrets Manager -You can run the project with Docker Compose. +The server uses AWS Secrets Manager for storing the mediator secrets. You need to configure AWS credentials in your environment. For tests you can use [LocalStack](https://localstack.cloud/) as a local AWS service. -* First change the `MONGO_URI` variable in the `.env` file to `mongodb://mongodb:27017` +> check the `.env.example` file for needed variables -* Then run the following command: +You can now start the mediator server: ```sh -docker-compose up +cargo run ``` -This will build the docker image of the mediator server with all its prerequisites and run it. - The output should look like this: ![image](docs/server-output.webp) From b32c40790cecdf1f517899c59d2e812f846d8d9e Mon Sep 17 00:00:00 2001 From: Hermann Core Date: Fri, 4 Jul 2025 08:57:14 +0100 Subject: [PATCH 16/25] fix: update docker-compose to add LocalStack service for AWS Secrets Manager interaction --- docker-compose.yml | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 7feceb40..8ba9a29b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,30 +4,48 @@ services: context: . container_name: didcomm-mediator ports: - - "3000:3000" + - 3000:3000 env_file: - .env depends_on: mongodb: condition: service_healthy + localstack: + condition: service_healthy networks: - mediator-network mongodb: - image: mongo:latest + image: mongo:8 container_name: mongodb + restart: always ports: - - "27017:27017" + - 27017:27017 volumes: - mongo-data:/data/db networks: - mediator-network healthcheck: - test: ["CMD", "mongo", "--eval", "db.adminCommand('ping')"] + test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')"] interval: 10s timeout: 5s retries: 5 + localstack: + container_name: localstack + image: localstack/localstack + ports: + - 4566:4566 + environment: + - SERVICES=secretsmanager + healthcheck: + test: ["CMD-SHELL", "curl -f http://localhost:4566/"] + interval: 5s + timeout: 5s + retries: 5 + networks: + - mediator-network + volumes: mongo-data: From 26de86e2b0f5179e30007eb380a80b08e149312c Mon Sep 17 00:00:00 2001 From: Hermann Core Date: Fri, 4 Jul 2025 08:58:18 +0100 Subject: [PATCH 17/25] fix: update test configuration and encoding for DID keys --- .github/scripts/test_config.sh | 2 -- crates/web-plugins/did-endpoint/Cargo.toml | 1 + crates/web-plugins/did-endpoint/src/didgen.rs | 3 +- crates/web-plugins/did-endpoint/src/util.rs | 31 +++++++++++++------ crates/web-plugins/did-endpoint/src/web.rs | 3 +- 5 files changed, 26 insertions(+), 14 deletions(-) diff --git a/.github/scripts/test_config.sh b/.github/scripts/test_config.sh index 07e50096..0bcc4baf 100755 --- a/.github/scripts/test_config.sh +++ b/.github/scripts/test_config.sh @@ -4,10 +4,8 @@ cat < .env.example SERVER_PUBLIC_DOMAIN=https://example.com SERVER_LOCAL_PORT=3000 -STORAGE_DIRPATH=test/storage MONGO_URI=mongodb://localhost:27017/ MONGO_DBN=didcomm-mediator -MASTER_KEY=1234567890qwertyuiopasdfghjklxzc EOL echo ".env.example file created successfully!" \ No newline at end of file diff --git a/crates/web-plugins/did-endpoint/Cargo.toml b/crates/web-plugins/did-endpoint/Cargo.toml index 2a579b5d..e7ae3bab 100644 --- a/crates/web-plugins/did-endpoint/Cargo.toml +++ b/crates/web-plugins/did-endpoint/Cargo.toml @@ -26,6 +26,7 @@ tracing.workspace = true mongodb.workspace = true http-body-util.workspace = true aws-config.workspace = true +base64.workspace = true uuid = { workspace = true, features = ["v4"] } tokio = { workspace = true, features = ["full"] } axum = { workspace = true, features = ["macros"] } diff --git a/crates/web-plugins/did-endpoint/src/didgen.rs b/crates/web-plugins/did-endpoint/src/didgen.rs index e7b9effe..726be623 100644 --- a/crates/web-plugins/did-endpoint/src/didgen.rs +++ b/crates/web-plugins/did-endpoint/src/didgen.rs @@ -193,6 +193,7 @@ fn validate_key(kid: &str, keystore: &Keystore) -> Result<(), String> { pub(crate) mod tests { use super::*; use crate::persistence::tests::MockDidDocumentRepository; + use base64::prelude::{Engine as _, BASE64_STANDARD}; pub(crate) fn setup() -> Jwk { serde_json::from_str( @@ -230,7 +231,7 @@ pub(crate) mod tests { #[tokio::test(flavor = "multi_thread")] async fn test_did_validation() { - let kid = "did:peer:123#key-1".to_string(); + let kid = BASE64_STANDARD.encode("did:peer:123#key-1"); let repository = MockDidDocumentRepository::new(); let mock_keystore = Keystore::with_mock_configs(vec![(kid.clone(), setup())]); diff --git a/crates/web-plugins/did-endpoint/src/util.rs b/crates/web-plugins/did-endpoint/src/util.rs index b30ae031..459afe13 100644 --- a/crates/web-plugins/did-endpoint/src/util.rs +++ b/crates/web-plugins/did-endpoint/src/util.rs @@ -1,18 +1,21 @@ +use base64::prelude::{Engine as _, BASE64_STANDARD}; use did_utils::didcore::Document; -use std::borrow::Cow; // This function is a hack to bypass certain constraints of the did:peer method specification. // Its purpose is to uniquely identify the keys used to generate a Peer DID address in the store. -pub(crate) fn handle_vm_id<'a>(vm_id: &'a str, diddoc: &Document) -> Cow<'a, str> { - if vm_id.starts_with('#') { - Cow::Owned(diddoc.id.to_owned() + vm_id) +pub(crate) fn handle_vm_id(vm_id: &str, diddoc: &Document) -> String { + let kid = if vm_id.starts_with('#') { + diddoc.id.to_owned() + vm_id } else { - Cow::Borrowed(vm_id) - } + vm_id.to_owned() + }; + + BASE64_STANDARD.encode(kid) } #[cfg(test)] mod tests { + use super::*; use did_utils::didcore::Document; use super::handle_vm_id; @@ -23,11 +26,19 @@ mod tests { id: "did:example:123".to_owned(), ..Default::default() }; - assert_eq!(handle_vm_id("#key-1", &diddoc), "did:example:123#key-1"); - assert_eq!(handle_vm_id("did:key:123#456", &diddoc), "did:key:123#456"); + let expected_kid = BASE64_STANDARD.encode("did:example:123#key-1"); + assert_eq!(handle_vm_id("#key-1", &diddoc), expected_kid); + let expected_kid = BASE64_STANDARD.encode("did:key:123#456"); + assert_eq!(handle_vm_id("did:key:123#456", &diddoc), expected_kid); let diddoc = Document::default(); - assert_eq!(handle_vm_id("#key-1", &diddoc), "#key-1"); - assert_eq!(handle_vm_id("key-1", &diddoc), "key-1"); + assert_eq!( + handle_vm_id("#key-1", &diddoc), + BASE64_STANDARD.encode("#key-1") + ); + assert_eq!( + handle_vm_id("key-1", &diddoc), + BASE64_STANDARD.encode("key-1") + ); } } diff --git a/crates/web-plugins/did-endpoint/src/web.rs b/crates/web-plugins/did-endpoint/src/web.rs index 1681415b..34aecf2d 100644 --- a/crates/web-plugins/did-endpoint/src/web.rs +++ b/crates/web-plugins/did-endpoint/src/web.rs @@ -192,6 +192,7 @@ mod tests { body::Body, http::{Request, StatusCode}, }; + use base64::prelude::{Engine as _, BASE64_STANDARD}; use database::Repository; use did_utils::{ didcore::{Document, KeyFormat, Proofs}, @@ -229,7 +230,7 @@ mod tests { ) .unwrap(); - let kid = "did:peer:123#key-1".to_string(); + let kid = BASE64_STANDARD.encode("did:peer:123#key-1"); let repository = MockDidDocumentRepository::new(); let mock_keystore = Keystore::with_mock_configs(vec![(kid, setup())]); From ef10f63bfb1b01895708cd54c13b848513d4e3de Mon Sep 17 00:00:00 2001 From: Hermann Core Date: Fri, 4 Jul 2025 09:00:11 +0100 Subject: [PATCH 18/25] refactor: add base64 encoding for verification methods and verification relationship in DID Document and update resolver logic --- .../web-plugins/didcomm-messaging/Cargo.toml | 1 + .../protocols/forward/Cargo.toml | 1 + .../didcomm-messaging/shared/Cargo.toml | 1 + .../shared/src/utils/resolvers.rs | 274 +++++++++--------- .../shared/src/utils/tests_utils.rs | 111 +++---- .../src/did_rotation/handler.rs | 8 +- .../didcomm-messaging/src/web/dispatcher.rs | 1 - crates/web-plugins/oob-messages/src/web.rs | 1 - 8 files changed, 200 insertions(+), 198 deletions(-) diff --git a/crates/web-plugins/didcomm-messaging/Cargo.toml b/crates/web-plugins/didcomm-messaging/Cargo.toml index b9b95f31..77cad439 100644 --- a/crates/web-plugins/didcomm-messaging/Cargo.toml +++ b/crates/web-plugins/didcomm-messaging/Cargo.toml @@ -34,6 +34,7 @@ serde_json.workspace = true thiserror.workspace = true http-body-util.workspace = true aws-config.workspace = true +base64.workspace = true tokio = { workspace = true, features = ["full"] } hyper = { workspace = true, features = ["full"] } axum = { workspace = true, features = ["macros"] } diff --git a/crates/web-plugins/didcomm-messaging/protocols/forward/Cargo.toml b/crates/web-plugins/didcomm-messaging/protocols/forward/Cargo.toml index 96d85292..68ae8858 100644 --- a/crates/web-plugins/didcomm-messaging/protocols/forward/Cargo.toml +++ b/crates/web-plugins/didcomm-messaging/protocols/forward/Cargo.toml @@ -15,6 +15,7 @@ async-trait.workspace = true serde_json.workspace = true thiserror.workspace = true futures.workspace = true +base64.workspace = true didcomm = { workspace = true, features = ["uniffi"] } hyper = { workspace = true, features = ["full"] } axum = { workspace = true, features = ["macros"] } diff --git a/crates/web-plugins/didcomm-messaging/shared/Cargo.toml b/crates/web-plugins/didcomm-messaging/shared/Cargo.toml index c5e05d2f..bb6ac495 100644 --- a/crates/web-plugins/didcomm-messaging/shared/Cargo.toml +++ b/crates/web-plugins/didcomm-messaging/shared/Cargo.toml @@ -16,6 +16,7 @@ async-trait.workspace = true mongodb.workspace = true eyre.workspace = true parking_lot.workspace = true +base64.workspace = true pin-project-lite.workspace = true tokio = { workspace = true, features = ["full"] } didcomm = { workspace = true, features = ["uniffi"] } diff --git a/crates/web-plugins/didcomm-messaging/shared/src/utils/resolvers.rs b/crates/web-plugins/didcomm-messaging/shared/src/utils/resolvers.rs index 71f65d37..92a66f58 100644 --- a/crates/web-plugins/didcomm-messaging/shared/src/utils/resolvers.rs +++ b/crates/web-plugins/didcomm-messaging/shared/src/utils/resolvers.rs @@ -1,4 +1,5 @@ use async_trait::async_trait; +use base64::prelude::{Engine as _, BASE64_STANDARD}; use did_utils::{ crypto::PublicKeyFormat, didcore::{Document, VerificationMethodType}, @@ -32,7 +33,7 @@ impl DIDResolver for LocalDIDResolver { async fn resolve(&self, did: &str) -> Result> { if did == self.diddoc.id { let mut diddoc = self.diddoc.clone(); - prepend_doc_id_to_vm_ids(&mut diddoc); + sanitize_vm_ids(&mut diddoc); return Ok(Some(serde_json::from_value(json!(diddoc))?)); } @@ -49,7 +50,7 @@ impl DIDResolver for LocalDIDResolver { let mut diddoc = DidPeer::with_format(PublicKeyFormat::Jwk) .expand(did) .map_err(|e| Error::new(ErrorKind::DIDNotResolved, e))?; - prepend_doc_id_to_vm_ids(&mut diddoc); + sanitize_vm_ids(&mut diddoc); let diddoc = serde_json::from_value(json!(diddoc))?; Ok(Some(diddoc)) } else { @@ -61,25 +62,27 @@ impl DIDResolver for LocalDIDResolver { } } -fn prepend_doc_id_to_vm_ids(diddoc: &mut Document) { - if let Some(verification_methods) = diddoc.verification_method.as_mut() { - for vm in verification_methods.iter_mut() { - vm.id = diddoc.id.to_owned() + &vm.id; +fn sanitize_vm_ids(diddoc: &mut Document) { + if diddoc.id.starts_with("did:peer") { + if let Some(verification_methods) = diddoc.verification_method.as_mut() { + for vm in verification_methods.iter_mut() { + vm.id = BASE64_STANDARD.encode(diddoc.id.to_owned() + &vm.id); + } } - } - let rel_prepend = |rel: &mut Option>| { - if let Some(rel) = rel { - for vm in rel.iter_mut() { - if let VerificationMethodType::Reference(ref mut id) = vm { - *id = diddoc.id.to_owned() + id; + let rel_prepend = |rel: &mut Option>| { + if let Some(rel) = rel { + for vm in rel.iter_mut() { + if let VerificationMethodType::Reference(ref mut id) = vm { + *id = BASE64_STANDARD.encode(diddoc.id.to_owned() + id); + } } } - } - }; + }; - rel_prepend(&mut diddoc.authentication); - rel_prepend(&mut diddoc.key_agreement); + rel_prepend(&mut diddoc.authentication); + rel_prepend(&mut diddoc.key_agreement); + } } #[derive(Clone)] @@ -140,7 +143,6 @@ mod tests { use super::*; use did_utils::jwk::Jwk; - use serde_json::Value; fn setup() -> Document { tests::setup().clone().diddoc.clone() @@ -153,53 +155,52 @@ mod tests { let did = "did:peer:2.Ez6LSteycMr6tTki5aAEjNAVDsp1vrx9DuDWHDnky9qxyFNUF.Vz6MkigiwfSzv66VSTAeGZLsTHa8ixK1agNFvry2KjYXmg1G3.SeyJpZCI6IiNkaWRjb21tIiwicyI6eyJhIjpbImRpZGNvbW0vdjIiXSwiciI6W10sInVyaSI6Imh0dHA6Ly9hbGljZS1tZWRpYXRvci5jb20ifSwidCI6ImRtIn0"; let resolved = resolver.resolve(did).await.unwrap().unwrap(); - let expected = serde_json::from_str::( - r##"{ - "id": "did:peer:2.Ez6LSteycMr6tTki5aAEjNAVDsp1vrx9DuDWHDnky9qxyFNUF.Vz6MkigiwfSzv66VSTAeGZLsTHa8ixK1agNFvry2KjYXmg1G3.SeyJpZCI6IiNkaWRjb21tIiwicyI6eyJhIjpbImRpZGNvbW0vdjIiXSwiciI6W10sInVyaSI6Imh0dHA6Ly9hbGljZS1tZWRpYXRvci5jb20ifSwidCI6ImRtIn0", - "verificationMethod": [ - { - "id": "did:peer:2.Ez6LSteycMr6tTki5aAEjNAVDsp1vrx9DuDWHDnky9qxyFNUF.Vz6MkigiwfSzv66VSTAeGZLsTHa8ixK1agNFvry2KjYXmg1G3.SeyJpZCI6IiNkaWRjb21tIiwicyI6eyJhIjpbImRpZGNvbW0vdjIiXSwiciI6W10sInVyaSI6Imh0dHA6Ly9hbGljZS1tZWRpYXRvci5jb20ifSwidCI6ImRtIn0#key-1", - "type": "JsonWebKey2020", - "controller": "did:peer:2.Ez6LSteycMr6tTki5aAEjNAVDsp1vrx9DuDWHDnky9qxyFNUF.Vz6MkigiwfSzv66VSTAeGZLsTHa8ixK1agNFvry2KjYXmg1G3.SeyJpZCI6IiNkaWRjb21tIiwicyI6eyJhIjpbImRpZGNvbW0vdjIiXSwiciI6W10sInVyaSI6Imh0dHA6Ly9hbGljZS1tZWRpYXRvci5jb20ifSwidCI6ImRtIn0", - "publicKeyJwk": { - "kty": "OKP", - "crv": "X25519", - "x": "_EgIPSRgbPPw5-nUsJ6xqMvw5rXn3BViGADeUrjAMzA" - } - }, - { - "id": "did:peer:2.Ez6LSteycMr6tTki5aAEjNAVDsp1vrx9DuDWHDnky9qxyFNUF.Vz6MkigiwfSzv66VSTAeGZLsTHa8ixK1agNFvry2KjYXmg1G3.SeyJpZCI6IiNkaWRjb21tIiwicyI6eyJhIjpbImRpZGNvbW0vdjIiXSwiciI6W10sInVyaSI6Imh0dHA6Ly9hbGljZS1tZWRpYXRvci5jb20ifSwidCI6ImRtIn0#key-2", - "type": "JsonWebKey2020", - "controller": "did:peer:2.Ez6LSteycMr6tTki5aAEjNAVDsp1vrx9DuDWHDnky9qxyFNUF.Vz6MkigiwfSzv66VSTAeGZLsTHa8ixK1agNFvry2KjYXmg1G3.SeyJpZCI6IiNkaWRjb21tIiwicyI6eyJhIjpbImRpZGNvbW0vdjIiXSwiciI6W10sInVyaSI6Imh0dHA6Ly9hbGljZS1tZWRpYXRvci5jb20ifSwidCI6ImRtIn0", - "publicKeyJwk": { - "kty": "OKP", - "crv": "Ed25519", - "x": "PuG2L5um-tAnHlvT29gTm9Wj9fZca16vfBCPKsHB5cA" - } + let agreem_kid = BASE64_STANDARD.encode(did.to_owned() + "#key-1"); + let auth_kid = BASE64_STANDARD.encode(did.to_owned() + "#key-2"); + let expected = json!({ + "id": "did:peer:2.Ez6LSteycMr6tTki5aAEjNAVDsp1vrx9DuDWHDnky9qxyFNUF.Vz6MkigiwfSzv66VSTAeGZLsTHa8ixK1agNFvry2KjYXmg1G3.SeyJpZCI6IiNkaWRjb21tIiwicyI6eyJhIjpbImRpZGNvbW0vdjIiXSwiciI6W10sInVyaSI6Imh0dHA6Ly9hbGljZS1tZWRpYXRvci5jb20ifSwidCI6ImRtIn0", + "verificationMethod": [ + { + "id": agreem_kid, + "type": "JsonWebKey2020", + "controller": "did:peer:2.Ez6LSteycMr6tTki5aAEjNAVDsp1vrx9DuDWHDnky9qxyFNUF.Vz6MkigiwfSzv66VSTAeGZLsTHa8ixK1agNFvry2KjYXmg1G3.SeyJpZCI6IiNkaWRjb21tIiwicyI6eyJhIjpbImRpZGNvbW0vdjIiXSwiciI6W10sInVyaSI6Imh0dHA6Ly9hbGljZS1tZWRpYXRvci5jb20ifSwidCI6ImRtIn0", + "publicKeyJwk": { + "kty": "OKP", + "crv": "X25519", + "x": "_EgIPSRgbPPw5-nUsJ6xqMvw5rXn3BViGADeUrjAMzA" } - ], - "authentication": [ - "did:peer:2.Ez6LSteycMr6tTki5aAEjNAVDsp1vrx9DuDWHDnky9qxyFNUF.Vz6MkigiwfSzv66VSTAeGZLsTHa8ixK1agNFvry2KjYXmg1G3.SeyJpZCI6IiNkaWRjb21tIiwicyI6eyJhIjpbImRpZGNvbW0vdjIiXSwiciI6W10sInVyaSI6Imh0dHA6Ly9hbGljZS1tZWRpYXRvci5jb20ifSwidCI6ImRtIn0#key-2" - ], - "keyAgreement": [ - "did:peer:2.Ez6LSteycMr6tTki5aAEjNAVDsp1vrx9DuDWHDnky9qxyFNUF.Vz6MkigiwfSzv66VSTAeGZLsTHa8ixK1agNFvry2KjYXmg1G3.SeyJpZCI6IiNkaWRjb21tIiwicyI6eyJhIjpbImRpZGNvbW0vdjIiXSwiciI6W10sInVyaSI6Imh0dHA6Ly9hbGljZS1tZWRpYXRvci5jb20ifSwidCI6ImRtIn0#key-1" - ], - "service": [ - { - "id": "#didcomm", - "type": "DIDCommMessaging", - "serviceEndpoint": { - "accept": [ - "didcomm/v2" - ], - "routingKeys": [], - "uri": "http://alice-mediator.com/" - } + }, + { + "id": auth_kid, + "type": "JsonWebKey2020", + "controller": "did:peer:2.Ez6LSteycMr6tTki5aAEjNAVDsp1vrx9DuDWHDnky9qxyFNUF.Vz6MkigiwfSzv66VSTAeGZLsTHa8ixK1agNFvry2KjYXmg1G3.SeyJpZCI6IiNkaWRjb21tIiwicyI6eyJhIjpbImRpZGNvbW0vdjIiXSwiciI6W10sInVyaSI6Imh0dHA6Ly9hbGljZS1tZWRpYXRvci5jb20ifSwidCI6ImRtIn0", + "publicKeyJwk": { + "kty": "OKP", + "crv": "Ed25519", + "x": "PuG2L5um-tAnHlvT29gTm9Wj9fZca16vfBCPKsHB5cA" } - ] - }"## - ) - .unwrap(); + } + ], + "authentication": [ + auth_kid + ], + "keyAgreement": [ + agreem_kid + ], + "service": [ + { + "id": "#didcomm", + "type": "DIDCommMessaging", + "serviceEndpoint": { + "accept": [ + "didcomm/v2" + ], + "routingKeys": [], + "uri": "http://alice-mediator.com/" + } + } + ] + }); assert_eq!( json_canon::to_string(&resolved).unwrap(), @@ -207,19 +208,20 @@ mod tests { ); let did = "did:key:z6MkfyTREjTxQ8hUwSwBPeDHf3uPL3qCjSSuNPwsyMpWUGH7"; + let auth_kid = did.to_owned() + "#z6MkfyTREjTxQ8hUwSwBPeDHf3uPL3qCjSSuNPwsyMpWUGH7"; + let agreem_kid = did.to_owned() + "#z6LSbuUXWSgPfpiDBjUK6E7yiCKMN2eKJsXn5b55ZgqGz6Mr"; let resolved = resolver.resolve(did).await.unwrap().unwrap(); - let expected = serde_json::from_str::( - r#"{ + let expected = json!({ "id": "did:key:z6MkfyTREjTxQ8hUwSwBPeDHf3uPL3qCjSSuNPwsyMpWUGH7", "keyAgreement": [ - "did:key:z6MkfyTREjTxQ8hUwSwBPeDHf3uPL3qCjSSuNPwsyMpWUGH7#z6LSbuUXWSgPfpiDBjUK6E7yiCKMN2eKJsXn5b55ZgqGz6Mr" + agreem_kid ], "authentication": [ - "did:key:z6MkfyTREjTxQ8hUwSwBPeDHf3uPL3qCjSSuNPwsyMpWUGH7#z6MkfyTREjTxQ8hUwSwBPeDHf3uPL3qCjSSuNPwsyMpWUGH7" + auth_kid ], "verificationMethod": [ { - "id": "did:key:z6MkfyTREjTxQ8hUwSwBPeDHf3uPL3qCjSSuNPwsyMpWUGH7#z6MkfyTREjTxQ8hUwSwBPeDHf3uPL3qCjSSuNPwsyMpWUGH7", + "id": auth_kid, "type": "JsonWebKey2020", "controller": "did:key:z6MkfyTREjTxQ8hUwSwBPeDHf3uPL3qCjSSuNPwsyMpWUGH7", "publicKeyJwk": { @@ -229,7 +231,7 @@ mod tests { } }, { - "id": "did:key:z6MkfyTREjTxQ8hUwSwBPeDHf3uPL3qCjSSuNPwsyMpWUGH7#z6LSbuUXWSgPfpiDBjUK6E7yiCKMN2eKJsXn5b55ZgqGz6Mr", + "id": agreem_kid, "type": "JsonWebKey2020", "controller": "did:key:z6MkfyTREjTxQ8hUwSwBPeDHf3uPL3qCjSSuNPwsyMpWUGH7", "publicKeyJwk": { @@ -240,9 +242,7 @@ mod tests { } ], "service": [] - }"#, - ) - .unwrap(); + }); assert_eq!( json_canon::to_string(&resolved).unwrap(), @@ -279,7 +279,6 @@ mod tests { #[tokio::test] async fn test_local_secrets_resolver_works() { - std::env::set_var("MASTER_KEY", "1234567890qwertyuiopasdfghjklxzc"); let secret_id = "did:key:z6MkfyTREjTxQ8hUwSwBPeDHf3uPL3qCjSSuNPwsyMpWUGH7#z6LSbuUXWSgPfpiDBjUK6E7yiCKMN2eKJsXn5b55ZgqGz6Mr"; let secret: Jwk = serde_json::from_str( r#"{ @@ -294,20 +293,17 @@ mod tests { let keystore = Keystore::with_mock_configs(vec![(secret_id.to_string(), secret)]); let resolver = LocalSecretsResolver::new(keystore); - let resolved = resolver.get_secret(secret_id).await.unwrap().unwrap(); - let expected = serde_json::from_str::( - r#"{ - "id": "did:key:z6MkfyTREjTxQ8hUwSwBPeDHf3uPL3qCjSSuNPwsyMpWUGH7#z6LSbuUXWSgPfpiDBjUK6E7yiCKMN2eKJsXn5b55ZgqGz6Mr", - "type": "JsonWebKey2020", - "privateKeyJwk": { - "crv": "X25519", - "d": "oItI6Jx-anGyhiDJIXtVAhzugOha05s-7_a5_CTs_V4", - "kty": "OKP", - "x": "A2gufB762KKDkbTX0usDbekRJ-_PPBeVhc2gNgjpswU" - } - }"#, - ) - .unwrap(); + let resolved = resolver.get_secret(&secret_id).await.unwrap().unwrap(); + let expected = json!({ + "id": secret_id, + "type": "JsonWebKey2020", + "privateKeyJwk": { + "crv": "X25519", + "d": "oItI6Jx-anGyhiDJIXtVAhzugOha05s-7_a5_CTs_V4", + "kty": "OKP", + "x": "A2gufB762KKDkbTX0usDbekRJ-_PPBeVhc2gNgjpswU" + } + }); assert_eq!( json_canon::to_string(&resolved).unwrap(), @@ -375,61 +371,61 @@ mod tests { }"## ).unwrap(); - prepend_doc_id_to_vm_ids(&mut diddoc); - - let expected = serde_json::from_str::( - r##"{ - "@context": [ - "https://www.w3.org/ns/did/v1", - "https://w3id.org/security/suites/jws-2020/v1" - ], - "id": "did:peer:2.Ez6LSbhKnZ7tsrvScZBR5mRSnVDa7S7km1aCpkHoWS1pkLhkj.Vz6MktvegL6Tx3fPrNhhYbtxmzq6nsjnQKoecKLARJVZ7catQ.Az6MktvegL6Tx3fPrNhhYbtxmzq6nsjnQKoecKLARJVZ7catQ.SeyJpZCI6IiNkaWRjb21tIiwicyI6eyJhIjpbImRpZGNvbW0vdjIiXSwiciI6W10sInVyaSI6Imh0dHA6Ly9hbGljZS1tZWRpYXRvci5jb20ifSwidCI6ImRtIn0", - "alsoKnownAs": [ - "did:peer:3zQmSBPjNZR15mNMUBKpTqk8Z4icxkv91zAG5GsnsGqZj6yY" - ], - "verificationMethod": [ - { - "id": "did:peer:2.Ez6LSbhKnZ7tsrvScZBR5mRSnVDa7S7km1aCpkHoWS1pkLhkj.Vz6MktvegL6Tx3fPrNhhYbtxmzq6nsjnQKoecKLARJVZ7catQ.Az6MktvegL6Tx3fPrNhhYbtxmzq6nsjnQKoecKLARJVZ7catQ.SeyJpZCI6IiNkaWRjb21tIiwicyI6eyJhIjpbImRpZGNvbW0vdjIiXSwiciI6W10sInVyaSI6Imh0dHA6Ly9hbGljZS1tZWRpYXRvci5jb20ifSwidCI6ImRtIn0#key-1", - "type": "JsonWebKey2020", - "controller": "did:peer:2.Ez6LSbhKnZ7tsrvScZBR5mRSnVDa7S7km1aCpkHoWS1pkLhkj.Vz6MktvegL6Tx3fPrNhhYbtxmzq6nsjnQKoecKLARJVZ7catQ.Az6MktvegL6Tx3fPrNhhYbtxmzq6nsjnQKoecKLARJVZ7catQ.SeyJpZCI6IiNkaWRjb21tIiwicyI6eyJhIjpbImRpZGNvbW0vdjIiXSwiciI6W10sInVyaSI6Imh0dHA6Ly9hbGljZS1tZWRpYXRvci5jb20ifSwidCI6ImRtIn0", - "publicKeyJwk": { - "kty": "OKP", - "crv": "X25519", - "x": "AEtUMFyAEQte9YlqvsqiKK9uD_PFe1lXNZ_CiMRpahA" - } - }, - { - "id": "did:peer:2.Ez6LSbhKnZ7tsrvScZBR5mRSnVDa7S7km1aCpkHoWS1pkLhkj.Vz6MktvegL6Tx3fPrNhhYbtxmzq6nsjnQKoecKLARJVZ7catQ.Az6MktvegL6Tx3fPrNhhYbtxmzq6nsjnQKoecKLARJVZ7catQ.SeyJpZCI6IiNkaWRjb21tIiwicyI6eyJhIjpbImRpZGNvbW0vdjIiXSwiciI6W10sInVyaSI6Imh0dHA6Ly9hbGljZS1tZWRpYXRvci5jb20ifSwidCI6ImRtIn0#key-2", - "type": "JsonWebKey2020", - "controller": "did:peer:2.Ez6LSbhKnZ7tsrvScZBR5mRSnVDa7S7km1aCpkHoWS1pkLhkj.Vz6MktvegL6Tx3fPrNhhYbtxmzq6nsjnQKoecKLARJVZ7catQ.Az6MktvegL6Tx3fPrNhhYbtxmzq6nsjnQKoecKLARJVZ7catQ.SeyJpZCI6IiNkaWRjb21tIiwicyI6eyJhIjpbImRpZGNvbW0vdjIiXSwiciI6W10sInVyaSI6Imh0dHA6Ly9hbGljZS1tZWRpYXRvci5jb20ifSwidCI6ImRtIn0", - "publicKeyJwk": { - "kty": "OKP", - "crv": "Ed25519", - "x": "1wfj-I-3zHB86RPIje5i6_jb0TeC67KF_mz8kdcyYqE" - } + sanitize_vm_ids(&mut diddoc); + + let agreem_id = BASE64_STANDARD.encode(diddoc.id.to_owned() + "#key-1"); + let auth_id = BASE64_STANDARD.encode(diddoc.id.to_owned() + "#key-2"); + let expected = json!({ + "@context": [ + "https://www.w3.org/ns/did/v1", + "https://w3id.org/security/suites/jws-2020/v1" + ], + "id": "did:peer:2.Ez6LSbhKnZ7tsrvScZBR5mRSnVDa7S7km1aCpkHoWS1pkLhkj.Vz6MktvegL6Tx3fPrNhhYbtxmzq6nsjnQKoecKLARJVZ7catQ.Az6MktvegL6Tx3fPrNhhYbtxmzq6nsjnQKoecKLARJVZ7catQ.SeyJpZCI6IiNkaWRjb21tIiwicyI6eyJhIjpbImRpZGNvbW0vdjIiXSwiciI6W10sInVyaSI6Imh0dHA6Ly9hbGljZS1tZWRpYXRvci5jb20ifSwidCI6ImRtIn0", + "alsoKnownAs": [ + "did:peer:3zQmSBPjNZR15mNMUBKpTqk8Z4icxkv91zAG5GsnsGqZj6yY" + ], + "verificationMethod": [ + { + "id": agreem_id, + "type": "JsonWebKey2020", + "controller": "did:peer:2.Ez6LSbhKnZ7tsrvScZBR5mRSnVDa7S7km1aCpkHoWS1pkLhkj.Vz6MktvegL6Tx3fPrNhhYbtxmzq6nsjnQKoecKLARJVZ7catQ.Az6MktvegL6Tx3fPrNhhYbtxmzq6nsjnQKoecKLARJVZ7catQ.SeyJpZCI6IiNkaWRjb21tIiwicyI6eyJhIjpbImRpZGNvbW0vdjIiXSwiciI6W10sInVyaSI6Imh0dHA6Ly9hbGljZS1tZWRpYXRvci5jb20ifSwidCI6ImRtIn0", + "publicKeyJwk": { + "kty": "OKP", + "crv": "X25519", + "x": "AEtUMFyAEQte9YlqvsqiKK9uD_PFe1lXNZ_CiMRpahA" } - ], - "authentication": [ - "did:peer:2.Ez6LSbhKnZ7tsrvScZBR5mRSnVDa7S7km1aCpkHoWS1pkLhkj.Vz6MktvegL6Tx3fPrNhhYbtxmzq6nsjnQKoecKLARJVZ7catQ.Az6MktvegL6Tx3fPrNhhYbtxmzq6nsjnQKoecKLARJVZ7catQ.SeyJpZCI6IiNkaWRjb21tIiwicyI6eyJhIjpbImRpZGNvbW0vdjIiXSwiciI6W10sInVyaSI6Imh0dHA6Ly9hbGljZS1tZWRpYXRvci5jb20ifSwidCI6ImRtIn0#key-2" - ], - "keyAgreement": [ - "did:peer:2.Ez6LSbhKnZ7tsrvScZBR5mRSnVDa7S7km1aCpkHoWS1pkLhkj.Vz6MktvegL6Tx3fPrNhhYbtxmzq6nsjnQKoecKLARJVZ7catQ.Az6MktvegL6Tx3fPrNhhYbtxmzq6nsjnQKoecKLARJVZ7catQ.SeyJpZCI6IiNkaWRjb21tIiwicyI6eyJhIjpbImRpZGNvbW0vdjIiXSwiciI6W10sInVyaSI6Imh0dHA6Ly9hbGljZS1tZWRpYXRvci5jb20ifSwidCI6ImRtIn0#key-1" - ], - "service": [ - { - "id": "#didcomm", - "type": "DIDCommMessaging", - "serviceEndpoint": { - "accept": [ - "didcomm/v2" - ], - "routingKeys": [], - "uri": "http://alice-mediator.com" - } + }, + { + "id": auth_id, + "type": "JsonWebKey2020", + "controller": "did:peer:2.Ez6LSbhKnZ7tsrvScZBR5mRSnVDa7S7km1aCpkHoWS1pkLhkj.Vz6MktvegL6Tx3fPrNhhYbtxmzq6nsjnQKoecKLARJVZ7catQ.Az6MktvegL6Tx3fPrNhhYbtxmzq6nsjnQKoecKLARJVZ7catQ.SeyJpZCI6IiNkaWRjb21tIiwicyI6eyJhIjpbImRpZGNvbW0vdjIiXSwiciI6W10sInVyaSI6Imh0dHA6Ly9hbGljZS1tZWRpYXRvci5jb20ifSwidCI6ImRtIn0", + "publicKeyJwk": { + "kty": "OKP", + "crv": "Ed25519", + "x": "1wfj-I-3zHB86RPIje5i6_jb0TeC67KF_mz8kdcyYqE" } - ] - }"## - ).unwrap(); + } + ], + "authentication": [ + auth_id + ], + "keyAgreement": [ + agreem_id + ], + "service": [ + { + "id": "#didcomm", + "type": "DIDCommMessaging", + "serviceEndpoint": { + "accept": [ + "didcomm/v2" + ], + "routingKeys": [], + "uri": "http://alice-mediator.com" + } + } + ] + }); assert_eq!( json_canon::to_string(&diddoc).unwrap(), diff --git a/crates/web-plugins/didcomm-messaging/shared/src/utils/tests_utils.rs b/crates/web-plugins/didcomm-messaging/shared/src/utils/tests_utils.rs index 803d5703..ad3d0e95 100644 --- a/crates/web-plugins/didcomm-messaging/shared/src/utils/tests_utils.rs +++ b/crates/web-plugins/didcomm-messaging/shared/src/utils/tests_utils.rs @@ -6,73 +6,74 @@ pub mod tests { state::{AppState, AppStateRepository}, utils::resolvers::LocalSecretsResolver, }; + use base64::{prelude::BASE64_STANDARD, Engine}; use did_utils::{didcore::Document, jwk::Jwk}; use didcomm::{ error::Error as DidcommError, secrets::SecretsResolver, Message, PackEncryptedOptions, UnpackOptions, }; use keystore::Keystore; - use std::{env, sync::Arc}; + use serde_json::json; + use std::sync::Arc; pub fn setup() -> Arc { - env::set_var("MASTER_KEY", "1234567890qwertyuiopasdfghjklxzc"); let public_domain = String::from("http://alice-mediator.com"); - let diddoc: Document = serde_json::from_str( - r##"{ - "@context": [ - "https://www.w3.org/ns/did/v1", - "https://w3id.org/security/suites/jws-2020/v1" - ], - "id": "did:peer:2.Ez6LSteycMr6tTki5aAEjNAVDsp1vrx9DuDWHDnky9qxyFNUF.Vz6MkigiwfSzv66VSTAeGZLsTHa8ixK1agNFvry2KjYXmg1G3.SeyJpZCI6IiNkaWRjb21tIiwicyI6eyJhIjpbImRpZGNvbW0vdjIiXSwiciI6W10sInVyaSI6Imh0dHA6Ly9hbGljZS1tZWRpYXRvci5jb20ifSwidCI6ImRtIn0", - "alsoKnownAs": [ - "did:peer:3zQmZo9aYaBjv2XtjRcTfP7X7QwyU1VVnrcEWVtcBhiAtPFa" - ], - "verificationMethod": [ - { - "id": "#key-1", - "type": "JsonWebKey2020", - "controller": "did:peer:2.Ez6LSteycMr6tTki5aAEjNAVDsp1vrx9DuDWHDnky9qxyFNUF.Vz6MkigiwfSzv66VSTAeGZLsTHa8ixK1agNFvry2KjYXmg1G3.SeyJpZCI6IiNkaWRjb21tIiwicyI6eyJhIjpbImRpZGNvbW0vdjIiXSwiciI6W10sInVyaSI6Imh0dHA6Ly9hbGljZS1tZWRpYXRvci5jb20ifSwidCI6ImRtIn0", - "publicKeyJwk": { - "kty": "OKP", - "crv": "X25519", - "x": "_EgIPSRgbPPw5-nUsJ6xqMvw5rXn3BViGADeUrjAMzA" - } - }, - { - "id": "#key-2", - "type": "JsonWebKey2020", - "controller": "did:peer:2.Ez6LSteycMr6tTki5aAEjNAVDsp1vrx9DuDWHDnky9qxyFNUF.Vz6MkigiwfSzv66VSTAeGZLsTHa8ixK1agNFvry2KjYXmg1G3.SeyJpZCI6IiNkaWRjb21tIiwicyI6eyJhIjpbImRpZGNvbW0vdjIiXSwiciI6W10sInVyaSI6Imh0dHA6Ly9hbGljZS1tZWRpYXRvci5jb20ifSwidCI6ImRtIn0", - "publicKeyJwk": { - "kty": "OKP", - "crv": "Ed25519", - "x": "PuG2L5um-tAnHlvT29gTm9Wj9fZca16vfBCPKsHB5cA" - } + let did = "did:peer:2.Ez6LSteycMr6tTki5aAEjNAVDsp1vrx9DuDWHDnky9qxyFNUF.Vz6MkigiwfSzv66VSTAeGZLsTHa8ixK1agNFvry2KjYXmg1G3.SeyJpZCI6IiNkaWRjb21tIiwicyI6eyJhIjpbImRpZGNvbW0vdjIiXSwiciI6W10sInVyaSI6Imh0dHA6Ly9hbGljZS1tZWRpYXRvci5jb20ifSwidCI6ImRtIn0"; + let diddoc: Document = serde_json::from_value(json!({ + "@context": [ + "https://www.w3.org/ns/did/v1", + "https://w3id.org/security/suites/jws-2020/v1" + ], + "id": did, + "alsoKnownAs": [ + "did:peer:3zQmZo9aYaBjv2XtjRcTfP7X7QwyU1VVnrcEWVtcBhiAtPFa" + ], + "verificationMethod": [ + { + "id": "#key-1", + "type": "JsonWebKey2020", + "controller": did, + "publicKeyJwk": { + "kty": "OKP", + "crv": "X25519", + "x": "_EgIPSRgbPPw5-nUsJ6xqMvw5rXn3BViGADeUrjAMzA" } - ], - "authentication": [ - "#key-2" - ], - "keyAgreement": [ - "#key-1" - ], - "service": [ - { - "id": "#didcomm", - "type": "DIDCommMessaging", - "serviceEndpoint": { - "accept": [ - "didcomm/v2" - ], - "routingKeys": [], - "uri": "http://alice-mediator.com/" - } + }, + { + "id": "#key-2", + "type": "JsonWebKey2020", + "controller": did, + "publicKeyJwk": { + "kty": "OKP", + "crv": "Ed25519", + "x": "PuG2L5um-tAnHlvT29gTm9Wj9fZca16vfBCPKsHB5cA" } - ] - }"## - ).unwrap(); + } + ], + "authentication": [ + "#key-2" + ], + "keyAgreement": [ + "#key-1" + ], + "service": [ + { + "id": "#didcomm", + "type": "DIDCommMessaging", + "serviceEndpoint": { + "accept": [ + "didcomm/v2" + ], + "routingKeys": [], + "uri": "http://alice-mediator.com/" + } + } + ] + })) + .unwrap(); - let secret_id = "did:peer:2.Ez6LSteycMr6tTki5aAEjNAVDsp1vrx9DuDWHDnky9qxyFNUF.Vz6MkigiwfSzv66VSTAeGZLsTHa8ixK1agNFvry2KjYXmg1G3.SeyJpZCI6IiNkaWRjb21tIiwicyI6eyJhIjpbImRpZGNvbW0vdjIiXSwiciI6W10sInVyaSI6Imh0dHA6Ly9hbGljZS1tZWRpYXRvci5jb20ifSwidCI6ImRtIn0#key-1"; + let secret_id = BASE64_STANDARD.encode(did.to_owned() + "#key-1"); let secret: Jwk = serde_json::from_str( r#"{ "kty": "OKP", @@ -83,7 +84,7 @@ pub mod tests { ) .unwrap(); - let mediator_secret = (secret_id.to_string(), secret); + let mediator_secret = (secret_id, secret); let keystore = Keystore::with_mock_configs(vec![mediator_secret]); let repository = AppStateRepository { diff --git a/crates/web-plugins/didcomm-messaging/src/did_rotation/handler.rs b/crates/web-plugins/didcomm-messaging/src/did_rotation/handler.rs index ea45600b..5aad8982 100644 --- a/crates/web-plugins/didcomm-messaging/src/did_rotation/handler.rs +++ b/crates/web-plugins/didcomm-messaging/src/did_rotation/handler.rs @@ -99,6 +99,7 @@ mod test { state::{AppState, AppStateRepository}, utils::resolvers::{LocalDIDResolver, LocalSecretsResolver}, }; + use base64::{prelude::BASE64_STANDARD, Engine}; pub fn prev_did() -> String { "did:key:z6MkrQT3VKYGkbPaYuJeBv31gNgpmVtRWP5yTocLDBgPpayM".to_string() @@ -109,8 +110,11 @@ mod test { pub fn setup() -> Arc { let public_domain = String::from("http://alice-mediator.com"); + let did = "did:peer:2.Vz6Mkf6r1uMJwoRAbzkuyj2RwPusdZhWSPeEknnTcKv2C2EN7.Ez6LSgbP4b3y8HVWG6C73WF2zLbzjDAPXjc33P2VfnVVHE347.SeyJpZCI6IiNkaWRjb21tIiwicyI6eyJhIjpbImRpZGNvbW0vdjIiXSwiciI6W10sInVyaSI6Imh0dHA6Ly9hbGljZS1tZWRpYXRvci5jb20ifSwidCI6ImRtIn0#key-1"; + let auth_id = BASE64_STANDARD.encode(did.to_owned() + "#key-1"); + let agreem_id = BASE64_STANDARD.encode(did.to_owned() + "#key-2"); let keys: Vec<(String, Jwk)> = vec![( - String::from("did:peer:2.Vz6Mkf6r1uMJwoRAbzkuyj2RwPusdZhWSPeEknnTcKv2C2EN7.Ez6LSgbP4b3y8HVWG6C73WF2zLbzjDAPXjc33P2VfnVVHE347.SeyJpZCI6IiNkaWRjb21tIiwicyI6eyJhIjpbImRpZGNvbW0vdjIiXSwiciI6W10sInVyaSI6Imh0dHA6Ly9hbGljZS1tZWRpYXRvci5jb20ifSwidCI6ImRtIn0#key-1"), + auth_id, serde_json::from_str( r#"{ "kty": "OKP", @@ -121,7 +125,7 @@ mod test { ) .unwrap(), ),( - String::from("did:peer:2.Vz6Mkf6r1uMJwoRAbzkuyj2RwPusdZhWSPeEknnTcKv2C2EN7.Ez6LSgbP4b3y8HVWG6C73WF2zLbzjDAPXjc33P2VfnVVHE347.SeyJpZCI6IiNkaWRjb21tIiwicyI6eyJhIjpbImRpZGNvbW0vdjIiXSwiciI6W10sInVyaSI6Imh0dHA6Ly9hbGljZS1tZWRpYXRvci5jb20ifSwidCI6ImRtIn0#key-2"), + agreem_id, serde_json::from_str( r#"{ "kty": "OKP", diff --git a/crates/web-plugins/didcomm-messaging/src/web/dispatcher.rs b/crates/web-plugins/didcomm-messaging/src/web/dispatcher.rs index 06935921..326f58c5 100644 --- a/crates/web-plugins/didcomm-messaging/src/web/dispatcher.rs +++ b/crates/web-plugins/didcomm-messaging/src/web/dispatcher.rs @@ -136,7 +136,6 @@ mod tests { #[tokio::test] async fn test_keylist_update_via_didcomm() { - std::env::set_var("MASTER_KEY", "1234567890qwertyuiopasdfghjklxzc"); let mut container = MessagePluginContainer { loaded: false, collected_routes: vec![], diff --git a/crates/web-plugins/oob-messages/src/web.rs b/crates/web-plugins/oob-messages/src/web.rs index 2353dca6..78b437a6 100644 --- a/crates/web-plugins/oob-messages/src/web.rs +++ b/crates/web-plugins/oob-messages/src/web.rs @@ -29,7 +29,6 @@ mod tests { #[tokio::test] async fn test_routes() { std::env::set_var("SERVER_PUBLIC_DOMAIN", "example.com"); - std::env::remove_var("STORAGE_DIRPATH"); let state = Arc::new(OOBMessagesState { store: Arc::new(Mutex::new(InMemoryStore::default())), From 2026af95f2c4ac8f766446b179f784b6ae87ff59 Mon Sep 17 00:00:00 2001 From: Hermann Core Date: Fri, 4 Jul 2025 09:00:33 +0100 Subject: [PATCH 19/25] fix: update dotenv-flow loading to handle errors gracefully --- Cargo.lock | 4 ++++ src/main.rs | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 889224f5..44ff1eae 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1691,6 +1691,7 @@ dependencies = [ "async-trait", "aws-config", "axum 0.7.9", + "base64 0.22.1", "chrono", "database", "did-utils", @@ -1798,6 +1799,7 @@ dependencies = [ "async-trait", "aws-config", "axum 0.7.9", + "base64 0.22.1", "database", "did-endpoint", "did-utils", @@ -2161,6 +2163,7 @@ version = "0.1.0" dependencies = [ "async-trait", "axum 0.7.9", + "base64 0.22.1", "database", "did-utils", "didcomm", @@ -4676,6 +4679,7 @@ name = "shared" version = "0.1.0" dependencies = [ "async-trait", + "base64 0.22.1", "database", "did-utils", "didcomm", diff --git a/src/main.rs b/src/main.rs index bee541a5..37050b24 100644 --- a/src/main.rs +++ b/src/main.rs @@ -13,7 +13,7 @@ static GLOBAL: Jemalloc = Jemalloc; #[tokio::main] async fn main() -> Result<()> { // Load dotenv-flow variables - dotenv_flow::dotenv_flow()?; + dotenv_flow::dotenv_flow().ok(); // Enable logging config_tracing(); From 147a76918d9efd980cf172ee20ee86f60b156e41 Mon Sep 17 00:00:00 2001 From: Hermann Core Date: Fri, 4 Jul 2025 09:06:43 +0100 Subject: [PATCH 20/25] style: apply code formatting --- .../didcomm-messaging/src/did_rotation/handler.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/crates/web-plugins/didcomm-messaging/src/did_rotation/handler.rs b/crates/web-plugins/didcomm-messaging/src/did_rotation/handler.rs index 5aad8982..340a46fc 100644 --- a/crates/web-plugins/didcomm-messaging/src/did_rotation/handler.rs +++ b/crates/web-plugins/didcomm-messaging/src/did_rotation/handler.rs @@ -89,6 +89,7 @@ mod test { use didcomm::secrets::SecretsResolver; use mongodb::bson::doc; + use base64::{prelude::BASE64_STANDARD, Engine}; use keystore::Keystore; use shared::{ breaker::CircuitBreaker, @@ -99,7 +100,6 @@ mod test { state::{AppState, AppStateRepository}, utils::resolvers::{LocalDIDResolver, LocalSecretsResolver}, }; - use base64::{prelude::BASE64_STANDARD, Engine}; pub fn prev_did() -> String { "did:key:z6MkrQT3VKYGkbPaYuJeBv31gNgpmVtRWP5yTocLDBgPpayM".to_string() @@ -113,7 +113,8 @@ mod test { let did = "did:peer:2.Vz6Mkf6r1uMJwoRAbzkuyj2RwPusdZhWSPeEknnTcKv2C2EN7.Ez6LSgbP4b3y8HVWG6C73WF2zLbzjDAPXjc33P2VfnVVHE347.SeyJpZCI6IiNkaWRjb21tIiwicyI6eyJhIjpbImRpZGNvbW0vdjIiXSwiciI6W10sInVyaSI6Imh0dHA6Ly9hbGljZS1tZWRpYXRvci5jb20ifSwidCI6ImRtIn0#key-1"; let auth_id = BASE64_STANDARD.encode(did.to_owned() + "#key-1"); let agreem_id = BASE64_STANDARD.encode(did.to_owned() + "#key-2"); - let keys: Vec<(String, Jwk)> = vec![( + let keys: Vec<(String, Jwk)> = vec![ + ( auth_id, serde_json::from_str( r#"{ @@ -124,7 +125,8 @@ mod test { }"#, ) .unwrap(), - ),( + ), + ( agreem_id, serde_json::from_str( r#"{ From 4963c053e1135aa4e42cd000f50bfcab8167722d Mon Sep 17 00:00:00 2001 From: Hermann Core Date: Fri, 4 Jul 2025 10:39:14 +0100 Subject: [PATCH 21/25] fix: remove base64 dependency from multiple various Cargo.toml files --- Cargo.lock | 4 ---- crates/web-plugins/did-endpoint/Cargo.toml | 1 - crates/web-plugins/didcomm-messaging/Cargo.toml | 1 - .../didcomm-messaging/protocols/forward/Cargo.toml | 1 - crates/web-plugins/didcomm-messaging/shared/Cargo.toml | 1 - 5 files changed, 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 44ff1eae..889224f5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1691,7 +1691,6 @@ dependencies = [ "async-trait", "aws-config", "axum 0.7.9", - "base64 0.22.1", "chrono", "database", "did-utils", @@ -1799,7 +1798,6 @@ dependencies = [ "async-trait", "aws-config", "axum 0.7.9", - "base64 0.22.1", "database", "did-endpoint", "did-utils", @@ -2163,7 +2161,6 @@ version = "0.1.0" dependencies = [ "async-trait", "axum 0.7.9", - "base64 0.22.1", "database", "did-utils", "didcomm", @@ -4679,7 +4676,6 @@ name = "shared" version = "0.1.0" dependencies = [ "async-trait", - "base64 0.22.1", "database", "did-utils", "didcomm", diff --git a/crates/web-plugins/did-endpoint/Cargo.toml b/crates/web-plugins/did-endpoint/Cargo.toml index e7ae3bab..2a579b5d 100644 --- a/crates/web-plugins/did-endpoint/Cargo.toml +++ b/crates/web-plugins/did-endpoint/Cargo.toml @@ -26,7 +26,6 @@ tracing.workspace = true mongodb.workspace = true http-body-util.workspace = true aws-config.workspace = true -base64.workspace = true uuid = { workspace = true, features = ["v4"] } tokio = { workspace = true, features = ["full"] } axum = { workspace = true, features = ["macros"] } diff --git a/crates/web-plugins/didcomm-messaging/Cargo.toml b/crates/web-plugins/didcomm-messaging/Cargo.toml index 77cad439..b9b95f31 100644 --- a/crates/web-plugins/didcomm-messaging/Cargo.toml +++ b/crates/web-plugins/didcomm-messaging/Cargo.toml @@ -34,7 +34,6 @@ serde_json.workspace = true thiserror.workspace = true http-body-util.workspace = true aws-config.workspace = true -base64.workspace = true tokio = { workspace = true, features = ["full"] } hyper = { workspace = true, features = ["full"] } axum = { workspace = true, features = ["macros"] } diff --git a/crates/web-plugins/didcomm-messaging/protocols/forward/Cargo.toml b/crates/web-plugins/didcomm-messaging/protocols/forward/Cargo.toml index 68ae8858..96d85292 100644 --- a/crates/web-plugins/didcomm-messaging/protocols/forward/Cargo.toml +++ b/crates/web-plugins/didcomm-messaging/protocols/forward/Cargo.toml @@ -15,7 +15,6 @@ async-trait.workspace = true serde_json.workspace = true thiserror.workspace = true futures.workspace = true -base64.workspace = true didcomm = { workspace = true, features = ["uniffi"] } hyper = { workspace = true, features = ["full"] } axum = { workspace = true, features = ["macros"] } diff --git a/crates/web-plugins/didcomm-messaging/shared/Cargo.toml b/crates/web-plugins/didcomm-messaging/shared/Cargo.toml index bb6ac495..c5e05d2f 100644 --- a/crates/web-plugins/didcomm-messaging/shared/Cargo.toml +++ b/crates/web-plugins/didcomm-messaging/shared/Cargo.toml @@ -16,7 +16,6 @@ async-trait.workspace = true mongodb.workspace = true eyre.workspace = true parking_lot.workspace = true -base64.workspace = true pin-project-lite.workspace = true tokio = { workspace = true, features = ["full"] } didcomm = { workspace = true, features = ["uniffi"] } From dbdb1236b96774b1f706f4efb257fedc27eefb9a Mon Sep 17 00:00:00 2001 From: Hermann Core Date: Fri, 4 Jul 2025 10:39:29 +0100 Subject: [PATCH 22/25] fix: sanitize secret names in AWS Secrets Manager operations --- crates/keystore/src/repository/aws.rs | 49 ++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 4 deletions(-) diff --git a/crates/keystore/src/repository/aws.rs b/crates/keystore/src/repository/aws.rs index 97ad7819..96e926be 100644 --- a/crates/keystore/src/repository/aws.rs +++ b/crates/keystore/src/repository/aws.rs @@ -44,7 +44,8 @@ impl SecretRepository for AwsSecretsManager { use aws_sdk_secretsmanager::error::SdkError; // Store a secret only if it does not already exist - match self.client.describe_secret().secret_id(name).send().await { + let name = sanitize_secret_name(name); + match self.client.describe_secret().secret_id(&name).send().await { Ok(_) => { warn!("Secret {name} already exists. Skipping..."); Ok(()) @@ -67,7 +68,8 @@ impl SecretRepository for AwsSecretsManager { async fn find(&self, name: &str) -> Result>, Error> { use aws_sdk_secretsmanager::error::SdkError; - match self.cache.get_secret_value(name, None, None, false).await { + let name = sanitize_secret_name(name); + match self.cache.get_secret_value(&name, None, None, false).await { Ok(value) => Ok(value.secret_string.map(|s| s.into_bytes())), Err(err) => { // Check for ResourceNotFoundException @@ -84,10 +86,49 @@ impl SecretRepository for AwsSecretsManager { } async fn delete(&self, name: &str) -> Result<(), Error> { - self.client.delete_secret().secret_id(name).send().await?; + let name = sanitize_secret_name(name); + self.client.delete_secret().secret_id(&name).send().await?; // Invalidate cache by refreshing the secret - let _ = self.cache.get_secret_value(name, None, None, true).await; + let _ = self.cache.get_secret_value(&name, None, None, true).await; Ok(()) } } + +// Replaces characters in a secret ID that are not supported by AWS Secrets Manager. +// +// This function replaces the following characters: +// - `:` is replaced with `_colon_` +// - `#` is replaced with `_hash_` +fn sanitize_secret_name(id: &str) -> String { + id.replace(':', "_colon_").replace('#', "_hash_") +} + +#[cfg(test)] +mod tests { + use super::*; + + fn decode_secret_name(id: &str) -> String { + id.replace("_hash_", "#").replace("_colon_", ":") + } + + #[test] + fn test_sanitize_secret_name_no_special_chars() { + let original_id = "example_good/secret@name.+="; + let encoded_id = sanitize_secret_name(original_id); + let decoded_id = decode_secret_name(&encoded_id); + + assert_eq!(encoded_id, "example_good/secret@name.+="); + assert_eq!(decoded_id, original_id); + } + + #[test] + fn test_sanitize_secret_name_with_special_chars() { + let original_id = "example:bad:secret#name.+="; + let encoded_id = sanitize_secret_name(original_id); + let decoded_id = decode_secret_name(&encoded_id); + + assert_eq!(encoded_id, "example_colon_bad_colon_secret_hash_name.+="); + assert_eq!(decoded_id, original_id); + } +} From 7d8ccabb4d9687d512af9307f648b7cf0fed8592 Mon Sep 17 00:00:00 2001 From: Hermann Core Date: Fri, 4 Jul 2025 10:40:39 +0100 Subject: [PATCH 23/25] fix: resolve regressions added by the latest changes --- crates/web-plugins/did-endpoint/src/didgen.rs | 5 ++- crates/web-plugins/did-endpoint/src/util.rs | 30 ++++++---------- crates/web-plugins/did-endpoint/src/web.rs | 5 ++- .../shared/src/utils/resolvers.rs | 35 +++++++++---------- .../shared/src/utils/tests_utils.rs | 3 +- .../src/did_rotation/handler.rs | 8 ++--- 6 files changed, 35 insertions(+), 51 deletions(-) diff --git a/crates/web-plugins/did-endpoint/src/didgen.rs b/crates/web-plugins/did-endpoint/src/didgen.rs index 726be623..8aeefb3a 100644 --- a/crates/web-plugins/did-endpoint/src/didgen.rs +++ b/crates/web-plugins/did-endpoint/src/didgen.rs @@ -193,7 +193,6 @@ fn validate_key(kid: &str, keystore: &Keystore) -> Result<(), String> { pub(crate) mod tests { use super::*; use crate::persistence::tests::MockDidDocumentRepository; - use base64::prelude::{Engine as _, BASE64_STANDARD}; pub(crate) fn setup() -> Jwk { serde_json::from_str( @@ -231,9 +230,9 @@ pub(crate) mod tests { #[tokio::test(flavor = "multi_thread")] async fn test_did_validation() { - let kid = BASE64_STANDARD.encode("did:peer:123#key-1"); + let kid = "did:peer:123#key-1"; let repository = MockDidDocumentRepository::new(); - let mock_keystore = Keystore::with_mock_configs(vec![(kid.clone(), setup())]); + let mock_keystore = Keystore::with_mock_configs(vec![(kid.to_string(), setup())]); // Mock read from store let diddoc: Document = serde_json::from_str( diff --git a/crates/web-plugins/did-endpoint/src/util.rs b/crates/web-plugins/did-endpoint/src/util.rs index 459afe13..cabd49cb 100644 --- a/crates/web-plugins/did-endpoint/src/util.rs +++ b/crates/web-plugins/did-endpoint/src/util.rs @@ -1,16 +1,14 @@ -use base64::prelude::{Engine as _, BASE64_STANDARD}; use did_utils::didcore::Document; +use std::borrow::Cow; // This function is a hack to bypass certain constraints of the did:peer method specification. // Its purpose is to uniquely identify the keys used to generate a Peer DID address in the store. -pub(crate) fn handle_vm_id(vm_id: &str, diddoc: &Document) -> String { - let kid = if vm_id.starts_with('#') { - diddoc.id.to_owned() + vm_id +pub(crate) fn handle_vm_id<'a>(vm_id: &'a str, diddoc: &Document) -> Cow<'a, str> { + if vm_id.starts_with('#') { + Cow::Owned(diddoc.id.to_owned() + vm_id) } else { - vm_id.to_owned() - }; - - BASE64_STANDARD.encode(kid) + Cow::Borrowed(vm_id) + } } #[cfg(test)] @@ -18,27 +16,19 @@ mod tests { use super::*; use did_utils::didcore::Document; - use super::handle_vm_id; - #[test] fn test_handle_vm_id() { let diddoc = Document { id: "did:example:123".to_owned(), ..Default::default() }; - let expected_kid = BASE64_STANDARD.encode("did:example:123#key-1"); + let expected_kid = "did:example:123#key-1"; assert_eq!(handle_vm_id("#key-1", &diddoc), expected_kid); - let expected_kid = BASE64_STANDARD.encode("did:key:123#456"); + let expected_kid = "did:key:123#456"; assert_eq!(handle_vm_id("did:key:123#456", &diddoc), expected_kid); let diddoc = Document::default(); - assert_eq!( - handle_vm_id("#key-1", &diddoc), - BASE64_STANDARD.encode("#key-1") - ); - assert_eq!( - handle_vm_id("key-1", &diddoc), - BASE64_STANDARD.encode("key-1") - ); + assert_eq!(handle_vm_id("#key-1", &diddoc), "#key-1"); + assert_eq!(handle_vm_id("key-1", &diddoc), "key-1"); } } diff --git a/crates/web-plugins/did-endpoint/src/web.rs b/crates/web-plugins/did-endpoint/src/web.rs index 34aecf2d..fd7897ef 100644 --- a/crates/web-plugins/did-endpoint/src/web.rs +++ b/crates/web-plugins/did-endpoint/src/web.rs @@ -192,7 +192,6 @@ mod tests { body::Body, http::{Request, StatusCode}, }; - use base64::prelude::{Engine as _, BASE64_STANDARD}; use database::Repository; use did_utils::{ didcore::{Document, KeyFormat, Proofs}, @@ -230,9 +229,9 @@ mod tests { ) .unwrap(); - let kid = BASE64_STANDARD.encode("did:peer:123#key-1"); + let kid = "did:peer:123#key-1"; let repository = MockDidDocumentRepository::new(); - let mock_keystore = Keystore::with_mock_configs(vec![(kid, setup())]); + let mock_keystore = Keystore::with_mock_configs(vec![(kid.to_string(), setup())]); repository .store(MediatorDidDocument { diff --git a/crates/web-plugins/didcomm-messaging/shared/src/utils/resolvers.rs b/crates/web-plugins/didcomm-messaging/shared/src/utils/resolvers.rs index 92a66f58..fca541e9 100644 --- a/crates/web-plugins/didcomm-messaging/shared/src/utils/resolvers.rs +++ b/crates/web-plugins/didcomm-messaging/shared/src/utils/resolvers.rs @@ -1,5 +1,4 @@ use async_trait::async_trait; -use base64::prelude::{Engine as _, BASE64_STANDARD}; use did_utils::{ crypto::PublicKeyFormat, didcore::{Document, VerificationMethodType}, @@ -33,7 +32,7 @@ impl DIDResolver for LocalDIDResolver { async fn resolve(&self, did: &str) -> Result> { if did == self.diddoc.id { let mut diddoc = self.diddoc.clone(); - sanitize_vm_ids(&mut diddoc); + prepend_did_to_vm_ids(&mut diddoc); return Ok(Some(serde_json::from_value(json!(diddoc))?)); } @@ -50,7 +49,7 @@ impl DIDResolver for LocalDIDResolver { let mut diddoc = DidPeer::with_format(PublicKeyFormat::Jwk) .expand(did) .map_err(|e| Error::new(ErrorKind::DIDNotResolved, e))?; - sanitize_vm_ids(&mut diddoc); + prepend_did_to_vm_ids(&mut diddoc); let diddoc = serde_json::from_value(json!(diddoc))?; Ok(Some(diddoc)) } else { @@ -62,11 +61,11 @@ impl DIDResolver for LocalDIDResolver { } } -fn sanitize_vm_ids(diddoc: &mut Document) { +fn prepend_did_to_vm_ids(diddoc: &mut Document) { if diddoc.id.starts_with("did:peer") { if let Some(verification_methods) = diddoc.verification_method.as_mut() { for vm in verification_methods.iter_mut() { - vm.id = BASE64_STANDARD.encode(diddoc.id.to_owned() + &vm.id); + vm.id = diddoc.id.to_owned() + &vm.id; } } @@ -74,7 +73,7 @@ fn sanitize_vm_ids(diddoc: &mut Document) { if let Some(rel) = rel { for vm in rel.iter_mut() { if let VerificationMethodType::Reference(ref mut id) = vm { - *id = BASE64_STANDARD.encode(diddoc.id.to_owned() + id); + *id = diddoc.id.to_owned() + id; } } } @@ -155,15 +154,15 @@ mod tests { let did = "did:peer:2.Ez6LSteycMr6tTki5aAEjNAVDsp1vrx9DuDWHDnky9qxyFNUF.Vz6MkigiwfSzv66VSTAeGZLsTHa8ixK1agNFvry2KjYXmg1G3.SeyJpZCI6IiNkaWRjb21tIiwicyI6eyJhIjpbImRpZGNvbW0vdjIiXSwiciI6W10sInVyaSI6Imh0dHA6Ly9hbGljZS1tZWRpYXRvci5jb20ifSwidCI6ImRtIn0"; let resolved = resolver.resolve(did).await.unwrap().unwrap(); - let agreem_kid = BASE64_STANDARD.encode(did.to_owned() + "#key-1"); - let auth_kid = BASE64_STANDARD.encode(did.to_owned() + "#key-2"); + let agreem_kid = did.to_owned() + "#key-1"; + let auth_kid = did.to_owned() + "#key-2"; let expected = json!({ - "id": "did:peer:2.Ez6LSteycMr6tTki5aAEjNAVDsp1vrx9DuDWHDnky9qxyFNUF.Vz6MkigiwfSzv66VSTAeGZLsTHa8ixK1agNFvry2KjYXmg1G3.SeyJpZCI6IiNkaWRjb21tIiwicyI6eyJhIjpbImRpZGNvbW0vdjIiXSwiciI6W10sInVyaSI6Imh0dHA6Ly9hbGljZS1tZWRpYXRvci5jb20ifSwidCI6ImRtIn0", + "id": did, "verificationMethod": [ { "id": agreem_kid, "type": "JsonWebKey2020", - "controller": "did:peer:2.Ez6LSteycMr6tTki5aAEjNAVDsp1vrx9DuDWHDnky9qxyFNUF.Vz6MkigiwfSzv66VSTAeGZLsTHa8ixK1agNFvry2KjYXmg1G3.SeyJpZCI6IiNkaWRjb21tIiwicyI6eyJhIjpbImRpZGNvbW0vdjIiXSwiciI6W10sInVyaSI6Imh0dHA6Ly9hbGljZS1tZWRpYXRvci5jb20ifSwidCI6ImRtIn0", + "controller": did, "publicKeyJwk": { "kty": "OKP", "crv": "X25519", @@ -173,7 +172,7 @@ mod tests { { "id": auth_kid, "type": "JsonWebKey2020", - "controller": "did:peer:2.Ez6LSteycMr6tTki5aAEjNAVDsp1vrx9DuDWHDnky9qxyFNUF.Vz6MkigiwfSzv66VSTAeGZLsTHa8ixK1agNFvry2KjYXmg1G3.SeyJpZCI6IiNkaWRjb21tIiwicyI6eyJhIjpbImRpZGNvbW0vdjIiXSwiciI6W10sInVyaSI6Imh0dHA6Ly9hbGljZS1tZWRpYXRvci5jb20ifSwidCI6ImRtIn0", + "controller": did, "publicKeyJwk": { "kty": "OKP", "crv": "Ed25519", @@ -212,7 +211,7 @@ mod tests { let agreem_kid = did.to_owned() + "#z6LSbuUXWSgPfpiDBjUK6E7yiCKMN2eKJsXn5b55ZgqGz6Mr"; let resolved = resolver.resolve(did).await.unwrap().unwrap(); let expected = json!({ - "id": "did:key:z6MkfyTREjTxQ8hUwSwBPeDHf3uPL3qCjSSuNPwsyMpWUGH7", + "id": did, "keyAgreement": [ agreem_kid ], @@ -223,7 +222,7 @@ mod tests { { "id": auth_kid, "type": "JsonWebKey2020", - "controller": "did:key:z6MkfyTREjTxQ8hUwSwBPeDHf3uPL3qCjSSuNPwsyMpWUGH7", + "controller": did, "publicKeyJwk": { "crv": "Ed25519", "kty": "OKP", @@ -233,7 +232,7 @@ mod tests { { "id": agreem_kid, "type": "JsonWebKey2020", - "controller": "did:key:z6MkfyTREjTxQ8hUwSwBPeDHf3uPL3qCjSSuNPwsyMpWUGH7", + "controller": did, "publicKeyJwk": { "crv": "X25519", "kty": "OKP", @@ -293,7 +292,7 @@ mod tests { let keystore = Keystore::with_mock_configs(vec![(secret_id.to_string(), secret)]); let resolver = LocalSecretsResolver::new(keystore); - let resolved = resolver.get_secret(&secret_id).await.unwrap().unwrap(); + let resolved = resolver.get_secret(secret_id).await.unwrap().unwrap(); let expected = json!({ "id": secret_id, "type": "JsonWebKey2020", @@ -371,10 +370,10 @@ mod tests { }"## ).unwrap(); - sanitize_vm_ids(&mut diddoc); + prepend_did_to_vm_ids(&mut diddoc); - let agreem_id = BASE64_STANDARD.encode(diddoc.id.to_owned() + "#key-1"); - let auth_id = BASE64_STANDARD.encode(diddoc.id.to_owned() + "#key-2"); + let agreem_id = diddoc.id.to_owned() + "#key-1"; + let auth_id = diddoc.id.to_owned() + "#key-2"; let expected = json!({ "@context": [ "https://www.w3.org/ns/did/v1", diff --git a/crates/web-plugins/didcomm-messaging/shared/src/utils/tests_utils.rs b/crates/web-plugins/didcomm-messaging/shared/src/utils/tests_utils.rs index ad3d0e95..c9b3fd01 100644 --- a/crates/web-plugins/didcomm-messaging/shared/src/utils/tests_utils.rs +++ b/crates/web-plugins/didcomm-messaging/shared/src/utils/tests_utils.rs @@ -6,7 +6,6 @@ pub mod tests { state::{AppState, AppStateRepository}, utils::resolvers::LocalSecretsResolver, }; - use base64::{prelude::BASE64_STANDARD, Engine}; use did_utils::{didcore::Document, jwk::Jwk}; use didcomm::{ error::Error as DidcommError, secrets::SecretsResolver, Message, PackEncryptedOptions, @@ -73,7 +72,7 @@ pub mod tests { })) .unwrap(); - let secret_id = BASE64_STANDARD.encode(did.to_owned() + "#key-1"); + let secret_id = did.to_owned() + "#key-1"; let secret: Jwk = serde_json::from_str( r#"{ "kty": "OKP", diff --git a/crates/web-plugins/didcomm-messaging/src/did_rotation/handler.rs b/crates/web-plugins/didcomm-messaging/src/did_rotation/handler.rs index 340a46fc..c05a54a6 100644 --- a/crates/web-plugins/didcomm-messaging/src/did_rotation/handler.rs +++ b/crates/web-plugins/didcomm-messaging/src/did_rotation/handler.rs @@ -87,10 +87,8 @@ mod test { use did_utils::{didcore::Document, jwk::Jwk}; use didcomm::secrets::SecretsResolver; - use mongodb::bson::doc; - - use base64::{prelude::BASE64_STANDARD, Engine}; use keystore::Keystore; + use mongodb::bson::doc; use shared::{ breaker::CircuitBreaker, repository::{ @@ -111,8 +109,8 @@ mod test { let public_domain = String::from("http://alice-mediator.com"); let did = "did:peer:2.Vz6Mkf6r1uMJwoRAbzkuyj2RwPusdZhWSPeEknnTcKv2C2EN7.Ez6LSgbP4b3y8HVWG6C73WF2zLbzjDAPXjc33P2VfnVVHE347.SeyJpZCI6IiNkaWRjb21tIiwicyI6eyJhIjpbImRpZGNvbW0vdjIiXSwiciI6W10sInVyaSI6Imh0dHA6Ly9hbGljZS1tZWRpYXRvci5jb20ifSwidCI6ImRtIn0#key-1"; - let auth_id = BASE64_STANDARD.encode(did.to_owned() + "#key-1"); - let agreem_id = BASE64_STANDARD.encode(did.to_owned() + "#key-2"); + let auth_id = did.to_owned() + "#key-1"; + let agreem_id = did.to_owned() + "#key-2"; let keys: Vec<(String, Jwk)> = vec![ ( auth_id, From a9f0b5d6bce41520e0559127c69e3b86cf3f2faa Mon Sep 17 00:00:00 2001 From: Hermann Core Date: Fri, 4 Jul 2025 10:52:21 +0100 Subject: [PATCH 24/25] feat: add example environment configuration file --- .env.example | 11 +++++++++++ .gitignore | 1 - 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 .env.example diff --git a/.env.example b/.env.example new file mode 100644 index 00000000..d636cbe2 --- /dev/null +++ b/.env.example @@ -0,0 +1,11 @@ +# Server configuration +SERVER_PUBLIC_DOMAIN=https://example.com +SERVER_LOCAL_PORT=3000 +MONGO_URI=mongodb://mongodb:27017/ +MONGO_DBN=didcomm-mediator + +# AWS configuration +AWS_ACCESS_KEY_ID=test +AWS_SECRET_ACCESS_KEY=test +AWS_REGION=us-east-1 +AWS_ENDPOINT_URL=http://localstack:4566 # Should be removed in production \ No newline at end of file diff --git a/.gitignore b/.gitignore index b7ec3eac..8e47b081 100644 --- a/.gitignore +++ b/.gitignore @@ -33,7 +33,6 @@ test/ # Environment variables files .env -.env.example # Reference crate From 86ca68967d68d747649f66204c1b74ded52be420 Mon Sep 17 00:00:00 2001 From: Awambeng Rodrick Date: Fri, 11 Jul 2025 15:49:51 +0100 Subject: [PATCH 25/25] fix: remove STORAGE_DIRPATH from environment variables in deployment and configmap --- mediator-charts/templates/env-configmap.yaml | 1 - mediator-charts/templates/mediator-deployment.yaml | 7 ------- 2 files changed, 8 deletions(-) diff --git a/mediator-charts/templates/env-configmap.yaml b/mediator-charts/templates/env-configmap.yaml index ca163010..2c7c1299 100644 --- a/mediator-charts/templates/env-configmap.yaml +++ b/mediator-charts/templates/env-configmap.yaml @@ -4,7 +4,6 @@ data: SERVER_LOCAL_PORT: "8080" SERVER_PUBLIC_DOMAIN: "https://didcomm-mediator.eudi-adorsys.com" MONGO_INITDB_ROOT_USERNAME: root - STORAGE_DIRPATH: /storage kind: ConfigMap metadata: diff --git a/mediator-charts/templates/mediator-deployment.yaml b/mediator-charts/templates/mediator-deployment.yaml index 81444085..5d2103e8 100644 --- a/mediator-charts/templates/mediator-deployment.yaml +++ b/mediator-charts/templates/mediator-deployment.yaml @@ -32,13 +32,6 @@ spec: key: MONGO_DBN name: {{ .Values.mediator.configmap.name }} - - - name: STORAGE_DIRPATH - valueFrom: - configMapKeyRef: - key: STORAGE_DIRPATH - name: {{ .Values.mediator.configmap.name }} - - name: MONGO_INITDB_ROOT_PASSWORD valueFrom: secretKeyRef: