Module otpauth::totp [] [src]

Two-step verification of TOTP algorithm

Example

extern crate otpauth;
extern crate time;

fn main() {
    let auth = otpauth::TOTP::new("python");
    let timestamp1 = time::now().to_timespec().sec as usize;
    let code = auth.generate(30, timestamp1);
    let timestamp2 = time::now().to_timespec().sec as usize;
    assert!(auth.verify(code, 30, timestamp2));
}

Structs

TOTP