Skip to content

Commit

Permalink
use compound verifier
Browse files Browse the repository at this point in the history
  • Loading branch information
UMR1352 committed Aug 15, 2024
1 parent bbc82f1 commit 7287ac4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
1 change: 0 additions & 1 deletion bindings/grpc/src/services/credential/validation.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
5 changes: 3 additions & 2 deletions bindings/grpc/src/services/domain_linkage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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");
}
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions bindings/grpc/src/services/presentation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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::<IotaDocument, Jwt, Object>(
&jwt_presentation,
Expand All @@ -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::<CoreDID>(&credential_jwt)
.map_err(|e| Error::CredentialValidationError(e.into()));
Expand Down
5 changes: 3 additions & 2 deletions bindings/grpc/src/services/sd_jwt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 {
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 7287ac4

Please sign in to comment.