pub struct Authenticator(/* private fields */);Expand description
Wrapper around a MAC used for authenticating clients that have a secret.
Implementations§
Source§impl Authenticator
impl Authenticator
Sourcepub fn validate(&self, challenge: &Uuid, tag: &str) -> bool
pub fn validate(&self, challenge: &Uuid, tag: &str) -> bool
Validate a reply to a challenge.
use bore_cli::auth::Authenticator;
use uuid::Uuid;
let auth = Authenticator::new("secret");
let challenge = Uuid::new_v4();
assert!(auth.validate(&challenge, &auth.answer(&challenge)));
assert!(!auth.validate(&challenge, "wrong answer"));Sourcepub async fn server_handshake<T: AsyncRead + AsyncWrite + Unpin>(
&self,
stream: &mut Delimited<T>,
) -> Result<()>
pub async fn server_handshake<T: AsyncRead + AsyncWrite + Unpin>( &self, stream: &mut Delimited<T>, ) -> Result<()>
As the server, send a challenge to the client and validate their response.
Sourcepub async fn client_handshake<T: AsyncRead + AsyncWrite + Unpin>(
&self,
stream: &mut Delimited<T>,
) -> Result<()>
pub async fn client_handshake<T: AsyncRead + AsyncWrite + Unpin>( &self, stream: &mut Delimited<T>, ) -> Result<()>
As the client, answer a challenge to attempt to authenticate with the server.
Auto Trait Implementations§
impl Freeze for Authenticator
impl RefUnwindSafe for Authenticator
impl Send for Authenticator
impl Sync for Authenticator
impl Unpin for Authenticator
impl UnwindSafe for Authenticator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more