Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion backend-2fa-implementation/src/two_factor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use totp_rs::{Algorithm, Secret, TOTP};
use rand::distributions::{Distribution, Uniform};
use rand::thread_rng;
use rand::Rng;
use std::collections::HashSet;
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use std::sync::{Arc, Mutex};
Expand Down Expand Up @@ -184,7 +185,7 @@ impl TwoFactorAuth {

pub fn generate_backup_codes(count: usize) -> Vec<String> {
let mut rng = rand::thread_rng();
let mut codes = std::collections::HashSet::new();
let mut codes = HashSet::new();
while codes.len() < count {
codes.insert(format!("{:04}-{:04}", rng.gen_range(0..10000), rng.gen_range(0..10000)));
}
Expand Down
Loading