docs.rs failed to build oath-0.1.3
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build:
oath-0.10.2
rust-oath
This library aims to provide implementations of HOTP, TOTP, and OCRA as specified by the RFCs.
Implemented:
Planned:
- OCRA (RFC 6287)
Examples
HOTP
// htop(key, counter, digits)
// hotp_raw takes bytes as the key
assert_eq!(hotp_raw(b"\xff", 23, 6), 330795);
// hotp takes a hex string as the key
assert_eq!(hotp("ff", 23, 6), 330795);
hotp_custom(b"\xff", 23, 6, Sha1::new());
TOTP
All the times below are in seconds.
// totp(key, digits, epoch, time_step)
totp("ff", 6, 0, 30); // defaults for most TOTP implementations
totp_raw(b"\xff", 6, 0, 30);
// totp_custom(key, digits, epoch, time_step, current_time, hash)
totp_custom(b"\xff", 6, 0, 30, 255, Sha1::new());
Misc
If you don't want to use rustc-serialize
directly, this library provides a
wrapper around from_hex()
. This helps with the functions that expect byte
arrays.
let seed = oath::from_hex("ff").unwrap();
totp_raw(seed.as_slice(), 6, 0, 30);