sequoia_cryptoki/check_password.rs
1use cryptoki::types::AuthPin;
2
3use crate::Result;
4use crate::Token;
5
6impl Token {
7 /// Returns if the PIN is valid.
8 ///
9 /// This tries to log in to the token. If the PIN is wrong, this
10 /// will decrement the retry counter.
11 pub fn check_password<P>(&self, pin: P) -> Result<()>
12 where
13 P: Into<AuthPin>
14 {
15 self.open_ro_user_session(pin.into())?;
16 Ok(())
17 }
18}