pub fn is_valid(&self, encoded_token: &str) -> bool {
        // Check size of encoded token struct.
        if encoded_token.len() > TOKEN_LENGTH_LIMIT {
            return false;
        }

        // Decode token struct from base64.
        let mut token = match Token::base64_decode(encoded_token) {
            Ok(token) => token,
            Err(_) => return false,
        };

        // Decrypt ttl using AES-GCM block cipher.
        let expiry = match self.decrypt_expiry(&mut token.payload, &token.tag, &token.iv) {
            Ok(expiry) => expiry,
            Err(_) => return false,
        };

        // Compare expiry (in ms) with current time in milliseconds.
        expiry > get_time_ms(ClockType::Monotonic)
    }
/// Attempts to decrypt expiry value within token sequence. Returns false if expiry
/// cannot be decrypted. If decryption succeeds, returns true if token has not expired
/// (i.e. current time is greater than expiry) and false otherwise.
Attempts to decrypt expiry value within token sequence. Returns false if expiry
cannot be decrypted. If decryption succeeds, returns true if token has not expired
and false otherwise.
Attempts to decrypt expiry value within token sequence . Returns false if expiry cannot be decrypted . If decryption succeeds returns true if token has not expired and false otherwise .
pub fn is_valid(&self, encoded_token: &str) -> bool {
        // Check size of encoded token struct.
        if encoded_token.len() > TOKEN_LENGTH_LIMIT {
            return false;
        }
        // Decode token struct from base64.
        let mut token = match Token::base64_decode(encoded_token) {
            Ok(token) => token,
            Err(_) => return false,
        };
        // Decrypt ttl using AES-GCM block cipher.
        let expiry = match self.decrypt_expiry(&mut token.payload, &token.tag, &token.iv) {
            Ok(expiry) => expiry,
            Err(_) => return false,
        };
        // Compare expiry (in ms) with current time in milliseconds.
        expiry > get_time_ms(ClockType::Monotonic)
    }
pub fn is_valid ( & self , encoded_token : & str ) -> bool { // Check size of encoded token struct. if encoded_token . len ( ) > TOKEN_LENGTH_LIMIT { return false ; } // Decode token struct from base64. let mut token = match Token :: base64_decode ( encoded_token ) { Ok ( token ) => token , Err ( _ ) => return false , } ; // Decrypt ttl using AES-GCM block cipher. let expiry = match self . decrypt_expiry ( & mut token . payload , & token . tag , & token . iv ) { Ok ( expiry ) => expiry , Err ( _ ) => return false , } ; // Compare expiry (in ms) with current time in milliseconds. expiry > get_time_ms ( ClockType :: Monotonic ) }
Attempts to decrypt expiry value within token sequence.
Attempts to decrypt expiry value within token sequence .
&self
encoded_token
&str
&self
encoded_token
&str