diff options
Diffstat (limited to 'util/src/entities/BackupCodes.ts')
-rw-r--r-- | util/src/entities/BackupCodes.ts | 16 |
1 files changed, 0 insertions, 16 deletions
diff --git a/util/src/entities/BackupCodes.ts b/util/src/entities/BackupCodes.ts index d532a39a..9092c14e 100644 --- a/util/src/entities/BackupCodes.ts +++ b/util/src/entities/BackupCodes.ts @@ -1,7 +1,6 @@ import { Column, Entity, JoinColumn, ManyToOne, RelationId } from "typeorm"; import { BaseClass } from "./BaseClass"; import { User } from "./User"; -import crypto from "crypto"; @Entity("backup_codes") export class BackupCode extends BaseClass { @@ -17,19 +16,4 @@ export class BackupCode extends BaseClass { @Column() expired: boolean; -} - -export function generateMfaBackupCodes(user_id: string) { - let backup_codes: BackupCode[] = []; - for (let i = 0; i < 10; i++) { - const code = BackupCode.create({ - user: { id: user_id }, - code: crypto.randomBytes(4).toString("hex"), // 8 characters - consumed: false, - expired: false, - }); - backup_codes.push(code); - } - - return backup_codes; } \ No newline at end of file |