Rust

code

Module

Numeric one-time codes, such as those sent by email or SMS.

Contents

use utopia_auth::proofs::code::Code;
Rust
pub struct Code

A numeric one-time code, 6 digits by default.

Rust
use utopia_auth::proofs::{Code, Proof};

let code = Code::new(8)?;
let secret = code.generate()?;
assert_eq!(secret.len(), 8);
assert!(secret.iter().all(u8::is_ascii_digit));
Also implements Default.