Only initialize Crypto when olm is provided
See https://github.com/vector-im/hydrogen-web/pull/691#discussion_r816988082
This commit is contained in:
parent
0935f2d23a
commit
2f4c639cef
1 changed files with 2 additions and 2 deletions
|
@ -143,8 +143,8 @@ export class Platform {
|
||||||
this._serviceWorkerHandler.registerAndStart(assetPaths.serviceWorker);
|
this._serviceWorkerHandler.registerAndStart(assetPaths.serviceWorker);
|
||||||
}
|
}
|
||||||
this.notificationService = new NotificationService(this._serviceWorkerHandler, config.push);
|
this.notificationService = new NotificationService(this._serviceWorkerHandler, config.push);
|
||||||
// `window.crypto.subtle` is only available in a secure context
|
// Only try to use crypto when olm is provided
|
||||||
if(window.isSecureContext) {
|
if(this._assetPaths.olm) {
|
||||||
this.crypto = new Crypto(cryptoExtras);
|
this.crypto = new Crypto(cryptoExtras);
|
||||||
}
|
}
|
||||||
this.storageFactory = new StorageFactory(this._serviceWorkerHandler);
|
this.storageFactory = new StorageFactory(this._serviceWorkerHandler);
|
||||||
|
|
Reference in a new issue