@ -1,6 +1,5 @@
@@ -1,6 +1,5 @@
import { Injector , LOCALE_ID , NgModule } from "@angular/core" ;
import { AbstractEncryptService } from "@bitwarden/common/abstractions/abstractEncrypt.service" ;
import { AccountApiService as AccountApiServiceAbstraction } from "@bitwarden/common/abstractions/account/account-api.service" ;
import {
InternalAccountService ,
@ -18,6 +17,7 @@ import { ConfigApiServiceAbstraction } from "@bitwarden/common/abstractions/conf
@@ -18,6 +17,7 @@ import { ConfigApiServiceAbstraction } from "@bitwarden/common/abstractions/conf
import { ConfigServiceAbstraction } from "@bitwarden/common/abstractions/config/config.service.abstraction" ;
import { CryptoService as CryptoServiceAbstraction } from "@bitwarden/common/abstractions/crypto.service" ;
import { CryptoFunctionService as CryptoFunctionServiceAbstraction } from "@bitwarden/common/abstractions/cryptoFunction.service" ;
import { EncryptService } from "@bitwarden/common/abstractions/encrypt.service" ;
import { EnvironmentService as EnvironmentServiceAbstraction } from "@bitwarden/common/abstractions/environment.service" ;
import { EventService as EventServiceAbstraction } from "@bitwarden/common/abstractions/event.service" ;
import { ExportService as ExportServiceAbstraction } from "@bitwarden/common/abstractions/export.service" ;
@ -62,6 +62,7 @@ import { ValidationService as ValidationServiceAbstraction } from "@bitwarden/co
@@ -62,6 +62,7 @@ import { ValidationService as ValidationServiceAbstraction } from "@bitwarden/co
import { VaultTimeoutService as VaultTimeoutServiceAbstraction } from "@bitwarden/common/abstractions/vaultTimeout/vaultTimeout.service" ;
import { VaultTimeoutSettingsService as VaultTimeoutSettingsServiceAbstraction } from "@bitwarden/common/abstractions/vaultTimeout/vaultTimeoutSettings.service" ;
import { StateFactory } from "@bitwarden/common/factories/stateFactory" ;
import { flagEnabled } from "@bitwarden/common/misc/flags" ;
import { Account } from "@bitwarden/common/models/domain/account" ;
import { GlobalState } from "@bitwarden/common/models/domain/global-state" ;
import { AccountApiServiceImplementation } from "@bitwarden/common/services/account/account-api.service" ;
@ -77,7 +78,8 @@ import { ConfigApiService } from "@bitwarden/common/services/config/config-api.s
@@ -77,7 +78,8 @@ import { ConfigApiService } from "@bitwarden/common/services/config/config-api.s
import { ConfigService } from "@bitwarden/common/services/config/config.service" ;
import { ConsoleLogService } from "@bitwarden/common/services/consoleLog.service" ;
import { CryptoService } from "@bitwarden/common/services/crypto.service" ;
import { EncryptService } from "@bitwarden/common/services/encrypt.service" ;
import { EncryptServiceImplementation } from "@bitwarden/common/services/cryptography/encrypt.service.implementation" ;
import { MultithreadEncryptServiceImplementation } from "@bitwarden/common/services/cryptography/multithread-encrypt.service.implementation" ;
import { EnvironmentService } from "@bitwarden/common/services/environment.service" ;
import { EventService } from "@bitwarden/common/services/event.service" ;
import { ExportService } from "@bitwarden/common/services/export.service" ;
@ -216,7 +218,8 @@ import { AbstractThemingService } from "./theming/theming.service.abstraction";
@@ -216,7 +218,8 @@ import { AbstractThemingService } from "./theming/theming.service.abstraction";
i18nService : I18nServiceAbstraction ,
injector : Injector ,
logService : LogService ,
stateService : StateServiceAbstraction
stateService : StateServiceAbstraction ,
encryptService : EncryptService
) = >
new CipherService (
cryptoService ,
@ -226,7 +229,8 @@ import { AbstractThemingService } from "./theming/theming.service.abstraction";
@@ -226,7 +229,8 @@ import { AbstractThemingService } from "./theming/theming.service.abstraction";
i18nService ,
( ) = > injector . get ( SearchServiceAbstraction ) ,
logService ,
stateService
stateService ,
encryptService
) ,
deps : [
CryptoServiceAbstraction ,
@ -237,6 +241,7 @@ import { AbstractThemingService } from "./theming/theming.service.abstraction";
@@ -237,6 +241,7 @@ import { AbstractThemingService } from "./theming/theming.service.abstraction";
Injector , // TODO: Get rid of this circular dependency!
LogService ,
StateServiceAbstraction ,
EncryptService ,
] ,
} ,
{
@ -299,7 +304,7 @@ import { AbstractThemingService } from "./theming/theming.service.abstraction";
@@ -299,7 +304,7 @@ import { AbstractThemingService } from "./theming/theming.service.abstraction";
useClass : CryptoService ,
deps : [
CryptoFunctionServiceAbstraction ,
Abstract EncryptService,
EncryptService ,
PlatformUtilsServiceAbstraction ,
LogService ,
StateServiceAbstraction ,
@ -442,8 +447,8 @@ import { AbstractThemingService } from "./theming/theming.service.abstraction";
@@ -442,8 +447,8 @@ import { AbstractThemingService } from "./theming/theming.service.abstraction";
deps : [ WINDOW ] ,
} ,
{
provide : Abstract EncryptService,
useClass : EncryptService ,
provide : EncryptService ,
useFactory : encryptServiceFactory ,
deps : [ CryptoFunctionServiceAbstraction , LogService , LOG_MAC_FAILURES ] ,
} ,
{
@ -576,3 +581,13 @@ import { AbstractThemingService } from "./theming/theming.service.abstraction";
@@ -576,3 +581,13 @@ import { AbstractThemingService } from "./theming/theming.service.abstraction";
] ,
} )
export class JslibServicesModule { }
function encryptServiceFactory (
cryptoFunctionservice : CryptoFunctionServiceAbstraction ,
logService : LogService ,
logMacFailures : boolean
) : EncryptService {
return flagEnabled ( "multithreadDecryption" )
? new MultithreadEncryptServiceImplementation ( cryptoFunctionservice , logService , logMacFailures )
: new EncryptServiceImplementation ( cryptoFunctionservice , logService , logMacFailures ) ;
}