refactor: remove application mfa helper functions (#2852)

This commit is contained in:
Mo
2024-02-19 10:43:05 -06:00
committed by GitHub
parent 74da19add8
commit a455304a7a
5 changed files with 31 additions and 40 deletions

View File

@@ -1,7 +1,13 @@
import { SettingsService } from '../Settings'
import { PureCryptoInterface } from '@standardnotes/sncrypto-common'
import { FeaturesService } from '../Features/FeaturesService'
import { AbstractService, InternalEventBusInterface, MfaServiceInterface, SignInStrings } from '@standardnotes/services'
import {
AbstractService,
InternalEventBusInterface,
MfaServiceInterface,
ProtectionsClientInterface,
SignInStrings,
} from '@standardnotes/services'
import { SettingName } from '@standardnotes/domain-core'
export class MfaService extends AbstractService implements MfaServiceInterface {
@@ -9,6 +15,7 @@ export class MfaService extends AbstractService implements MfaServiceInterface {
private settingsService: SettingsService,
private crypto: PureCryptoInterface,
private featuresService: FeaturesService,
private protections: ProtectionsClientInterface,
protected override internalEventBus: InternalEventBusInterface,
) {
super(internalEventBus)
@@ -48,6 +55,10 @@ export class MfaService extends AbstractService implements MfaServiceInterface {
}
async disableMfa(): Promise<void> {
if (!(await this.protections.authorizeMfaDisable())) {
return
}
return await this.settingsService.deleteSetting(SettingName.create(SettingName.NAMES.MfaSecret).getValue())
}