From 7287ac4a1ebaf641c3c680b84a37ef6091649869 Mon Sep 17 00:00:00 2001 From: Enrico Marconi Date: Thu, 15 Aug 2024 14:19:57 +0200 Subject: [PATCH] use compound verifier --- bindings/grpc/src/services/credential/validation.rs | 1 - bindings/grpc/src/services/domain_linkage.rs | 5 +++-- bindings/grpc/src/services/presentation.rs | 6 +++--- bindings/grpc/src/services/sd_jwt.rs | 5 +++-- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/bindings/grpc/src/services/credential/validation.rs b/bindings/grpc/src/services/credential/validation.rs index 09828a60f8..1960e54b99 100644 --- a/bindings/grpc/src/services/credential/validation.rs +++ b/bindings/grpc/src/services/credential/validation.rs @@ -1,7 +1,6 @@ // Copyright 2020-2024 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -use identity_eddsa_verifier::EdDSAJwsVerifier; use identity_iota::core::FromJson; use identity_iota::core::Object; use identity_iota::core::ToJson; diff --git a/bindings/grpc/src/services/domain_linkage.rs b/bindings/grpc/src/services/domain_linkage.rs index bb8b214982..b85bab2ff0 100644 --- a/bindings/grpc/src/services/domain_linkage.rs +++ b/bindings/grpc/src/services/domain_linkage.rs @@ -18,7 +18,6 @@ use _domain_linkage::ValidateDidResponse; use _domain_linkage::ValidateDomainAgainstDidConfigurationRequest; use _domain_linkage::ValidateDomainRequest; use _domain_linkage::ValidateDomainResponse; -use identity_eddsa_verifier::EdDSAJwsVerifier; use identity_iota::core::FromJson; use identity_iota::core::Url; use identity_iota::credential::DomainLinkageConfiguration; @@ -38,6 +37,8 @@ use tonic::Response; use tonic::Status; use url::Origin; +use crate::verifier::Verifier; + mod _domain_linkage { tonic::include_proto!("domain_linkage"); } @@ -276,7 +277,7 @@ impl DomainLinkageService { .for_each(|(credential, issuer_did_doc)| { let id = issuer_did_doc.id().to_string(); - if let Err(err) = JwtDomainLinkageValidator::with_signature_verifier(EdDSAJwsVerifier::default()) + if let Err(err) = JwtDomainLinkageValidator::with_signature_verifier(Verifier::default()) .validate_linkage( &issuer_did_doc, &domain_linkage_configuration, diff --git a/bindings/grpc/src/services/presentation.rs b/bindings/grpc/src/services/presentation.rs index 5f8a7e86e1..3ba3ce6ddc 100644 --- a/bindings/grpc/src/services/presentation.rs +++ b/bindings/grpc/src/services/presentation.rs @@ -7,7 +7,7 @@ use _presentation::credential_validation_result::Result as ValidationResult; use _presentation::CredentialValidationResult; use _presentation::JwtPresentationRequest; use _presentation::JwtPresentationResponse; -use identity_eddsa_verifier::EdDSAJwsVerifier; +use crate::verifier::Verifier; use identity_iota::core::Object; use identity_iota::core::ToJson; use identity_iota::credential::CompoundJwtPresentationValidationError; @@ -90,7 +90,7 @@ impl PresentationService for PresentationSvc { .await .map_err(Error::ResolutionError)?; - let presentation_validator = JwtPresentationValidator::with_signature_verifier(EdDSAJwsVerifier::default()); + let presentation_validator = JwtPresentationValidator::with_signature_verifier(Verifier::default()); let mut decoded_presentation = presentation_validator .validate::( &jwt_presentation, @@ -101,7 +101,7 @@ impl PresentationService for PresentationSvc { let credentials = std::mem::take(&mut decoded_presentation.presentation.verifiable_credential); let mut decoded_credentials = Vec::with_capacity(credentials.len()); - let credential_validator = JwtCredentialValidator::with_signature_verifier(EdDSAJwsVerifier::default()); + let credential_validator = JwtCredentialValidator::with_signature_verifier(Verifier::default()); for credential_jwt in credentials { let issuer_did = JwtCredentialValidatorUtils::extract_issuer_from_jwt::(&credential_jwt) .map_err(|e| Error::CredentialValidationError(e.into())); diff --git a/bindings/grpc/src/services/sd_jwt.rs b/bindings/grpc/src/services/sd_jwt.rs index af792e51f6..be8ff8b1fe 100644 --- a/bindings/grpc/src/services/sd_jwt.rs +++ b/bindings/grpc/src/services/sd_jwt.rs @@ -5,7 +5,6 @@ use _sd_jwt::verification_server::Verification; use _sd_jwt::verification_server::VerificationServer; use _sd_jwt::VerificationRequest; use _sd_jwt::VerificationResponse; -use identity_eddsa_verifier::EdDSAJwsVerifier; use identity_iota::core::Object; use identity_iota::core::Timestamp; use identity_iota::core::ToJson; @@ -25,6 +24,8 @@ use serde::Deserialize; use serde::Serialize; use thiserror::Error; +use crate::verifier::Verifier; + use self::_sd_jwt::KeyBindingOptions; mod _sd_jwt { @@ -125,7 +126,7 @@ impl Verification for SdJwtService { sd_jwt.jwt = jwt.into(); let decoder = SdObjectDecoder::new_with_sha256(); - let validator = SdJwtCredentialValidator::with_signature_verifier(EdDSAJwsVerifier::default(), decoder); + let validator = SdJwtCredentialValidator::with_signature_verifier(Verifier::default(), decoder); let credential = validator .validate_credential::<_, Object>( &sd_jwt,