You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-08-09 10:22:46 +03:00
Modernize window.crypto access constants (#4169)
* Force service worker-safe crypto when operating under a service worker
* Fix tests/unsafe execution
* Further fix tests?
* Docs would probably be good
* Define a type guard function
https://www.typescriptlang.org/docs/handbook/advanced-types.html#user-defined-type-guards
* Use `@types` repo
* Maybe don't modify tsconfig, I guess
* Revert "Use `@types` repo"
This reverts commit db46bcf1db
.
* Use a different type for Window
* Simplify the crypto accessors
This commit is contained in:
@@ -16,9 +16,9 @@ limitations under the License.
|
||||
|
||||
import { logger } from "../logger";
|
||||
|
||||
export let crypto = globalThis.window?.crypto;
|
||||
export let subtleCrypto = globalThis.window?.crypto?.subtle ?? global.window?.crypto?.webkitSubtle;
|
||||
export let TextEncoder = globalThis.window?.TextEncoder;
|
||||
export let crypto = globalThis.crypto;
|
||||
export let subtleCrypto = crypto?.subtle ?? crypto?.webkitSubtle; // TODO: Stop using webkitSubtle fallback
|
||||
export let TextEncoder = globalThis.TextEncoder;
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
if (!crypto) {
|
||||
|
Reference in New Issue
Block a user