diff --git a/Cargo.toml b/Cargo.toml index deb16f3..8018c2f 100755 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,3 +38,6 @@ siwe-recap = { version = "0.2" } [dev-dependencies] async-std = { version = "1.10", features = ["attributes"] } +base64 = "0.13" +serde_ipld_dagcbor = "0.4" +did-method-key = { git = "https://github.com/spruceid/ssi.git", branch = "feat/ucan-0.10" } diff --git a/src/v3/common.rs b/src/v3/common.rs index 9f36bf1..31cd8bc 100644 --- a/src/v3/common.rs +++ b/src/v3/common.rs @@ -257,3 +257,17 @@ where Ok(RecapCacao::try_from(siwe)?.into()) } } + +#[cfg(test)] +mod test { + use super::*; + + #[async_std::test] + async fn basic() { + let encoded = "qmNpc3NYG50aygECAbFNPE9fv7z7mK8tMwAA1JyVuTqnAGNhdWRYVp0a7QE4NstKM22BZAAHaojdiik61NN1l7wVRKwcQJWixAbFHzEjejZNa2lFaExWMmVxOWFqelBRQTZRMkJVU2t6WHdUMm1GYkR2TkdqTXl0VzRTV2g0YXZhMWNhdHSheEtrZXBsZXI6cGtoOmVpcDE1NToxOjB4QjE0ZDNjNEY1RkJGQkNGQjk4YWYyZDMzMDAwMGQ0OWM5NUI5M2FBNzovL2RlZmF1bHQva3alZmt2L2RlbIGgZmt2L2dldIGgZmt2L3B1dIGgZ2t2L2xpc3SBoGtrdi9tZXRhZGF0YYGgY25uY3FVajg5YkdHWmtoNFJKNjY4dmNwcmaAY2lhdBocvbpSY2V4cBsAAAAHda9C0mNmY3SkZWlhdC16ZC41MlplZXhwLXpkLjUyWmZkb21haW5pbG9jYWxob3N0aXJlc291cmNlc4Bhc1hINOcBG5HDAwx4ASjJGspMdIhMu2NX9o06hfQbz1SqCvdAWjwWOpO6aDh56KfReehDpmKEJxYXdQVVLMAmFVq1SZxBIzljSnkc"; + let decoded = base64::decode(encoded).unwrap(); + let cacao: CommonCacao = serde_ipld_dagcbor::from_slice(&decoded).unwrap(); + let verifier = CommonVerifier::new(&did_method_key::DIDKey); + cacao.verify(&verifier).await.unwrap(); + } +}