aboutsummaryrefslogtreecommitdiff
path: root/src/util.rs
diff options
context:
space:
mode:
authorRobin Krahl <robin.krahl@ireas.org>2019-01-25 18:46:57 +0000
committerRobin Krahl <robin.krahl@ireas.org>2019-01-25 19:49:35 +0100
commit809d31a4273505487febb2dd281376d2bb3766ab (patch)
tree127b0fa98b7c9e309e7de9a05506dba720e878af /src/util.rs
parent846c34226572d53bf93bb4191f4742eb6eaa37b1 (diff)
downloadnitrokey-rs-809d31a4273505487febb2dd281376d2bb3766ab.tar.gz
nitrokey-rs-809d31a4273505487febb2dd281376d2bb3766ab.tar.bz2
Remove rand_core::Error from public API
rand_core does not have a stable release yet, and it is unlikely that there will be one soon. To be able to stabilize nitrokey without waiting for a stable rand_core version, we remove the rand_core::Error type from the public API and replace it with a Box<dyn error::Error>.
Diffstat (limited to 'src/util.rs')
-rw-r--r--src/util.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/util.rs b/src/util.rs
index 5f25655..d87cd7c 100644
--- a/src/util.rs
+++ b/src/util.rs
@@ -73,7 +73,7 @@ pub fn get_last_error() -> Error {
}
pub fn generate_password(length: usize) -> Result<Vec<u8>, Error> {
- let mut rng = OsRng::new()?;
+ let mut rng = OsRng::new().map_err(|err| Error::RandError(Box::new(err)))?;
let mut data = vec![0u8; length];
rng.fill_bytes(&mut data[..]);
Ok(data)