Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
Signed-off-by: Patrik Stas <[email protected]>
  • Loading branch information
Patrik-Stas committed Nov 30, 2023
1 parent 16d16c8 commit 6442acc
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,6 @@ async fn resolve_their_ddo(
.resolve(&request.content.did.parse()?, &Default::default())
.await?
.did_document()
.to_owned()
.to_owned(),
))
}
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,12 @@ mod tests {
convert_to_hashmap, didcommv2::ExtraFieldsDidCommV2, SovKeyKind,
};
use did_parser::{Did, DidUrl};
use crate::peer_did::numalgos::numalgo2::resolve::resolve_numalgo2;
use crate::resolver::options::PublicKeyEncoding;

use super::*;
use crate::{
peer_did::numalgos::numalgo2::resolve::resolve_numalgo2,
resolver::options::PublicKeyEncoding,
};

fn create_verification_method(
did_full: String,
Expand Down Expand Up @@ -263,18 +265,18 @@ mod tests {
.add_service(service)
.build();


let did = append_encoded_service_segment(did.to_string(), &did_document).unwrap();

let ddo = resolve_numalgo2(
&did.parse::<Did>().unwrap(),
PublicKeyEncoding::Base58,
).unwrap().build();
let ddo = resolve_numalgo2(&did.parse::<Did>().unwrap(), PublicKeyEncoding::Base58)
.unwrap()
.build();

let ddo_expected = resolve_numalgo2(
&did_expected.parse::<Did>().unwrap(),
PublicKeyEncoding::Base58,
).unwrap().build();
)
.unwrap()
.build();

assert_eq!(ddo, ddo_expected);
assert_eq!(did, did_expected);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
use base64::{engine::general_purpose::STANDARD_NO_PAD, Engine};
use did_doc::schema::{
did_doc::DidDocumentBuilder, service::Service, types::uri::Uri,
};
use did_doc::schema::{did_doc::DidDocumentBuilder, service::Service, types::uri::Uri};
use did_doc_sov::extra_fields::{convert_to_hashmap, didcommv2::ExtraFieldsDidCommV2};
use did_parser::Did;
use public_key::Key;
Expand Down Expand Up @@ -77,8 +75,7 @@ fn process_service_element(
let decoded = STANDARD_NO_PAD.decode(element)?;
let service: ServiceAbbreviated = serde_json::from_slice(&decoded)?;

did_doc_builder =
did_doc_builder.add_service(deabbreviate_service(service, *service_index)?);
did_doc_builder = did_doc_builder.add_service(deabbreviate_service(service, *service_index)?);
*service_index += 1;

Ok(did_doc_builder)
Expand Down Expand Up @@ -127,7 +124,8 @@ fn deabbreviate_service(
t => t.to_string(),
};

// TODO: this should be "#service-{}", the first string shall not be interpolated, just hardcoded "service"
// TODO: this should be "#service-{}", the first string shall not be interpolated, just
// hardcoded "service"
let id = format!("#{}-{}", service_type.to_lowercase(), index).parse()?;

if service.routing_keys().is_empty() {
Expand Down

0 comments on commit 6442acc

Please sign in to comment.