diff --git a/src/routes/api/totp.ts b/src/routes/api/totp.ts index bfe1ce746..6435b796b 100644 --- a/src/routes/api/totp.ts +++ b/src/routes/api/totp.ts @@ -1,4 +1,3 @@ -import options from '../../services/options.js'; import {generateSecret} from 'time2fa'; function generateTOTPSecret() { @@ -17,26 +16,10 @@ function getTotpEnabled() { } function getTOTPStatus() { - // const totpEnabled = options.getOptionBool('totpEnabled'); const totpEnabled = getTotpEnabled(); return {success: true, message: totpEnabled, enabled: getTotpEnabled()}; } -function enableTOTP() { - if (!getTotpEnabled()) { - return {success: 'false'}; - } - - options.setOption('totpEnabled', true); - options.setOption('oAuthEnabled', false); - return {success: 'true'}; -} - -function disableTOTP() { - options.setOption('totpEnabled', false); - return {success: true}; -} - function getSecret() { return process.env.TOTP_SECRET; } @@ -44,7 +27,5 @@ function getSecret() { export default { generateSecret: generateTOTPSecret, getTOTPStatus, - enableTOTP, - disableTOTP, getSecret }; \ No newline at end of file diff --git a/src/routes/routes.ts b/src/routes/routes.ts index d6f2024ea..e6d86a2a8 100644 --- a/src/routes/routes.ts +++ b/src/routes/routes.ts @@ -124,8 +124,6 @@ function register(app: express.Application) { apiRoute(GET, '/api/totp/generate', totp.generateSecret); apiRoute(GET, '/api/totp/status', totp.getTOTPStatus); - apiRoute(PST, '/api/totp/enable', totp.enableTOTP); - apiRoute(PST, '/api/totp/disable', totp.disableTOTP); apiRoute(GET, '/api/totp/get', totp.getSecret); apiRoute(GET, '/api/oauth/status', openID.getOAuthStatus); diff --git a/src/services/auth.ts b/src/services/auth.ts index 5d9de249c..5bca6ef55 100644 --- a/src/services/auth.ts +++ b/src/services/auth.ts @@ -10,7 +10,6 @@ import passwordService from "./encryption/password.js"; import type { NextFunction, Request, Response } from 'express'; import { AppRequest } from '../routes/route-interface.js'; import openID from './open_id.js'; -import sql from './sql.js'; import open_id_encryption from './encryption/open_id_encryption.js'; const noAuthentication = config.General && config.General.noAuthentication === true; diff --git a/src/services/encryption/my_scrypt.ts b/src/services/encryption/my_scrypt.ts index 7c26ce05b..589da6eed 100644 --- a/src/services/encryption/my_scrypt.ts +++ b/src/services/encryption/my_scrypt.ts @@ -2,7 +2,6 @@ import optionService from "../options.js"; import crypto from "crypto"; -import utils from "../utils.js"; import sql from "../sql.js"; function getVerificationHash(password: crypto.BinaryLike) { @@ -56,11 +55,6 @@ function createSubjectIdentifierDerivedKey( subjectIdentifer: string | crypto.BinaryLike, salt: string | crypto.BinaryLike ) { - // const salt = optionService.getOption("subjectIdentifierDerivedKeySalt"); - - // const salt = sql.getValue("SELECT salt FROM user_data"); - // if (salt === undefined || salt === null) return undefined; - return getScryptHash(subjectIdentifer, salt); } diff --git a/src/services/environment_variable_loader.ts b/src/services/environment_variable_loader.ts deleted file mode 100644 index 0655339d1..000000000 --- a/src/services/environment_variable_loader.ts +++ /dev/null @@ -1,19 +0,0 @@ -import options from '../services/options.js'; - -function loadEnvironmentVariables(){ - if (process.env.TOTP_ENABLED === undefined) { - options.setOption("totpEnabled", false); - return false; - } - - if (process.env.TOTP_ENABLED.toLocaleLowerCase() !== 'true') { - options.setOption("totpEnabled", false); - return false; - } - - options.setOption("totpEnabled", true); -} - -export default { - loadEnvironmentVariables -} \ No newline at end of file diff --git a/src/services/open_id.ts b/src/services/open_id.ts index c431b6c2d..fb17744c9 100644 --- a/src/services/open_id.ts +++ b/src/services/open_id.ts @@ -115,7 +115,6 @@ function generateOAuthConfig() { }; const logoutParams = { - // end_session_endpoint: "/end-session/", }; const authConfig = {