@metamask/snaps-execution-environments 0.38.1-flask.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +283 -18
- package/dist/browserify/iframe/bundle.js +4 -6
- package/dist/browserify/node-process/bundle.js +2 -4
- package/dist/browserify/node-thread/bundle.js +2 -4
- package/dist/browserify/offscreen/bundle.js +3 -5
- package/dist/{types/common → common}/BaseSnapExecutor.d.ts +7 -7
- package/dist/common/BaseSnapExecutor.js +370 -0
- package/dist/common/BaseSnapExecutor.js.map +1 -0
- package/dist/{types/common → common}/commands.d.ts +2 -2
- package/dist/common/commands.js +65 -0
- package/dist/common/commands.js.map +1 -0
- package/dist/{types/common → common}/endowments/commonEndowmentFactory.d.ts +1 -5
- package/dist/common/endowments/commonEndowmentFactory.js +75 -0
- package/dist/common/endowments/commonEndowmentFactory.js.map +1 -0
- package/dist/{types/common → common}/endowments/crypto.d.ts +0 -4
- package/dist/common/endowments/crypto.js +28 -0
- package/dist/common/endowments/crypto.js.map +1 -0
- package/dist/{esm/common → common}/endowments/date.js +16 -20
- package/dist/common/endowments/date.js.map +1 -0
- package/dist/{types/common → common}/endowments/index.d.ts +3 -5
- package/dist/{esm/common → common}/endowments/index.js +36 -34
- package/dist/common/endowments/index.js.map +1 -0
- package/dist/{esm/common → common}/endowments/interval.js +12 -13
- package/dist/common/endowments/interval.js.map +1 -0
- package/dist/{esm/common → common}/endowments/math.js +15 -21
- package/dist/common/endowments/math.js.map +1 -0
- package/dist/common/endowments/network.js +170 -0
- package/dist/common/endowments/network.js.map +1 -0
- package/dist/common/endowments/textDecoder.js +18 -0
- package/dist/common/endowments/textDecoder.js.map +1 -0
- package/dist/common/endowments/textEncoder.js +18 -0
- package/dist/common/endowments/textEncoder.js.map +1 -0
- package/dist/{esm/common → common}/endowments/timeout.js +13 -14
- package/dist/common/endowments/timeout.js.map +1 -0
- package/dist/{types/common → common}/globalEvents.d.ts +0 -1
- package/dist/common/globalEvents.js +47 -0
- package/dist/common/globalEvents.js.map +1 -0
- package/dist/common/globalObject.js +50 -0
- package/dist/{cjs/common → common}/globalObject.js.map +1 -1
- package/dist/common/keyring.d.ts +12 -0
- package/dist/common/keyring.js +42 -0
- package/dist/common/keyring.js.map +1 -0
- package/dist/common/lockdown/lockdown-events.js +60 -0
- package/dist/common/lockdown/lockdown-events.js.map +1 -0
- package/dist/{esm/common → common}/lockdown/lockdown-more.js +23 -16
- package/dist/common/lockdown/lockdown-more.js.map +1 -0
- package/dist/{esm/common → common}/lockdown/lockdown.js +12 -7
- package/dist/common/lockdown/lockdown.js.map +1 -0
- package/dist/{types/common → common}/sortParams.d.ts +1 -1
- package/dist/{esm/common → common}/sortParams.js +13 -7
- package/dist/common/sortParams.js.map +1 -0
- package/dist/{types/common → common}/utils.d.ts +4 -5
- package/dist/{esm/common → common}/utils.js +56 -43
- package/dist/common/utils.js.map +1 -0
- package/dist/{types/common → common}/validation.d.ts +10 -2
- package/dist/common/validation.js +109 -0
- package/dist/common/validation.js.map +1 -0
- package/dist/{types/iframe → iframe}/IFrameSnapExecutor.d.ts +1 -1
- package/dist/iframe/IFrameSnapExecutor.js +42 -0
- package/dist/iframe/IFrameSnapExecutor.js.map +1 -0
- package/dist/iframe/index.js +10 -0
- package/dist/iframe/index.js.map +1 -0
- package/dist/logging.js +13 -0
- package/dist/logging.js.map +1 -0
- package/dist/node-process/ChildProcessSnapExecutor.js +30 -0
- package/dist/node-process/ChildProcessSnapExecutor.js.map +1 -0
- package/dist/node-process/index.js +8 -0
- package/dist/node-process/index.js.map +1 -0
- package/dist/node-thread/ThreadSnapExecutor.js +30 -0
- package/dist/node-thread/ThreadSnapExecutor.js.map +1 -0
- package/dist/node-thread/index.js +8 -0
- package/dist/node-thread/index.js.map +1 -0
- package/dist/{types/offscreen → offscreen}/OffscreenSnapExecutor.d.ts +1 -2
- package/dist/offscreen/OffscreenSnapExecutor.js +104 -0
- package/dist/offscreen/OffscreenSnapExecutor.js.map +1 -0
- package/dist/offscreen/index.js +16 -0
- package/dist/offscreen/index.js.map +1 -0
- package/dist/openrpc.json +210 -0
- package/package.json +34 -47
- package/dist/browserify/worker-executor/bundle.js +0 -12155
- package/dist/browserify/worker-pool/bundle.js +0 -12
- package/dist/browserify/worker-pool/index.html +0 -12150
- package/dist/cjs/common/BaseSnapExecutor.js +0 -423
- package/dist/cjs/common/BaseSnapExecutor.js.map +0 -1
- package/dist/cjs/common/commands.js +0 -67
- package/dist/cjs/common/commands.js.map +0 -1
- package/dist/cjs/common/endowments/commonEndowmentFactory.js +0 -147
- package/dist/cjs/common/endowments/commonEndowmentFactory.js.map +0 -1
- package/dist/cjs/common/endowments/console.js +0 -134
- package/dist/cjs/common/endowments/console.js.map +0 -1
- package/dist/cjs/common/endowments/crypto.js +0 -44
- package/dist/cjs/common/endowments/crypto.js.map +0 -1
- package/dist/cjs/common/endowments/date.js +0 -53
- package/dist/cjs/common/endowments/date.js.map +0 -1
- package/dist/cjs/common/endowments/index.js +0 -91
- package/dist/cjs/common/endowments/index.js.map +0 -1
- package/dist/cjs/common/endowments/interval.js +0 -61
- package/dist/cjs/common/endowments/interval.js.map +0 -1
- package/dist/cjs/common/endowments/math.js +0 -67
- package/dist/cjs/common/endowments/math.js.map +0 -1
- package/dist/cjs/common/endowments/network.js +0 -206
- package/dist/cjs/common/endowments/network.js.map +0 -1
- package/dist/cjs/common/endowments/textDecoder.js +0 -28
- package/dist/cjs/common/endowments/textDecoder.js.map +0 -1
- package/dist/cjs/common/endowments/textEncoder.js +0 -28
- package/dist/cjs/common/endowments/textEncoder.js.map +0 -1
- package/dist/cjs/common/endowments/timeout.js +0 -63
- package/dist/cjs/common/endowments/timeout.js.map +0 -1
- package/dist/cjs/common/globalEvents.js +0 -39
- package/dist/cjs/common/globalEvents.js.map +0 -1
- package/dist/cjs/common/globalObject.js +0 -53
- package/dist/cjs/common/lockdown/lockdown-events.js +0 -74
- package/dist/cjs/common/lockdown/lockdown-events.js.map +0 -1
- package/dist/cjs/common/lockdown/lockdown-more.js +0 -73
- package/dist/cjs/common/lockdown/lockdown-more.js.map +0 -1
- package/dist/cjs/common/lockdown/lockdown.js +0 -30
- package/dist/cjs/common/lockdown/lockdown.js.map +0 -1
- package/dist/cjs/common/sortParams.js +0 -26
- package/dist/cjs/common/sortParams.js.map +0 -1
- package/dist/cjs/common/utils.js +0 -132
- package/dist/cjs/common/utils.js.map +0 -1
- package/dist/cjs/common/validation.js +0 -94
- package/dist/cjs/common/validation.js.map +0 -1
- package/dist/cjs/iframe/IFrameSnapExecutor.js +0 -50
- package/dist/cjs/iframe/IFrameSnapExecutor.js.map +0 -1
- package/dist/cjs/iframe/index.js +0 -13
- package/dist/cjs/iframe/index.js.map +0 -1
- package/dist/cjs/logging.js +0 -15
- package/dist/cjs/logging.js.map +0 -1
- package/dist/cjs/node-process/ChildProcessSnapExecutor.js +0 -39
- package/dist/cjs/node-process/ChildProcessSnapExecutor.js.map +0 -1
- package/dist/cjs/node-process/index.js +0 -11
- package/dist/cjs/node-process/index.js.map +0 -1
- package/dist/cjs/node-thread/ThreadSnapExecutor.js +0 -39
- package/dist/cjs/node-thread/ThreadSnapExecutor.js.map +0 -1
- package/dist/cjs/node-thread/index.js +0 -11
- package/dist/cjs/node-thread/index.js.map +0 -1
- package/dist/cjs/offscreen/OffscreenSnapExecutor.js +0 -173
- package/dist/cjs/offscreen/OffscreenSnapExecutor.js.map +0 -1
- package/dist/cjs/offscreen/index.js +0 -19
- package/dist/cjs/offscreen/index.js.map +0 -1
- package/dist/cjs/webworker/executor/WebWorkerSnapExecutor.js +0 -45
- package/dist/cjs/webworker/executor/WebWorkerSnapExecutor.js.map +0 -1
- package/dist/cjs/webworker/executor/index.js +0 -13
- package/dist/cjs/webworker/executor/index.js.map +0 -1
- package/dist/cjs/webworker/pool/WebWorkerPool.js +0 -248
- package/dist/cjs/webworker/pool/WebWorkerPool.js.map +0 -1
- package/dist/cjs/webworker/pool/index.js +0 -13
- package/dist/cjs/webworker/pool/index.js.map +0 -1
- package/dist/esm/common/BaseSnapExecutor.js +0 -408
- package/dist/esm/common/BaseSnapExecutor.js.map +0 -1
- package/dist/esm/common/commands.js +0 -66
- package/dist/esm/common/commands.js.map +0 -1
- package/dist/esm/common/endowments/commonEndowmentFactory.js +0 -132
- package/dist/esm/common/endowments/commonEndowmentFactory.js.map +0 -1
- package/dist/esm/common/endowments/console.js +0 -116
- package/dist/esm/common/endowments/console.js.map +0 -1
- package/dist/esm/common/endowments/crypto.js +0 -26
- package/dist/esm/common/endowments/crypto.js.map +0 -1
- package/dist/esm/common/endowments/date.js.map +0 -1
- package/dist/esm/common/endowments/index.js.map +0 -1
- package/dist/esm/common/endowments/interval.js.map +0 -1
- package/dist/esm/common/endowments/math.js.map +0 -1
- package/dist/esm/common/endowments/network.js +0 -196
- package/dist/esm/common/endowments/network.js.map +0 -1
- package/dist/esm/common/endowments/textDecoder.js +0 -18
- package/dist/esm/common/endowments/textDecoder.js.map +0 -1
- package/dist/esm/common/endowments/textEncoder.js +0 -18
- package/dist/esm/common/endowments/textEncoder.js.map +0 -1
- package/dist/esm/common/endowments/timeout.js.map +0 -1
- package/dist/esm/common/globalEvents.js +0 -35
- package/dist/esm/common/globalEvents.js.map +0 -1
- package/dist/esm/common/globalObject.js +0 -36
- package/dist/esm/common/globalObject.js.map +0 -1
- package/dist/esm/common/lockdown/lockdown-events.js +0 -66
- package/dist/esm/common/lockdown/lockdown-events.js.map +0 -1
- package/dist/esm/common/lockdown/lockdown-more.js.map +0 -1
- package/dist/esm/common/lockdown/lockdown.js.map +0 -1
- package/dist/esm/common/sortParams.js.map +0 -1
- package/dist/esm/common/utils.js.map +0 -1
- package/dist/esm/common/validation.js +0 -69
- package/dist/esm/common/validation.js.map +0 -1
- package/dist/esm/iframe/IFrameSnapExecutor.js +0 -35
- package/dist/esm/iframe/IFrameSnapExecutor.js.map +0 -1
- package/dist/esm/iframe/index.js +0 -9
- package/dist/esm/iframe/index.js.map +0 -1
- package/dist/esm/logging.js +0 -10
- package/dist/esm/logging.js.map +0 -1
- package/dist/esm/node-process/ChildProcessSnapExecutor.js +0 -24
- package/dist/esm/node-process/ChildProcessSnapExecutor.js.map +0 -1
- package/dist/esm/node-process/index.js +0 -7
- package/dist/esm/node-process/index.js.map +0 -1
- package/dist/esm/node-thread/ThreadSnapExecutor.js +0 -24
- package/dist/esm/node-thread/ThreadSnapExecutor.js.map +0 -1
- package/dist/esm/node-thread/index.js +0 -7
- package/dist/esm/node-thread/index.js.map +0 -1
- package/dist/esm/offscreen/OffscreenSnapExecutor.js +0 -176
- package/dist/esm/offscreen/OffscreenSnapExecutor.js.map +0 -1
- package/dist/esm/offscreen/index.js +0 -15
- package/dist/esm/offscreen/index.js.map +0 -1
- package/dist/esm/webworker/executor/WebWorkerSnapExecutor.js +0 -30
- package/dist/esm/webworker/executor/WebWorkerSnapExecutor.js.map +0 -1
- package/dist/esm/webworker/executor/index.js +0 -9
- package/dist/esm/webworker/executor/index.js.map +0 -1
- package/dist/esm/webworker/pool/WebWorkerPool.js +0 -245
- package/dist/esm/webworker/pool/WebWorkerPool.js.map +0 -1
- package/dist/esm/webworker/pool/index.js +0 -9
- package/dist/esm/webworker/pool/index.js.map +0 -1
- package/dist/types/common/endowments/console.d.ts +0 -45
- package/dist/types/webworker/executor/WebWorkerSnapExecutor.d.ts +0 -13
- package/dist/types/webworker/executor/index.d.ts +0 -1
- package/dist/types/webworker/pool/WebWorkerPool.d.ts +0 -23
- package/dist/types/webworker/pool/index.d.ts +0 -1
- /package/dist/{types/common → common}/endowments/date.d.ts +0 -0
- /package/dist/{types/common → common}/endowments/interval.d.ts +0 -0
- /package/dist/{types/common → common}/endowments/math.d.ts +0 -0
- /package/dist/{types/common → common}/endowments/network.d.ts +0 -0
- /package/dist/{types/common → common}/endowments/textDecoder.d.ts +0 -0
- /package/dist/{types/common → common}/endowments/textEncoder.d.ts +0 -0
- /package/dist/{types/common → common}/endowments/timeout.d.ts +0 -0
- /package/dist/{types/common → common}/globalObject.d.ts +0 -0
- /package/dist/{types/common → common}/lockdown/lockdown-events.d.ts +0 -0
- /package/dist/{types/common → common}/lockdown/lockdown-more.d.ts +0 -0
- /package/dist/{types/common → common}/lockdown/lockdown.d.ts +0 -0
- /package/dist/{types/iframe → iframe}/index.d.ts +0 -0
- /package/dist/{types/logging.d.ts → logging.d.ts} +0 -0
- /package/dist/{types/node-process → node-process}/ChildProcessSnapExecutor.d.ts +0 -0
- /package/dist/{types/node-process → node-process}/index.d.ts +0 -0
- /package/dist/{types/node-thread → node-thread}/ThreadSnapExecutor.d.ts +0 -0
- /package/dist/{types/node-thread → node-thread}/index.d.ts +0 -0
- /package/dist/{types/offscreen → offscreen}/index.d.ts +0 -0
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "default", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return _default;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _globalObject = require("../globalObject");
|
|
12
|
-
const _console = /*#__PURE__*/ _interop_require_default(require("./console"));
|
|
13
|
-
const _crypto = /*#__PURE__*/ _interop_require_default(require("./crypto"));
|
|
14
|
-
const _date = /*#__PURE__*/ _interop_require_default(require("./date"));
|
|
15
|
-
const _interval = /*#__PURE__*/ _interop_require_default(require("./interval"));
|
|
16
|
-
const _math = /*#__PURE__*/ _interop_require_default(require("./math"));
|
|
17
|
-
const _network = /*#__PURE__*/ _interop_require_default(require("./network"));
|
|
18
|
-
const _textDecoder = /*#__PURE__*/ _interop_require_default(require("./textDecoder"));
|
|
19
|
-
const _textEncoder = /*#__PURE__*/ _interop_require_default(require("./textEncoder"));
|
|
20
|
-
const _timeout = /*#__PURE__*/ _interop_require_default(require("./timeout"));
|
|
21
|
-
function _interop_require_default(obj) {
|
|
22
|
-
return obj && obj.__esModule ? obj : {
|
|
23
|
-
default: obj
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
// Array of common endowments
|
|
27
|
-
const commonEndowments = [
|
|
28
|
-
{
|
|
29
|
-
endowment: AbortController,
|
|
30
|
-
name: 'AbortController'
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
endowment: AbortSignal,
|
|
34
|
-
name: 'AbortSignal'
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
endowment: ArrayBuffer,
|
|
38
|
-
name: 'ArrayBuffer'
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
endowment: atob,
|
|
42
|
-
name: 'atob',
|
|
43
|
-
bind: true
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
endowment: BigInt,
|
|
47
|
-
name: 'BigInt'
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
endowment: BigInt64Array,
|
|
51
|
-
name: 'BigInt64Array'
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
endowment: BigUint64Array,
|
|
55
|
-
name: 'BigUint64Array'
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
endowment: btoa,
|
|
59
|
-
name: 'btoa',
|
|
60
|
-
bind: true
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
endowment: DataView,
|
|
64
|
-
name: 'DataView'
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
endowment: Float32Array,
|
|
68
|
-
name: 'Float32Array'
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
endowment: Float64Array,
|
|
72
|
-
name: 'Float64Array'
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
endowment: Int8Array,
|
|
76
|
-
name: 'Int8Array'
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
endowment: Int16Array,
|
|
80
|
-
name: 'Int16Array'
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
endowment: Int32Array,
|
|
84
|
-
name: 'Int32Array'
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
endowment: Uint8Array,
|
|
88
|
-
name: 'Uint8Array'
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
endowment: Uint8ClampedArray,
|
|
92
|
-
name: 'Uint8ClampedArray'
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
endowment: Uint16Array,
|
|
96
|
-
name: 'Uint16Array'
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
endowment: Uint32Array,
|
|
100
|
-
name: 'Uint32Array'
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
endowment: URL,
|
|
104
|
-
name: 'URL'
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
endowment: WebAssembly,
|
|
108
|
-
name: 'WebAssembly'
|
|
109
|
-
}
|
|
110
|
-
];
|
|
111
|
-
/**
|
|
112
|
-
* Creates a consolidated collection of common endowments.
|
|
113
|
-
* This function will return factories for all common endowments including
|
|
114
|
-
* the additionally attenuated. All hardened with SES.
|
|
115
|
-
*
|
|
116
|
-
* @returns An object with common endowments.
|
|
117
|
-
*/ const buildCommonEndowments = ()=>{
|
|
118
|
-
const endowmentFactories = [
|
|
119
|
-
_crypto.default,
|
|
120
|
-
_interval.default,
|
|
121
|
-
_math.default,
|
|
122
|
-
_network.default,
|
|
123
|
-
_timeout.default,
|
|
124
|
-
_textDecoder.default,
|
|
125
|
-
_textEncoder.default,
|
|
126
|
-
_date.default,
|
|
127
|
-
_console.default
|
|
128
|
-
];
|
|
129
|
-
commonEndowments.forEach((endowmentSpecification)=>{
|
|
130
|
-
const endowment = {
|
|
131
|
-
names: [
|
|
132
|
-
endowmentSpecification.name
|
|
133
|
-
],
|
|
134
|
-
factory: ()=>{
|
|
135
|
-
const boundEndowment = typeof endowmentSpecification.endowment === 'function' && endowmentSpecification.bind ? endowmentSpecification.endowment.bind(_globalObject.rootRealmGlobal) : endowmentSpecification.endowment;
|
|
136
|
-
return {
|
|
137
|
-
[endowmentSpecification.name]: harden(boundEndowment)
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
endowmentFactories.push(endowment);
|
|
142
|
-
});
|
|
143
|
-
return endowmentFactories;
|
|
144
|
-
};
|
|
145
|
-
const _default = buildCommonEndowments;
|
|
146
|
-
|
|
147
|
-
//# sourceMappingURL=commonEndowmentFactory.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/common/endowments/commonEndowmentFactory.ts"],"sourcesContent":["import type { SnapId } from '@metamask/snaps-utils';\n\nimport { rootRealmGlobal } from '../globalObject';\nimport consoleEndowment from './console';\nimport crypto from './crypto';\nimport date from './date';\nimport interval from './interval';\nimport math from './math';\nimport network from './network';\nimport textDecoder from './textDecoder';\nimport textEncoder from './textEncoder';\nimport timeout from './timeout';\n\nexport type EndowmentFactoryOptions = {\n snapId?: SnapId;\n};\n\nexport type EndowmentFactory = {\n names: readonly string[];\n factory: (options?: EndowmentFactoryOptions) => { [key: string]: unknown };\n};\n\nexport type CommonEndowmentSpecification = {\n endowment: unknown;\n name: string;\n bind?: boolean;\n};\n\n// Array of common endowments\nconst commonEndowments: CommonEndowmentSpecification[] = [\n { endowment: AbortController, name: 'AbortController' },\n { endowment: AbortSignal, name: 'AbortSignal' },\n { endowment: ArrayBuffer, name: 'ArrayBuffer' },\n { endowment: atob, name: 'atob', bind: true },\n { endowment: BigInt, name: 'BigInt' },\n { endowment: BigInt64Array, name: 'BigInt64Array' },\n { endowment: BigUint64Array, name: 'BigUint64Array' },\n { endowment: btoa, name: 'btoa', bind: true },\n { endowment: DataView, name: 'DataView' },\n { endowment: Float32Array, name: 'Float32Array' },\n { endowment: Float64Array, name: 'Float64Array' },\n { endowment: Int8Array, name: 'Int8Array' },\n { endowment: Int16Array, name: 'Int16Array' },\n { endowment: Int32Array, name: 'Int32Array' },\n { endowment: Uint8Array, name: 'Uint8Array' },\n { endowment: Uint8ClampedArray, name: 'Uint8ClampedArray' },\n { endowment: Uint16Array, name: 'Uint16Array' },\n { endowment: Uint32Array, name: 'Uint32Array' },\n { endowment: URL, name: 'URL' },\n { endowment: WebAssembly, name: 'WebAssembly' },\n];\n\n/**\n * Creates a consolidated collection of common endowments.\n * This function will return factories for all common endowments including\n * the additionally attenuated. All hardened with SES.\n *\n * @returns An object with common endowments.\n */\nconst buildCommonEndowments = (): EndowmentFactory[] => {\n const endowmentFactories: EndowmentFactory[] = [\n crypto,\n interval,\n math,\n network,\n timeout,\n textDecoder,\n textEncoder,\n date,\n consoleEndowment,\n ];\n\n commonEndowments.forEach((endowmentSpecification) => {\n const endowment = {\n names: [endowmentSpecification.name] as const,\n factory: () => {\n const boundEndowment =\n typeof endowmentSpecification.endowment === 'function' &&\n endowmentSpecification.bind\n ? endowmentSpecification.endowment.bind(rootRealmGlobal)\n : endowmentSpecification.endowment;\n return {\n [endowmentSpecification.name]: harden(boundEndowment),\n } as const;\n },\n };\n endowmentFactories.push(endowment);\n });\n\n return endowmentFactories;\n};\n\nexport default buildCommonEndowments;\n"],"names":["commonEndowments","endowment","AbortController","name","AbortSignal","ArrayBuffer","atob","bind","BigInt","BigInt64Array","BigUint64Array","btoa","DataView","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","URL","WebAssembly","buildCommonEndowments","endowmentFactories","crypto","interval","math","network","timeout","textDecoder","textEncoder","date","consoleEndowment","forEach","endowmentSpecification","names","factory","boundEndowment","rootRealmGlobal","harden","push"],"mappings":";;;;+BA4FA;;;eAAA;;;8BA1FgC;gEACH;+DACV;6DACF;iEACI;6DACJ;gEACG;oEACI;oEACA;gEACJ;;;;;;AAiBpB,6BAA6B;AAC7B,MAAMA,mBAAmD;IACvD;QAAEC,WAAWC;QAAiBC,MAAM;IAAkB;IACtD;QAAEF,WAAWG;QAAaD,MAAM;IAAc;IAC9C;QAAEF,WAAWI;QAAaF,MAAM;IAAc;IAC9C;QAAEF,WAAWK;QAAMH,MAAM;QAAQI,MAAM;IAAK;IAC5C;QAAEN,WAAWO;QAAQL,MAAM;IAAS;IACpC;QAAEF,WAAWQ;QAAeN,MAAM;IAAgB;IAClD;QAAEF,WAAWS;QAAgBP,MAAM;IAAiB;IACpD;QAAEF,WAAWU;QAAMR,MAAM;QAAQI,MAAM;IAAK;IAC5C;QAAEN,WAAWW;QAAUT,MAAM;IAAW;IACxC;QAAEF,WAAWY;QAAcV,MAAM;IAAe;IAChD;QAAEF,WAAWa;QAAcX,MAAM;IAAe;IAChD;QAAEF,WAAWc;QAAWZ,MAAM;IAAY;IAC1C;QAAEF,WAAWe;QAAYb,MAAM;IAAa;IAC5C;QAAEF,WAAWgB;QAAYd,MAAM;IAAa;IAC5C;QAAEF,WAAWiB;QAAYf,MAAM;IAAa;IAC5C;QAAEF,WAAWkB;QAAmBhB,MAAM;IAAoB;IAC1D;QAAEF,WAAWmB;QAAajB,MAAM;IAAc;IAC9C;QAAEF,WAAWoB;QAAalB,MAAM;IAAc;IAC9C;QAAEF,WAAWqB;QAAKnB,MAAM;IAAM;IAC9B;QAAEF,WAAWsB;QAAapB,MAAM;IAAc;CAC/C;AAED;;;;;;CAMC,GACD,MAAMqB,wBAAwB;IAC5B,MAAMC,qBAAyC;QAC7CC,eAAM;QACNC,iBAAQ;QACRC,aAAI;QACJC,gBAAO;QACPC,gBAAO;QACPC,oBAAW;QACXC,oBAAW;QACXC,aAAI;QACJC,gBAAgB;KACjB;IAEDlC,iBAAiBmC,OAAO,CAAC,CAACC;QACxB,MAAMnC,YAAY;YAChBoC,OAAO;gBAACD,uBAAuBjC,IAAI;aAAC;YACpCmC,SAAS;gBACP,MAAMC,iBACJ,OAAOH,uBAAuBnC,SAAS,KAAK,cAC5CmC,uBAAuB7B,IAAI,GACvB6B,uBAAuBnC,SAAS,CAACM,IAAI,CAACiC,6BAAe,IACrDJ,uBAAuBnC,SAAS;gBACtC,OAAO;oBACL,CAACmC,uBAAuBjC,IAAI,CAAC,EAAEsC,OAAOF;gBACxC;YACF;QACF;QACAd,mBAAmBiB,IAAI,CAACzC;IAC1B;IAEA,OAAOwB;AACT;MAEA,WAAeD"}
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
function _export(target, all) {
|
|
6
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: all[name]
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
_export(exports, {
|
|
12
|
-
consoleAttenuatedMethods: function() {
|
|
13
|
-
return consoleAttenuatedMethods;
|
|
14
|
-
},
|
|
15
|
-
consoleMethods: function() {
|
|
16
|
-
return consoleMethods;
|
|
17
|
-
},
|
|
18
|
-
default: function() {
|
|
19
|
-
return _default;
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
const _utils = require("@metamask/utils");
|
|
23
|
-
const _globalObject = require("../globalObject");
|
|
24
|
-
const consoleAttenuatedMethods = new Set([
|
|
25
|
-
'log',
|
|
26
|
-
'assert',
|
|
27
|
-
'error',
|
|
28
|
-
'debug',
|
|
29
|
-
'info',
|
|
30
|
-
'warn'
|
|
31
|
-
]);
|
|
32
|
-
const consoleMethods = new Set([
|
|
33
|
-
'debug',
|
|
34
|
-
'error',
|
|
35
|
-
'info',
|
|
36
|
-
'log',
|
|
37
|
-
'warn',
|
|
38
|
-
'dir',
|
|
39
|
-
'dirxml',
|
|
40
|
-
'table',
|
|
41
|
-
'trace',
|
|
42
|
-
'group',
|
|
43
|
-
'groupCollapsed',
|
|
44
|
-
'groupEnd',
|
|
45
|
-
'clear',
|
|
46
|
-
'count',
|
|
47
|
-
'countReset',
|
|
48
|
-
'assert',
|
|
49
|
-
'profile',
|
|
50
|
-
'profileEnd',
|
|
51
|
-
'time',
|
|
52
|
-
'timeLog',
|
|
53
|
-
'timeEnd',
|
|
54
|
-
'timeStamp',
|
|
55
|
-
'context'
|
|
56
|
-
]);
|
|
57
|
-
const consoleFunctions = [
|
|
58
|
-
'log',
|
|
59
|
-
'error',
|
|
60
|
-
'debug',
|
|
61
|
-
'info',
|
|
62
|
-
'warn'
|
|
63
|
-
];
|
|
64
|
-
/**
|
|
65
|
-
* Gets the appropriate (prepended) message to pass to one of the attenuated
|
|
66
|
-
* method calls.
|
|
67
|
-
*
|
|
68
|
-
* @param snapId - Id of the snap that we're getting a message for.
|
|
69
|
-
* @param message - The id of the snap that will interact with the endowment.
|
|
70
|
-
* @param args - The array of additional arguments.
|
|
71
|
-
* @returns An array of arguments to be passed into an attenuated console method call.
|
|
72
|
-
*/ function getMessage(snapId, message, ...args) {
|
|
73
|
-
const prefix = `[Snap: ${snapId}]`;
|
|
74
|
-
// If the first argument is a string, prepend the prefix to the message, and keep the
|
|
75
|
-
// rest of the arguments as-is.
|
|
76
|
-
if (typeof message === 'string') {
|
|
77
|
-
return [
|
|
78
|
-
`${prefix} ${message}`,
|
|
79
|
-
...args
|
|
80
|
-
];
|
|
81
|
-
}
|
|
82
|
-
// Otherwise, the `message` is an object, array, etc., so add the prefix as a separate
|
|
83
|
-
// message to the arguments.
|
|
84
|
-
return [
|
|
85
|
-
prefix,
|
|
86
|
-
message,
|
|
87
|
-
...args
|
|
88
|
-
];
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Create a a {@link console} object, with the same properties as the global
|
|
92
|
-
* {@link console} object, but with some methods replaced.
|
|
93
|
-
*
|
|
94
|
-
* @param options - Factory options used in construction of the endowment.
|
|
95
|
-
* @param options.snapId - The id of the snap that will interact with the endowment.
|
|
96
|
-
* @returns The {@link console} object with the replaced methods.
|
|
97
|
-
*/ function createConsole({ snapId } = {}) {
|
|
98
|
-
(0, _utils.assert)(snapId !== undefined);
|
|
99
|
-
const keys = Object.getOwnPropertyNames(_globalObject.rootRealmGlobal.console);
|
|
100
|
-
const attenuatedConsole = keys.reduce((target, key)=>{
|
|
101
|
-
if (consoleMethods.has(key) && !consoleAttenuatedMethods.has(key)) {
|
|
102
|
-
return {
|
|
103
|
-
...target,
|
|
104
|
-
[key]: _globalObject.rootRealmGlobal.console[key]
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
return target;
|
|
108
|
-
}, {});
|
|
109
|
-
return harden({
|
|
110
|
-
console: {
|
|
111
|
-
...attenuatedConsole,
|
|
112
|
-
assert: (value, message, ...optionalParams)=>{
|
|
113
|
-
_globalObject.rootRealmGlobal.console.assert(value, ...getMessage(snapId, message, ...optionalParams));
|
|
114
|
-
},
|
|
115
|
-
...consoleFunctions.reduce((target, key)=>{
|
|
116
|
-
return {
|
|
117
|
-
...target,
|
|
118
|
-
[key]: (message, ...optionalParams)=>{
|
|
119
|
-
_globalObject.rootRealmGlobal.console[key](...getMessage(snapId, message, ...optionalParams));
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
}, {})
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
const endowmentModule = {
|
|
127
|
-
names: [
|
|
128
|
-
'console'
|
|
129
|
-
],
|
|
130
|
-
factory: createConsole
|
|
131
|
-
};
|
|
132
|
-
const _default = endowmentModule;
|
|
133
|
-
|
|
134
|
-
//# sourceMappingURL=console.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/common/endowments/console.ts"],"sourcesContent":["import type { SnapId } from '@metamask/snaps-utils';\nimport { assert } from '@metamask/utils';\n\nimport { rootRealmGlobal } from '../globalObject';\nimport type { EndowmentFactoryOptions } from './commonEndowmentFactory';\n\nexport const consoleAttenuatedMethods = new Set([\n 'log',\n 'assert',\n 'error',\n 'debug',\n 'info',\n 'warn',\n]);\n\n/**\n * A set of all the `console` values that will be passed to the snap. This has\n * all the values that are available in both the browser and Node.js.\n */\nexport const consoleMethods = new Set([\n 'debug',\n 'error',\n 'info',\n 'log',\n 'warn',\n 'dir',\n 'dirxml',\n 'table',\n 'trace',\n 'group',\n 'groupCollapsed',\n 'groupEnd',\n 'clear',\n 'count',\n 'countReset',\n 'assert',\n 'profile',\n 'profileEnd',\n 'time',\n 'timeLog',\n 'timeEnd',\n 'timeStamp',\n 'context',\n]);\n\nconst consoleFunctions = ['log', 'error', 'debug', 'info', 'warn'] as const;\n\ntype ConsoleFunctions = {\n [Key in typeof consoleFunctions[number]]: typeof rootRealmGlobal.console[Key];\n};\n\n/**\n * Gets the appropriate (prepended) message to pass to one of the attenuated\n * method calls.\n *\n * @param snapId - Id of the snap that we're getting a message for.\n * @param message - The id of the snap that will interact with the endowment.\n * @param args - The array of additional arguments.\n * @returns An array of arguments to be passed into an attenuated console method call.\n */\nfunction getMessage(snapId: SnapId, message: unknown, ...args: unknown[]) {\n const prefix = `[Snap: ${snapId}]`;\n\n // If the first argument is a string, prepend the prefix to the message, and keep the\n // rest of the arguments as-is.\n if (typeof message === 'string') {\n return [`${prefix} ${message}`, ...args];\n }\n\n // Otherwise, the `message` is an object, array, etc., so add the prefix as a separate\n // message to the arguments.\n return [prefix, message, ...args];\n}\n\n/**\n * Create a a {@link console} object, with the same properties as the global\n * {@link console} object, but with some methods replaced.\n *\n * @param options - Factory options used in construction of the endowment.\n * @param options.snapId - The id of the snap that will interact with the endowment.\n * @returns The {@link console} object with the replaced methods.\n */\nfunction createConsole({ snapId }: EndowmentFactoryOptions = {}) {\n assert(snapId !== undefined);\n const keys = Object.getOwnPropertyNames(\n rootRealmGlobal.console,\n ) as (keyof typeof console)[];\n\n const attenuatedConsole = keys.reduce((target, key) => {\n if (consoleMethods.has(key) && !consoleAttenuatedMethods.has(key)) {\n return { ...target, [key]: rootRealmGlobal.console[key] };\n }\n\n return target;\n }, {});\n\n return harden({\n console: {\n ...attenuatedConsole,\n assert: (\n value: any,\n message?: string | undefined,\n ...optionalParams: any[]\n ) => {\n rootRealmGlobal.console.assert(\n value,\n ...getMessage(snapId, message, ...optionalParams),\n );\n },\n ...consoleFunctions.reduce<ConsoleFunctions>((target, key) => {\n return {\n ...target,\n [key]: (message?: unknown, ...optionalParams: any[]) => {\n rootRealmGlobal.console[key](\n ...getMessage(snapId, message, ...optionalParams),\n );\n },\n };\n }, {} as ConsoleFunctions),\n },\n });\n}\n\nconst endowmentModule = {\n names: ['console'] as const,\n factory: createConsole,\n};\n\nexport default endowmentModule;\n"],"names":["consoleAttenuatedMethods","consoleMethods","Set","consoleFunctions","getMessage","snapId","message","args","prefix","createConsole","assert","undefined","keys","Object","getOwnPropertyNames","rootRealmGlobal","console","attenuatedConsole","reduce","target","key","has","harden","value","optionalParams","endowmentModule","names","factory"],"mappings":";;;;;;;;;;;IAMaA,wBAAwB;eAAxBA;;IAaAC,cAAc;eAAdA;;IA6Gb,OAA+B;eAA/B;;;uBA/HuB;8BAES;AAGzB,MAAMD,2BAA2B,IAAIE,IAAI;IAC9C;IACA;IACA;IACA;IACA;IACA;CACD;AAMM,MAAMD,iBAAiB,IAAIC,IAAI;IACpC;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAED,MAAMC,mBAAmB;IAAC;IAAO;IAAS;IAAS;IAAQ;CAAO;AAMlE;;;;;;;;CAQC,GACD,SAASC,WAAWC,MAAc,EAAEC,OAAgB,EAAE,GAAGC,IAAe;IACtE,MAAMC,SAAS,CAAC,OAAO,EAAEH,OAAO,CAAC,CAAC;IAElC,qFAAqF;IACrF,+BAA+B;IAC/B,IAAI,OAAOC,YAAY,UAAU;QAC/B,OAAO;YAAC,CAAC,EAAEE,OAAO,CAAC,EAAEF,QAAQ,CAAC;eAAKC;SAAK;IAC1C;IAEA,sFAAsF;IACtF,4BAA4B;IAC5B,OAAO;QAACC;QAAQF;WAAYC;KAAK;AACnC;AAEA;;;;;;;CAOC,GACD,SAASE,cAAc,EAAEJ,MAAM,EAA2B,GAAG,CAAC,CAAC;IAC7DK,IAAAA,aAAM,EAACL,WAAWM;IAClB,MAAMC,OAAOC,OAAOC,mBAAmB,CACrCC,6BAAe,CAACC,OAAO;IAGzB,MAAMC,oBAAoBL,KAAKM,MAAM,CAAC,CAACC,QAAQC;QAC7C,IAAInB,eAAeoB,GAAG,CAACD,QAAQ,CAACpB,yBAAyBqB,GAAG,CAACD,MAAM;YACjE,OAAO;gBAAE,GAAGD,MAAM;gBAAE,CAACC,IAAI,EAAEL,6BAAe,CAACC,OAAO,CAACI,IAAI;YAAC;QAC1D;QAEA,OAAOD;IACT,GAAG,CAAC;IAEJ,OAAOG,OAAO;QACZN,SAAS;YACP,GAAGC,iBAAiB;YACpBP,QAAQ,CACNa,OACAjB,SACA,GAAGkB;gBAEHT,6BAAe,CAACC,OAAO,CAACN,MAAM,CAC5Ba,UACGnB,WAAWC,QAAQC,YAAYkB;YAEtC;YACA,GAAGrB,iBAAiBe,MAAM,CAAmB,CAACC,QAAQC;gBACpD,OAAO;oBACL,GAAGD,MAAM;oBACT,CAACC,IAAI,EAAE,CAACd,SAAmB,GAAGkB;wBAC5BT,6BAAe,CAACC,OAAO,CAACI,IAAI,IACvBhB,WAAWC,QAAQC,YAAYkB;oBAEtC;gBACF;YACF,GAAG,CAAC,EAAsB;QAC5B;IACF;AACF;AAEA,MAAMC,kBAAkB;IACtBC,OAAO;QAAC;KAAU;IAClBC,SAASlB;AACX;MAEA,WAAegB"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
function _export(target, all) {
|
|
6
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: all[name]
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
_export(exports, {
|
|
12
|
-
createCrypto: function() {
|
|
13
|
-
return createCrypto;
|
|
14
|
-
},
|
|
15
|
-
default: function() {
|
|
16
|
-
return _default;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
const _globalObject = require("../globalObject");
|
|
20
|
-
const createCrypto = ()=>{
|
|
21
|
-
if ('crypto' in _globalObject.rootRealmGlobal && typeof _globalObject.rootRealmGlobal.crypto === 'object' && 'SubtleCrypto' in _globalObject.rootRealmGlobal && typeof _globalObject.rootRealmGlobal.SubtleCrypto === 'function') {
|
|
22
|
-
return {
|
|
23
|
-
crypto: harden(_globalObject.rootRealmGlobal.crypto),
|
|
24
|
-
SubtleCrypto: harden(_globalObject.rootRealmGlobal.SubtleCrypto)
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
// For now, we expose the experimental webcrypto API for Node.js execution environments
|
|
28
|
-
// TODO: Figure out if this is enough long-term or if we should use a polyfill.
|
|
29
|
-
/* eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires, n/global-require */ const crypto = require('crypto').webcrypto;
|
|
30
|
-
return {
|
|
31
|
-
crypto: harden(crypto),
|
|
32
|
-
SubtleCrypto: harden(crypto.subtle.constructor)
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
const endowmentModule = {
|
|
36
|
-
names: [
|
|
37
|
-
'crypto',
|
|
38
|
-
'SubtleCrypto'
|
|
39
|
-
],
|
|
40
|
-
factory: createCrypto
|
|
41
|
-
};
|
|
42
|
-
const _default = endowmentModule;
|
|
43
|
-
|
|
44
|
-
//# sourceMappingURL=crypto.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/common/endowments/crypto.ts"],"sourcesContent":["import { rootRealmGlobal } from '../globalObject';\n\nexport const createCrypto = () => {\n if (\n 'crypto' in rootRealmGlobal &&\n typeof rootRealmGlobal.crypto === 'object' &&\n 'SubtleCrypto' in rootRealmGlobal &&\n typeof rootRealmGlobal.SubtleCrypto === 'function'\n ) {\n return {\n crypto: harden(rootRealmGlobal.crypto),\n SubtleCrypto: harden(rootRealmGlobal.SubtleCrypto),\n };\n }\n // For now, we expose the experimental webcrypto API for Node.js execution environments\n // TODO: Figure out if this is enough long-term or if we should use a polyfill.\n /* eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires, n/global-require */\n const crypto = require('crypto').webcrypto;\n return {\n crypto: harden(crypto),\n SubtleCrypto: harden(crypto.subtle.constructor),\n } as const;\n};\n\nconst endowmentModule = {\n names: ['crypto', 'SubtleCrypto'] as const,\n factory: createCrypto,\n};\nexport default endowmentModule;\n"],"names":["createCrypto","rootRealmGlobal","crypto","SubtleCrypto","harden","require","webcrypto","subtle","constructor","endowmentModule","names","factory"],"mappings":";;;;;;;;;;;IAEaA,YAAY;eAAZA;;IA0Bb,OAA+B;eAA/B;;;8BA5BgC;AAEzB,MAAMA,eAAe;IAC1B,IACE,YAAYC,6BAAe,IAC3B,OAAOA,6BAAe,CAACC,MAAM,KAAK,YAClC,kBAAkBD,6BAAe,IACjC,OAAOA,6BAAe,CAACE,YAAY,KAAK,YACxC;QACA,OAAO;YACLD,QAAQE,OAAOH,6BAAe,CAACC,MAAM;YACrCC,cAAcC,OAAOH,6BAAe,CAACE,YAAY;QACnD;IACF;IACA,uFAAuF;IACvF,+EAA+E;IAC/E,wHAAwH,GACxH,MAAMD,SAASG,QAAQ,UAAUC,SAAS;IAC1C,OAAO;QACLJ,QAAQE,OAAOF;QACfC,cAAcC,OAAOF,OAAOK,MAAM,CAACC,WAAW;IAChD;AACF;AAEA,MAAMC,kBAAkB;IACtBC,OAAO;QAAC;QAAU;KAAe;IACjCC,SAASX;AACX;MACA,WAAeS"}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "default", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return _default;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _globalObject = require("../globalObject");
|
|
12
|
-
/**
|
|
13
|
-
* Creates a {@link Date} constructor, with most of the same properties as the global object.
|
|
14
|
-
* The Date.now() function has added noise as to limit its precision and prevent potential timing attacks.
|
|
15
|
-
* The Date constructor uses this now() function to seed itself if no arguments are given to the constructor.
|
|
16
|
-
*
|
|
17
|
-
* @returns A modified {@link Date} constructor with limited precision.
|
|
18
|
-
*/ function createDate() {
|
|
19
|
-
const keys = Object.getOwnPropertyNames(_globalObject.rootRealmGlobal.Date);
|
|
20
|
-
let currentTime = 0;
|
|
21
|
-
const now = ()=>{
|
|
22
|
-
const actual = _globalObject.rootRealmGlobal.Date.now();
|
|
23
|
-
const newTime = Math.round(actual + Math.random());
|
|
24
|
-
if (newTime > currentTime) {
|
|
25
|
-
currentTime = newTime;
|
|
26
|
-
}
|
|
27
|
-
return currentTime;
|
|
28
|
-
};
|
|
29
|
-
const NewDate = function(...args) {
|
|
30
|
-
return Reflect.construct(_globalObject.rootRealmGlobal.Date, args.length === 0 ? [
|
|
31
|
-
now()
|
|
32
|
-
] : args, new.target);
|
|
33
|
-
};
|
|
34
|
-
keys.forEach((key)=>{
|
|
35
|
-
Reflect.defineProperty(NewDate, key, {
|
|
36
|
-
configurable: false,
|
|
37
|
-
writable: false,
|
|
38
|
-
value: key === 'now' ? now : _globalObject.rootRealmGlobal.Date[key]
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
return {
|
|
42
|
-
Date: harden(NewDate)
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
const endowmentModule = {
|
|
46
|
-
names: [
|
|
47
|
-
'Date'
|
|
48
|
-
],
|
|
49
|
-
factory: createDate
|
|
50
|
-
};
|
|
51
|
-
const _default = endowmentModule;
|
|
52
|
-
|
|
53
|
-
//# sourceMappingURL=date.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/common/endowments/date.ts"],"sourcesContent":["import { rootRealmGlobal } from '../globalObject';\n\n/**\n * Creates a {@link Date} constructor, with most of the same properties as the global object.\n * The Date.now() function has added noise as to limit its precision and prevent potential timing attacks.\n * The Date constructor uses this now() function to seed itself if no arguments are given to the constructor.\n *\n * @returns A modified {@link Date} constructor with limited precision.\n */\nfunction createDate() {\n const keys = Object.getOwnPropertyNames(\n rootRealmGlobal.Date,\n ) as (keyof typeof Date)[];\n\n let currentTime = 0;\n const now = () => {\n const actual = rootRealmGlobal.Date.now();\n const newTime = Math.round(actual + Math.random());\n if (newTime > currentTime) {\n currentTime = newTime;\n }\n return currentTime;\n };\n\n const NewDate = function (...args: unknown[]) {\n return Reflect.construct(\n rootRealmGlobal.Date,\n args.length === 0 ? [now()] : args,\n new.target,\n );\n } as DateConstructor;\n\n keys.forEach((key) => {\n Reflect.defineProperty(NewDate, key, {\n configurable: false,\n writable: false,\n value: key === 'now' ? now : rootRealmGlobal.Date[key],\n });\n });\n\n return { Date: harden(NewDate) };\n}\n\nconst endowmentModule = {\n names: ['Date'] as const,\n factory: createDate,\n};\n\nexport default endowmentModule;\n"],"names":["createDate","keys","Object","getOwnPropertyNames","rootRealmGlobal","Date","currentTime","now","actual","newTime","Math","round","random","NewDate","args","Reflect","construct","length","forEach","key","defineProperty","configurable","writable","value","harden","endowmentModule","names","factory"],"mappings":";;;;+BAgDA;;;eAAA;;;8BAhDgC;AAEhC;;;;;;CAMC,GACD,SAASA;IACP,MAAMC,OAAOC,OAAOC,mBAAmB,CACrCC,6BAAe,CAACC,IAAI;IAGtB,IAAIC,cAAc;IAClB,MAAMC,MAAM;QACV,MAAMC,SAASJ,6BAAe,CAACC,IAAI,CAACE,GAAG;QACvC,MAAME,UAAUC,KAAKC,KAAK,CAACH,SAASE,KAAKE,MAAM;QAC/C,IAAIH,UAAUH,aAAa;YACzBA,cAAcG;QAChB;QACA,OAAOH;IACT;IAEA,MAAMO,UAAU,SAAU,GAAGC,IAAe;QAC1C,OAAOC,QAAQC,SAAS,CACtBZ,6BAAe,CAACC,IAAI,EACpBS,KAAKG,MAAM,KAAK,IAAI;YAACV;SAAM,GAAGO,MAC9B;IAEJ;IAEAb,KAAKiB,OAAO,CAAC,CAACC;QACZJ,QAAQK,cAAc,CAACP,SAASM,KAAK;YACnCE,cAAc;YACdC,UAAU;YACVC,OAAOJ,QAAQ,QAAQZ,MAAMH,6BAAe,CAACC,IAAI,CAACc,IAAI;QACxD;IACF;IAEA,OAAO;QAAEd,MAAMmB,OAAOX;IAAS;AACjC;AAEA,MAAMY,kBAAkB;IACtBC,OAAO;QAAC;KAAO;IACfC,SAAS3B;AACX;MAEA,WAAeyB"}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "createEndowments", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return createEndowments;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _snapsutils = require("@metamask/snaps-utils");
|
|
12
|
-
const _utils = require("@metamask/utils");
|
|
13
|
-
const _globalObject = require("../globalObject");
|
|
14
|
-
const _commonEndowmentFactory = /*#__PURE__*/ _interop_require_default(require("./commonEndowmentFactory"));
|
|
15
|
-
function _interop_require_default(obj) {
|
|
16
|
-
return obj && obj.__esModule ? obj : {
|
|
17
|
-
default: obj
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Retrieve consolidated endowment factories for common endowments.
|
|
22
|
-
*/ const registeredEndowments = (0, _commonEndowmentFactory.default)();
|
|
23
|
-
/**
|
|
24
|
-
* A map of endowment names to their factory functions. Some endowments share
|
|
25
|
-
* the same factory function, but we only call each factory once for each snap.
|
|
26
|
-
* See {@link createEndowments} for details.
|
|
27
|
-
*/ const endowmentFactories = registeredEndowments.reduce((factories, builder)=>{
|
|
28
|
-
builder.names.forEach((name)=>{
|
|
29
|
-
factories.set(name, builder.factory);
|
|
30
|
-
});
|
|
31
|
-
return factories;
|
|
32
|
-
}, new Map());
|
|
33
|
-
function createEndowments(snap, ethereum, snapId, endowments = []) {
|
|
34
|
-
const attenuatedEndowments = {};
|
|
35
|
-
// TODO: All endowments should be hardened to prevent covert communication
|
|
36
|
-
// channels. Hardening the returned objects breaks tests elsewhere in the
|
|
37
|
-
// monorepo, so further research is needed.
|
|
38
|
-
const result = endowments.reduce(({ allEndowments, teardowns }, endowmentName)=>{
|
|
39
|
-
// First, check if the endowment has a factory, and default to that.
|
|
40
|
-
if (endowmentFactories.has(endowmentName)) {
|
|
41
|
-
if (!(0, _utils.hasProperty)(attenuatedEndowments, endowmentName)) {
|
|
42
|
-
// Call the endowment factory for the current endowment. If the factory
|
|
43
|
-
// creates multiple endowments, they will all be assigned to the
|
|
44
|
-
// `attenuatedEndowments` object, but will only be passed on to the snap
|
|
45
|
-
// if explicitly listed among its endowment.
|
|
46
|
-
// This may not have an actual use case, but, safety first.
|
|
47
|
-
// We just confirmed that endowmentFactories has the specified key.
|
|
48
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
49
|
-
const { teardownFunction, ...endowment } = endowmentFactories.get(endowmentName)({
|
|
50
|
-
snapId
|
|
51
|
-
});
|
|
52
|
-
Object.assign(attenuatedEndowments, endowment);
|
|
53
|
-
if (teardownFunction) {
|
|
54
|
-
teardowns.push(teardownFunction);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
allEndowments[endowmentName] = attenuatedEndowments[endowmentName];
|
|
58
|
-
} else if (endowmentName === 'ethereum') {
|
|
59
|
-
// Special case for adding the EIP-1193 provider.
|
|
60
|
-
allEndowments[endowmentName] = ethereum;
|
|
61
|
-
} else if (endowmentName in _globalObject.rootRealmGlobal) {
|
|
62
|
-
(0, _snapsutils.logWarning)(`Access to unhardened global ${endowmentName}.`);
|
|
63
|
-
// If the endowment doesn't have a factory, just use whatever is on the
|
|
64
|
-
// global object.
|
|
65
|
-
const globalValue = _globalObject.rootRealmGlobal[endowmentName];
|
|
66
|
-
allEndowments[endowmentName] = globalValue;
|
|
67
|
-
} else {
|
|
68
|
-
// If we get to this point, we've been passed an endowment that doesn't
|
|
69
|
-
// exist in our current environment.
|
|
70
|
-
throw new Error(`Unknown endowment: "${endowmentName}".`);
|
|
71
|
-
}
|
|
72
|
-
return {
|
|
73
|
-
allEndowments,
|
|
74
|
-
teardowns
|
|
75
|
-
};
|
|
76
|
-
}, {
|
|
77
|
-
allEndowments: {
|
|
78
|
-
snap
|
|
79
|
-
},
|
|
80
|
-
teardowns: []
|
|
81
|
-
});
|
|
82
|
-
const teardown = async ()=>{
|
|
83
|
-
await Promise.all(result.teardowns.map((teardownFunction)=>teardownFunction()));
|
|
84
|
-
};
|
|
85
|
-
return {
|
|
86
|
-
endowments: result.allEndowments,
|
|
87
|
-
teardown
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/common/endowments/index.ts"],"sourcesContent":["import type { StreamProvider } from '@metamask/providers';\nimport type { SnapsGlobalObject } from '@metamask/rpc-methods';\nimport type { SnapId } from '@metamask/snaps-utils';\nimport { logWarning } from '@metamask/snaps-utils';\nimport { hasProperty } from '@metamask/utils';\n\nimport { rootRealmGlobal } from '../globalObject';\nimport type { EndowmentFactoryOptions } from './commonEndowmentFactory';\nimport buildCommonEndowments from './commonEndowmentFactory';\n\ntype EndowmentFactoryResult = {\n /**\n * A function that performs any necessary teardown when the snap becomes idle.\n *\n * NOTE:** The endowments are not reconstructed if the snap is re-invoked\n * before being terminated, so the teardown operation must not render the\n * endowments unusable; it should simply restore the endowments to their\n * original state.\n */\n teardownFunction?: () => Promise<void> | void;\n [key: string]: unknown;\n};\n\n/**\n * Retrieve consolidated endowment factories for common endowments.\n */\nconst registeredEndowments = buildCommonEndowments();\n\n/**\n * A map of endowment names to their factory functions. Some endowments share\n * the same factory function, but we only call each factory once for each snap.\n * See {@link createEndowments} for details.\n */\nconst endowmentFactories = registeredEndowments.reduce((factories, builder) => {\n builder.names.forEach((name) => {\n factories.set(name, builder.factory);\n });\n return factories;\n}, new Map<string, (options?: EndowmentFactoryOptions) => EndowmentFactoryResult>());\n\n/**\n * Gets the endowments for a particular Snap. Some endowments, like `setTimeout`\n * and `clearTimeout`, must be attenuated so that they can only affect behavior\n * within the Snap's own realm. Therefore, we use factory functions to create\n * such attenuated / modified endowments. Otherwise, the value that's on the\n * root realm global will be used.\n *\n * @param snap - The Snaps global API object.\n * @param ethereum - The Snap's EIP-1193 provider object.\n * @param snapId - The id of the snap that will use the created endowments.\n * @param endowments - The list of endowments to provide to the snap.\n * @returns An object containing the Snap's endowments.\n */\nexport function createEndowments(\n snap: SnapsGlobalObject,\n ethereum: StreamProvider,\n snapId: SnapId,\n endowments: string[] = [],\n): { endowments: Record<string, unknown>; teardown: () => Promise<void> } {\n const attenuatedEndowments: Record<string, unknown> = {};\n\n // TODO: All endowments should be hardened to prevent covert communication\n // channels. Hardening the returned objects breaks tests elsewhere in the\n // monorepo, so further research is needed.\n const result = endowments.reduce<{\n allEndowments: Record<string, unknown>;\n teardowns: (() => Promise<void> | void)[];\n }>(\n ({ allEndowments, teardowns }, endowmentName) => {\n // First, check if the endowment has a factory, and default to that.\n if (endowmentFactories.has(endowmentName)) {\n if (!hasProperty(attenuatedEndowments, endowmentName)) {\n // Call the endowment factory for the current endowment. If the factory\n // creates multiple endowments, they will all be assigned to the\n // `attenuatedEndowments` object, but will only be passed on to the snap\n // if explicitly listed among its endowment.\n // This may not have an actual use case, but, safety first.\n\n // We just confirmed that endowmentFactories has the specified key.\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const { teardownFunction, ...endowment } = endowmentFactories.get(\n endowmentName,\n )!({ snapId });\n Object.assign(attenuatedEndowments, endowment);\n if (teardownFunction) {\n teardowns.push(teardownFunction);\n }\n }\n allEndowments[endowmentName] = attenuatedEndowments[endowmentName];\n } else if (endowmentName === 'ethereum') {\n // Special case for adding the EIP-1193 provider.\n allEndowments[endowmentName] = ethereum;\n } else if (endowmentName in rootRealmGlobal) {\n logWarning(`Access to unhardened global ${endowmentName}.`);\n // If the endowment doesn't have a factory, just use whatever is on the\n // global object.\n const globalValue = (rootRealmGlobal as Record<string, unknown>)[\n endowmentName\n ];\n allEndowments[endowmentName] = globalValue;\n } else {\n // If we get to this point, we've been passed an endowment that doesn't\n // exist in our current environment.\n throw new Error(`Unknown endowment: \"${endowmentName}\".`);\n }\n return { allEndowments, teardowns };\n },\n {\n allEndowments: { snap },\n teardowns: [],\n },\n );\n\n const teardown = async () => {\n await Promise.all(\n result.teardowns.map((teardownFunction) => teardownFunction()),\n );\n };\n return { endowments: result.allEndowments, teardown };\n}\n"],"names":["createEndowments","registeredEndowments","buildCommonEndowments","endowmentFactories","reduce","factories","builder","names","forEach","name","set","factory","Map","snap","ethereum","snapId","endowments","attenuatedEndowments","result","allEndowments","teardowns","endowmentName","has","hasProperty","teardownFunction","endowment","get","Object","assign","push","rootRealmGlobal","logWarning","globalValue","Error","teardown","Promise","all","map"],"mappings":";;;;+BAqDgBA;;;eAAAA;;;4BAlDW;uBACC;8BAEI;+EAEE;;;;;;AAelC;;CAEC,GACD,MAAMC,uBAAuBC,IAAAA,+BAAqB;AAElD;;;;CAIC,GACD,MAAMC,qBAAqBF,qBAAqBG,MAAM,CAAC,CAACC,WAAWC;IACjEA,QAAQC,KAAK,CAACC,OAAO,CAAC,CAACC;QACrBJ,UAAUK,GAAG,CAACD,MAAMH,QAAQK,OAAO;IACrC;IACA,OAAON;AACT,GAAG,IAAIO;AAeA,SAASZ,iBACda,IAAuB,EACvBC,QAAwB,EACxBC,MAAc,EACdC,aAAuB,EAAE;IAEzB,MAAMC,uBAAgD,CAAC;IAEvD,0EAA0E;IAC1E,yEAAyE;IACzE,2CAA2C;IAC3C,MAAMC,SAASF,WAAWZ,MAAM,CAI9B,CAAC,EAAEe,aAAa,EAAEC,SAAS,EAAE,EAAEC;QAC7B,oEAAoE;QACpE,IAAIlB,mBAAmBmB,GAAG,CAACD,gBAAgB;YACzC,IAAI,CAACE,IAAAA,kBAAW,EAACN,sBAAsBI,gBAAgB;gBACrD,uEAAuE;gBACvE,gEAAgE;gBAChE,wEAAwE;gBACxE,4CAA4C;gBAC5C,2DAA2D;gBAE3D,mEAAmE;gBACnE,oEAAoE;gBACpE,MAAM,EAAEG,gBAAgB,EAAE,GAAGC,WAAW,GAAGtB,mBAAmBuB,GAAG,CAC/DL,eACC;oBAAEN;gBAAO;gBACZY,OAAOC,MAAM,CAACX,sBAAsBQ;gBACpC,IAAID,kBAAkB;oBACpBJ,UAAUS,IAAI,CAACL;gBACjB;YACF;YACAL,aAAa,CAACE,cAAc,GAAGJ,oBAAoB,CAACI,cAAc;QACpE,OAAO,IAAIA,kBAAkB,YAAY;YACvC,iDAAiD;YACjDF,aAAa,CAACE,cAAc,GAAGP;QACjC,OAAO,IAAIO,iBAAiBS,6BAAe,EAAE;YAC3CC,IAAAA,sBAAU,EAAC,CAAC,4BAA4B,EAAEV,cAAc,CAAC,CAAC;YAC1D,uEAAuE;YACvE,iBAAiB;YACjB,MAAMW,cAAc,AAACF,6BAAe,AAA4B,CAC9DT,cACD;YACDF,aAAa,CAACE,cAAc,GAAGW;QACjC,OAAO;YACL,uEAAuE;YACvE,oCAAoC;YACpC,MAAM,IAAIC,MAAM,CAAC,oBAAoB,EAAEZ,cAAc,EAAE,CAAC;QAC1D;QACA,OAAO;YAAEF;YAAeC;QAAU;IACpC,GACA;QACED,eAAe;YAAEN;QAAK;QACtBO,WAAW,EAAE;IACf;IAGF,MAAMc,WAAW;QACf,MAAMC,QAAQC,GAAG,CACflB,OAAOE,SAAS,CAACiB,GAAG,CAAC,CAACb,mBAAqBA;IAE/C;IACA,OAAO;QAAER,YAAYE,OAAOC,aAAa;QAAEe;IAAS;AACtD"}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "default", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return _default;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const MINIMUM_INTERVAL = 10;
|
|
12
|
-
/**
|
|
13
|
-
* Creates a pair of `setInterval` and `clearInterval` functions attenuated such
|
|
14
|
-
* that:
|
|
15
|
-
* - `setInterval` throws if its "handler" parameter is not a function.
|
|
16
|
-
* - `clearInterval` only clears timeouts created by its sibling `setInterval`,
|
|
17
|
-
* or else no-ops.
|
|
18
|
-
*
|
|
19
|
-
* @returns An object with the attenuated `setInterval` and `clearInterval`
|
|
20
|
-
* functions.
|
|
21
|
-
*/ const createInterval = ()=>{
|
|
22
|
-
const registeredHandles = new Map();
|
|
23
|
-
const _setInterval = (handler, timeout)=>{
|
|
24
|
-
if (typeof handler !== 'function') {
|
|
25
|
-
throw new Error(`The interval handler must be a function. Received: ${typeof handler}`);
|
|
26
|
-
}
|
|
27
|
-
harden(handler);
|
|
28
|
-
const handle = Object.freeze(Object.create(null));
|
|
29
|
-
const platformHandle = setInterval(handler, Math.max(MINIMUM_INTERVAL, timeout ?? 0));
|
|
30
|
-
registeredHandles.set(handle, platformHandle);
|
|
31
|
-
return handle;
|
|
32
|
-
};
|
|
33
|
-
const _clearInterval = (handle)=>{
|
|
34
|
-
harden(handle);
|
|
35
|
-
const platformHandle = registeredHandles.get(handle);
|
|
36
|
-
if (platformHandle !== undefined) {
|
|
37
|
-
clearInterval(platformHandle);
|
|
38
|
-
registeredHandles.delete(handle);
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
const teardownFunction = ()=>{
|
|
42
|
-
for (const handle of registeredHandles.keys()){
|
|
43
|
-
_clearInterval(handle);
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
return {
|
|
47
|
-
setInterval: harden(_setInterval),
|
|
48
|
-
clearInterval: harden(_clearInterval),
|
|
49
|
-
teardownFunction
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
const endowmentModule = {
|
|
53
|
-
names: [
|
|
54
|
-
'setInterval',
|
|
55
|
-
'clearInterval'
|
|
56
|
-
],
|
|
57
|
-
factory: createInterval
|
|
58
|
-
};
|
|
59
|
-
const _default = endowmentModule;
|
|
60
|
-
|
|
61
|
-
//# sourceMappingURL=interval.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/common/endowments/interval.ts"],"sourcesContent":["const MINIMUM_INTERVAL = 10;\n\n/**\n * Creates a pair of `setInterval` and `clearInterval` functions attenuated such\n * that:\n * - `setInterval` throws if its \"handler\" parameter is not a function.\n * - `clearInterval` only clears timeouts created by its sibling `setInterval`,\n * or else no-ops.\n *\n * @returns An object with the attenuated `setInterval` and `clearInterval`\n * functions.\n */\nconst createInterval = () => {\n const registeredHandles = new Map<unknown, unknown>();\n\n const _setInterval = (handler: TimerHandler, timeout?: number): unknown => {\n if (typeof handler !== 'function') {\n throw new Error(\n `The interval handler must be a function. Received: ${typeof handler}`,\n );\n }\n harden(handler);\n const handle = Object.freeze(Object.create(null));\n const platformHandle = setInterval(\n handler,\n Math.max(MINIMUM_INTERVAL, timeout ?? 0),\n );\n registeredHandles.set(handle, platformHandle);\n return handle;\n };\n\n const _clearInterval = (handle: unknown): void => {\n harden(handle);\n const platformHandle = registeredHandles.get(handle);\n if (platformHandle !== undefined) {\n clearInterval(platformHandle as any);\n registeredHandles.delete(handle);\n }\n };\n\n const teardownFunction = (): void => {\n for (const handle of registeredHandles.keys()) {\n _clearInterval(handle);\n }\n };\n\n return {\n setInterval: harden(_setInterval),\n clearInterval: harden(_clearInterval),\n teardownFunction,\n } as const;\n};\n\nconst endowmentModule = {\n names: ['setInterval', 'clearInterval'] as const,\n factory: createInterval,\n};\nexport default endowmentModule;\n"],"names":["MINIMUM_INTERVAL","createInterval","registeredHandles","Map","_setInterval","handler","timeout","Error","harden","handle","Object","freeze","create","platformHandle","setInterval","Math","max","set","_clearInterval","get","undefined","clearInterval","delete","teardownFunction","keys","endowmentModule","names","factory"],"mappings":";;;;+BAyDA;;;eAAA;;;AAzDA,MAAMA,mBAAmB;AAEzB;;;;;;;;;CASC,GACD,MAAMC,iBAAiB;IACrB,MAAMC,oBAAoB,IAAIC;IAE9B,MAAMC,eAAe,CAACC,SAAuBC;QAC3C,IAAI,OAAOD,YAAY,YAAY;YACjC,MAAM,IAAIE,MACR,CAAC,mDAAmD,EAAE,OAAOF,QAAQ,CAAC;QAE1E;QACAG,OAAOH;QACP,MAAMI,SAASC,OAAOC,MAAM,CAACD,OAAOE,MAAM,CAAC;QAC3C,MAAMC,iBAAiBC,YACrBT,SACAU,KAAKC,GAAG,CAAChB,kBAAkBM,WAAW;QAExCJ,kBAAkBe,GAAG,CAACR,QAAQI;QAC9B,OAAOJ;IACT;IAEA,MAAMS,iBAAiB,CAACT;QACtBD,OAAOC;QACP,MAAMI,iBAAiBX,kBAAkBiB,GAAG,CAACV;QAC7C,IAAII,mBAAmBO,WAAW;YAChCC,cAAcR;YACdX,kBAAkBoB,MAAM,CAACb;QAC3B;IACF;IAEA,MAAMc,mBAAmB;QACvB,KAAK,MAAMd,UAAUP,kBAAkBsB,IAAI,GAAI;YAC7CN,eAAeT;QACjB;IACF;IAEA,OAAO;QACLK,aAAaN,OAAOJ;QACpBiB,eAAeb,OAAOU;QACtBK;IACF;AACF;AAEA,MAAME,kBAAkB;IACtBC,OAAO;QAAC;QAAe;KAAgB;IACvCC,SAAS1B;AACX;MACA,WAAewB"}
|