1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-08-21 22:23:52 +02:00

Use the new KDF constants (#1559)

This commit is contained in:
Oscar Hinton 2022-03-24 11:15:48 +01:00 committed by GitHub
parent 2c43249e98
commit 00975e6896
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 18 additions and 28 deletions

2
jslib

@ -1 +1 @@
Subproject commit 9950fb42a15bad434a4b404419ff4a87af67a27b
Subproject commit 5b7b2a03ddbecbc93adc54a5c69e8141c00c192f

View File

@ -1,11 +1,6 @@
import "core-js/stable";
require("zone.js/dist/zone");
// IE11 fix, ref: https://github.com/angular/angular/issues/24769
if (!Element.prototype.matches && (Element.prototype as any).msMatchesSelector) {
Element.prototype.matches = (Element.prototype as any).msMatchesSelector;
}
if (process.env.NODE_ENV === "production") {
// Production
} else {

View File

@ -6,6 +6,7 @@ import { CryptoService } from "jslib-common/abstractions/crypto.service";
import { CryptoFunctionService } from "jslib-common/abstractions/cryptoFunction.service";
import { I18nService } from "jslib-common/abstractions/i18n.service";
import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service";
import { SEND_KDF_ITERATIONS } from "jslib-common/enums/kdfType";
import { SendType } from "jslib-common/enums/sendType";
import { Utils } from "jslib-common/misc/utils";
import { SendAccess } from "jslib-common/models/domain/sendAccess";
@ -140,7 +141,7 @@ export class AccessComponent implements OnInit {
this.password,
keyArray,
"sha256",
100000
SEND_KDF_ITERATIONS
);
this.accessRequest.password = Utils.fromBufferToB64(passwordHash);
}

View File

@ -61,7 +61,7 @@
<div class="col-12">
<div class="form-group">
<div class="small form-text text-muted">
<p>{{ "kdfIterationsDesc" | i18n: (100000 | number) }}</p>
<p>{{ "kdfIterationsDesc" | i18n: (recommendedKdfIterations | number) }}</p>
<strong>{{ "warning" | i18n }}</strong
>: {{ "kdfIterationsWarning" | i18n: (50000 | number) }}
</div>

View File

@ -7,7 +7,7 @@ import { LogService } from "jslib-common/abstractions/log.service";
import { MessagingService } from "jslib-common/abstractions/messaging.service";
import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service";
import { StateService } from "jslib-common/abstractions/state.service";
import { KdfType } from "jslib-common/enums/kdfType";
import { DEFAULT_KDF_ITERATIONS, KdfType } from "jslib-common/enums/kdfType";
import { KdfRequest } from "jslib-common/models/request/kdfRequest";
@Component({
@ -20,6 +20,7 @@ export class ChangeKdfComponent implements OnInit {
kdf = KdfType.PBKDF2_SHA256;
kdfOptions: any[] = [];
formPromise: Promise<any>;
recommendedKdfIterations = DEFAULT_KDF_ITERATIONS;
constructor(
private apiService: ApiService,

View File

@ -85,10 +85,6 @@ export class WebPlatformUtilsService implements PlatformUtilsService {
return this.getDevice() === DeviceType.SafariBrowser;
}
isIE(): boolean {
return this.getDevice() === DeviceType.IEBrowser;
}
isMacAppStore(): boolean {
return false;
}
@ -139,26 +135,23 @@ export class WebPlatformUtilsService implements PlatformUtilsService {
blobOptions.type = type;
}
}
if (blobOptions != null && !this.isIE()) {
if (blobOptions != null) {
blob = new Blob([blobData], blobOptions);
} else {
blob = new Blob([blobData]);
}
if (navigator.msSaveOrOpenBlob) {
navigator.msSaveBlob(blob, fileName);
} else {
const a = win.document.createElement("a");
if (doDownload) {
a.download = fileName;
} else if (!this.isSafari()) {
a.target = "_blank";
}
a.href = URL.createObjectURL(blob);
a.style.position = "fixed";
win.document.body.appendChild(a);
a.click();
win.document.body.removeChild(a);
const a = win.document.createElement("a");
if (doDownload) {
a.download = fileName;
} else if (!this.isSafari()) {
a.target = "_blank";
}
a.href = URL.createObjectURL(blob);
a.style.position = "fixed";
win.document.body.appendChild(a);
a.click();
win.document.body.removeChild(a);
}
getApplicationVersion(): Promise<string> {