Updated dependencies, bumped to 2021 edition - Updated sha2 from a yanked version - Updated sha-1 - Updated hmac - Updated byteorder - Updated base64
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
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()
}