Files
imphnen-backend-service/imphnen-utils/src/generate_otp.rs
T

14 lines
235 B
Rust
Raw Normal View History

2025-03-19 23:17:50 +07:00
use rand::{rng, Rng};
pub struct OtpManager;
impl OtpManager {
pub fn generate_otp() -> u32 {
rng().random_range(100_000..1_000_000)
}
pub fn validate_otp(stored_otp: u32, user_otp: u32) -> bool {
stored_otp == user_otp
}
}