use alloc::vec::Vec;
pub trait Authenticator {
type Error: core::fmt::Display;
fn sign(&mut self, token: &[u8]) -> impl Future<Output = Result<Vec<u8>, Self::Error>>;
fn public_key(&self) -> &[u8];
fn offer_public_key(&self) -> bool {
true
}
}
impl<A: Authenticator + ?Sized> Authenticator for &mut A {
type Error = A::Error;
fn sign(&mut self, token: &[u8]) -> impl Future<Output = Result<Vec<u8>, Self::Error>> {
(**self).sign(token)
}
fn public_key(&self) -> &[u8] {
(**self).public_key()
}
fn offer_public_key(&self) -> bool {
(**self).offer_public_key()
}
}
use core::future::Future;