Skip to content

Commit

Permalink
Refactor didcore, remove generics from DidDocument
Browse files Browse the repository at this point in the history
Signed-off-by: Patrik Stas <[email protected]>
  • Loading branch information
Patrik-Stas committed Feb 9, 2024
1 parent 13e330f commit 87a5de5
Show file tree
Hide file tree
Showing 137 changed files with 3,633 additions and 4,595 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ jobs:
default: true
- name: "Run resolver tests"
run: |
cargo test --examples -p did_doc -p did_parser -p did_resolver -p did_resolver_registry -p did_resolver_sov -p did_resolver_web -p did_doc_sov -p did_key -p did_peer --test "*"
cargo test --examples -p did_doc -p did_parser -p did_resolver -p did_resolver_registry -p did_resolver_sov -p did_resolver_web -p did_key -p did_peer --test "*"
test-integration-node-wrapper:
needs: workflow-setup
Expand Down
49 changes: 31 additions & 18 deletions Cargo.lock

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

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ members = [
"did_core/did_doc",
"did_core/did_methods/did_peer",
"did_core/did_methods/did_key",
"did_core/did_doc_sov",
"did_core/did_parser",
"did_core/did_parser_nom",
"did_core/did_resolver",
Expand Down
2 changes: 1 addition & 1 deletion aries/agents/node/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,6 @@ typings/
# End of https://www.gitignore.io/api/node


vcxagent-core/storage-proofs/
vcxagent-core/storage-*

**/test/tmp
6 changes: 3 additions & 3 deletions aries/agents/rust/aries-vcx-agent/src/agent/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ use std::sync::Arc;

use aries_vcx::{
common::ledger::{
service_didsov::{DidSovServiceType, EndpointDidSov},
service_didsov::EndpointDidSov,
transactions::{add_new_did, write_endpoint},
},
did_doc::schema::service::typed::ServiceType,
global::settings::DEFAULT_LINK_SECRET_ALIAS,
};
use aries_vcx_core::{
Expand Down Expand Up @@ -106,7 +107,7 @@ impl Agent {
.await?;
let endpoint = EndpointDidSov::create()
.set_service_endpoint(init_config.service_endpoint.clone())
.set_types(Some(vec![DidSovServiceType::DidCommunication]));
.set_types(Some(vec![ServiceType::DIDCommV1.to_string()]));
write_endpoint(
wallet.as_ref(),
ledger_write.as_ref(),
Expand All @@ -130,7 +131,6 @@ impl Agent {
init_config.service_endpoint.clone(),
));
let did_exchange = Arc::new(ServiceDidExchange::new(
ledger_read.clone(),
wallet.clone(),
did_resolver_registry,
init_config.service_endpoint.clone(),
Expand Down
26 changes: 16 additions & 10 deletions aries/agents/rust/aries-vcx-agent/src/error/convertors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ use std::convert::From;

use aries_vcx::{
did_doc::error::DidDocumentBuilderError,
did_doc_sov::error::DidDocumentSovError,
errors::error::{AriesVcxError, AriesVcxErrorKind},
protocols::did_exchange::state_machine::generic::GenericDidExchange,
};
use aries_vcx_core::errors::error::AriesVcxCoreError;
use did_resolver_sov::did_resolver::did_doc::schema::utils::error::DidDocumentLookupError;

use crate::error::*;

Expand All @@ -30,7 +30,6 @@ impl From<serde_json::Error> for AgentError {
}
}

// TODO
impl From<AriesVcxCoreError> for AgentError {
fn from(err: AriesVcxCoreError) -> Self {
let kind = AgentErrorKind::GenericAriesVcxError;
Expand All @@ -39,14 +38,6 @@ impl From<AriesVcxCoreError> for AgentError {
}
}

impl From<DidDocumentSovError> for AgentError {
fn from(err: DidDocumentSovError) -> Self {
let kind = AgentErrorKind::GenericAriesVcxError;
let message = format!("DidDocumentSovError; err: {:?}", err.to_string());
AgentError { message, kind }
}
}

impl From<DidDocumentBuilderError> for AgentError {
fn from(err: DidDocumentBuilderError) -> Self {
let kind = AgentErrorKind::GenericAriesVcxError;
Expand All @@ -63,6 +54,14 @@ impl From<aries_vcx::did_parser::ParseError> for AgentError {
}
}

impl From<did_peer::error::DidPeerError> for AgentError {
fn from(err: did_peer::error::DidPeerError) -> Self {
let kind = AgentErrorKind::GenericAriesVcxError;
let message = format!("DidPeerError; err: {:?}", err.to_string());
AgentError { message, kind }
}
}

impl From<public_key::PublicKeyError> for AgentError {
fn from(err: public_key::PublicKeyError) -> Self {
let kind = AgentErrorKind::GenericAriesVcxError;
Expand All @@ -86,6 +85,13 @@ impl From<(GenericDidExchange, AriesVcxError)> for AgentError {
AgentError { message, kind }
}
}
impl From<DidDocumentLookupError> for AgentError {
fn from(err: DidDocumentLookupError) -> Self {
let kind = AgentErrorKind::GenericAriesVcxError;
let message = format!("DidDocumentLookupError; err: {:?}", err.to_string());
AgentError { message, kind }
}
}

impl From<anoncreds_types::Error> for AgentError {
fn from(err: anoncreds_types::Error) -> Self {
Expand Down
57 changes: 0 additions & 57 deletions aries/agents/rust/aries-vcx-agent/src/helper.rs

This file was deleted.

2 changes: 1 addition & 1 deletion aries/agents/rust/aries-vcx-agent/src/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pub struct VcxHttpClient;

#[async_trait]
impl Transport for VcxHttpClient {
async fn send_message(&self, msg: Vec<u8>, service_endpoint: Url) -> VcxResult<()> {
async fn send_message(&self, msg: Vec<u8>, service_endpoint: &Url) -> VcxResult<()> {
shared::http_client::post_message(msg, service_endpoint).await?;
Ok(())
}
Expand Down
1 change: 0 additions & 1 deletion aries/agents/rust/aries-vcx-agent/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ extern crate uuid;

mod agent;
mod error;
pub mod helper;
mod http;
mod services;
mod storage;
Expand Down
Loading

0 comments on commit 87a5de5

Please sign in to comment.