1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-18 17:23:37 +00:00

add handleMigrateEncryptionKey to default and web service

This commit is contained in:
rr-bw
2024-09-02 08:50:38 -07:00
parent 983cee8af6
commit 19acf12900
6 changed files with 83 additions and 6 deletions

View File

@@ -1,8 +1,17 @@
import { UrlTree } from "@angular/router";
import { AuthResult } from "@bitwarden/common/auth/models/domain/auth-result";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { ToastService } from "@bitwarden/components";
import { LoginService, PasswordPolicies } from "./login.service";
export class DefaultLoginService implements LoginService {
constructor(
protected i18nService: I18nService,
protected toastService: ToastService,
) {}
getShowPasswordlessFlag(): boolean {
return null;
}
@@ -14,4 +23,18 @@ export class DefaultLoginService implements LoginService {
async getOrgPolicies(): Promise<PasswordPolicies | null> {
return null;
}
// Legacy accounts used the master key to encrypt data. Migration is required but only performed on web
async handleMigrateEncryptionKey(result: AuthResult): Promise<boolean> {
if (!result.requiresEncryptionKeyMigration) {
return false;
}
this.toastService.showToast({
variant: "error",
title: this.i18nService.t("errorOccured"),
message: this.i18nService.t("encryptionKeyMigrationRequired"),
});
return true;
}
}