aries-vcx
aries-vcx copied to clipboard
DID:SOV DIDDoc does resolve without a service/endpoint
part of this series of issues; https://github.com/hyperledger/aries-vcx/issues/1089
in the did_resolver_sov crate, if the did:sov DID does not have an endpoint attribute, then the entire DIDDoc fails to resolve.
E.g. the following fails with NotFound("DID not found"):
#[tokio::test]
async fn write_new_nym_and_get_did_doc() {
let profile = build_setup_profile().await;
let (new_nym, verkey) = profile
.wallet
.create_and_store_my_did(None, None)
.await
.unwrap();
profile
.ledger_write
.publish_nym(
&profile.wallet,
&profile.institution_did,
&new_nym,
Some(&verkey),
None,
None,
)
.await
.unwrap();
// NEED TO WRITE ENDPOINT FOR IT TO RESOLVE
// write_test_endpoint(&profile.wallet, &profile.ledger_write, &new_nym).await;
let resolver = DidSovResolver::new(profile.ledger_read);
let did = format!("did:sov:{}", new_nym);
let did_doc = resolver
.resolve(
&Did::parse(did.clone()).unwrap(),
&DidResolutionOptions::default(),
)
.await
.unwrap();
println!(
"{}",
serde_json::to_string_pretty(&did_doc.did_document()).unwrap()
);
}
Expected behaviour according to spec https://sovrin-foundation.github.io/sovrin/spec/did-method-spec-template.html#crud-operation-definitions :
If an endpoint ATTRIB does not exist for the NYM, the service block is an empty array (e.g. "service": []