Struct yubirs::otp::result::VerificationResult
source · pub struct VerificationResult {
pub otp: Option<String>,
pub nonce: Option<String>,
pub signature: Vec<u8>,
pub timestamp: DateTime<Utc>,
pub status: Status,
pub decrypted_timestamp: Option<String>,
pub decrypted_use_counter: Option<String>,
pub decrypted_session_use_counter: Option<String>,
pub success_percent: Option<u8>,
/* private fields */
}
Expand description
This structure provides type-safe access to all of the fields which may appear in a response / verification result from the Yubico API. More details on what the fields mean are in the official documentation: https://developers.yubico.com/OTP/Specifications/OTP_validation_protocol.html.
Fields§
§otp: Option<String>
§nonce: Option<String>
§signature: Vec<u8>
§timestamp: DateTime<Utc>
§status: Status
§decrypted_timestamp: Option<String>
§decrypted_use_counter: Option<String>
§decrypted_session_use_counter: Option<String>
§success_percent: Option<u8>
Implementations§
source§impl VerificationResult
impl VerificationResult
sourcepub fn new(
api_key: &[u8],
expected_otp: &Otp,
expected_nonce: &str,
response: Vec<u8>
) -> Result<VerificationResult>
pub fn new( api_key: &[u8], expected_otp: &Otp, expected_nonce: &str, response: Vec<u8> ) -> Result<VerificationResult>
Parse the given raw HTTP response into a result structure. Use the other pieces of information to verify that the response is valid (i.e., the contents and signature match what we expect).
sourcepub fn is_valid(&self) -> bool
pub fn is_valid(&self) -> bool
Returns true if and only if the result indicates that the OTP was successfully verified.
sourcepub fn is_retryable_error(&self) -> bool
pub fn is_retryable_error(&self) -> bool
Returns true if this error is retryable (i.e., the request may actually succeed if we try it again).
Trait Implementations§
source§impl Clone for VerificationResult
impl Clone for VerificationResult
source§fn clone(&self) -> VerificationResult
fn clone(&self) -> VerificationResult
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl RefUnwindSafe for VerificationResult
impl Send for VerificationResult
impl Sync for VerificationResult
impl Unpin for VerificationResult
impl UnwindSafe for VerificationResult
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