From ec1bf8640f66c3aa630d970e281fe6971c28104b Mon Sep 17 00:00:00 2001 From: "Aode (lion)" Date: Thu, 18 Nov 2021 21:05:40 -0600 Subject: [PATCH] core: add verify traits --- apub-core/src/signature.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/apub-core/src/signature.rs b/apub-core/src/signature.rs index 03533bc..bc4a0f6 100644 --- a/apub-core/src/signature.rs +++ b/apub-core/src/signature.rs @@ -13,3 +13,15 @@ pub trait SignFactory { fn key_id(&self) -> Self::KeyId; fn signer(&self) -> Self::Signer; } + +pub trait Verify { + type Error: std::error::Error + Send; + + fn verify(&self, signing_string: &str, signature: &str) -> Result; +} + +pub trait VerifyFactory { + type Verifier: Verify + Send + 'static; + + fn verifier(&self, public_key_pem: String) -> Self::Verifier; +}