1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-26 09:33:22 +00:00
Files
browser/libs/common/src/platform/services/container.service.ts
Oscar Hinton db84ccf935 [PM-16838] Forbid imports containing /src/ (#12744)
Forbids bad imports containing /src/.
2025-01-10 10:37:34 -05:00

38 lines
1.1 KiB
TypeScript

// FIXME: remove `src` and fix import
// eslint-disable-next-line no-restricted-imports
import { KeyService } from "../../../../key-management/src/abstractions/key.service";
import { EncryptService } from "../abstractions/encrypt.service";
export class ContainerService {
constructor(
private keyService: KeyService,
private encryptService: EncryptService,
) {}
attachToGlobal(global: any) {
if (!global.bitwardenContainerService) {
global.bitwardenContainerService = this;
}
}
/**
* @throws Will throw if KeyService was not instantiated and provided to the ContainerService constructor
*/
getKeyService(): KeyService {
if (this.keyService == null) {
throw new Error("ContainerService.keyService not initialized.");
}
return this.keyService;
}
/**
* @throws Will throw if EncryptService was not instantiated and provided to the ContainerService constructor
*/
getEncryptService(): EncryptService {
if (this.encryptService == null) {
throw new Error("ContainerService.encryptService not initialized.");
}
return this.encryptService;
}
}