dig-account 0.1.2

The DIG Network user Account: the fat, strictly-logical crate for everything an account does — the Account+Profile object model, unlock policy + keystore crypto, the in-process identity+money signer, per-profile key/DEK derivation, DID+dig-store mint/sign, and all wallet ops. Headless (no UI). Consumed by dig-app.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//! The single-additional-factor seam (TOTP, passkey, …).

use super::factors::AuthFactors;

/// A single additional authentication factor (TOTP, passkey, …). This is the seam a concrete TOTP
/// (RFC 6238) or WebAuthn verifier implements; the gate stays agnostic to the primitive. Kept
/// separate from [`AuthPolicy`](super::policy::AuthPolicy) so factors compose independently of policy
/// plumbing.
pub trait SecondFactor: Send + Sync {
    /// A short human-facing name for the factor (for error messages / UI), e.g. `"TOTP"`.
    fn name(&self) -> &str;

    /// Verify the presented `factors` satisfy this factor. `Ok(())` on success; `Err` (mapped to
    /// [`UnlockError::Unauthorized`](super::policy::UnlockError::Unauthorized)) on a missing or
    /// invalid factor.
    fn verify(&self, factors: &AuthFactors) -> Result<(), String>;
}