tests: vault locking (#2394)
This commit is contained in:
@@ -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),
|
||||
)
|
||||
})
|
||||
|
||||
@@ -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'),
|
||||
|
||||
@@ -852,10 +852,6 @@ export class ItemManager extends Services.AbstractService implements Services.It
|
||||
: ItemRelationshipDirection.NoRelationship
|
||||
}
|
||||
|
||||
itemsBelongingToKeySystem(systemIdentifier: Models.KeySystemIdentifier): Models.DecryptedItemInterface[] {
|
||||
return this.items.filter((item) => item.key_system_identifier === systemIdentifier)
|
||||
}
|
||||
|
||||
public conflictsOf(uuid: string) {
|
||||
return this.collection.conflictsOf(uuid)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user