Implemented multiple U2f keys, key names, and compromised checks

This commit is contained in:
Daniel García committed 2019-02-16 23:07:48 +01:00
1 parent 6027b969f5
commit a744b9437a
3 files changed
+135 -83

No files matched your search

+6 -3
View File
@@ -47,10 +47,13 @@ impl NumberOrString {
}
}
fn into_i32(self) -> Option<i32> {
fn into_i32(self) -> ApiResult<i32> {
use std::num::ParseIntError as PIE;
match self {
NumberOrString::Number(n) => Some(n),
NumberOrString::String(s) => s.parse().ok(),
NumberOrString::Number(n) => Ok(n),
NumberOrString::String(s) => s
.parse()
.map_err(|e: PIE| crate::Error::new("Can't convert to number", e.to_string())),
}
}
}