core: simplify deliver lifetimes, add digest::build, verify::build
This commit is contained in:
parent
ec1bf8640f
commit
1c7700c9a0
|
@ -5,9 +5,6 @@ pub trait Client<'a> {
|
|||
type Error: std::error::Error + 'static;
|
||||
type Future: Future<Output = Result<(), Self::Error>> + 'a;
|
||||
|
||||
fn deliver<'b, T: serde::ser::Serialize>(
|
||||
&'b self,
|
||||
inbox: &'a Url,
|
||||
activity: &'a T,
|
||||
) -> Self::Future;
|
||||
fn deliver<T: serde::ser::Serialize>(&'a self, inbox: &'a Url, activity: &'a T)
|
||||
-> Self::Future;
|
||||
}
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
pub trait Digest {
|
||||
const NAME: &'static str;
|
||||
|
||||
fn build() -> Self;
|
||||
fn digest(self, input: &[u8]) -> String;
|
||||
}
|
||||
|
||||
pub trait DigestFactory {
|
||||
type Digest: Digest + Send;
|
||||
|
||||
fn digest(&self) -> Self::Digest;
|
||||
}
|
||||
|
|
|
@ -17,11 +17,13 @@ pub trait SignFactory {
|
|||
pub trait Verify {
|
||||
type Error: std::error::Error + Send;
|
||||
|
||||
fn build(public_key_pem: &str) -> Result<Self, Self::Error>
|
||||
where
|
||||
Self: Sized;
|
||||
|
||||
fn verify(&self, signing_string: &str, signature: &str) -> Result<bool, Self::Error>;
|
||||
}
|
||||
|
||||
pub trait VerifyFactory {
|
||||
type Verifier: Verify + Send + 'static;
|
||||
|
||||
fn verifier(&self, public_key_pem: String) -> Self::Verifier;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue