We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
crypto
SubtleCrypto
1 parent d607aef commit 3f39337Copy full SHA for 3f39337
packages/snaps-execution-environments/src/common/endowments/crypto.ts
@@ -1,6 +1,18 @@
1
+import { assert } from '@metamask/utils';
2
+
3
import { rootRealmGlobal } from '../globalObject';
4
5
export const createCrypto = () => {
6
+ assert(
7
+ rootRealmGlobal.crypto,
8
+ 'Crypto endowment requires `globalThis.crypto` to be defined.',
9
+ );
10
11
12
+ rootRealmGlobal.SubtleCrypto,
13
+ 'Crypto endowment requires `globalThis.SubtleCrypto` to be defined.',
14
15
16
return {
17
crypto: harden(rootRealmGlobal.crypto),
18
SubtleCrypto: harden(rootRealmGlobal.SubtleCrypto),
0 commit comments