Skip to content

A modern, self-hosted backup solution for secure, encrypted backups across local and cloud storage.

feat: adds Two Factor Authentication

towfiqief9aaf6f6439
diff --git a/backend/package.json b/backend/package.json
index b65b866..2cddf7e 100644
--- a/backend/package.json
+++ b/backend/package.json
@@ -26,12 +26,15 @@
"ejs": "^3.1.10",
"express": "^5.2.1",
"express-rate-limit": "^7.5.1",
+ "express-session": "^1.19.0",
"helmet": "^8.1.0",
"jsonwebtoken": "^9.0.3",
"nanoid": "^5.0.9",
"node-ssh": "^13.2.0",
"nodemailer": "8.0.1",
+ "otpauth": "^9.5.0",
"pino": "^9.6.0",
+ "qrcode": "^1.5.4",
"systeminformation": "^5.31.0",
"tsx": "^4.21.0",
"zod": "^4.1.12"
@@ -43,11 +46,13 @@
"@types/cors": "^2.8.17",
"@types/ejs": "^3.1.5",
"@types/express": "^5.0.0",
+ "@types/express-session": "^1.18.2",
"@types/jest": "^30.0.0",
"@types/jsonwebtoken": "^9.0.8",
"@types/node": "^22.10.10",
"@types/nodemailer": "^7.0.10",
"@types/pg": "^8.11.11",
+ "@types/qrcode": "^1.5.6",
"@types/supertest": "^6.0.3",
"concurrently": "^9.1.2",
"cross-env": "^10.0.0",
diff --git a/backend/src/controllers/SettingsController.ts b/backend/src/controllers/SettingsController.ts
index 69ffa0f..c72dd4b 100644
--- a/backend/src/controllers/SettingsController.ts
+++ b/backend/src/controllers/SettingsController.ts
@@ -157,4 +157,54 @@ export class SettingsController {
return;
}
}
+
+ async setupTwoFactorAuth(req: Request, res: Response): Promise<void> {
+ try {
+ // This service method generates the QR code and the temporary secret
+ const { qrCodeDataUrl, setupKey, tempSecret } =
+ await this.settingsService.setupTwoFactorAuth();
+
+ // SECURELY store the secret on the server in the user's session.
+ req.session.totpSecret = tempSecret;
+
+ // Send only the visual parts to the client.
+ res.status(200).json({ success: true, result: { qrCodeDataUrl, setupKey } });
+ } catch (error: any) {
+ res.status(error.statusCode || 500).json({ success: false, error: error.message });
+ }
+ }
+
+ async finalizeTwoFactorSetup(req: Request, res: Response): Promise<void> {
+ const { code } = req.body;
+ const settingsId = parseInt(req.params.id, 10);
+
+ // 1. Retrieve the secret from the server-side session.
+ const tempSecret = req.session.totpSecret;
+
+ if (!tempSecret) {
+ res.status(400).json({
+ success: false,
+ error: 'Your session has expired. Please start the setup process again.',
+ });
+ return;
+ }
+
+ try {
+ // The service method validates the code against the temporary secret
+ const { recoveryCodes } = await this.settingsService.finalizeTwoFactorSetup(
+ tempSecret,
+ code,
+ settingsId
+ );
+
+ // 2. Clean up the temporary secret from the session.
+ delete req.session.totpSecret; // or req.session.destroy();
+
+ // 3. Send back the one-time recovery codes.
+ res.status(200).json({ success: true, result: { recoveryCodes } });
+ } catch (error: any) {
+ // If the code was invalid, the service will throw an error.
+ res.status(error.statusCode || 500).json({ success: false, error: error.message });
+ }
+ }
}
diff --git a/backend/src/controllers/UserController.ts b/backend/src/controllers/UserController.ts
index b21c51f..f53eab8 100644
--- a/backend/src/controllers/UserController.ts
+++ b/backend/src/controllers/UserController.ts
@@ -1,8 +1,12 @@
+import Cryptr from 'cryptr';
+import * as otpauth from 'otpauth';
import { configService } from '../services/ConfigService';
import { Request, Response } from 'express';
import jwt from 'jsonwebtoken';
+import { SettingsService } from '../services/SettingsService';
export class UserController {
+ constructor(private settingsService: SettingsService) {}
async validateUser(req: Request, res: Response): Promise<void> {
res.status(200).json({ success: true });
}
@@ -38,6 +42,68 @@ export class UserController {
return;
}
+ async verifyTotp(req: Request, res: Response): Promise<void> {
+ const { code } = req.body;
+
+ // 1. Fetch settings to get the secret
+ // This assumes you have access to settingsService
+ const appSettings = await this.settingsService.getMainSettings();
+ const totpConfig = appSettings?.settings?.totp;
+
+ if (!totpConfig || !totpConfig.enabled || !totpConfig.secret) {
+ res.status(400).json({ error: '2FA is not enabled for this account.' });
+ return;
+ }
+
+ try {
+ // 2. Decrypt the stored secret
+ const cryptr = new Cryptr(configService.config.SECRET);
+ const decryptedSecret = cryptr.decrypt(totpConfig.secret);
+
+ // 3. Re-create the TOTP instance with the exact same parameters
+ const appName = appSettings?.settings?.title || 'Pluton';
+ const userIdentifier = 'admin';
+ const totp = new otpauth.TOTP({
+ issuer: appName,
+ label: userIdentifier,
+ secret: otpauth.Secret.fromBase32(decryptedSecret),
+ algorithm: 'SHA1',
+ digits: 6,
+ period: 30,
+ });
+
+ // 4. Validate the token
+ const delta = totp.validate({
+ token: code,
+ window: 1, // Allows codes from the previous, current, and next time periods
+ });
+
+ if (delta === null) {
+ // Code is invalid
+ res.status(401).json({ success: false, error: 'Invalid verification code.' });
+ return;
+ }
+
+ // 5. Code is valid! Proceed with login
+ // (The JWT generation and cookie setting logic from your original loginUser method goes here)
+ const sessionDuration = configService.config.SESSION_DURATION || 7;
+ const token = jwt.sign({ user: 'admin' }, configService.config.SECRET, {
+ expiresIn: `${sessionDuration}d`,
+ });
+
+ res.cookie('token', token, {
+ httpOnly: true,
+ sameSite: 'lax',
+ maxAge: sessionDuration * 24 * 60 * 60 * 1000,
+ secure: configService.config.APP_URL?.startsWith('https'),
+ });
+ res.status(200).json({ success: true, error: null });
+ } catch (error) {
+ console.error('Error during 2FA verification:', error);
+ res.status(500).json({ success: false, error: 'An error occurred during verification.' });
+ }
+ }
+
async logoutUser(req: Request, res: Response): Promise<void> {
res.clearCookie('token', {
httpOnly: true,
diff --git a/backend/src/createApp.ts b/backend/src/createApp.ts
index 9cbc422..39893fc 100644
--- a/backend/src/createApp.ts
+++ b/backend/src/createApp.ts
@@ -3,6 +3,7 @@ import { fileURLToPath } from 'url';
import express, { type Express } from 'express';
import { IncomingMessage, ServerResponse } from 'http';
import cors from 'cors';
+import session from 'express-session';
import helmet from 'helmet';
import rateLimit from 'express-rate-limit';
import { db } from './db';
@@ -116,24 +117,36 @@ export async function createApp(): Promise<{ app: Express }> {
const deviceController = new DeviceController(deviceService);
const storageController = new StorageController(storageService);
const settingsController = new SettingsController(settingsService);
- const userController = new UserController();
+ const userController = new UserController(settingsService);
const setupController = new SetupController();
- console.log('process.env.APP_URL :', process.env.APP_URL);
- console.log(' configService.config.APP_URL:', configService.config.APP_URL);
// Express App
const app = express();
app.use(
cors({
origin: [
process.env.APP_URL as string, // Vite core frontend dev server
- configService.config.APP_URL || 'http://mypluton.com', // Production domain
+ configService.config.APP_URL, // Production domain
],
credentials: true,
methods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'],
exposedHeaders: ['X-App-Version', 'X-Server-OS', 'X-Install-Type', 'X-Setup-Pending'],
})
);
+
+ // Session Middleware for 2FA Setup Process
+ app.use(
+ session({
+ secret: configService.config.SECRET,
+ resave: false,
+ saveUninitialized: false,
+ cookie: {
+ secure: configService.config.NODE_ENV === 'production',
+ httpOnly: true,
+ maxAge: 1000 * 60 * 15, // 15 minutes
+ },
+ })
+ );
app.use(versionMiddleware);
app.use(express.json());
diff --git a/backend/src/routes/settings.ts b/backend/src/routes/settings.ts
index f33f3e2..95813db 100644
--- a/backend/src/routes/settings.ts
+++ b/backend/src/routes/settings.ts
@@ -12,6 +12,8 @@ export function createSettingsRouter(
router.get('/:id/logs', authM, controller.getAppLogs.bind(controller));
router.get('/:id/logs/download', authM, controller.downloadAppLogs.bind(controller));
router.post('/integration/validate', authM, controller.validateIntegration.bind(controller));
+ router.post('/:id/2fa/setup', authM, controller.setupTwoFactorAuth.bind(controller));
+ router.post('/:id/2fa/finalize', authM, controller.finalizeTwoFactorSetup.bind(controller));
return router;
}
diff --git a/backend/src/routes/users.ts b/backend/src/routes/users.ts
index 895dbe3..f65504b 100644
--- a/backend/src/routes/users.ts
+++ b/backend/src/routes/users.ts
@@ -11,6 +11,7 @@ export function createUserRouter(
router.post('/login', ...loginMiddlewares, controller.loginUser.bind(controller));
router.get('/validate', authM, controller.validateUser.bind(controller));
router.post('/logout', authM, controller.logoutUser.bind(controller));
+ router.post('/verify-otp', ...loginMiddlewares, controller.verifyTotp.bind(controller));
return router;
}
diff --git a/backend/src/services/SettingsService.ts b/backend/src/services/SettingsService.ts
index ecea4d8..93b8c1e 100644
--- a/backend/src/services/SettingsService.ts
+++ b/backend/src/services/SettingsService.ts
@@ -1,3 +1,5 @@
+import * as otpauth from 'otpauth';
+import qrcode from 'qrcode';
import { createReadStream, constants, ReadStream } from 'fs';
import { readFile, access } from 'fs/promises';
import { Settings, settingsUpdateSchema } from '../db/schema/settings';
@@ -8,6 +10,9 @@ import { INotificationChannelResolver } from '../types/notifications';
import { NotificationChannelResolver } from '../notifications/channels/NotificationChannelResolver';
import { appPaths } from '../utils/AppPaths';
import { AppError, NotFoundError } from '../utils/AppError';
+import Cryptr from 'cryptr';
+import { configService } from './ConfigService';
+import { createHash, randomBytes } from 'crypto';
/**
* A class for managing settings operations.
@@ -168,4 +173,78 @@ export class SettingsService {
throw new AppError(500, `Failed to download logs: ${error.message}`);
}
}
+
+ async setupTwoFactorAuth() {
+ // 1. Get required info from settings
+ const appSettings = await this.getMainSettings();
+ if (!appSettings || !appSettings.settings) {
+ throw new Error('Application settings not found.');
+ }
+ const appName = appSettings.settings.title || 'Pluton';
+ const userIdentifier = 'admin';
+
+ // 2. Create a new TOTP instance
+ const totp = new otpauth.TOTP({
+ issuer: appName,
+ label: userIdentifier,
+ algorithm: 'SHA1',
+ digits: 6,
+ period: 30,
+ });
+
+ const secret = totp.secret.base32;
+
+ const uri = totp.toString();
+ const qrCodeDataUrl = await qrcode.toDataURL(uri);
+
+ // Return the secret so the controller can store it in the session
+ return { qrCodeDataUrl, setupKey: secret, tempSecret: secret };
+ }
+
+ public async finalizeTwoFactorSetup(tempSecret: string, userCode: string, settingsId: number) {
+ // 1. Validate the code against the temporary secret
+ const totp = new otpauth.TOTP({
+ secret: otpauth.Secret.fromBase32(tempSecret), // Load from the temporary secret
+ algorithm: 'SHA1',
+ digits: 6,
+ period: 30,
+ });
+
+ const delta = totp.validate({ token: userCode, window: 1 });
+
+ if (delta === null) {
+ throw new AppError(400, 'Invalid verification code. Please try again.');
+ }
+
+ // 2. Code is valid, proceed to save permanently
+ const appSettings = await this.settingsStore.getById(settingsId);
+ if (!appSettings || !appSettings.settings) {
+ throw new AppError(500, 'Could not retrieve settings to finalize setup.');
+ }
+
+ const cryptr = new Cryptr(configService.config.SECRET);
+ const encryptedSecret = cryptr.encrypt(tempSecret);
+
+ // 3. Generate and hash recovery codes
+ const recoveryCodes = Array.from({ length: 10 }, () =>
+ randomBytes(5).toString('hex').toUpperCase()
+ );
+ const hashedRecoveryCodes = recoveryCodes.map(code =>
+ createHash('sha256').update(code).digest('hex')
+ );
+
+ const updatedSettings: AppSettings = {
+ ...appSettings.settings,
+ totp: {
+ enabled: true,
+ secret: encryptedSecret,
+ recoveryCodes: hashedRecoveryCodes,
+ },
+ };
+
+ await this.settingsStore.update(settingsId, updatedSettings);
+
+ // 4. Return the plain-text recovery codes to be shown to the user ONCE
+ return { recoveryCodes };
+ }
}
diff --git a/backend/src/types/express-session.d.ts b/backend/src/types/express-session.d.ts
new file mode 100644
index 0000000..56328d7
--- /dev/null
+++ b/backend/src/types/express-session.d.ts
@@ -0,0 +1,7 @@
+import 'express-session';
+
+declare module 'express-session' {
+ interface SessionData {
+ totpSecret?: string;
+ }
+}
diff --git a/frontend/src/components/Settings/GeneralSettings/GeneralSettings.tsx b/frontend/src/components/Settings/GeneralSettings/GeneralSettings.tsx
index 7f4dd8d..f987c3e 100644
--- a/frontend/src/components/Settings/GeneralSettings/GeneralSettings.tsx
+++ b/frontend/src/components/Settings/GeneralSettings/GeneralSettings.tsx
@@ -1,6 +1,10 @@
+import { useState } from 'react';
+import { ActionModal } from '../..';
import { useTheme } from '../../../context/ThemeContext';
import Input from '../../common/form/Input/Input';
+import Toggle from '../../common/form/Toggle/Toggle';
import Tristate from '../../common/form/Tristate/Tristate';
+import TwoFactorSetup from '../TwoFactorSetup/TwoFactorSetup';
import classes from './GeneralSettings.module.scss';
interface GeneralSettingsProps {
@@ -9,8 +13,22 @@ interface GeneralSettingsProps {
onUpdate: (settings: Record<string, any>) => void;
}
-const GeneralSettings = ({ settings, onUpdate }: GeneralSettingsProps) => {
+const GeneralSettings = ({ settings, settingsID, onUpdate }: GeneralSettingsProps) => {
const { setTheme } = useTheme();
+ const [show2FASetupConfirm, setShow2FASetupConfirm] = useState(false);
+ const [show2FASetup, setShow2FASetup] = useState(false);
+
+ const { totp } = settings || {};
+ const is2FASetupComplete = totp?.secret;
+
+ const update2FASetting = (enabled: boolean) => {
+ if (enabled === true && !is2FASetupComplete) {
+ setShow2FASetupConfirm(true);
+ return;
+ } else {
+ onUpdate({ ...settings, totp: { ...totp, enabled } });
+ }
+ };
const handleThemeChange = (newThemeValue: 'auto' | 'light' | 'dark') => {
setTheme(newThemeValue);
@@ -58,6 +76,24 @@ const GeneralSettings = ({ settings, onUpdate }: GeneralSettingsProps) => {
inline={false}
/>
</div>
+ <div className={classes.field}>
+ <Toggle label="Enable 2FA" fieldValue={settings?.totp?.enabled || false} onUpdate={(val) => update2FASetting(val)} inline={true} />
+ </div>
+ {show2FASetupConfirm && (
+ <ActionModal
+ title={`Enable Two-Factor Authentication (2FA)`}
+ message={`Are you sure you want to enable Two-Factor Authentication (2FA) to secure Pluton Login? You will be required to use an authenticator app to login if you enable this feature.`}
+ closeModal={() => setShow2FASetupConfirm(false)}
+ width="420px"
+ primaryAction={{
+ title: `Yes, Enable 2FA`,
+ type: 'default',
+ isPending: false,
+ action: () => setShow2FASetup(true),
+ }}
+ />
+ )}
+ {show2FASetup && <TwoFactorSetup id={settingsID} close={() => setShow2FASetup(false)} />}
</div>
);
};
diff --git a/frontend/src/components/Settings/TwoFactorSetup/TwoFactorSetup.module.scss b/frontend/src/components/Settings/TwoFactorSetup/TwoFactorSetup.module.scss
new file mode 100644
index 0000000..f0dd076
--- /dev/null
+++ b/frontend/src/components/Settings/TwoFactorSetup/TwoFactorSetup.module.scss
@@ -0,0 +1,62 @@
+.setupContainer {
+ .errorMsg {
+ background-color: var(--error-bg-color);
+ color: var(--error-text-color);
+ padding: 6px 12px;
+ border-radius: 6px;
+ }
+ .instructions {
+ ol {
+ margin: 0;
+ padding: 12px 20px;
+ padding-top: 0;
+ }
+ }
+ .qrSection {
+ .qrCode {
+ background-color: var(--background-color);
+ padding: 12px;
+ text-align: center;
+ border-radius: 6px 6px 0 0;
+ }
+ .setupKey {
+ padding: 6px;
+ margin-bottom: 12px;
+ background: var(--primary-color-light);
+ text-align: center;
+ border-radius: 0 0 6px 6px;
+ }
+ .verifySection {
+ display: flex;
+ & > div:nth-child(1) {
+ width: calc(100% - 140px);
+ }
+ & > button {
+ margin-left: 12px;
+ }
+ }
+ }
+}
+
+.successMessage {
+ .successMsg {
+ background-color: var(--success-bg-color);
+ color: var(--success-text-color);
+ padding: 6px 12px;
+ border-radius: 6px;
+ font-weight: 600;
+ }
+ strong {
+ font-weight: 600;
+ }
+ code {
+ background-color: var(--line-color);
+ width: 100%;
+ display: block;
+ padding: 12px;
+ box-sizing: border-box;
+ border-radius: 6px;
+ white-space: pre;
+ font-size: 14px;
+ }
+}
diff --git a/frontend/src/components/Settings/TwoFactorSetup/TwoFactorSetup.tsx b/frontend/src/components/Settings/TwoFactorSetup/TwoFactorSetup.tsx
new file mode 100644
index 0000000..eec4a83
--- /dev/null
+++ b/frontend/src/components/Settings/TwoFactorSetup/TwoFactorSetup.tsx
@@ -0,0 +1,99 @@
+import { useEffect, useState } from 'react';
+import { Modal, Icon, Input, Button } from '@plutonhq/core-frontend/components';
+import classes from './TwoFactorSetup.module.scss';
+import { useSetupTwoFactorAuth, useVerifyTwoFactorAuth } from '../../../services';
+
+interface TwoFactorSetupProps {
+ id: number;
+ close: () => void;
+}
+
+const TwoFactorSetup = ({ close, id = 1 }: TwoFactorSetupProps) => {
+ const [verificationCode, setVerificationCode] = useState('');
+ const setupMutation = useSetupTwoFactorAuth();
+ const verifyMutation = useVerifyTwoFactorAuth();
+ const isLoading = setupMutation.isPending || verifyMutation.isPending;
+
+ const qrCodeUrl: string = setupMutation.data?.result?.qrCodeDataUrl || '';
+ const setupKey: string = setupMutation.data?.result?.setupKey || '';
+ const recoveryCodes: string[] = verifyMutation.data?.result?.recoveryCodes || [];
+
+ useEffect(() => {
+ setupMutation.mutate(id);
+ }, []);
+
+ const verify2FA = () => {
+ verifyMutation.mutate({ code: verificationCode, id });
+ };
+
+ return (
+ <>
+ {!verifyMutation.isSuccess && (
+ <Modal title="Two-Factor Authentication (2FA) Setup" closeModal={() => !isLoading && close()} width="500px" disableBackdropClick={true}>
+ <div className={classes.twoFactorSetup}>
+ {setupMutation.isPending && (
+ <p>
+ <Icon type="loading" /> Setting up 2FA...
+ </p>
+ )}
+ {setupMutation.isError && <p className={classes.error}>Error setting up 2FA. Please try again.</p>}
+ {setupMutation.isSuccess && (
+ <div className={classes.setupContainer}>
+ <div className={classes.instructions}>
+ <h4>Setup Instructions</h4>
+ <ol>
+ <li>
+ Download and install an authenticator app on your mobile device (e.g., Google Authenticator, Authy, Microsoft
+ Authenticator).
+ </li>
+ <li>Open the authenticator app and choose to add a new account.</li>
+ <li>Scan the QR code below using the authenticator app or manually enter the setup key provided.</li>
+ <li>Once added, the app will generate a 6-digit verification code that refreshes every 30 seconds.</li>
+ <li>Enter the current 6-digit code from the authenticator app into the field below to complete the setup.</li>
+ </ol>
+ </div>
+ <div className={classes.qrSection}>
+ <div className={classes.qrCode}>{qrCodeUrl && <img src={qrCodeUrl} alt="2FA QR Code" />}</div>
+ <div className={classes.setupKey}>Setup Key: {setupKey}</div>
+ {verifyMutation.isError && <p className={classes.errorMsg}>{verifyMutation.error?.message}</p>}
+ <div className={classes.verifySection}>
+ <Input
+ type="text"
+ placeholder="Enter 6-digit code"
+ fieldValue={verificationCode}
+ onUpdate={(val) => setVerificationCode(val)}
+ full={true}
+ />
+ <Button text="Verify & Enable 2FA" onClick={() => verify2FA()} variant="primary" size="sm" />
+ </div>
+ </div>
+ </div>
+ )}
+ </div>
+ </Modal>
+ )}
+
+ {verifyMutation.isSuccess && (
+ <Modal
+ title="Two-Factor Authentication (2FA) Setup"
+ closeModal={() => !isLoading && location.reload()}
+ width="500px"
+ disableBackdropClick={true}
+ >
+ <div className={classes.successMessage}>
+ <p className={classes.successMsg}>Two-Factor Authentication (2FA) has been successfully enabled.</p>
+ <p>
+ <strong>
+ Save these backup codes in a secure place. They will be required to access your account if you lose your device. They won't be
+ shown again.
+ </strong>
+ </p>
+ <code className={classes.recoveryCodes}>{recoveryCodes.join('\n')}</code>
+ </div>
+ </Modal>
+ )}
+ </>
+ );
+};
+
+export default TwoFactorSetup;
diff --git a/frontend/src/components/index.ts b/frontend/src/components/index.ts
index 8b08858..333d6ad 100644
--- a/frontend/src/components/index.ts
+++ b/frontend/src/components/index.ts
@@ -111,6 +111,7 @@ export { default as AppLogs } from './Settings/AppLogs/AppLogs';
export { default as GeneralSettings } from './Settings/GeneralSettings/GeneralSettings';
export { default as IntegrationSettings } from './Settings/IntegrationSettings/IntegrationSettings';
export { default as SMTPSettings } from './Settings/IntegrationSettings/SMTPSettings';
+export { default as TwoFactorSetup } from './Settings/TwoFactorSetup/TwoFactorSetup';
// Skeleton components
export { default as SkeletonItems } from './Skeleton/SkeletonItems';
diff --git a/frontend/src/services/settings.ts b/frontend/src/services/settings.ts
index b00bf9e..2ff9f2e 100644
--- a/frontend/src/services/settings.ts
+++ b/frontend/src/services/settings.ts
@@ -1,5 +1,6 @@
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
import { API_URL } from '../utils/constants';
+import { useNavigate } from 'react-router';
// ============== Settings API ==============
@@ -211,3 +212,92 @@ export function useCompleteSetup() {
mutationFn: completeSetup,
});
}
+
+// Two-Factor Authentication (2FA) Setup and Verification
+
+export async function setupTwoFactorAuth(id: number) {
+ const headers = new Headers({ 'Content-Type': 'application/json', Accept: 'application/json' });
+ const res = await fetch(`${API_URL}/settings/${id}/2fa/setup`, {
+ method: 'POST',
+ headers,
+ credentials: 'include',
+ });
+ // Check if response is ok
+ if (!res.ok) {
+ const data = await res.json();
+ throw new Error(data.error);
+ }
+ const data = await res.json();
+ return data;
+}
+
+export function useSetupTwoFactorAuth() {
+ return useMutation({
+ mutationFn: setupTwoFactorAuth,
+ onSuccess: (res) => {
+ console.log('# 2FA setup data fetched successfully! :', res);
+ },
+ onError: (res) => {
+ console.log('# 2FA setup data fetch failed! :', res);
+ },
+ });
+}
+export async function verifyTwoFactorAuth({ code, id }: { code: string; id: number }) {
+ const headers = new Headers({ 'Content-Type': 'application/json', Accept: 'application/json' });
+ const res = await fetch(`${API_URL}/settings/${id}/2fa/finalize`, {
+ method: 'POST',
+ headers,
+ credentials: 'include',
+ body: JSON.stringify({ code }),
+ });
+ // Check if response is ok
+ if (!res.ok) {
+ const data = await res.json();
+ throw new Error(data.error);
+ }
+ const data = await res.json();
+ return data;
+}
+
+export function useVerifyTwoFactorAuth() {
+ return useMutation({
+ mutationFn: verifyTwoFactorAuth,
+ onSuccess: (res) => {
+ console.log('# 2FA verification successful! :', res);
+ },
+ onError: (res) => {
+ console.log('# 2FA verification failed! :', res);
+ },
+ });
+}
+
+export async function verifyTwoFactorOTP({ code }: { code: string }) {
+ const headers = new Headers({ 'Content-Type': 'application/json', Accept: 'application/json' });
+ const res = await fetch(`${API_URL}/user/verify-otp`, {
+ method: 'POST',
+ headers,
+ credentials: 'include',
+ body: JSON.stringify({ code }),
+ });
+ // Check if response is ok
+ if (!res.ok) {
+ const data = await res.json();
+ throw new Error(data.error);
+ }
+ const data = await res.json();
+ return data;
+}
+
+export function useVerifyTwoFactorOTP() {
+ const navigate = useNavigate();
+ return useMutation({
+ mutationFn: verifyTwoFactorOTP,
+ onSuccess: (res) => {
+ console.log('# 2FA verification successful! :', res);
+ navigate('/');
+ },
+ onError: (res) => {
+ console.log('# 2FA verification failed! :', res);
+ },
+ });
+}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 2f62f95..652bcec 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -74,6 +74,9 @@ importers:
express-rate-limit:
specifier: ^7.5.1
version: 7.5.1([email protected])
+ express-session:
+ specifier: ^1.19.0
+ version: 1.19.0
helmet:
specifier: ^8.1.0
version: 8.1.0
@@ -89,9 +92,15 @@ importers:
nodemailer:
specifier: 8.0.1
version: 8.0.1
+ otpauth:
+ specifier: ^9.5.0
+ version: 9.5.0
pino:
specifier: ^9.6.0
version: 9.14.0
+ qrcode:
+ specifier: ^1.5.4
+ version: 1.5.4
systeminformation:
specifier: ^5.31.0
version: 5.31.0
@@ -120,6 +129,9 @@ importers:
'@types/express':
specifier: ^5.0.0
version: 5.0.5
+ '@types/express-session':
+ specifier: ^1.18.2
+ version: 1.18.2
'@types/jest':
specifier: ^30.0.0
version: 30.0.0
@@ -135,6 +147,9 @@ importers:
'@types/pg':
specifier: ^8.11.11
version: 8.15.6
+ '@types/qrcode':
+ specifier: ^1.5.6
+ version: 1.5.6
'@types/supertest':
specifier: ^6.0.3
version: 6.0.3
@@ -2043,6 +2058,10 @@ packages:
resolution: {integrity: sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==}
engines: {node: ^14.21.3 || >=16}
+ '@noble/[email protected]':
+ resolution: {integrity: sha512-XlOlEbQcE9fmuXxrVTXCTlG2nlRXa9Rj3rr5Ue/+tX+nmkgbX720YHh0VR3hBF9xDvwnb8D2shVGOwNx+ulArw==}
+ engines: {node: '>= 20.19.0'}
+
'@octokit/[email protected]':
resolution: {integrity: sha512-tY/msAuJo6ARbK6SPIxZrPBms3xPbfwBrulZe0Wtr/DIY9lje2HeV1uoebShn6mx7SjCHif6EjMvoREj+gZ+SA==}
engines: {node: '>= 18'}
@@ -2442,6 +2461,9 @@ packages:
resolution: {integrity: sha512-jnHMsrd0Mwa9Cf4IdOzbz543y4XJepXrbia2T4b6+spXC2We3t1y6K44D3mR8XMFSXMCf3/l7rCgddfx7UNVBA==}
+ '@types/[email protected]':
+ resolution: {integrity: sha512-k+I0BxwVXsnEU2hV77cCobC08kIsn4y44C3gC0b46uxZVMaXA04lSPgRLR/bSL2w0t0ShJiG8o4jPzRG/nscFg==}
+
resolution: {integrity: sha512-LuIQOcb6UmnF7C1PCFmEU1u2hmiHL43fgFQX67sN3H4Z+0Yk0Neo++mFsBjhOAuLzvlQeqAAkeDOZrJs9rzumQ==}
@@ -2508,6 +2530,9 @@ packages:
resolution: {integrity: sha512-F6bEyamV9jKGAFBEmlQnesRPGOQqS2+Uwi0Em15xenOxHaf2hv6L8YCVn3rPdPJOiJfPiCnLIRyvwVaqMY3MIw==}
+ '@types/[email protected]':
+ resolution: {integrity: sha512-te7NQcV2BOvdj2b1hCAHzAoMNuj65kNBMz0KBaxM6c3VGBOhU0dURQKOtH8CFNI/dsKkwlv32p26qYQTWoB5bw==}
+
resolution: {integrity: sha512-eOunJqu0K1923aExK6y8p6fsihYEn/BYuQ4g0CxAAgFc4b/ZLN4CrsRZ55srTdqoiLzU2B2evC+apEIxprEzkQ==}
@@ -3124,6 +3149,9 @@ packages:
resolution: {integrity: sha512-saHYOzhIQs6wy2sVxTM6bUDsQO4F50V9RQ22qBpEdCW+I+/Wmke2HOl6lS6dTpdxVhb88/I6+Hs+438c3lfUow==}
+ resolution: {integrity: sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==}
+
resolution: {integrity: sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==}
@@ -3216,6 +3244,9 @@ packages:
resolution: {integrity: sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==}
+ resolution: {integrity: sha512-NXdYc3dLr47pBkpUCHtKSwIOQXLVn8dZEuywboCOJY/osA0wFSLlSawr3KN8qXJEyX66FcONTH8EIlVuK0yyFA==}
+
resolution: {integrity: sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==}
engines: {node: '>=6.6.0'}
@@ -3305,6 +3336,14 @@ packages:
resolution: {integrity: sha512-2P0p0pFGzHS5EMnhdxQi7aJN+iMheud0UhG4dlE1DLAlvL8JHjJJTX/CSm4JXwV0Ka5nGk3zC5mcb5bUQUxxMA==}
+ resolution: {integrity: sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==}
+ peerDependencies:
+ supports-color: '*'
+ peerDependenciesMeta:
+ supports-color:
+ optional: true
+
resolution: {integrity: sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==}
peerDependencies:
@@ -3399,6 +3438,9 @@ packages:
resolution: {integrity: sha512-qejHi7bcSD4hQAZE0tNAawRK1ZtafHDmMTMkrrIGgSLl7hTnQHmKCeB45xAcbfTqK2zowkM3j3bHt/4b/ARbYQ==}
engines: {node: '>=0.3.1'}
+ resolution: {integrity: sha512-qiSlmBq9+BCdCA/L46dw8Uy93mloxsPSbwnm5yrKn2vMPiy8KyAskTF6zuV/j5BMsmOGZDPs7KjU+mjb670kfA==}
+
resolution: {integrity: sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==}
engines: {node: '>=0.10.0'}
@@ -3795,6 +3837,10 @@ packages:
peerDependencies:
express: '>= 4.11'
+ resolution: {integrity: sha512-0csaMkGq+vaiZTmSMMGkfdCOabYv192VbytFypcvI0MANrp+4i/7yEkJ0sbAEhycQjntaKGzYfjfXQyVb7BHMA==}
+ engines: {node: '>= 0.8.0'}
+
resolution: {integrity: sha512-hIS4idWWai69NezIdRt2xFVofaF4j+6INOpJlVOLDO8zXGpUVEVzIYk12UUi2JzjEzWL3IOAxcTubgz9Po0yXw==}
engines: {node: '>= 18'}
@@ -4778,6 +4824,9 @@ packages:
resolution: {integrity: sha512-xV2bxeN6F7oYjZWTe/YPAy6MN2M+sL4u/Rlm2AHCIVGfo2p1yGmBHQ6vHehl4bRTZBdHu3TSkWdYgkwpYzAGSw==}
engines: {node: '>=0.10.0'}
+ resolution: {integrity: sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==}
+
resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==}
@@ -4907,6 +4956,10 @@ packages:
resolution: {integrity: sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==}
engines: {node: '>= 0.8'}
+ resolution: {integrity: sha512-737ZY3yNnXy37FHkQxPzt4UZ2UWPWiCZWLvFZ4fu5cueciegX0zGPnrlY6bwRg4FdQOe9YU8MkmJwGhoMybl8A==}
+ engines: {node: '>= 0.8'}
+
resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==}
@@ -4918,6 +4971,9 @@ packages:
resolution: {integrity: sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==}
engines: {node: '>= 0.8.0'}
+ resolution: {integrity: sha512-Ldhc6UYl4baR5toGr8nfKC+L/b8/RgHKoIixAebgoNGzUUCET02g04rMEZ2ZsPfeVQhMHcuaOgb28nwMr81zCA==}
+
resolution: {integrity: sha512-qFOyK5PjiWZd+QQIh+1jhdb9LpxTF0qs7Pm8o5QHYZ0M3vKqSqzsZaEB6oWlxZ+q2sJBMI/Ktgd2N5ZwQoRHfg==}
engines: {node: '>= 0.4'}
@@ -5036,6 +5092,10 @@ packages:
resolution: {integrity: sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==}
engines: {node: '>=8'}
+ resolution: {integrity: sha512-40QW5YalBNfQo5yRYmiw7Yz6TKKVr3h6970B2YE+3fQpsWcrbj1PzJgxeJ19DRQjhMbKPIuMY8rFaXc8moolVw==}
+ engines: {node: '>=10.13.0'}
+
resolution: {integrity: sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg==}
engines: {node: '>= 0.4'}
@@ -5150,6 +5210,11 @@ packages:
resolution: {integrity: sha512-oTUZM/NAZS8p7ANR3SHh30kXB+zK2r2BPcEn/awJIbOvq82WoMN4p62AWWp3Hhw50G0xMsw1mhIBLqHw64EcNQ==}
+ resolution: {integrity: sha512-1ca71Zgiu6ORjHqFBDpnSMTR2ReToX4l1Au1VFLyVeBTFavzQnv5JxMFr3ukHVKpSrSA2MCk0lNJSykjUfz7Zg==}
+ engines: {node: '>=10.13.0'}
+ hasBin: true
+
resolution: {integrity: sha512-mAZTtNCeetKMH+pSjrb76NAM8V9a05I9aBZOHztWy/UqcJdQYNsf59vrRKWnojAT9Y+GbIvoTBC++CPHqpDBhQ==}
engines: {node: '>=0.6'}
@@ -5161,6 +5226,10 @@ packages:
resolution: {integrity: sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g==}
engines: {node: '>=8'}
+ resolution: {integrity: sha512-iv7LhNVO047HzYR3InF6pUcUsPQiHTM1Qal51DcGSuZFBil1aBBWG5eHPNek7bvILMaYJ/8RU1e8w1AMdHmLQQ==}
+ engines: {node: '>= 0.8'}
+
resolution: {integrity: sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==}
@@ -5287,6 +5356,9 @@ packages:
resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==}
engines: {node: '>=0.10.0'}
+ resolution: {integrity: sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==}
+
resolution: {integrity: sha512-0S5SrIUJ9LfpbVl4Yzij6VipUdafHrOTzvmfazSw/jeZrZtQK303OPZW+obtkaw7jQlTQppy0UvZWm9872PbRw==}
@@ -5514,6 +5586,9 @@ packages:
resolution: {integrity: sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw==}
engines: {node: '>= 18'}
+ resolution: {integrity: sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==}
+
resolution: {integrity: sha512-oeM1lpU/UvhTxw+g3cIfxXHyJRc/uidd3yK1P242gzHds0udQBYzs3y8j4gCCW+ZJ7ad0yctld8RYO+bdurlvw==}
@@ -5819,6 +5894,7 @@ packages:
resolution: {integrity: sha512-OfAa3Oip5YC9Ad1jEs92Hw08Wy4JfdpdeequIwaJGsQG0tJtb8gpQfCdLuBefsk6n8WiUdt/5qmzcW+BDXtzbQ==}
engines: {node: '>=14.17.0'}
+ deprecated: 'pnpm users: upgrade to 14.0.2 or newer'
hasBin: true
@@ -6090,6 +6166,10 @@ packages:
engines: {node: '>=0.8.0'}
hasBin: true
+ resolution: {integrity: sha512-KPHm4VL5dDXKz01UuEd88Df+KzynaohSL9fBh096KWAxSKZQDI2uBrVqtvRM4rwrIrRRKsdLNML/lnaaVSRioA==}
+ engines: {node: '>= 0.8'}
+
resolution: {integrity: sha512-nWJ91DjeOkej/TA8pXQ3myruKpKEYgqvpw9lz4OPHj/NWFNluYrjbz9j01CJ8yKQd2g4jFoOkINCTW2I5LEEyw==}
engines: {node: '>= 0.4'}
@@ -6267,6 +6347,9 @@ packages:
resolution: {integrity: sha512-K4jVyjnBdgvc86Y6BkaLZEN933SwYOuBFkdmBu9ZfkcAbdVbpITnDmjvZ/aQjRXQrv5EPkTnD1s39GiiqbngCw==}
engines: {node: '>= 0.4'}
+ resolution: {integrity: sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ==}
+
resolution: {integrity: sha512-LYfpUkmqwl0h9A2HL09Mms427Q1RZWuOHsukfVcKRq9q95iQxdw0ix1JQrqbcDR9PH1QDwf5Qo8OZb5lksZ8Xg==}
engines: {node: '>= 0.4'}
@@ -6332,6 +6415,10 @@ packages:
resolution: {integrity: sha512-qW8PDy16OV1UBaUNGlTVcepzrlzyzNW/ZJvFQQs2j2TzGsg6IKjcpZC1RSquqQnTOafl5pCj5bGfAHlCjOOjdA==}
+ resolution: {integrity: sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==}
+ engines: {node: '>=8'}
+
resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==}
engines: {node: '>=10'}
@@ -6355,6 +6442,9 @@ packages:
resolution: {integrity: sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==}
engines: {node: '>=0.4'}
+ resolution: {integrity: sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==}
+
resolution: {integrity: sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==}
engines: {node: '>=10'}
@@ -6378,6 +6468,10 @@ packages:
engines: {node: '>= 14.6'}
hasBin: true
+ resolution: {integrity: sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==}
+ engines: {node: '>=6'}
+
resolution: {integrity: sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==}
engines: {node: '>=10'}
@@ -6386,6 +6480,10 @@ packages:
resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==}
engines: {node: '>=12'}
+ resolution: {integrity: sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==}
+ engines: {node: '>=8'}
+
resolution: {integrity: sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==}
engines: {node: '>=10'}
@@ -8049,6 +8147,8 @@ snapshots:
'@noble/[email protected]': {}
+ '@noble/[email protected]': {}
+
'@octokit/[email protected]': {}
'@octokit/[email protected]':
@@ -8412,6 +8512,10 @@ snapshots:
'@types/range-parser': 1.2.7
'@types/send': 1.2.1
+ '@types/[email protected]':
+ dependencies:
+ '@types/express': 5.0.5
+
dependencies:
'@types/body-parser': 1.19.6
@@ -8482,6 +8586,10 @@ snapshots:
'@types/[email protected]': {}
+ '@types/[email protected]':
+ dependencies:
+ '@types/node': 22.18.13
+
'@types/[email protected]': {}
'@types/[email protected]': {}
@@ -9187,6 +9295,12 @@ snapshots:
+ dependencies:
+ string-width: 4.2.3
+ strip-ansi: 6.0.1
+ wrap-ansi: 6.2.0
+
dependencies:
string-width: 4.2.3
@@ -9288,6 +9402,8 @@ snapshots:
+
@@ -9375,6 +9491,10 @@ snapshots:
+ dependencies:
+ ms: 2.0.0
+
dependencies:
ms: 2.1.3
@@ -9438,6 +9558,8 @@ snapshots:
+
dependencies:
esutils: 2.0.3
@@ -9955,6 +10077,19 @@ snapshots:
dependencies:
express: 5.2.1
+ dependencies:
+ cookie: 0.7.2
+ cookie-signature: 1.0.7
+ debug: 2.6.9
+ depd: 2.0.0
+ on-headers: 1.1.0
+ parseurl: 1.3.3
+ safe-buffer: 5.2.1
+ uid-safe: 2.1.5
+ transitivePeerDependencies:
+ - supports-color
+
dependencies:
accepts: 2.0.0
@@ -11116,6 +11251,8 @@ snapshots:
+
@@ -11242,6 +11379,8 @@ snapshots:
dependencies:
ee-first: 1.1.1
+
dependencies:
wrappy: 1.0.2
@@ -11259,6 +11398,10 @@ snapshots:
type-check: 0.4.0
word-wrap: 1.2.5
+ dependencies:
+ '@noble/hashes': 2.0.1
+
dependencies:
get-intrinsic: 1.3.0
@@ -11380,6 +11523,8 @@ snapshots:
dependencies:
find-up: 4.1.0
+
@@ -11480,6 +11625,12 @@ snapshots:
+ dependencies:
+ dijkstrajs: 1.0.3
+ pngjs: 5.0.0
+ yargs: 15.4.1
+
dependencies:
side-channel: 1.1.0
@@ -11488,6 +11639,8 @@ snapshots:
+
dependencies:
safe-buffer: 5.2.1
@@ -11669,6 +11822,8 @@ snapshots:
+
@@ -11911,6 +12066,8 @@ snapshots:
transitivePeerDependencies:
- supports-color
+
@@ -12574,6 +12731,10 @@ snapshots:
optional: true
+ dependencies:
+ random-bytes: 1.0.0
+
dependencies:
call-bound: 1.0.4
@@ -12777,6 +12938,8 @@ snapshots:
is-weakmap: 2.0.2
is-weakset: 2.0.4
+
dependencies:
available-typed-arrays: 1.0.7
@@ -12908,6 +13071,12 @@ snapshots:
'@types/trusted-types': 2.0.7
workbox-core: 7.3.0
+ dependencies:
+ ansi-styles: 4.3.0
+ string-width: 4.2.3
+ strip-ansi: 6.0.1
+
dependencies:
ansi-styles: 4.3.0
@@ -12931,6 +13100,8 @@ snapshots:
+
@@ -12943,10 +13114,29 @@ snapshots:
+ dependencies:
+ camelcase: 5.3.1
+ decamelize: 1.2.0
+
+ dependencies:
+ cliui: 6.0.0
+ decamelize: 1.2.0
+ find-up: 4.1.0
+ get-caller-file: 2.0.5
+ require-directory: 2.1.1
+ require-main-filename: 2.0.0
+ set-blocking: 2.0.0
+ string-width: 4.2.3
+ which-module: 2.0.1
+ y18n: 4.0.3
+ yargs-parser: 18.1.3
+
dependencies:
cliui: 7.0.4