diff options
author | Jesse Luehrs <doy@tozt.net> | 2021-07-05 14:24:56 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2021-07-05 14:56:31 -0400 |
commit | 3433d1847943666522ad220b3e6d7849de528907 (patch) | |
tree | 34e4e7d66f6fb84675fda590cac4fdb88ebe9aab /src/bin | |
parent | 4ee2d262788171e411962a507dd1eda04529cdd7 (diff) | |
download | rbw-3433d1847943666522ad220b3e6d7849de528907.tar.gz rbw-3433d1847943666522ad220b3e6d7849de528907.zip |
use totp-lite instead of oath
oath appears to be unmaintained
Diffstat (limited to 'src/bin')
-rw-r--r-- | src/bin/rbw/commands.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/bin/rbw/commands.rs b/src/bin/rbw/commands.rs index 53310d7..ee767c7 100644 --- a/src/bin/rbw/commands.rs +++ b/src/bin/rbw/commands.rs @@ -1500,9 +1500,13 @@ fn parse_totp_secret(secret: &str) -> anyhow::Result<Vec<u8>> { fn generate_totp(secret: &str) -> anyhow::Result<String> { let key = parse_totp_secret(secret)?; - Ok(format!( - "{:06}", - oath::totp_raw_now(&key, 6, 0, 30, &oath::HashType::SHA1) + Ok(totp_lite::totp_custom::<totp_lite::Sha1>( + totp_lite::DEFAULT_STEP, + 6, + &key, + std::time::SystemTime::now() + .duration_since(std::time::SystemTime::UNIX_EPOCH)? + .as_secs(), )) } |