diff --git a/Cargo.lock b/Cargo.lock index a2c0f63..ca03222 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,21 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "addr2line" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" + [[package]] name = "android-tzdata" version = "0.1.1" @@ -23,6 +38,21 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" +[[package]] +name = "backtrace" +version = "0.3.74" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" +dependencies = [ + "addr2line", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", + "windows-targets", +] + [[package]] name = "base-x" version = "0.2.11" @@ -315,6 +345,12 @@ dependencies = [ "wasi", ] +[[package]] +name = "gimli" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" + [[package]] name = "group" version = "0.13.0" @@ -497,6 +533,15 @@ version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" +[[package]] +name = "miniz_oxide" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" +dependencies = [ + "adler2", +] + [[package]] name = "multibase" version = "0.9.1" @@ -561,6 +606,15 @@ dependencies = [ "libm", ] +[[package]] +name = "object" +version = "0.36.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" version = "1.20.2" @@ -614,6 +668,12 @@ dependencies = [ "base64ct", ] +[[package]] +name = "pin-project-lite" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" + [[package]] name = "pkcs1" version = "0.7.5" @@ -752,6 +812,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "rustc-demangle" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" + [[package]] name = "ryu" version = "1.0.18" @@ -979,6 +1045,28 @@ dependencies = [ "time-core", ] +[[package]] +name = "tokio" +version = "1.40.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998" +dependencies = [ + "backtrace", + "pin-project-lite", + "tokio-macros", +] + +[[package]] +name = "tokio-macros" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.82", +] + [[package]] name = "typenum" version = "1.17.0" @@ -1156,6 +1244,7 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" name = "xdid" version = "0.0.0" dependencies = [ + "tokio", "xdid-core", "xdid-method-key", "xdid-method-web", diff --git a/crates/xdid/Cargo.toml b/crates/xdid/Cargo.toml index 102e472..98f0745 100644 --- a/crates/xdid/Cargo.toml +++ b/crates/xdid/Cargo.toml @@ -15,3 +15,6 @@ did-web = ["dep:xdid-method-web"] xdid-core = { path = "../xdid-core" } xdid-method-key = { path = "../xdid-method-key", optional = true } xdid-method-web = { path = "../xdid-method-web", optional = true } + +[dev-dependencies] +tokio = { version = "1.40.0", features = ["macros", "rt"] } diff --git a/crates/xdid/src/resolver.rs b/crates/xdid/src/resolver.rs index fe11307..857e8b9 100644 --- a/crates/xdid/src/resolver.rs +++ b/crates/xdid/src/resolver.rs @@ -27,3 +27,19 @@ impl DidResolver { Err(ResolutionError::UnsupportedMethod) } } + +#[cfg(test)] +mod tests { + use xdid_method_key::{keys::p256::P256KeyPair, DidKey}; + + use super::*; + + #[tokio::test] + async fn test_resolve_did_key() { + let did = DidKey::new(P256KeyPair::generate().unwrap().to_public()).to_did(); + + let resolver = DidResolver::default(); + let document = resolver.resolve(&did).await.unwrap(); + assert_eq!(document.id, did); + } +}