diff --git a/ssi-ucan/Cargo.toml b/ssi-ucan/Cargo.toml index 7a1f28f65..65251cabb 100644 --- a/ssi-ucan/Cargo.toml +++ b/ssi-ucan/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ssi-ucan" -version = "0.1.1" +version = "0.2.0" edition = "2021" authors = ["Spruce Systems, Inc."] license = "Apache-2.0" diff --git a/ssi-ucan/src/lib.rs b/ssi-ucan/src/lib.rs index 9fa620e1c..4ad7e9f42 100644 --- a/ssi-ucan/src/lib.rs +++ b/ssi-ucan/src/lib.rs @@ -97,7 +97,7 @@ impl Ucan { /// This method will resolve the DID of the issuer and verify the signature /// using their public key. This method works over a JWT as the original /// encoding is not retained by the UCAN struct. - pub async fn verify_and_decode(jwt: &str, resolver: &dyn DIDResolver) -> Result + pub async fn decode_and_verify(jwt: &str, resolver: &dyn DIDResolver) -> Result where F: for<'a> Deserialize<'a>, A: for<'a> Deserialize<'a>, @@ -393,7 +393,7 @@ mod tests { serde_json::from_str(include_str!("../../tests/ucan-v0.9.0-valid.json")).unwrap(); for case in cases { - let ucan = Ucan::verify_and_decode(&case.token, DIDKey.to_resolver()) + let ucan = Ucan::decode_and_verify(&case.token, DIDKey.to_resolver()) .await .unwrap(); @@ -410,7 +410,7 @@ mod tests { match Ucan::::decode(&case.token) { Ok(u) => { if u.payload.validate_time(None).is_ok() - && Ucan::::verify_and_decode(&case.token, DIDKey.to_resolver()) + && Ucan::::decode_and_verify(&case.token, DIDKey.to_resolver()) .await .is_ok() { @@ -425,7 +425,7 @@ mod tests { #[async_std::test] async fn basic() { let case = "eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCIsInVjdiI6IjAuOS4wIn0.eyJhdHQiOltdLCJhdWQiOiJkaWQ6ZXhhbXBsZToxMjMiLCJleHAiOjkwMDAwMDAwMDEuMCwiaXNzIjoiZGlkOmtleTp6Nk1ram16ZXBUcGc0NFJvejhKbk45QXhUS0QyMjk1Z2p6M3h0NDhQb2k3MjYxR1MiLCJwcmYiOltdfQ.V38liNHsdVO0Zk_davTBsewq-2XCxs_3qIRLuwUNj87aqdlMfa9X5O5IRR5u7apzWm7sUiR0FS3J3Nnu7IWtBQ"; - Ucan::::verify_and_decode(case, DIDKey.to_resolver()) + Ucan::::decode_and_verify(case, DIDKey.to_resolver()) .await .unwrap(); }