tests: vault locking (#2394)

This commit is contained in:
Mo
2023-08-07 15:27:06 -05:00
committed by GitHub
parent a9edf671b1
commit 3b531ce8bb
23 changed files with 268 additions and 82 deletions

View File

@@ -131,6 +131,8 @@ import {
GetHost,
SetHost,
GenerateUuid,
GetVaultItems,
ValidateVaultPassword,
} from '@standardnotes/services'
import { ItemManager } from '../../Services/Items/ItemManager'
import { PayloadManager } from '../../Services/Payloads/PayloadManager'
@@ -215,10 +217,21 @@ export class Dependencies {
}
private registerUseCaseMakers() {
this.factory.set(TYPES.ValidateVaultPassword, () => {
return new ValidateVaultPassword(
this.get<EncryptionService>(TYPES.EncryptionService),
this.get<KeySystemKeyManager>(TYPES.KeySystemKeyManager),
)
})
this.factory.set(TYPES.GenerateUuid, () => {
return new GenerateUuid(this.get<PureCryptoInterface>(TYPES.Crypto))
})
this.factory.set(TYPES.GetVaultItems, () => {
return new GetVaultItems(this.get<ItemManager>(TYPES.ItemManager))
})
this.factory.set(TYPES.DecryptErroredPayloads, () => {
return new DecryptErroredPayloads(
this.get<ItemsEncryptionService>(TYPES.ItemsEncryptionService),
@@ -389,9 +402,9 @@ export class Dependencies {
this.factory.set(TYPES.DeleteVault, () => {
return new DeleteVault(
this.get<ItemManager>(TYPES.ItemManager),
this.get<MutatorService>(TYPES.MutatorService),
this.get<KeySystemKeyManager>(TYPES.KeySystemKeyManager),
this.get<GetVaultItems>(TYPES.GetVaultItems),
)
})
@@ -432,11 +445,11 @@ export class Dependencies {
this.factory.set(TYPES.CreateSharedVault, () => {
return new CreateSharedVault(
this.get<ItemManager>(TYPES.ItemManager),
this.get<MutatorService>(TYPES.MutatorService),
this.get<SharedVaultServer>(TYPES.SharedVaultServer),
this.get<CreateVault>(TYPES.CreateVault),
this.get<MoveItemsToVault>(TYPES.MoveItemsToVault),
this.get<GetVaultItems>(TYPES.GetVaultItems),
)
})
@@ -566,10 +579,10 @@ export class Dependencies {
this.factory.set(TYPES.ConvertToSharedVault, () => {
return new ConvertToSharedVault(
this.get<ItemManager>(TYPES.ItemManager),
this.get<MutatorService>(TYPES.MutatorService),
this.get<SharedVaultServer>(TYPES.SharedVaultServer),
this.get<MoveItemsToVault>(TYPES.MoveItemsToVault),
this.get<GetVaultItems>(TYPES.GetVaultItems),
)
})
@@ -837,6 +850,8 @@ export class Dependencies {
this.get<KeySystemKeyManager>(TYPES.KeySystemKeyManager),
this.get<GetVaults>(TYPES.GetVaults),
this.get<DecryptErroredPayloads>(TYPES.DecryptErroredPayloads),
this.get<RemoveItemsFromMemory>(TYPES.RemoveItemsFromMemory),
this.get<GetVaultItems>(TYPES.GetVaultItems),
this.get<InternalEventBus>(TYPES.InternalEventBus),
)
})
@@ -857,6 +872,8 @@ export class Dependencies {
this.get<DeleteVault>(TYPES.DeleteVault),
this.get<RotateVaultKey>(TYPES.RotateVaultKey),
this.get<SendVaultDataChangedMessage>(TYPES.SendVaultDataChangedMessage),
this.get<IsVaultOwner>(TYPES.IsVaultOwner),
this.get<ValidateVaultPassword>(TYPES.ValidateVaultPassword),
this.get<InternalEventBus>(TYPES.InternalEventBus),
)
})

View File

@@ -160,6 +160,8 @@ export const TYPES = {
GetHost: Symbol.for('GetHost'),
SetHost: Symbol.for('SetHost'),
GenerateUuid: Symbol.for('GenerateUuid'),
GetVaultItems: Symbol.for('GetVaultItems'),
ValidateVaultPassword: Symbol.for('ValidateVaultPassword'),
// Mappers
SessionStorageMapper: Symbol.for('SessionStorageMapper'),