Struct ethcore_signer::AuthCodes
[−]
[src]
pub struct AuthCodes<T: TimeProvider = DefaultTimeProvider> { /* fields omitted */ }
Manages authorization codes for SignerUIs
Methods
impl AuthCodes<DefaultTimeProvider>
[src]
fn from_file(file: &Path) -> Result<AuthCodes>
Reads AuthCodes
from file and creates new instance using DefaultTimeProvider
.
impl<T: TimeProvider> AuthCodes<T>
[src]
fn to_file(&self, file: &Path) -> Result<()>
Writes all AuthCodes
to a disk.
fn new(codes: Vec<String>, now: T) -> Self
Creates a new AuthCodes
store with given TimeProvider
.
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.
fn generate_new(&mut self) -> Result<String>
Generates and returns a new code that can be used by SignerUIs
fn is_empty(&self) -> bool
Returns true if there are no tokens in this store
fn clear_garbage(&mut self)
Removes old tokens that have not been used since creation.