From 44f9d36df1689b5ceaef37c84b240a8ad75918c9 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Fri, 26 Nov 2021 05:56:13 +0900 Subject: [PATCH] Make request test follow API change --- plume-common/src/activity_pub/request.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/plume-common/src/activity_pub/request.rs b/plume-common/src/activity_pub/request.rs index 8f20de13..e5c879a7 100644 --- a/plume-common/src/activity_pub/request.rs +++ b/plume-common/src/activity_pub/request.rs @@ -166,8 +166,8 @@ pub fn signature( #[cfg(test)] mod tests { - use super::{signature, Error}; - use crate::activity_pub::sign::{gen_keypair, Signer}; + use super::signature; + use crate::activity_pub::sign::{gen_keypair, Error, Result, Signer}; use openssl::{hash::MessageDigest, pkey::PKey, rsa::Rsa}; use reqwest::header::HeaderMap; @@ -187,13 +187,11 @@ mod tests { } impl Signer for MySigner { - type Error = Error; - fn get_key_id(&self) -> String { "mysigner".into() } - fn sign(&self, to_sign: &str) -> Result, Self::Error> { + fn sign(&self, to_sign: &str) -> Result> { let key = PKey::from_rsa(Rsa::private_key_from_pem(self.private_key.as_ref()).unwrap()) .unwrap(); let mut signer = openssl::sign::Signer::new(MessageDigest::sha256(), &key).unwrap(); @@ -201,7 +199,7 @@ mod tests { signer.sign_to_vec().map_err(|_| Error()) } - fn verify(&self, data: &str, signature: &[u8]) -> Result { + fn verify(&self, data: &str, signature: &[u8]) -> Result { let key = PKey::from_rsa(Rsa::public_key_from_pem(self.public_key.as_ref()).unwrap()) .unwrap(); let mut verifier = openssl::sign::Verifier::new(MessageDigest::sha256(), &key).unwrap();