Commit 97695cf26d76a3648eca41516f07fabd856b2770

Cléo Rebert 2022-01-13T15:55:04

Updated dependencies, bumped to 2021 edition - Updated sha2 from a yanked version - Updated sha-1 - Updated hmac - Updated byteorder - Updated base64

diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml
index a14ae5c..8c2b2d6 100644
--- a/.github/workflows/rust.yml
+++ b/.github/workflows/rust.yml
@@ -17,6 +17,6 @@ jobs:
     steps:
     - uses: actions/checkout@v2
     - name: Build
-      run: cargo build --verbose --features qr
+      run: cargo build --verbose --all-features
     - name: Run tests
-      run: cargo test --verbose --features qr
+      run: cargo test --verbose --all-features
diff --git a/Cargo.toml b/Cargo.toml
index 2958906..1679c87 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,8 +1,8 @@
 [package]
 name = "totp-rs"
-version = "0.6.4"
+version = "0.6.5"
 authors = ["Cleo Rebert <cleo.rebert@gmail.com>"]
-edition = "2018"
+edition = "2021"
 readme = "README.md"
 license = "MIT"
 description = "RFC-compliant TOTP implementation with ease of use as a goal and additionnal QoL features."
@@ -21,11 +21,11 @@ serde_support = ["serde"]
 
 [dependencies]
 serde = { version = "1.0", features = ["derive"], optional = true }
-sha2 = "0.9.5"
-sha-1 = "0.9.7"
-hmac = "0.8.0"
-byteorder = ">= 1.3"
-base32 = ">= 0.4"
-qrcode = { version = ">= 0.12", optional = true }
-image = { version = ">= 0.23", optional = true}
-base64 = { version = ">= 0.12", optional = true }
+sha2 = "~0.10.1"
+sha-1 = "~0.10.0"
+hmac = "~0.12.0"
+byteorder = "~1.4.3"
+base32 = "~0.4"
+qrcode = { version = "~0.12", optional = true }
+image = { version = "~0.23.14", optional = true}
+base64 = { version = "~0.13", optional = true }
diff --git a/src/lib.rs b/src/lib.rs
index 127ff76..5f50f61 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -45,7 +45,7 @@ use std::io::Cursor;
 #[cfg(feature = "qr")]
 use {base64, image::Luma, qrcode::QrCode};
 
-use hmac::{Hmac, Mac, NewMac};
+use hmac::{Hmac, Mac};
 use sha1::Sha1;
 use sha2::{Sha256, Sha512};
 
@@ -95,17 +95,17 @@ impl<T: AsRef<[u8]>> TOTP<T> {
         let ctr = (time / self.step).to_be_bytes();
         match self.algorithm {
             Algorithm::SHA1 => {
-                let mut mac = HmacSha1::new_varkey(self.secret.as_ref()).expect("no key");
+                let mut mac = HmacSha1::new_from_slice(self.secret.as_ref()).expect("no key");
                 mac.update(&ctr);
                 mac.finalize().into_bytes().to_vec()
             }
             Algorithm::SHA256 => {
-                let mut mac = HmacSha256::new_varkey(self.secret.as_ref()).expect("no key");
+                let mut mac = HmacSha256::new_from_slice(self.secret.as_ref()).expect("no key");
                 mac.update(&ctr);
                 mac.finalize().into_bytes().to_vec()
             }
             Algorithm::SHA512 => {
-                let mut mac = HmacSha512::new_varkey(self.secret.as_ref()).expect("no key");
+                let mut mac = HmacSha512::new_from_slice(self.secret.as_ref()).expect("no key");
                 mac.update(&ctr);
                 mac.finalize().into_bytes().to_vec()
             }