Merge branch 'outdated-dependencies' into 'master'

Update dependencies

See merge request lumi/sasl-rs!7
This commit is contained in:
lumi 2020-05-15 12:37:48 +00:00
commit 54169dbff7
3 changed files with 6 additions and 7 deletions

View file

@ -16,11 +16,11 @@ gitlab = { repository = "lumi/sasl-rs" }
[features] [features]
default = ["scram"] default = ["scram"]
scram = ["base64", "rand_os", "sha-1", "sha2", "hmac", "pbkdf2"] scram = ["base64", "getrandom", "sha-1", "sha2", "hmac", "pbkdf2"]
[dependencies] [dependencies]
base64 = { version = "0.10", optional = true } base64 = { version = "0.12", optional = true }
rand_os = { version = "0.1", optional = true } getrandom = { version = "0.1", optional = true }
sha-1 = { version = "0.8", optional = true } sha-1 = { version = "0.8", optional = true }
sha2 = { version = "0.8", optional = true } sha2 = { version = "0.8", optional = true }
hmac = { version = "0.7", optional = true } hmac = { version = "0.7", optional = true }

View file

@ -1,4 +1,4 @@
use rand_os::{OsRng, rand_core::{RngCore, Error as RngError}}; use getrandom::{getrandom, Error as RngError};
use sha1::{Sha1 as Sha1_hash, Digest}; use sha1::{Sha1 as Sha1_hash, Digest};
use sha2::Sha256 as Sha256_hash; use sha2::Sha256 as Sha256_hash;
use hmac::{Hmac, Mac}; use hmac::{Hmac, Mac};
@ -13,8 +13,7 @@ use base64;
/// Generate a nonce for SCRAM authentication. /// Generate a nonce for SCRAM authentication.
pub fn generate_nonce() -> Result<String, RngError> { pub fn generate_nonce() -> Result<String, RngError> {
let mut data = [0u8; 32]; let mut data = [0u8; 32];
let mut rng = OsRng::new()?; getrandom(&mut data)?;
rng.fill_bytes(&mut data);
Ok(base64::encode(&data)) Ok(base64::encode(&data))
} }

View file

@ -1,5 +1,5 @@
#[cfg(feature = "scram")] #[cfg(feature = "scram")]
use rand_os::rand_core::Error as RngError; use getrandom::Error as RngError;
/// A wrapper enum for things that could go wrong in this crate. /// A wrapper enum for things that could go wrong in this crate.
#[derive(Debug)] #[derive(Debug)]