diff --git a/src/ctap/storage.rs b/src/ctap/storage.rs index 0408041..7fdf50c 100644 --- a/src/ctap/storage.rs +++ b/src/ctap/storage.rs @@ -271,11 +271,11 @@ impl PersistentStore { /// Returns the number of credentials. pub fn count_credentials(&self) -> Result { - let mut iter_result = Ok(()); - let iter = self.iter_credentials(&mut iter_result)?; - let result = iter.count(); - iter_result?; - Ok(result) + let mut count = 0; + for handle in self.store.iter()? { + count += key::CREDENTIALS.contains(&handle?.get_key()) as usize; + } + Ok(count) } /// Returns the estimated number of credentials that can still be stored.