From 6ea51cf59344952d565eded950d99bf5659f29ce Mon Sep 17 00:00:00 2001 From: Matthias Date: Wed, 24 Aug 2022 10:41:56 +0200 Subject: [PATCH] Added database info for 2fa --- src/entities/index.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/entities/index.ts b/src/entities/index.ts index 244a27d..0529684 100644 --- a/src/entities/index.ts +++ b/src/entities/index.ts @@ -13,6 +13,12 @@ export enum UserRole { DISABLED = 0 } +export enum tfaTypes { + NONE = 0, + EMAIL = 1, + TOTP = 2 +} + @Entity() export class INode { @PrimaryGeneratedColumn() @@ -59,6 +65,20 @@ export class User { rootId: number; @OneToOne(() => INode) root: Promise; + + @Column({ + type: 'int', + default: tfaTypes.NONE, + transformer: { + from: (db: number): tfaTypes => db, + to: (type: tfaTypes): number => type + } + }) + tfaType: tfaTypes; + + // base32 string + @Column({ nullable: true }) + tfaSecret: string; } @Entity()