Struct bore_cli::auth::Authenticator
source · [−]pub struct Authenticator(_);
Expand description
Wrapper around a MAC used for authenticating clients that have a secret.
Implementations
sourceimpl 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(
&self,
stream: &mut impl AsyncBufRead + AsyncWrite + Unpin
) -> Result<()>
pub async fn server_handshake(
&self,
stream: &mut impl AsyncBufRead + AsyncWrite + Unpin
) -> Result<()>
As the server, send a challenge to the client and validate their response.
sourcepub async fn client_handshake(
&self,
stream: &mut impl AsyncBufRead + AsyncWrite + Unpin
) -> Result<()>
pub async fn client_handshake(
&self,
stream: &mut impl AsyncBufRead + AsyncWrite + Unpin
) -> Result<()>
As the client, answer a challenge to attempt to authenticate with the server.
Auto Trait Implementations
impl RefUnwindSafe for Authenticator
impl Send for Authenticator
impl Sync for Authenticator
impl Unpin for Authenticator
impl UnwindSafe for Authenticator
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more