Expand description
Implementation of standards which are part of the OATH Reference Architecture.
Examples
let key_ascii = "12345678901234567890".to_owned();
let mut hotp = libreauth::oath::HOTPBuilder::new()
.ascii_key(&key_ascii)
.finalize()
.unwrap();
let code = hotp.generate();
assert_eq!(code, "755224");
assert!(hotp.is_valid(&"755224".to_owned()));
let code = hotp.increment_counter().generate();
assert_eq!(code, "287082");
assert!(hotp.is_valid(&"287082".to_owned()));
let key_base32 = "GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ".to_owned();
let mut totp = libreauth::oath::TOTPBuilder::new()
.base32_key(&key_base32)
.finalize()
.unwrap();
let code = totp.generate();
println!("TOTP code: {}", code);
assert!(totp.is_valid(&code));
Structs
- Generates, manipulates and checks HOTP codes.
- Builds an HOTP object.
- [C binding] HOTP configuration storage
- Creates the Key Uri Format according to the Google authenticator specification by calling
key_uri_format()
onHOTP
orTOTP
. This value can be used to generete QR codes which allow easy scanning by the end user. - Generates and checks TOTP codes.
- Builds a TOTP object.
- [C binding] TOTP configuration storage
Enums
- Errors used for the Rust interface.
- Error codes used in the C interface.
- Defines the base policy for showing or hiding parameters in a Key URI.
Functions
- [C binding] Generate an HOTP code according to the given configuration and stores it in the supplied buffer.
- [C binding] Generate the key URI.
- [C binding] Initialize a
struct libreauth_hotp_cfg
with the default values. - [C binding] Check whether or not the supplied HOTP code is valid.
- [C binding] Generate a TOTP code according to the given configuration and stores it in the supplied buffer.
- [C binding] Generate the key URI.
- [C binding] Initialize a
struct libreauth_totp_cfg
with the default values. - [C binding] Initialize a
struct libreauth_totp_cfg
with the default values.