1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 00:03:56 +00:00

[PM-2367] [BEEEP]: Extract password strength from password-generation-service (#5502)

* Extract passwordStrength from passwordGenerationService

Extract passwordStrength from password-generation.service.ts
Create new password-strength.service.ts
Create new password-strength.service.abstraction.ts
Register new password-strength service
Fix usages in libs

* Fix usage in web

* Fix usage in desktop

* Fix usage in CLI

* Fix usage in browser

Move password-generation-factory to tools

* Fix tests

* Change dependency in jslib-services.module
This commit is contained in:
Daniel James Smith
2023-06-13 23:22:25 +02:00
committed by GitHub
parent 22caae116c
commit 72a5ba455c
28 changed files with 224 additions and 111 deletions

View File

@@ -35,6 +35,7 @@ import { Utils } from "@bitwarden/common/platform/misc/utils";
import { EncString } from "@bitwarden/common/platform/models/domain/enc-string";
import { SymmetricCryptoKey } from "@bitwarden/common/platform/models/domain/symmetric-crypto-key";
import { PasswordGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/password";
import { PasswordStrengthServiceAbstraction } from "@bitwarden/common/tools/password-strength";
import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction";
import { Response } from "../../models/response";
@@ -54,6 +55,7 @@ export class LoginCommand {
protected cryptoFunctionService: CryptoFunctionService,
protected environmentService: EnvironmentService,
protected passwordGenerationService: PasswordGenerationServiceAbstraction,
protected passwordStrengthService: PasswordStrengthServiceAbstraction,
protected platformUtilsService: PlatformUtilsService,
protected stateService: StateService,
protected cryptoService: CryptoService,
@@ -505,7 +507,7 @@ export class LoginCommand {
}
// Strength & Policy Validation
const strengthResult = this.passwordGenerationService.passwordStrength(
const strengthResult = this.passwordStrengthService.getPasswordStrength(
masterPassword,
this.email
);

View File

@@ -45,6 +45,10 @@ import {
PasswordGenerationService,
PasswordGenerationServiceAbstraction,
} from "@bitwarden/common/tools/generator/password";
import {
PasswordStrengthService,
PasswordStrengthServiceAbstraction,
} from "@bitwarden/common/tools/password-strength";
import { SendApiService } from "@bitwarden/common/tools/send/services/send-api.service";
import { SendService } from "@bitwarden/common/tools/send/services/send.service";
import { InternalFolderService } from "@bitwarden/common/vault/abstractions/folder/folder.service.abstraction";
@@ -103,6 +107,7 @@ export class Main {
vaultTimeoutSettingsService: VaultTimeoutSettingsService;
syncService: SyncService;
passwordGenerationService: PasswordGenerationServiceAbstraction;
passwordStrengthService: PasswordStrengthServiceAbstraction;
totpService: TotpService;
containerService: ContainerService;
auditService: AuditService;
@@ -302,6 +307,8 @@ export class Main {
this.twoFactorService = new TwoFactorService(this.i18nService, this.platformUtilsService);
this.passwordStrengthService = new PasswordStrengthService();
this.passwordGenerationService = new PasswordGenerationService(
this.cryptoService,
this.policyService,
@@ -322,7 +329,7 @@ export class Main {
this.twoFactorService,
this.i18nService,
this.encryptService,
this.passwordGenerationService,
this.passwordStrengthService,
this.policyService
);

View File

@@ -145,6 +145,7 @@ export class Program {
this.main.cryptoFunctionService,
this.main.environmentService,
this.main.passwordGenerationService,
this.main.passwordStrengthService,
this.main.platformUtilsService,
this.main.stateService,
this.main.cryptoService,