pub struct Keys { /* private fields */ }Expand description
A key table as an Authenticator, Directory and Accounts implementation.
The table is read again whenever it reports a change.
use coqui_access::{AccountPut, Accounts, Attempt, Authenticator, Verdict};
use coqui_access_key::Keys;
let keys = Keys::builder().build().unwrap();
let made = keys
.put(AccountPut { name: "relay".into(), ..AccountPut::default() })
.unwrap();
let verdict = keys
.authenticate(Attempt { secret: made.secret, ..Attempt::default() })
.unwrap();
assert!(matches!(verdict, Verdict::Valid(_)));Implementations§
Trait Implementations§
Source§impl Accounts for Keys
impl Accounts for Keys
Source§fn put(&self, account: AccountPut) -> Result<PutOutcome, ProviderError>
fn put(&self, account: AccountPut) -> Result<PutOutcome, ProviderError>
Makes an account and its key, or changes what is said of one there is. An account that is there and has nothing said to change is given another key, and the one it had stops being taken. A key is never given: it is made here and answered once.
Source§fn accounts(&self) -> Result<Vec<AccountInfo>, ProviderError>
fn accounts(&self) -> Result<Vec<AccountInfo>, ProviderError>
The accounts kept, without anything that proves one.
Source§impl Authenticator for Keys
impl Authenticator for Keys
Source§fn authenticate(&self, attempt: Attempt) -> Result<Verdict, ProviderError>
fn authenticate(&self, attempt: Attempt) -> Result<Verdict, ProviderError>
Checks one attempt without returning person details or credential material. Read more
Auto Trait Implementations§
impl !Freeze for Keys
impl !RefUnwindSafe for Keys
impl !UnwindSafe for Keys
impl Send for Keys
impl Sync for Keys
impl Unpin for Keys
impl UnsafeUnpin for Keys
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