chore: should validate password before deleting vault (#2400)

This commit is contained in:
Aman Harwara
2023-08-09 22:17:47 +05:30
committed by GitHub
parent 43e4e0e5f2
commit 875e8c3ee4
7 changed files with 98 additions and 0 deletions

View File

@@ -164,6 +164,7 @@ import { Logger, isNotUndefined, isDeinitable } from '@standardnotes/utils'
import { EncryptionOperators } from '@standardnotes/encryption'
import { AsymmetricMessagePayload, AsymmetricMessageSharedVaultInvite } from '@standardnotes/models'
import { PureCryptoInterface } from '@standardnotes/sncrypto-common'
import { AuthorizeVaultDeletion } from '@standardnotes/services/src/Domain/Vault/UseCase/AuthorizeVaultDeletion'
export class Dependencies {
private factory = new Map<symbol, () => unknown>()
@@ -225,6 +226,15 @@ export class Dependencies {
)
})
this.factory.set(TYPES.AuthorizeVaultDeletion, () => {
return new AuthorizeVaultDeletion(
this.get<VaultLockService>(TYPES.VaultLockService),
this.get<ProtectionService>(TYPES.ProtectionService),
this.get<ChallengeService>(TYPES.ChallengeService),
this.get<ValidateVaultPassword>(TYPES.ValidateVaultPassword),
)
})
this.factory.set(TYPES.GenerateUuid, () => {
return new GenerateUuid(this.get<PureCryptoInterface>(TYPES.Crypto))
})
@@ -879,6 +889,7 @@ export class Dependencies {
this.get<SendVaultDataChangedMessage>(TYPES.SendVaultDataChangedMessage),
this.get<IsVaultOwner>(TYPES.IsVaultOwner),
this.get<ValidateVaultPassword>(TYPES.ValidateVaultPassword),
this.get<AuthorizeVaultDeletion>(TYPES.AuthorizeVaultDeletion),
this.get<InternalEventBus>(TYPES.InternalEventBus),
)
})

View File

@@ -163,6 +163,7 @@ export const TYPES = {
GenerateUuid: Symbol.for('GenerateUuid'),
GetVaultItems: Symbol.for('GetVaultItems'),
ValidateVaultPassword: Symbol.for('ValidateVaultPassword'),
AuthorizeVaultDeletion: Symbol.for('AuthorizeVaultDeletion'),
// Mappers
SessionStorageMapper: Symbol.for('SessionStorageMapper'),