diff --git a/did-webkey/src/lib.rs b/did-webkey/src/lib.rs index 3e3164835..da06d0c41 100644 --- a/did-webkey/src/lib.rs +++ b/did-webkey/src/lib.rs @@ -391,7 +391,7 @@ mod tests { } #[tokio::test] - async fn from_did_webkey() { + async fn from_did_webkey_ssh() { // TODO: use JWK fingerprint let did_url: &str = "https://localhost/user.keys"; let pubkeys: &str = include_str!("../tests/ssh_keys"); @@ -463,4 +463,32 @@ mod tests { }); shutdown().ok(); } + + #[tokio::test] + async fn from_did_webkey_gpg() { + // TODO: use JWK fingerprint + let did_url: &str = "https://localhost/user.gpg"; + let pubkeys: &str = include_str!("../tests/user.gpg"); + + let (url, shutdown) = web_server(did_url, pubkeys).unwrap(); + PROXY.with(|proxy| { + proxy.replace(Some(url)); + }); + let (res_meta, doc_opt, _doc_meta) = DIDWebKey + .resolve( + "did:webkey:gpg:localhost:user.keys", + &ResolutionInputMetadata::default(), + ) + .await; + assert_eq!(res_meta.error, None); + // let value_expected = unimplemented!(); + let doc = doc_opt.unwrap(); + let doc_value = serde_json::to_value(doc).unwrap(); + eprintln!("doc {}", serde_json::to_string_pretty(&doc_value).unwrap()); + assert_eq!(doc_value, value_expected); + PROXY.with(|proxy| { + proxy.replace(None); + }); + shutdown().ok(); + } } diff --git a/did-webkey/tests/user.gpg b/did-webkey/tests/user.gpg new file mode 100644 index 000000000..1e4345f18 --- /dev/null +++ b/did-webkey/tests/user.gpg @@ -0,0 +1,73 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQGNBGHXRxABDACmjJYqojR9OG5hrSnlPNd1vTm4oH0YuTq95OlJ469zDGAlr5Q1 +Y6Tq5ovuISG8MqnpcD1UtpiJPSfqfOlGOQyFAt6cAB27Swu0X7ETGo6Qb71vEn8I +k7u2wNivxmuGOW/YaS2ZGw02EpI4U1NFCtzUvGrEEKwZ3X1GRNqYVMJd5bFio1ZJ +T7WzFQ2DakSe0mVapRZpMFe9PB0c+LbJDXlxaMedgCxfxKvByBy4zWNRizOr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