pub struct AdminTokenStore { /* private fields */ }Expand description
Handle to the (optional) currently-valid admin token.
Implementations§
Source§impl AdminTokenStore
impl AdminTokenStore
pub fn new(data_dir: PathBuf) -> Self
Sourcepub fn issue(&self) -> Result<String, ServerError>
pub fn issue(&self) -> Result<String, ServerError>
Generate, persist, and print a fresh admin token.
The returned string is the token in its user-facing form and should be exposed to the operator (typically via stdout).
Sourcepub fn consume(&self, presented: &str) -> Result<(), ServerError>
pub fn consume(&self, presented: &str) -> Result<(), ServerError>
Verify presented against the currently-valid token.
On success the token is invalidated (single-use) and its hash file removed, and the caller can proceed with enrollment.
pub fn is_active(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for AdminTokenStore
impl Forget for AdminTokenStore
impl Move for AdminTokenStore
impl RefUnwindSafe for AdminTokenStore
impl Send for AdminTokenStore
impl Sync for AdminTokenStore
impl Unpin for AdminTokenStore
impl UnsafeUnpin for AdminTokenStore
impl UnwindSafe for AdminTokenStore
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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