From 2f4c639cef3246386cf9e739ffbd1039184f5678 Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Wed, 2 Mar 2022 03:17:59 -0600 Subject: [PATCH] Only initialize Crypto when olm is provided See https://github.com/vector-im/hydrogen-web/pull/691#discussion_r816988082 --- src/platform/web/Platform.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/platform/web/Platform.js b/src/platform/web/Platform.js index b6fdfae5..8c8b4fac 100644 --- a/src/platform/web/Platform.js +++ b/src/platform/web/Platform.js @@ -143,8 +143,8 @@ export class Platform { this._serviceWorkerHandler.registerAndStart(assetPaths.serviceWorker); } this.notificationService = new NotificationService(this._serviceWorkerHandler, config.push); - // `window.crypto.subtle` is only available in a secure context - if(window.isSecureContext) { + // Only try to use crypto when olm is provided + if(this._assetPaths.olm) { this.crypto = new Crypto(cryptoExtras); } this.storageFactory = new StorageFactory(this._serviceWorkerHandler);