Feat: 2fa (#1783)
* preplan otp, better qrcode library * add 2fa as feature * add totp generation * working totp lifecycle * don't allow disabled user to log in not a security issue as permission handler would fail anyway * require 2fa on login if enabled * update packages * fix typo * remove console.logs
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import fs from 'node:fs/promises';
|
||||
import debug from 'debug';
|
||||
import QRCode from 'qrcode';
|
||||
import { encodeQR } from 'qr';
|
||||
import type { InterfaceType } from '#db/repositories/interface/types';
|
||||
|
||||
const WG_DEBUG = debug('WireGuard');
|
||||
@@ -128,9 +128,10 @@ class WireGuard {
|
||||
|
||||
async getClientQRCodeSVG({ clientId }: { clientId: ID }) {
|
||||
const config = await this.getClientConfiguration({ clientId });
|
||||
return QRCode.toString(config, {
|
||||
type: 'svg',
|
||||
width: 512,
|
||||
return encodeQR(config, 'svg', {
|
||||
ecc: 'high',
|
||||
scale: 4,
|
||||
encoding: 'byte',
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user