Struct parity_rpc::AuthCodes
source · [−]pub struct AuthCodes<T: TimeProvider = DefaultTimeProvider> { /* private fields */ }
Expand description
Manages authorization codes for SignerUIs
Implementations
sourceimpl<T: TimeProvider> AuthCodes<T>
impl<T: TimeProvider> AuthCodes<T>
sourcepub fn new(codes: Vec<String>, now: T) -> Self
pub fn new(codes: Vec<String>, now: T) -> Self
Creates a new AuthCodes
store with given TimeProvider
.
sourcepub fn is_valid(&mut self, hash: &H256, time: u64) -> bool
pub fn is_valid(&mut self, hash: &H256, time: u64) -> bool
Checks if given hash is correct authcode of SignerUI
Updates this hash last used field in case it’s valid.
sourcepub fn generate_new(&mut self) -> Result<String>
pub fn generate_new(&mut self) -> Result<String>
Generates and returns a new code that can be used by SignerUIs
sourcepub fn clear_garbage(&mut self)
pub fn clear_garbage(&mut self)
Removes old tokens that have not been used since creation.
Auto Trait Implementations
impl<T> RefUnwindSafe for AuthCodes<T> where
T: RefUnwindSafe,
impl<T> Send for AuthCodes<T> where
T: Send,
impl<T> Sync for AuthCodes<T> where
T: Sync,
impl<T> Unpin for AuthCodes<T> where
T: Unpin,
impl<T> UnwindSafe for AuthCodes<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more