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

[PS-1107] User Verification Service Refactor (#3219)

* UserVerificationService refactor

* Remove temp change

* move import order

* Address PR feedback
This commit is contained in:
Justin Baur
2022-08-09 21:31:02 -04:00
committed by GitHub
parent 43d428b3df
commit 1ba76dec16
35 changed files with 209 additions and 108 deletions

View File

@@ -4,24 +4,30 @@ import { ApiService } from "@bitwarden/common/abstractions/api.service";
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
import { LogService } from "@bitwarden/common/abstractions/log.service";
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
import { UserVerificationService } from "@bitwarden/common/abstractions/userVerification.service";
import { UserVerificationService } from "@bitwarden/common/abstractions/userVerification/userVerification.service.abstraction";
import { TwoFactorProviderType } from "@bitwarden/common/enums/twoFactorProviderType";
import { UpdateTwoFactorYubioOtpRequest } from "@bitwarden/common/models/request/updateTwoFactorYubioOtpRequest";
import { TwoFactorYubiKeyResponse } from "@bitwarden/common/models/response/twoFactorYubiKeyResponse";
import { AuthResponse } from "@bitwarden/common/types/authResponse";
import { TwoFactorBaseComponent } from "./two-factor-base.component";
interface Key {
key: string;
existingKey: string;
}
@Component({
selector: "app-two-factor-yubikey",
templateUrl: "two-factor-yubikey.component.html",
})
export class TwoFactorYubiKeyComponent extends TwoFactorBaseComponent {
type = TwoFactorProviderType.Yubikey;
keys: any[];
keys: Key[];
nfc = false;
formPromise: Promise<any>;
disablePromise: Promise<any>;
formPromise: Promise<TwoFactorYubiKeyResponse>;
disablePromise: Promise<unknown>;
constructor(
apiService: ApiService,
@@ -33,7 +39,7 @@ export class TwoFactorYubiKeyComponent extends TwoFactorBaseComponent {
super(apiService, i18nService, platformUtilsService, logService, userVerificationService);
}
auth(authResponse: any) {
auth(authResponse: AuthResponse<TwoFactorYubiKeyResponse>) {
super.auth(authResponse);
this.processResponse(authResponse.response);
}
@@ -59,7 +65,7 @@ export class TwoFactorYubiKeyComponent extends TwoFactorBaseComponent {
return super.disable(this.disablePromise);
}
remove(key: any) {
remove(key: Key) {
key.existingKey = null;
key.key = null;
}