doido-auth 0.0.18

Unified authentication for Doido — AuthUser trait, extractors, strategies, and auth generators.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
//! Two-factor tests (feature `auth-2fa`).

#![cfg(feature = "auth-2fa")]

use doido_auth::two_factor::{enroll, verify_code};

#[test]
fn enroll_produces_secret_and_uri() {
    let enrollment = enroll("user@example.com", "MyApp").unwrap();
    assert!(enrollment.otpauth_uri.contains("otpauth://totp/MyApp"));
    assert!(!enrollment.secret.is_empty());
    assert!(!verify_code(&enrollment.secret, "000000").unwrap());
}