From 45661d98d8c6d03ad10f53e0fe1d1457540c80c4 Mon Sep 17 00:00:00 2001 From: Hinton Date: Tue, 22 Mar 2022 09:47:48 +0100 Subject: [PATCH 1/2] Use the new KDF constants --- src/app/send/access.component.ts | 3 ++- src/app/settings/change-kdf.component.html | 2 +- src/app/settings/change-kdf.component.ts | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/app/send/access.component.ts b/src/app/send/access.component.ts index 1bf4b9e588e..2665f28bf96 100644 --- a/src/app/send/access.component.ts +++ b/src/app/send/access.component.ts @@ -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); } diff --git a/src/app/settings/change-kdf.component.html b/src/app/settings/change-kdf.component.html index ebd616f1f59..82cd56b1c97 100644 --- a/src/app/settings/change-kdf.component.html +++ b/src/app/settings/change-kdf.component.html @@ -61,7 +61,7 @@
-

{{ "kdfIterationsDesc" | i18n: (100000 | number) }}

+

{{ "kdfIterationsDesc" | i18n: (recommendedKdfIterations | number) }}

{{ "warning" | i18n }}: {{ "kdfIterationsWarning" | i18n: (50000 | number) }}
diff --git a/src/app/settings/change-kdf.component.ts b/src/app/settings/change-kdf.component.ts index beef67bbb8c..dcc268ac7c2 100644 --- a/src/app/settings/change-kdf.component.ts +++ b/src/app/settings/change-kdf.component.ts @@ -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; + recommendedKdfIterations = DEFAULT_KDF_ITERATIONS; constructor( private apiService: ApiService, From 42c1db9f13b8332867caf4259357420b501590a8 Mon Sep 17 00:00:00 2001 From: Hinton Date: Thu, 24 Mar 2022 10:51:33 +0100 Subject: [PATCH 2/2] Remove isIE and bump jslib --- jslib | 2 +- src/app/polyfills.ts | 5 ---- src/services/webPlatformUtils.service.ts | 31 +++++++++--------------- 3 files changed, 13 insertions(+), 25 deletions(-) diff --git a/jslib b/jslib index 9950fb42a15..5b7b2a03ddb 160000 --- a/jslib +++ b/jslib @@ -1 +1 @@ -Subproject commit 9950fb42a15bad434a4b404419ff4a87af67a27b +Subproject commit 5b7b2a03ddbecbc93adc54a5c69e8141c00c192f diff --git a/src/app/polyfills.ts b/src/app/polyfills.ts index 28df461ccc4..0691f05659b 100644 --- a/src/app/polyfills.ts +++ b/src/app/polyfills.ts @@ -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 { diff --git a/src/services/webPlatformUtils.service.ts b/src/services/webPlatformUtils.service.ts index 9132479b47a..0c9b56fae14 100644 --- a/src/services/webPlatformUtils.service.ts +++ b/src/services/webPlatformUtils.service.ts @@ -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 {