This package is a library designed to provide out-of-box HOTP and TOTP clients to generate one-time passwords.
HOTP
work with base32 secret string:
use HotpBuilder;
let mut hotp_client = new
.base32_secret
.build
.expect;
assert_eq!;
hotp_client.increment_counter;
assert_eq!;
If secret string isn't base32 encoding, you should use .key(secret_string.as_bytes().to_owned()) instead of .base32_secret method.
TOTP
work with base32 secret string:
use TotpBuilder;
let mut totp_cleint = new
.base32_secret
.build
.expect;
let totp_code = totp_cleint.generate;
println!;
If secret string isn't base32 encoding, you should use .key(secret_string.as_bytes().to_owned()) instead of .base32_secret method.