[PM-108] Login with Device - Change desktop to not get fingerprint from API (#4834)

* [PM-108] Fingerprint is calculated based on pubKey

* [PM-108] Change userId to userEmail. Remove fingerprint from AuthResponse
This commit is contained in:
André Bispo 2023-03-13 15:40:21 +00:00 committed by GitHub
parent 1666488672
commit 07b074f184
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 4 deletions

View File

@ -11,7 +11,7 @@
<div class="section"> <div class="section">
<h4 class="label">{{ "fingerprintPhraseHeader" | i18n }}</h4> <h4 class="label">{{ "fingerprintPhraseHeader" | i18n }}</h4>
<code>{{ authRequestResponse?.requestFingerprint }}</code> <code>{{ fingerprintPhrase }}</code>
</div> </div>
<div class="section"> <div class="section">

View File

@ -6,11 +6,13 @@ import { ModalRef } from "@bitwarden/angular/components/modal/modal.ref";
import { ModalConfig } from "@bitwarden/angular/services/modal.service"; import { ModalConfig } from "@bitwarden/angular/services/modal.service";
import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { ApiService } from "@bitwarden/common/abstractions/api.service";
import { AppIdService } from "@bitwarden/common/abstractions/appId.service"; import { AppIdService } from "@bitwarden/common/abstractions/appId.service";
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
import { I18nService } from "@bitwarden/common/abstractions/i18n.service"; import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service"; import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
import { StateService } from "@bitwarden/common/abstractions/state.service"; import { StateService } from "@bitwarden/common/abstractions/state.service";
import { AuthService } from "@bitwarden/common/auth/abstractions/auth.service"; import { AuthService } from "@bitwarden/common/auth/abstractions/auth.service";
import { AuthRequestResponse } from "@bitwarden/common/auth/models/response/auth-request.response"; import { AuthRequestResponse } from "@bitwarden/common/auth/models/response/auth-request.response";
import { Utils } from "@bitwarden/common/misc/utils";
const RequestTimeOut = 60000 * 15; //15 Minutes const RequestTimeOut = 60000 * 15; //15 Minutes
const RequestTimeUpdate = 60000 * 5; //5 Minutes const RequestTimeUpdate = 60000 * 5; //5 Minutes
@ -25,6 +27,7 @@ export class LoginApprovalComponent implements OnInit, OnDestroy {
private destroy$ = new Subject<void>(); private destroy$ = new Subject<void>();
email: string; email: string;
fingerprintPhrase: string;
authRequestResponse: AuthRequestResponse; authRequestResponse: AuthRequestResponse;
interval: NodeJS.Timer; interval: NodeJS.Timer;
requestTimeText: string; requestTimeText: string;
@ -37,6 +40,7 @@ export class LoginApprovalComponent implements OnInit, OnDestroy {
protected apiService: ApiService, protected apiService: ApiService,
protected authService: AuthService, protected authService: AuthService,
protected appIdService: AppIdService, protected appIdService: AppIdService,
protected cryptoService: CryptoService,
private modalRef: ModalRef, private modalRef: ModalRef,
config: ModalConfig config: ModalConfig
) { ) {
@ -61,8 +65,11 @@ export class LoginApprovalComponent implements OnInit, OnDestroy {
async ngOnInit() { async ngOnInit() {
if (this.notificationId != null) { if (this.notificationId != null) {
this.authRequestResponse = await this.apiService.getAuthRequest(this.notificationId); this.authRequestResponse = await this.apiService.getAuthRequest(this.notificationId);
const publicKey = Utils.fromB64ToArray(this.authRequestResponse.publicKey);
this.email = await this.stateService.getEmail(); this.email = await this.stateService.getEmail();
this.fingerprintPhrase = (
await this.cryptoService.getFingerprint(this.email, publicKey.buffer)
).join("-");
this.updateTimeText(); this.updateTimeText();
this.interval = setInterval(() => { this.interval = setInterval(() => {

View File

@ -12,7 +12,6 @@ export class AuthRequestResponse extends BaseResponse {
masterPasswordHash: string; masterPasswordHash: string;
creationDate: string; creationDate: string;
requestApproved?: boolean; requestApproved?: boolean;
requestFingerprint?: string;
responseDate?: string; responseDate?: string;
isAnswered: boolean; isAnswered: boolean;
isExpired: boolean; isExpired: boolean;
@ -27,7 +26,6 @@ export class AuthRequestResponse extends BaseResponse {
this.masterPasswordHash = this.getResponseProperty("MasterPasswordHash"); this.masterPasswordHash = this.getResponseProperty("MasterPasswordHash");
this.creationDate = this.getResponseProperty("CreationDate"); this.creationDate = this.getResponseProperty("CreationDate");
this.requestApproved = this.getResponseProperty("RequestApproved"); this.requestApproved = this.getResponseProperty("RequestApproved");
this.requestFingerprint = this.getResponseProperty("RequestFingerprint");
this.responseDate = this.getResponseProperty("ResponseDate"); this.responseDate = this.getResponseProperty("ResponseDate");
const requestDate = new Date(this.creationDate); const requestDate = new Date(this.creationDate);