-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integrate of develop did resolution for did method did:web #38
Comments
Simple path testing on an existing online server There is a unit test in the code base just testing if the server is responding. Could be extended to test if document returned is a did server. |
mod local;
use did_resolver::{
did_parser::Did,
traits::resolvable::{resolution_options::DidResolutionOptions, DidResolvable},
};
use did_resolver_web::resolution::resolver::DidWebResolver;
#[tokio::test]
async fn resolves_did_web_address() -> Result<(), Box<dyn std::error::Error>> {
//! This test requires that a running instance of
//! the server be accessible on the internet.
// Read did:web address from local uncommitted file
// since it is subject to frequent change
use local::DID_ADDRESS as did;
// Resolve via the universal resolver
let resp = reqwest::get(format!("https://dev.uniresolver.io/1.0/identifiers/{did}"))
.await?
.json::<serde_json::Value>()
.await?;
// Extract DID document
let diddoc = resp
.get("didDocument")
.expect("Missing didDocument property");
assert_eq!(did, diddoc.get("id").unwrap());
Ok(())
}
#[tokio::test]
async fn resolves_did_web_address_with_local_binding() {
let did = Did::parse(format!("did:web:{}%3A{}", "localhost", "8090")).expect("did parse error");
let did_web_resolver = DidWebResolver::http();
let options = DidResolutionOptions::default();
let result = did_web_resolver
.resolve(&did, &options)
.await
.expect("resolution error");
let diddoc = result.did_document();
assert_eq!(&did, diddoc.id());
}
#[tokio::test]
async fn resolves_did_web_address_with_https_local_binding() {
//! This test requires that a running instance of
//! the server be accessible on the internet.
// Read did:web address from local uncommitted file
// since it is subject to frequent change
use local::DID_ADDRESS;
let did = Did::parse(DID_ADDRESS.to_string()).expect("did parse error");
let did_web_resolver = DidWebResolver::https();
let options = DidResolutionOptions::default();
let result = did_web_resolver
.resolve(&did, &options)
.await
.expect("resolution error");
let diddoc = result.did_document();
assert_eq!(&did, diddoc.id());
} |
[package]
name = "somebank"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
tokio = { version = "1.30.0", features = ["full"] }
axum = "0.6.20"
serde_json = "1.0.104"
chrono = "0.4.26"
tower-http = { version = "0.4.3", features = ["fs"] }
reqwest = { version = "0.11.18", features = ["blocking", "json"] }
# aries-vcx
did_resolver = { path = "../../aries-vcx/did_resolver" }
did_resolver_web = { path = "../../aries-vcx/did_resolver_web" } |
github-project-automation
bot
moved this from In Progress
to Done
in didcomm-mediator-rs
Oct 5, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Spec at https://w3c-ccg.github.io/did-method-web/
It can be implemented as a sub-module of the did-utils project
The text was updated successfully, but these errors were encountered: