use cryptoki::types::AuthPin;
use crate::Result;
use crate::Token;
impl Token {
/// Returns if the PIN is valid.
///
/// This tries to log in to the token. If the PIN is wrong, this
/// will decrement the retry counter.
pub fn check_password<P>(&self, pin: P) -> Result<()>
where
P: Into<AuthPin>
{
self.open_ro_user_session(pin.into())?;
Ok(())
}
}