Merge pull request #271 from ia0/count_credentials
Improve count_credentials by not deserializing them
This commit is contained in:
@@ -268,11 +268,11 @@ impl PersistentStore {
|
|||||||
|
|
||||||
/// Returns the number of credentials.
|
/// Returns the number of credentials.
|
||||||
pub fn count_credentials(&self) -> Result<usize, Ctap2StatusCode> {
|
pub fn count_credentials(&self) -> Result<usize, Ctap2StatusCode> {
|
||||||
let mut iter_result = Ok(());
|
let mut count = 0;
|
||||||
let iter = self.iter_credentials(&mut iter_result)?;
|
for handle in self.store.iter()? {
|
||||||
let result = iter.count();
|
count += key::CREDENTIALS.contains(&handle?.get_key()) as usize;
|
||||||
iter_result?;
|
}
|
||||||
Ok(result)
|
Ok(count)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the estimated number of credentials that can still be stored.
|
/// Returns the estimated number of credentials that can still be stored.
|
||||||
|
|||||||
Reference in New Issue
Block a user