@metamask/snaps-execution-environments 6.6.1 → 6.7.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 +19 -1
- package/dist/common/BaseSnapExecutor.cjs +436 -0
- package/dist/common/BaseSnapExecutor.cjs.map +1 -0
- package/dist/{types/common/BaseSnapExecutor.d.ts → common/BaseSnapExecutor.d.cts} +8 -6
- package/dist/common/BaseSnapExecutor.d.cts.map +1 -0
- package/dist/common/BaseSnapExecutor.d.mts +70 -0
- package/dist/common/BaseSnapExecutor.d.mts.map +1 -0
- package/dist/common/BaseSnapExecutor.mjs +430 -24
- package/dist/common/BaseSnapExecutor.mjs.map +1 -1
- package/dist/common/commands.cjs +95 -0
- package/dist/common/commands.cjs.map +1 -0
- package/dist/{types/common/commands.d.ts → common/commands.d.cts} +5 -4
- package/dist/common/commands.d.cts.map +1 -0
- package/dist/common/commands.d.mts +31 -0
- package/dist/common/commands.d.mts.map +1 -0
- package/dist/common/commands.mjs +89 -10
- package/dist/common/commands.mjs.map +1 -1
- package/dist/common/endowments/commonEndowmentFactory.cjs +76 -0
- package/dist/common/endowments/commonEndowmentFactory.cjs.map +1 -0
- package/dist/{types/common/endowments/commonEndowmentFactory.d.ts → common/endowments/commonEndowmentFactory.d.cts} +5 -4
- package/dist/common/endowments/commonEndowmentFactory.d.cts.map +1 -0
- package/dist/common/endowments/commonEndowmentFactory.d.mts +26 -0
- package/dist/common/endowments/commonEndowmentFactory.d.mts.map +1 -0
- package/dist/common/endowments/commonEndowmentFactory.mjs +69 -18
- package/dist/common/endowments/commonEndowmentFactory.mjs.map +1 -1
- package/dist/common/endowments/console.cjs +103 -0
- package/dist/common/endowments/console.cjs.map +1 -0
- package/dist/{types/common/endowments/console.d.ts → common/endowments/console.d.cts} +2 -1
- package/dist/common/endowments/console.d.cts.map +1 -0
- package/dist/common/endowments/console.d.mts +46 -0
- package/dist/common/endowments/console.d.mts.map +1 -0
- package/dist/common/endowments/console.mjs +98 -11
- package/dist/common/endowments/console.mjs.map +1 -1
- package/dist/common/endowments/crypto.cjs +30 -0
- package/dist/common/endowments/crypto.cjs.map +1 -0
- package/dist/{types/common/endowments/crypto.d.ts → common/endowments/crypto.d.cts} +1 -0
- package/dist/common/endowments/crypto.d.cts.map +1 -0
- package/dist/common/endowments/crypto.d.mts +13 -0
- package/dist/common/endowments/crypto.d.mts.map +1 -0
- package/dist/common/endowments/crypto.mjs +24 -9
- package/dist/common/endowments/crypto.mjs.map +1 -1
- package/dist/common/endowments/date.cjs +39 -0
- package/dist/common/endowments/date.cjs.map +1 -0
- package/dist/{types/common/endowments/date.d.ts → common/endowments/date.d.cts} +1 -0
- package/dist/common/endowments/date.d.cts.map +1 -0
- package/dist/common/endowments/date.d.mts +16 -0
- package/dist/common/endowments/date.d.mts.map +1 -0
- package/dist/common/endowments/date.mjs +35 -7
- package/dist/common/endowments/date.mjs.map +1 -1
- package/dist/common/endowments/index.cjs +93 -0
- package/dist/common/endowments/index.cjs.map +1 -0
- package/dist/{types/common/endowments/index.d.ts → common/endowments/index.d.cts} +4 -3
- package/dist/common/endowments/index.d.cts.map +1 -0
- package/dist/common/endowments/index.d.mts +29 -0
- package/dist/common/endowments/index.d.mts.map +1 -0
- package/dist/common/endowments/index.mjs +85 -20
- package/dist/common/endowments/index.mjs.map +1 -1
- package/dist/common/endowments/interval.cjs +51 -0
- package/dist/common/endowments/interval.cjs.map +1 -0
- package/dist/{types/common/endowments/interval.d.ts → common/endowments/interval.d.cts} +1 -0
- package/dist/common/endowments/interval.d.cts.map +1 -0
- package/dist/common/endowments/interval.d.mts +10 -0
- package/dist/common/endowments/interval.d.mts.map +1 -0
- package/dist/common/endowments/interval.mjs +47 -6
- package/dist/common/endowments/interval.mjs.map +1 -1
- package/dist/common/endowments/math.cjs +54 -0
- package/dist/common/endowments/math.cjs.map +1 -0
- package/dist/{types/common/endowments/math.d.ts → common/endowments/math.d.cts} +1 -0
- package/dist/common/endowments/math.d.cts.map +1 -0
- package/dist/common/endowments/math.d.mts +61 -0
- package/dist/common/endowments/math.d.mts.map +1 -0
- package/dist/common/endowments/math.mjs +50 -8
- package/dist/common/endowments/math.mjs.map +1 -1
- package/dist/common/endowments/network.cjs +255 -0
- package/dist/common/endowments/network.cjs.map +1 -0
- package/dist/{types/common/endowments/network.d.ts → common/endowments/network.d.cts} +4 -2
- package/dist/common/endowments/network.d.cts.map +1 -0
- package/dist/common/endowments/network.d.mts +25 -0
- package/dist/common/endowments/network.d.mts.map +1 -0
- package/dist/common/endowments/network.mjs +251 -8
- package/dist/common/endowments/network.mjs.map +1 -1
- package/dist/common/endowments/textDecoder.cjs +18 -0
- package/dist/common/endowments/textDecoder.cjs.map +1 -0
- package/dist/{types/common/endowments/textDecoder.d.ts → common/endowments/textDecoder.d.cts} +1 -0
- package/dist/common/endowments/textDecoder.d.cts.map +1 -0
- package/dist/common/endowments/textDecoder.d.mts +11 -0
- package/dist/common/endowments/textDecoder.d.mts.map +1 -0
- package/dist/common/endowments/textDecoder.mjs +14 -6
- package/dist/common/endowments/textDecoder.mjs.map +1 -1
- package/dist/common/endowments/textEncoder.cjs +18 -0
- package/dist/common/endowments/textEncoder.cjs.map +1 -0
- package/dist/{types/common/endowments/textEncoder.d.ts → common/endowments/textEncoder.d.cts} +1 -0
- package/dist/common/endowments/textEncoder.d.cts.map +1 -0
- package/dist/common/endowments/textEncoder.d.mts +11 -0
- package/dist/common/endowments/textEncoder.d.mts.map +1 -0
- package/dist/common/endowments/textEncoder.mjs +14 -6
- package/dist/common/endowments/textEncoder.mjs.map +1 -1
- package/dist/common/endowments/timeout.cjs +53 -0
- package/dist/common/endowments/timeout.cjs.map +1 -0
- package/dist/{types/common/endowments/timeout.d.ts → common/endowments/timeout.d.cts} +1 -0
- package/dist/common/endowments/timeout.d.cts.map +1 -0
- package/dist/common/endowments/timeout.d.mts +10 -0
- package/dist/common/endowments/timeout.d.mts.map +1 -0
- package/dist/common/endowments/timeout.mjs +49 -6
- package/dist/common/endowments/timeout.mjs.map +1 -1
- package/dist/common/globalEvents.cjs +48 -0
- package/dist/common/globalEvents.cjs.map +1 -0
- package/dist/{types/common/globalEvents.d.ts → common/globalEvents.d.cts} +1 -0
- package/dist/common/globalEvents.d.cts.map +1 -0
- package/dist/common/globalEvents.d.mts +21 -0
- package/dist/common/globalEvents.d.mts.map +1 -0
- package/dist/common/globalEvents.mjs +42 -10
- package/dist/common/globalEvents.mjs.map +1 -1
- package/dist/common/globalObject.cjs +50 -0
- package/dist/common/globalObject.cjs.map +1 -0
- package/dist/{types/common/globalObject.d.ts → common/globalObject.d.cts} +1 -0
- package/dist/common/globalObject.d.cts.map +1 -0
- package/dist/common/globalObject.d.mts +10 -0
- package/dist/common/globalObject.d.mts.map +1 -0
- package/dist/common/globalObject.mjs +45 -9
- package/dist/common/globalObject.mjs.map +1 -1
- package/dist/common/lockdown/lockdown-events.cjs +60 -0
- package/dist/common/lockdown/lockdown-events.cjs.map +1 -0
- package/dist/{types/common/lockdown/lockdown-events.d.ts → common/lockdown/lockdown-events.d.cts} +1 -0
- package/dist/common/lockdown/lockdown-events.d.cts.map +1 -0
- package/dist/common/lockdown/lockdown-events.d.mts +5 -0
- package/dist/common/lockdown/lockdown-events.d.mts.map +1 -0
- package/dist/common/lockdown/lockdown-events.mjs +55 -7
- package/dist/common/lockdown/lockdown-events.mjs.map +1 -1
- package/dist/common/lockdown/lockdown-more.cjs +89 -0
- package/dist/common/lockdown/lockdown-more.cjs.map +1 -0
- package/dist/{types/common/lockdown/lockdown-more.d.ts → common/lockdown/lockdown-more.d.cts} +1 -0
- package/dist/common/lockdown/lockdown-more.d.cts.map +1 -0
- package/dist/common/lockdown/lockdown-more.d.mts +23 -0
- package/dist/common/lockdown/lockdown-more.d.mts.map +1 -0
- package/dist/common/lockdown/lockdown-more.mjs +84 -7
- package/dist/common/lockdown/lockdown-more.mjs.map +1 -1
- package/dist/common/lockdown/lockdown.cjs +29 -0
- package/dist/common/lockdown/lockdown.cjs.map +1 -0
- package/dist/{types/common/lockdown/lockdown.d.ts → common/lockdown/lockdown.d.cts} +1 -0
- package/dist/common/lockdown/lockdown.d.cts.map +1 -0
- package/dist/common/lockdown/lockdown.d.mts +8 -0
- package/dist/common/lockdown/lockdown.d.mts.map +1 -0
- package/dist/common/lockdown/lockdown.mjs +22 -19
- package/dist/common/lockdown/lockdown.mjs.map +1 -1
- package/dist/common/sortParams.cjs +35 -0
- package/dist/common/sortParams.cjs.map +1 -0
- package/dist/{types/common/sortParams.d.ts → common/sortParams.d.cts} +2 -1
- package/dist/common/sortParams.d.cts.map +1 -0
- package/dist/common/sortParams.d.mts +17 -0
- package/dist/common/sortParams.d.mts.map +1 -0
- package/dist/common/sortParams.mjs +29 -6
- package/dist/common/sortParams.mjs.map +1 -1
- package/dist/common/utils.cjs +156 -0
- package/dist/common/utils.cjs.map +1 -0
- package/dist/{types/common/utils.d.ts → common/utils.d.cts} +2 -1
- package/dist/common/utils.d.cts.map +1 -0
- package/dist/common/utils.d.mts +50 -0
- package/dist/common/utils.d.mts.map +1 -0
- package/dist/common/utils.mjs +146 -20
- package/dist/common/utils.mjs.map +1 -1
- package/dist/common/validation.cjs +137 -0
- package/dist/common/validation.cjs.map +1 -0
- package/dist/{types/common/validation.d.ts → common/validation.d.cts} +37 -36
- package/dist/common/validation.d.cts.map +1 -0
- package/dist/common/validation.d.mts +199 -0
- package/dist/common/validation.d.mts.map +1 -0
- package/dist/common/validation.mjs +127 -37
- package/dist/common/validation.mjs.map +1 -1
- package/dist/iframe/IFrameSnapExecutor.cjs +42 -0
- package/dist/iframe/IFrameSnapExecutor.cjs.map +1 -0
- package/dist/{types/iframe/IFrameSnapExecutor.d.ts → iframe/IFrameSnapExecutor.d.cts} +3 -2
- package/dist/iframe/IFrameSnapExecutor.d.cts.map +1 -0
- package/dist/iframe/IFrameSnapExecutor.d.mts +14 -0
- package/dist/iframe/IFrameSnapExecutor.d.mts.map +1 -0
- package/dist/iframe/IFrameSnapExecutor.mjs +42 -26
- package/dist/iframe/IFrameSnapExecutor.mjs.map +1 -1
- package/dist/iframe/index.cjs +10 -0
- package/dist/iframe/index.cjs.map +1 -0
- package/dist/iframe/index.d.cts +2 -0
- package/dist/iframe/index.d.cts.map +1 -0
- package/dist/iframe/index.d.mts +2 -0
- package/dist/iframe/index.d.mts.map +1 -0
- package/dist/iframe/index.mjs +4 -31
- package/dist/iframe/index.mjs.map +1 -1
- package/dist/index.cjs +18 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +2 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +1 -8
- package/dist/index.mjs.map +1 -1
- package/dist/logging.cjs +13 -0
- package/dist/logging.cjs.map +1 -0
- package/dist/{types/logging.d.ts → logging.d.cts} +1 -0
- package/dist/logging.d.cts.map +1 -0
- package/dist/logging.d.mts +9 -0
- package/dist/logging.d.mts.map +1 -0
- package/dist/logging.mjs +9 -7
- package/dist/logging.mjs.map +1 -1
- package/dist/node-process/ChildProcessSnapExecutor.cjs +30 -0
- package/dist/node-process/ChildProcessSnapExecutor.cjs.map +1 -0
- package/dist/{types/node-process/ChildProcessSnapExecutor.d.ts → node-process/ChildProcessSnapExecutor.d.cts} +2 -1
- package/dist/node-process/ChildProcessSnapExecutor.d.cts.map +1 -0
- package/dist/node-process/ChildProcessSnapExecutor.d.mts +5 -0
- package/dist/node-process/ChildProcessSnapExecutor.d.mts.map +1 -0
- package/dist/node-process/ChildProcessSnapExecutor.mjs +30 -26
- package/dist/node-process/ChildProcessSnapExecutor.mjs.map +1 -1
- package/dist/node-process/index.cjs +8 -0
- package/dist/node-process/index.cjs.map +1 -0
- package/dist/node-process/index.d.cts +2 -0
- package/dist/node-process/index.d.cts.map +1 -0
- package/dist/node-process/index.d.mts +2 -0
- package/dist/node-process/index.d.mts.map +1 -0
- package/dist/node-process/index.mjs +3 -28
- package/dist/node-process/index.mjs.map +1 -1
- package/dist/node-thread/ThreadSnapExecutor.cjs +30 -0
- package/dist/node-thread/ThreadSnapExecutor.cjs.map +1 -0
- package/dist/node-thread/ThreadSnapExecutor.d.cts +5 -0
- package/dist/node-thread/ThreadSnapExecutor.d.cts.map +1 -0
- package/dist/node-thread/ThreadSnapExecutor.d.mts +5 -0
- package/dist/node-thread/ThreadSnapExecutor.d.mts.map +1 -0
- package/dist/node-thread/ThreadSnapExecutor.mjs +30 -26
- package/dist/node-thread/ThreadSnapExecutor.mjs.map +1 -1
- package/dist/node-thread/index.cjs +8 -0
- package/dist/node-thread/index.cjs.map +1 -0
- package/dist/node-thread/index.d.cts +2 -0
- package/dist/node-thread/index.d.cts.map +1 -0
- package/dist/node-thread/index.d.mts +2 -0
- package/dist/node-thread/index.d.mts.map +1 -0
- package/dist/node-thread/index.mjs +3 -28
- package/dist/node-thread/index.mjs.map +1 -1
- package/dist/proxy/ProxySnapExecutor.cjs +112 -0
- package/dist/proxy/ProxySnapExecutor.cjs.map +1 -0
- package/dist/{types/proxy/ProxySnapExecutor.d.ts → proxy/ProxySnapExecutor.d.cts} +4 -3
- package/dist/proxy/ProxySnapExecutor.d.cts.map +1 -0
- package/dist/proxy/ProxySnapExecutor.d.mts +36 -0
- package/dist/proxy/ProxySnapExecutor.d.mts.map +1 -0
- package/dist/proxy/ProxySnapExecutor.mjs +104 -6
- package/dist/proxy/ProxySnapExecutor.mjs.map +1 -1
- package/dist/proxy/index.cjs +18 -0
- package/dist/proxy/index.cjs.map +1 -0
- package/dist/proxy/index.d.cts +2 -0
- package/dist/proxy/index.d.cts.map +1 -0
- package/dist/proxy/index.d.mts +2 -0
- package/dist/proxy/index.d.mts.map +1 -0
- package/dist/proxy/index.mjs +1 -8
- package/dist/proxy/index.mjs.map +1 -1
- package/dist/webview/WebViewExecutorStream.cjs +79 -0
- package/dist/webview/WebViewExecutorStream.cjs.map +1 -0
- package/dist/{types/webview/WebViewExecutorStream.d.ts → webview/WebViewExecutorStream.d.cts} +3 -2
- package/dist/webview/WebViewExecutorStream.d.cts.map +1 -0
- package/dist/webview/WebViewExecutorStream.d.mts +33 -0
- package/dist/webview/WebViewExecutorStream.d.mts.map +1 -0
- package/dist/webview/WebViewExecutorStream.mjs +74 -6
- package/dist/webview/WebViewExecutorStream.mjs.map +1 -1
- package/dist/webview/index.cjs +16 -0
- package/dist/webview/index.cjs.map +1 -0
- package/dist/webview/index.d.cts +2 -0
- package/dist/webview/index.d.cts.map +1 -0
- package/dist/webview/index.d.mts +2 -0
- package/dist/webview/index.d.mts.map +1 -0
- package/dist/webview/index.mjs +9 -21
- package/dist/webview/index.mjs.map +1 -1
- package/dist/webworker/executor/WebWorkerSnapExecutor.cjs +37 -0
- package/dist/webworker/executor/WebWorkerSnapExecutor.cjs.map +1 -0
- package/dist/{types/webworker/executor/WebWorkerSnapExecutor.d.ts → webworker/executor/WebWorkerSnapExecutor.d.cts} +3 -2
- package/dist/webworker/executor/WebWorkerSnapExecutor.d.cts.map +1 -0
- package/dist/webworker/executor/WebWorkerSnapExecutor.d.mts +14 -0
- package/dist/webworker/executor/WebWorkerSnapExecutor.d.mts.map +1 -0
- package/dist/webworker/executor/WebWorkerSnapExecutor.mjs +37 -26
- package/dist/webworker/executor/WebWorkerSnapExecutor.mjs.map +1 -1
- package/dist/webworker/executor/index.cjs +10 -0
- package/dist/webworker/executor/index.cjs.map +1 -0
- package/dist/webworker/executor/index.d.cts +2 -0
- package/dist/webworker/executor/index.d.cts.map +1 -0
- package/dist/webworker/executor/index.d.mts +2 -0
- package/dist/webworker/executor/index.d.mts.map +1 -0
- package/dist/webworker/executor/index.mjs +4 -31
- package/dist/webworker/executor/index.mjs.map +1 -1
- package/dist/webworker/pool/WebWorkerPool.cjs +168 -0
- package/dist/webworker/pool/WebWorkerPool.cjs.map +1 -0
- package/dist/{types/webworker/pool/WebWorkerPool.d.ts → webworker/pool/WebWorkerPool.d.cts} +4 -3
- package/dist/webworker/pool/WebWorkerPool.d.cts.map +1 -0
- package/dist/webworker/pool/WebWorkerPool.d.mts +24 -0
- package/dist/webworker/pool/WebWorkerPool.d.mts.map +1 -0
- package/dist/webworker/pool/WebWorkerPool.mjs +163 -6
- package/dist/webworker/pool/WebWorkerPool.mjs.map +1 -1
- package/dist/webworker/pool/index.cjs +10 -0
- package/dist/webworker/pool/index.cjs.map +1 -0
- package/dist/webworker/pool/index.d.cts +2 -0
- package/dist/webworker/pool/index.d.cts.map +1 -0
- package/dist/webworker/pool/index.d.mts +2 -0
- package/dist/webworker/pool/index.d.mts.map +1 -0
- package/dist/webworker/pool/index.mjs +4 -12
- package/dist/webworker/pool/index.mjs.map +1 -1
- package/package.json +23 -20
- package/dist/browserify/iframe/bundle.js +0 -9
- package/dist/browserify/iframe/index.html +0 -13394
- package/dist/browserify/node-process/bundle.js +0 -13390
- package/dist/browserify/node-thread/bundle.js +0 -13390
- package/dist/browserify/webview/index.html +0 -13402
- package/dist/browserify/worker-executor/bundle.js +0 -13392
- package/dist/browserify/worker-pool/bundle.js +0 -9
- package/dist/browserify/worker-pool/index.html +0 -13394
- package/dist/chunk-2VA6RAEE.js +0 -30
- package/dist/chunk-2VA6RAEE.js.map +0 -1
- package/dist/chunk-3JCT4MWT.js +0 -108
- package/dist/chunk-3JCT4MWT.js.map +0 -1
- package/dist/chunk-46LW37FK.js +0 -144
- package/dist/chunk-46LW37FK.js.map +0 -1
- package/dist/chunk-4COIRXF5.js +0 -86
- package/dist/chunk-4COIRXF5.js.map +0 -1
- package/dist/chunk-4XRZLEKU.js +0 -49
- package/dist/chunk-4XRZLEKU.js.map +0 -1
- package/dist/chunk-53ZULHPK.mjs +0 -16
- package/dist/chunk-53ZULHPK.mjs.map +0 -1
- package/dist/chunk-5DEV3QQU.mjs +0 -12
- package/dist/chunk-5DEV3QQU.mjs.map +0 -1
- package/dist/chunk-5STN3QCA.js +0 -183
- package/dist/chunk-5STN3QCA.js.map +0 -1
- package/dist/chunk-72KFTWQZ.mjs +0 -45
- package/dist/chunk-72KFTWQZ.mjs.map +0 -1
- package/dist/chunk-75RCH4ZX.mjs +0 -151
- package/dist/chunk-75RCH4ZX.mjs.map +0 -1
- package/dist/chunk-7AJWXSDQ.mjs +0 -73
- package/dist/chunk-7AJWXSDQ.mjs.map +0 -1
- package/dist/chunk-7MMUJJQ2.js +0 -151
- package/dist/chunk-7MMUJJQ2.js.map +0 -1
- package/dist/chunk-BCBKEUCG.mjs +0 -38
- package/dist/chunk-BCBKEUCG.mjs.map +0 -1
- package/dist/chunk-BEJDC4XI.mjs +0 -40
- package/dist/chunk-BEJDC4XI.mjs.map +0 -1
- package/dist/chunk-BLHIYDO5.js +0 -40
- package/dist/chunk-BLHIYDO5.js.map +0 -1
- package/dist/chunk-BTEAZZKP.mjs +0 -24
- package/dist/chunk-BTEAZZKP.mjs.map +0 -1
- package/dist/chunk-BVRVUIJB.mjs +0 -67
- package/dist/chunk-BVRVUIJB.mjs.map +0 -1
- package/dist/chunk-CV5LC4PP.js +0 -24
- package/dist/chunk-CV5LC4PP.js.map +0 -1
- package/dist/chunk-DKDTGAFK.js +0 -67
- package/dist/chunk-DKDTGAFK.js.map +0 -1
- package/dist/chunk-DLLLH5HN.js +0 -26
- package/dist/chunk-DLLLH5HN.js.map +0 -1
- package/dist/chunk-EXN2TFDJ.js +0 -38
- package/dist/chunk-EXN2TFDJ.js.map +0 -1
- package/dist/chunk-FOEAIF5U.js +0 -16
- package/dist/chunk-FOEAIF5U.js.map +0 -1
- package/dist/chunk-FUPEJT7B.js +0 -82
- package/dist/chunk-FUPEJT7B.js.map +0 -1
- package/dist/chunk-HCXTK3PR.js +0 -472
- package/dist/chunk-HCXTK3PR.js.map +0 -1
- package/dist/chunk-HGLRZZ56.js +0 -32
- package/dist/chunk-HGLRZZ56.js.map +0 -1
- package/dist/chunk-HL2TTKF3.mjs +0 -144
- package/dist/chunk-HL2TTKF3.mjs.map +0 -1
- package/dist/chunk-HWS4QSOC.mjs +0 -16
- package/dist/chunk-HWS4QSOC.mjs.map +0 -1
- package/dist/chunk-HXKBUIYS.js +0 -262
- package/dist/chunk-HXKBUIYS.js.map +0 -1
- package/dist/chunk-HXUJHX3E.mjs +0 -33
- package/dist/chunk-HXUJHX3E.mjs.map +0 -1
- package/dist/chunk-I5G4YFHM.js +0 -73
- package/dist/chunk-I5G4YFHM.js.map +0 -1
- package/dist/chunk-IX5S3V47.mjs +0 -26
- package/dist/chunk-IX5S3V47.mjs.map +0 -1
- package/dist/chunk-JDWYJ5UI.mjs +0 -33
- package/dist/chunk-JDWYJ5UI.mjs.map +0 -1
- package/dist/chunk-JOT5JH42.js +0 -52
- package/dist/chunk-JOT5JH42.js.map +0 -1
- package/dist/chunk-KEAB7ZVV.js +0 -50
- package/dist/chunk-KEAB7ZVV.js.map +0 -1
- package/dist/chunk-LO5ORVRC.js +0 -16
- package/dist/chunk-LO5ORVRC.js.map +0 -1
- package/dist/chunk-M3OBSGHF.mjs +0 -472
- package/dist/chunk-M3OBSGHF.mjs.map +0 -1
- package/dist/chunk-MCXWFCGV.js +0 -1
- package/dist/chunk-MCXWFCGV.js.map +0 -1
- package/dist/chunk-MIWGLICQ.mjs +0 -108
- package/dist/chunk-MIWGLICQ.mjs.map +0 -1
- package/dist/chunk-MMYM63NH.mjs +0 -82
- package/dist/chunk-MMYM63NH.mjs.map +0 -1
- package/dist/chunk-MS2LQQYH.js +0 -38
- package/dist/chunk-MS2LQQYH.js.map +0 -1
- package/dist/chunk-MXNMMTJW.mjs +0 -51
- package/dist/chunk-MXNMMTJW.mjs.map +0 -1
- package/dist/chunk-OBT45IWW.js +0 -92
- package/dist/chunk-OBT45IWW.js.map +0 -1
- package/dist/chunk-OCNPLHS2.js +0 -51
- package/dist/chunk-OCNPLHS2.js.map +0 -1
- package/dist/chunk-ODICKSGZ.mjs +0 -86
- package/dist/chunk-ODICKSGZ.mjs.map +0 -1
- package/dist/chunk-Q42NNJFY.mjs +0 -32
- package/dist/chunk-Q42NNJFY.mjs.map +0 -1
- package/dist/chunk-QZC2X6NG.js +0 -44
- package/dist/chunk-QZC2X6NG.js.map +0 -1
- package/dist/chunk-RACRYFWM.js +0 -45
- package/dist/chunk-RACRYFWM.js.map +0 -1
- package/dist/chunk-RD2APLK5.js +0 -33
- package/dist/chunk-RD2APLK5.js.map +0 -1
- package/dist/chunk-S5NWI5Z7.mjs +0 -50
- package/dist/chunk-S5NWI5Z7.mjs.map +0 -1
- package/dist/chunk-S7257EN3.mjs +0 -49
- package/dist/chunk-S7257EN3.mjs.map +0 -1
- package/dist/chunk-TSEAPB7L.mjs +0 -1
- package/dist/chunk-TSEAPB7L.mjs.map +0 -1
- package/dist/chunk-UOPIRTJX.mjs +0 -44
- package/dist/chunk-UOPIRTJX.mjs.map +0 -1
- package/dist/chunk-V76DI2XM.mjs +0 -183
- package/dist/chunk-V76DI2XM.mjs.map +0 -1
- package/dist/chunk-W7EDURT5.mjs +0 -92
- package/dist/chunk-W7EDURT5.mjs.map +0 -1
- package/dist/chunk-XPCW7TKM.mjs +0 -262
- package/dist/chunk-XPCW7TKM.mjs.map +0 -1
- package/dist/chunk-Y7AK2VVC.mjs +0 -52
- package/dist/chunk-Y7AK2VVC.mjs.map +0 -1
- package/dist/chunk-YRZVIDCF.mjs +0 -38
- package/dist/chunk-YRZVIDCF.mjs.map +0 -1
- package/dist/chunk-Z7BOREC4.js +0 -12
- package/dist/chunk-Z7BOREC4.js.map +0 -1
- package/dist/chunk-ZAYDLP42.js +0 -33
- package/dist/chunk-ZAYDLP42.js.map +0 -1
- package/dist/chunk-ZNTCZK7J.mjs +0 -30
- package/dist/chunk-ZNTCZK7J.mjs.map +0 -1
- package/dist/common/BaseSnapExecutor.js +0 -26
- package/dist/common/BaseSnapExecutor.js.map +0 -1
- package/dist/common/commands.js +0 -11
- package/dist/common/commands.js.map +0 -1
- package/dist/common/endowments/commonEndowmentFactory.js +0 -20
- package/dist/common/endowments/commonEndowmentFactory.js.map +0 -1
- package/dist/common/endowments/console.js +0 -13
- package/dist/common/endowments/console.js.map +0 -1
- package/dist/common/endowments/crypto.js +0 -11
- package/dist/common/endowments/crypto.js.map +0 -1
- package/dist/common/endowments/date.js +0 -9
- package/dist/common/endowments/date.js.map +0 -1
- package/dist/common/endowments/index.js +0 -21
- package/dist/common/endowments/index.js.map +0 -1
- package/dist/common/endowments/interval.js +0 -8
- package/dist/common/endowments/interval.js.map +0 -1
- package/dist/common/endowments/math.js +0 -10
- package/dist/common/endowments/math.js.map +0 -1
- package/dist/common/endowments/network.js +0 -10
- package/dist/common/endowments/network.js.map +0 -1
- package/dist/common/endowments/textDecoder.js +0 -8
- package/dist/common/endowments/textDecoder.js.map +0 -1
- package/dist/common/endowments/textEncoder.js +0 -8
- package/dist/common/endowments/textEncoder.js.map +0 -1
- package/dist/common/endowments/timeout.js +0 -8
- package/dist/common/endowments/timeout.js.map +0 -1
- package/dist/common/globalEvents.js +0 -11
- package/dist/common/globalEvents.js.map +0 -1
- package/dist/common/globalObject.js +0 -10
- package/dist/common/globalObject.js.map +0 -1
- package/dist/common/lockdown/lockdown-events.js +0 -8
- package/dist/common/lockdown/lockdown-events.js.map +0 -1
- package/dist/common/lockdown/lockdown-more.js +0 -8
- package/dist/common/lockdown/lockdown-more.js.map +0 -1
- package/dist/common/lockdown/lockdown.js +0 -22
- package/dist/common/lockdown/lockdown.js.map +0 -1
- package/dist/common/sortParams.js +0 -8
- package/dist/common/sortParams.js.map +0 -1
- package/dist/common/utils.js +0 -21
- package/dist/common/utils.js.map +0 -1
- package/dist/common/validation.js +0 -38
- package/dist/common/validation.js.map +0 -1
- package/dist/globals.d.js +0 -1
- package/dist/globals.d.js.map +0 -1
- package/dist/globals.d.mjs +0 -1
- package/dist/globals.d.mjs.map +0 -1
- package/dist/iframe/IFrameSnapExecutor.js +0 -27
- package/dist/iframe/IFrameSnapExecutor.js.map +0 -1
- package/dist/iframe/index.js +0 -35
- package/dist/iframe/index.js.map +0 -1
- package/dist/index.js +0 -9
- package/dist/index.js.map +0 -1
- package/dist/logging.js +0 -8
- package/dist/logging.js.map +0 -1
- package/dist/node-process/ChildProcessSnapExecutor.js +0 -27
- package/dist/node-process/ChildProcessSnapExecutor.js.map +0 -1
- package/dist/node-process/index.js +0 -31
- package/dist/node-process/index.js.map +0 -1
- package/dist/node-thread/ThreadSnapExecutor.js +0 -27
- package/dist/node-thread/ThreadSnapExecutor.js.map +0 -1
- package/dist/node-thread/index.js +0 -31
- package/dist/node-thread/index.js.map +0 -1
- package/dist/proxy/ProxySnapExecutor.js +0 -8
- package/dist/proxy/ProxySnapExecutor.js.map +0 -1
- package/dist/proxy/index.js +0 -9
- package/dist/proxy/index.js.map +0 -1
- package/dist/tsconfig.build.tsbuildinfo +0 -1
- package/dist/types/iframe/index.d.ts +0 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/node-process/index.d.ts +0 -1
- package/dist/types/node-thread/ThreadSnapExecutor.d.ts +0 -4
- package/dist/types/node-thread/index.d.ts +0 -1
- package/dist/types/proxy/index.d.ts +0 -1
- package/dist/types/vendor/global.d.js +0 -1
- package/dist/types/vendor/global.d.js.map +0 -1
- package/dist/types/vendor/global.d.mjs +0 -1
- package/dist/types/vendor/global.d.mjs.map +0 -1
- package/dist/types/vendor/providers.d.js +0 -1
- package/dist/types/vendor/providers.d.js.map +0 -1
- package/dist/types/vendor/providers.d.mjs +0 -1
- package/dist/types/vendor/providers.d.mjs.map +0 -1
- package/dist/types/vendor/readable-stream.d.js +0 -1
- package/dist/types/vendor/readable-stream.d.js.map +0 -1
- package/dist/types/vendor/readable-stream.d.mjs +0 -1
- package/dist/types/vendor/readable-stream.d.mjs.map +0 -1
- package/dist/types/webview/index.d.ts +0 -1
- package/dist/types/webworker/executor/index.d.ts +0 -1
- package/dist/types/webworker/pool/index.d.ts +0 -1
- package/dist/webview/WebViewExecutorStream.js +0 -8
- package/dist/webview/WebViewExecutorStream.js.map +0 -1
- package/dist/webview/index.js +0 -26
- package/dist/webview/index.js.map +0 -1
- package/dist/webworker/executor/WebWorkerSnapExecutor.js +0 -27
- package/dist/webworker/executor/WebWorkerSnapExecutor.js.map +0 -1
- package/dist/webworker/executor/index.js +0 -35
- package/dist/webworker/executor/index.js.map +0 -1
- package/dist/webworker/pool/WebWorkerPool.js +0 -8
- package/dist/webworker/pool/WebWorkerPool.js.map +0 -1
- package/dist/webworker/pool/index.js +0 -16
- package/dist/webworker/pool/index.js.map +0 -1
package/dist/chunk-MCXWFCGV.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";//# sourceMappingURL=chunk-MCXWFCGV.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":""}
|
package/dist/chunk-MIWGLICQ.mjs
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__privateAdd,
|
|
3
|
-
__privateGet,
|
|
4
|
-
__privateMethod,
|
|
5
|
-
__privateSet
|
|
6
|
-
} from "./chunk-YRZVIDCF.mjs";
|
|
7
|
-
|
|
8
|
-
// src/proxy/ProxySnapExecutor.ts
|
|
9
|
-
import { WindowPostMessageStream } from "@metamask/post-message-stream";
|
|
10
|
-
import packageJson from "@metamask/snaps-execution-environments/package.json";
|
|
11
|
-
import { createWindow, logError } from "@metamask/snaps-utils";
|
|
12
|
-
import { assert } from "@metamask/utils";
|
|
13
|
-
var IFRAME_URL = `https://execution.metamask.io/iframe/${packageJson.version}/index.html`;
|
|
14
|
-
var _stream, _frameUrl, _onData, onData_fn, _initializeJob, initializeJob_fn, _terminateJob, terminateJob_fn;
|
|
15
|
-
var _ProxySnapExecutor = class _ProxySnapExecutor {
|
|
16
|
-
constructor(stream, frameUrl) {
|
|
17
|
-
/**
|
|
18
|
-
* Handle an incoming message from a `ProxyExecutionService`. This
|
|
19
|
-
* assumes that the message contains a `jobId` property, and a JSON-RPC
|
|
20
|
-
* request in the `data` property.
|
|
21
|
-
*
|
|
22
|
-
* @param data - The message data.
|
|
23
|
-
* @param data.data - The JSON-RPC request.
|
|
24
|
-
* @param data.jobId - The job ID.
|
|
25
|
-
*/
|
|
26
|
-
__privateAdd(this, _onData);
|
|
27
|
-
/**
|
|
28
|
-
* Create a new iframe and set up a stream to communicate with it.
|
|
29
|
-
*
|
|
30
|
-
* @param jobId - The job ID.
|
|
31
|
-
*/
|
|
32
|
-
__privateAdd(this, _initializeJob);
|
|
33
|
-
/**
|
|
34
|
-
* Terminate the job with the given ID. This will close the iframe and delete
|
|
35
|
-
* the job from the internal job map.
|
|
36
|
-
*
|
|
37
|
-
* @param jobId - The job ID.
|
|
38
|
-
*/
|
|
39
|
-
__privateAdd(this, _terminateJob);
|
|
40
|
-
__privateAdd(this, _stream, void 0);
|
|
41
|
-
__privateAdd(this, _frameUrl, void 0);
|
|
42
|
-
this.jobs = {};
|
|
43
|
-
__privateSet(this, _stream, stream);
|
|
44
|
-
__privateGet(this, _stream).on("data", __privateMethod(this, _onData, onData_fn).bind(this));
|
|
45
|
-
__privateSet(this, _frameUrl, frameUrl);
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Initialize the executor with the given stream. This is a wrapper around the
|
|
49
|
-
* constructor.
|
|
50
|
-
*
|
|
51
|
-
* @param stream - The stream to use for communication.
|
|
52
|
-
* @param frameUrl - An optional URL for the iframe to use.
|
|
53
|
-
* @returns The initialized executor.
|
|
54
|
-
*/
|
|
55
|
-
static initialize(stream, frameUrl = IFRAME_URL) {
|
|
56
|
-
return new _ProxySnapExecutor(stream, frameUrl);
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
_stream = new WeakMap();
|
|
60
|
-
_frameUrl = new WeakMap();
|
|
61
|
-
_onData = new WeakSet();
|
|
62
|
-
onData_fn = function(data) {
|
|
63
|
-
const { jobId, data: request } = data;
|
|
64
|
-
if (!this.jobs[jobId]) {
|
|
65
|
-
__privateMethod(this, _initializeJob, initializeJob_fn).call(this, jobId).then(() => {
|
|
66
|
-
__privateMethod(this, _onData, onData_fn).call(this, data);
|
|
67
|
-
}).catch((error) => {
|
|
68
|
-
logError("[Worker] Error initializing job:", error);
|
|
69
|
-
});
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
if (request.method === "terminateJob") {
|
|
73
|
-
__privateMethod(this, _terminateJob, terminateJob_fn).call(this, jobId);
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
this.jobs[jobId].stream.write(request);
|
|
77
|
-
};
|
|
78
|
-
_initializeJob = new WeakSet();
|
|
79
|
-
initializeJob_fn = async function(jobId) {
|
|
80
|
-
const window = await createWindow(__privateGet(this, _frameUrl), jobId);
|
|
81
|
-
const jobStream = new WindowPostMessageStream({
|
|
82
|
-
name: "parent",
|
|
83
|
-
target: "child",
|
|
84
|
-
targetWindow: window,
|
|
85
|
-
// iframe's internal window
|
|
86
|
-
targetOrigin: "*"
|
|
87
|
-
});
|
|
88
|
-
jobStream.on("data", (data) => {
|
|
89
|
-
__privateGet(this, _stream).write({ data, jobId });
|
|
90
|
-
});
|
|
91
|
-
this.jobs[jobId] = { id: jobId, window, stream: jobStream };
|
|
92
|
-
return this.jobs[jobId];
|
|
93
|
-
};
|
|
94
|
-
_terminateJob = new WeakSet();
|
|
95
|
-
terminateJob_fn = function(jobId) {
|
|
96
|
-
assert(this.jobs[jobId], `Job "${jobId}" not found.`);
|
|
97
|
-
const iframe = document.getElementById(jobId);
|
|
98
|
-
assert(iframe, `Iframe with ID "${jobId}" not found.`);
|
|
99
|
-
iframe.remove();
|
|
100
|
-
this.jobs[jobId].stream.destroy();
|
|
101
|
-
delete this.jobs[jobId];
|
|
102
|
-
};
|
|
103
|
-
var ProxySnapExecutor = _ProxySnapExecutor;
|
|
104
|
-
|
|
105
|
-
export {
|
|
106
|
-
ProxySnapExecutor
|
|
107
|
-
};
|
|
108
|
-
//# sourceMappingURL=chunk-MIWGLICQ.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/proxy/ProxySnapExecutor.ts"],"sourcesContent":["import type { BasePostMessageStream } from '@metamask/post-message-stream';\nimport { WindowPostMessageStream } from '@metamask/post-message-stream';\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport packageJson from '@metamask/snaps-execution-environments/package.json';\nimport { createWindow, logError } from '@metamask/snaps-utils';\nimport type { JsonRpcRequest } from '@metamask/utils';\nimport { assert } from '@metamask/utils';\n\ntype ExecutorJob = {\n id: string;\n window: Window;\n stream: WindowPostMessageStream;\n};\n\nconst IFRAME_URL = `https://execution.metamask.io/iframe/${packageJson.version}/index.html`;\n\n/**\n * A \"proxy\" snap executor that uses a level of indirection to execute snaps.\n *\n * Useful for multiple execution environments.\n *\n * This is not a traditional snap executor, as it does not execute snaps itself.\n * Instead, it creates an iframe window for each snap execution, and sends the\n * snap execution request to the iframe window. The iframe window is responsible\n * for executing the snap.\n *\n * This executor is persisted between snap executions. The executor essentially\n * acts as a proxy between the client and the iframe execution environment.\n */\nexport class ProxySnapExecutor {\n readonly #stream: BasePostMessageStream;\n\n readonly #frameUrl: string;\n\n readonly jobs: Record<string, ExecutorJob> = {};\n\n /**\n * Initialize the executor with the given stream. This is a wrapper around the\n * constructor.\n *\n * @param stream - The stream to use for communication.\n * @param frameUrl - An optional URL for the iframe to use.\n * @returns The initialized executor.\n */\n static initialize(stream: BasePostMessageStream, frameUrl = IFRAME_URL) {\n return new ProxySnapExecutor(stream, frameUrl);\n }\n\n constructor(stream: BasePostMessageStream, frameUrl: string) {\n this.#stream = stream;\n this.#stream.on('data', this.#onData.bind(this));\n this.#frameUrl = frameUrl;\n }\n\n /**\n * Handle an incoming message from a `ProxyExecutionService`. This\n * assumes that the message contains a `jobId` property, and a JSON-RPC\n * request in the `data` property.\n *\n * @param data - The message data.\n * @param data.data - The JSON-RPC request.\n * @param data.jobId - The job ID.\n */\n #onData(data: { data: JsonRpcRequest; jobId: string }) {\n const { jobId, data: request } = data;\n\n if (!this.jobs[jobId]) {\n // This ensures that a job is initialized before it is used. To avoid\n // code duplication, we call the `#onData` method again, which will\n // run the rest of the logic after initialization.\n this.#initializeJob(jobId)\n .then(() => {\n this.#onData(data);\n })\n .catch((error) => {\n logError('[Worker] Error initializing job:', error);\n });\n\n return;\n }\n\n // This is a method specific to the `OffscreenSnapExecutor`, as the service\n // itself does not have access to the iframes directly.\n if (request.method === 'terminateJob') {\n this.#terminateJob(jobId);\n return;\n }\n\n this.jobs[jobId].stream.write(request);\n }\n\n /**\n * Create a new iframe and set up a stream to communicate with it.\n *\n * @param jobId - The job ID.\n */\n async #initializeJob(jobId: string): Promise<ExecutorJob> {\n const window = await createWindow(this.#frameUrl, jobId);\n const jobStream = new WindowPostMessageStream({\n name: 'parent',\n target: 'child',\n targetWindow: window, // iframe's internal window\n targetOrigin: '*',\n });\n\n // Write messages from the iframe to the parent, wrapped with the job ID.\n jobStream.on('data', (data) => {\n this.#stream.write({ data, jobId });\n });\n\n this.jobs[jobId] = { id: jobId, window, stream: jobStream };\n return this.jobs[jobId];\n }\n\n /**\n * Terminate the job with the given ID. This will close the iframe and delete\n * the job from the internal job map.\n *\n * @param jobId - The job ID.\n */\n #terminateJob(jobId: string) {\n assert(this.jobs[jobId], `Job \"${jobId}\" not found.`);\n\n const iframe = document.getElementById(jobId);\n assert(iframe, `Iframe with ID \"${jobId}\" not found.`);\n\n iframe.remove();\n this.jobs[jobId].stream.destroy();\n delete this.jobs[jobId];\n }\n}\n"],"mappings":";;;;;;;;AACA,SAAS,+BAA+B;AAExC,OAAO,iBAAiB;AACxB,SAAS,cAAc,gBAAgB;AAEvC,SAAS,cAAc;AAQvB,IAAM,aAAa,wCAAwC,YAAY,OAAO;AAd9E;AA6BO,IAAM,qBAAN,MAAM,mBAAkB;AAAA,EAmB7B,YAAY,QAA+B,UAAkB;AAe7D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiCA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAM;AAwBN;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA1FA,uBAAS,SAAT;AAEA,uBAAS,WAAT;AAEA,SAAS,OAAoC,CAAC;AAe5C,uBAAK,SAAU;AACf,uBAAK,SAAQ,GAAG,QAAQ,sBAAK,oBAAQ,KAAK,IAAI,CAAC;AAC/C,uBAAK,WAAY;AAAA,EACnB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EARA,OAAO,WAAW,QAA+B,WAAW,YAAY;AACtE,WAAO,IAAI,mBAAkB,QAAQ,QAAQ;AAAA,EAC/C;AAoFF;AApGW;AAEA;AA+BT;AAAA,YAAO,SAAC,MAA+C;AACrD,QAAM,EAAE,OAAO,MAAM,QAAQ,IAAI;AAEjC,MAAI,CAAC,KAAK,KAAK,KAAK,GAAG;AAIrB,0BAAK,kCAAL,WAAoB,OACjB,KAAK,MAAM;AACV,4BAAK,oBAAL,WAAa;AAAA,IACf,CAAC,EACA,MAAM,CAAC,UAAU;AAChB,eAAS,oCAAoC,KAAK;AAAA,IACpD,CAAC;AAEH;AAAA,EACF;AAIA,MAAI,QAAQ,WAAW,gBAAgB;AACrC,0BAAK,gCAAL,WAAmB;AACnB;AAAA,EACF;AAEA,OAAK,KAAK,KAAK,EAAE,OAAO,MAAM,OAAO;AACvC;AAOM;AAAA,mBAAc,eAAC,OAAqC;AACxD,QAAM,SAAS,MAAM,aAAa,mBAAK,YAAW,KAAK;AACvD,QAAM,YAAY,IAAI,wBAAwB;AAAA,IAC5C,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,cAAc;AAAA;AAAA,IACd,cAAc;AAAA,EAChB,CAAC;AAGD,YAAU,GAAG,QAAQ,CAAC,SAAS;AAC7B,uBAAK,SAAQ,MAAM,EAAE,MAAM,MAAM,CAAC;AAAA,EACpC,CAAC;AAED,OAAK,KAAK,KAAK,IAAI,EAAE,IAAI,OAAO,QAAQ,QAAQ,UAAU;AAC1D,SAAO,KAAK,KAAK,KAAK;AACxB;AAQA;AAAA,kBAAa,SAAC,OAAe;AAC3B,SAAO,KAAK,KAAK,KAAK,GAAG,QAAQ,KAAK,cAAc;AAEpD,QAAM,SAAS,SAAS,eAAe,KAAK;AAC5C,SAAO,QAAQ,mBAAmB,KAAK,cAAc;AAErD,SAAO,OAAO;AACd,OAAK,KAAK,KAAK,EAAE,OAAO,QAAQ;AAChC,SAAO,KAAK,KAAK,KAAK;AACxB;AApGK,IAAM,oBAAN;","names":[]}
|
package/dist/chunk-MMYM63NH.mjs
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
assertIsOnNameLookupRequestArguments,
|
|
3
|
-
assertIsOnSignatureRequestArguments,
|
|
4
|
-
assertIsOnTransactionRequestArguments,
|
|
5
|
-
assertIsOnUserInputRequestArguments
|
|
6
|
-
} from "./chunk-75RCH4ZX.mjs";
|
|
7
|
-
|
|
8
|
-
// src/common/commands.ts
|
|
9
|
-
import { HandlerType } from "@metamask/snaps-utils";
|
|
10
|
-
import { assertExhaustive } from "@metamask/utils";
|
|
11
|
-
function getHandlerArguments(origin, handler, request) {
|
|
12
|
-
switch (handler) {
|
|
13
|
-
case HandlerType.OnTransaction: {
|
|
14
|
-
assertIsOnTransactionRequestArguments(request.params);
|
|
15
|
-
const { transaction, chainId, transactionOrigin } = request.params;
|
|
16
|
-
return {
|
|
17
|
-
transaction,
|
|
18
|
-
chainId,
|
|
19
|
-
transactionOrigin
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
case HandlerType.OnSignature: {
|
|
23
|
-
assertIsOnSignatureRequestArguments(request.params);
|
|
24
|
-
const { signature, signatureOrigin } = request.params;
|
|
25
|
-
return { signature, signatureOrigin };
|
|
26
|
-
}
|
|
27
|
-
case HandlerType.OnNameLookup: {
|
|
28
|
-
assertIsOnNameLookupRequestArguments(request.params);
|
|
29
|
-
const { chainId, domain, address } = request.params;
|
|
30
|
-
return domain ? {
|
|
31
|
-
chainId,
|
|
32
|
-
domain
|
|
33
|
-
} : {
|
|
34
|
-
chainId,
|
|
35
|
-
address
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
case HandlerType.OnRpcRequest:
|
|
39
|
-
case HandlerType.OnKeyringRequest:
|
|
40
|
-
return { origin, request };
|
|
41
|
-
case HandlerType.OnCronjob:
|
|
42
|
-
return { request };
|
|
43
|
-
case HandlerType.OnInstall:
|
|
44
|
-
case HandlerType.OnUpdate:
|
|
45
|
-
return { origin };
|
|
46
|
-
case HandlerType.OnHomePage:
|
|
47
|
-
return {};
|
|
48
|
-
case HandlerType.OnUserInput: {
|
|
49
|
-
assertIsOnUserInputRequestArguments(request.params);
|
|
50
|
-
const { id, event, context } = request.params;
|
|
51
|
-
return { id, event, context };
|
|
52
|
-
}
|
|
53
|
-
default:
|
|
54
|
-
return assertExhaustive(handler);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
function getCommandMethodImplementations(startSnap, invokeSnap, onTerminate) {
|
|
58
|
-
return {
|
|
59
|
-
ping: async () => Promise.resolve("OK"),
|
|
60
|
-
terminate: async () => {
|
|
61
|
-
onTerminate();
|
|
62
|
-
return Promise.resolve("OK");
|
|
63
|
-
},
|
|
64
|
-
executeSnap: async (snapId, sourceCode, endowments) => {
|
|
65
|
-
await startSnap(snapId, sourceCode, endowments);
|
|
66
|
-
return "OK";
|
|
67
|
-
},
|
|
68
|
-
snapRpc: async (target, handler, origin, request) => {
|
|
69
|
-
return await invokeSnap(
|
|
70
|
-
target,
|
|
71
|
-
handler,
|
|
72
|
-
getHandlerArguments(origin, handler, request)
|
|
73
|
-
) ?? null;
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export {
|
|
79
|
-
getHandlerArguments,
|
|
80
|
-
getCommandMethodImplementations
|
|
81
|
-
};
|
|
82
|
-
//# sourceMappingURL=chunk-MMYM63NH.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/common/commands.ts"],"sourcesContent":["import { HandlerType } from '@metamask/snaps-utils';\nimport { assertExhaustive } from '@metamask/utils';\n\nimport type { InvokeSnap, InvokeSnapArgs } from './BaseSnapExecutor';\nimport type {\n ExecuteSnap,\n JsonRpcRequestWithoutId,\n Ping,\n PossibleLookupRequestArgs,\n SnapRpc,\n Terminate,\n} from './validation';\nimport {\n assertIsOnTransactionRequestArguments,\n assertIsOnSignatureRequestArguments,\n assertIsOnNameLookupRequestArguments,\n assertIsOnUserInputRequestArguments,\n} from './validation';\n\nexport type CommandMethodsMapping = {\n ping: Ping;\n terminate: Terminate;\n executeSnap: ExecuteSnap;\n snapRpc: SnapRpc;\n};\n\n/**\n * Formats the arguments for the given handler.\n *\n * @param origin - The origin of the request.\n * @param handler - The handler to pass the request to.\n * @param request - The request object.\n * @returns The formatted arguments.\n */\nexport function getHandlerArguments(\n origin: string,\n handler: HandlerType,\n request: JsonRpcRequestWithoutId,\n): InvokeSnapArgs {\n // `request` is already validated by the time this function is called.\n\n switch (handler) {\n case HandlerType.OnTransaction: {\n assertIsOnTransactionRequestArguments(request.params);\n\n const { transaction, chainId, transactionOrigin } = request.params;\n return {\n transaction,\n chainId,\n transactionOrigin,\n };\n }\n case HandlerType.OnSignature: {\n assertIsOnSignatureRequestArguments(request.params);\n\n const { signature, signatureOrigin } = request.params;\n return { signature, signatureOrigin };\n }\n case HandlerType.OnNameLookup: {\n assertIsOnNameLookupRequestArguments(request.params);\n\n // TS complains that domain/address are not part of the type\n // casting here as we've already validated the request args in the above step.\n const { chainId, domain, address } =\n request.params as unknown as PossibleLookupRequestArgs;\n\n return domain\n ? {\n chainId,\n domain,\n }\n : {\n chainId,\n address,\n };\n }\n case HandlerType.OnRpcRequest:\n case HandlerType.OnKeyringRequest:\n return { origin, request };\n\n case HandlerType.OnCronjob:\n return { request };\n\n case HandlerType.OnInstall:\n case HandlerType.OnUpdate:\n return { origin };\n\n case HandlerType.OnHomePage:\n return {};\n case HandlerType.OnUserInput: {\n assertIsOnUserInputRequestArguments(request.params);\n\n const { id, event, context } = request.params;\n return { id, event, context };\n }\n\n default:\n return assertExhaustive(handler);\n }\n}\n\n/**\n * Gets an object mapping internal, \"command\" JSON-RPC method names to their\n * implementations.\n *\n * @param startSnap - A function that starts a snap.\n * @param invokeSnap - A function that invokes the RPC method handler of a\n * snap.\n * @param onTerminate - A function that will be called when this executor is\n * terminated in order to handle cleanup tasks.\n * @returns An object containing the \"command\" method implementations.\n */\nexport function getCommandMethodImplementations(\n startSnap: (...args: Parameters<ExecuteSnap>) => Promise<void>,\n invokeSnap: InvokeSnap,\n onTerminate: () => void,\n): CommandMethodsMapping {\n return {\n ping: async () => Promise.resolve('OK'),\n terminate: async () => {\n onTerminate();\n return Promise.resolve('OK');\n },\n\n executeSnap: async (snapId, sourceCode, endowments) => {\n await startSnap(snapId, sourceCode, endowments);\n return 'OK';\n },\n\n snapRpc: async (target, handler, origin, request) => {\n return (\n (await invokeSnap(\n target,\n handler,\n getHandlerArguments(origin, handler, request),\n )) ?? null\n );\n },\n };\n}\n"],"mappings":";;;;;;;;AAAA,SAAS,mBAAmB;AAC5B,SAAS,wBAAwB;AAiC1B,SAAS,oBACd,QACA,SACA,SACgB;AAGhB,UAAQ,SAAS;AAAA,IACf,KAAK,YAAY,eAAe;AAC9B,4CAAsC,QAAQ,MAAM;AAEpD,YAAM,EAAE,aAAa,SAAS,kBAAkB,IAAI,QAAQ;AAC5D,aAAO;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAAA,IACA,KAAK,YAAY,aAAa;AAC5B,0CAAoC,QAAQ,MAAM;AAElD,YAAM,EAAE,WAAW,gBAAgB,IAAI,QAAQ;AAC/C,aAAO,EAAE,WAAW,gBAAgB;AAAA,IACtC;AAAA,IACA,KAAK,YAAY,cAAc;AAC7B,2CAAqC,QAAQ,MAAM;AAInD,YAAM,EAAE,SAAS,QAAQ,QAAQ,IAC/B,QAAQ;AAEV,aAAO,SACH;AAAA,QACE;AAAA,QACA;AAAA,MACF,IACA;AAAA,QACE;AAAA,QACA;AAAA,MACF;AAAA,IACN;AAAA,IACA,KAAK,YAAY;AAAA,IACjB,KAAK,YAAY;AACf,aAAO,EAAE,QAAQ,QAAQ;AAAA,IAE3B,KAAK,YAAY;AACf,aAAO,EAAE,QAAQ;AAAA,IAEnB,KAAK,YAAY;AAAA,IACjB,KAAK,YAAY;AACf,aAAO,EAAE,OAAO;AAAA,IAElB,KAAK,YAAY;AACf,aAAO,CAAC;AAAA,IACV,KAAK,YAAY,aAAa;AAC5B,0CAAoC,QAAQ,MAAM;AAElD,YAAM,EAAE,IAAI,OAAO,QAAQ,IAAI,QAAQ;AACvC,aAAO,EAAE,IAAI,OAAO,QAAQ;AAAA,IAC9B;AAAA,IAEA;AACE,aAAO,iBAAiB,OAAO;AAAA,EACnC;AACF;AAaO,SAAS,gCACd,WACA,YACA,aACuB;AACvB,SAAO;AAAA,IACL,MAAM,YAAY,QAAQ,QAAQ,IAAI;AAAA,IACtC,WAAW,YAAY;AACrB,kBAAY;AACZ,aAAO,QAAQ,QAAQ,IAAI;AAAA,IAC7B;AAAA,IAEA,aAAa,OAAO,QAAQ,YAAY,eAAe;AACrD,YAAM,UAAU,QAAQ,YAAY,UAAU;AAC9C,aAAO;AAAA,IACT;AAAA,IAEA,SAAS,OAAO,QAAQ,SAAS,QAAQ,YAAY;AACnD,aACG,MAAM;AAAA,QACL;AAAA,QACA;AAAA,QACA,oBAAoB,QAAQ,SAAS,OAAO;AAAA,MAC9C,KAAM;AAAA,IAEV;AAAA,EACF;AACF;","names":[]}
|
package/dist/chunk-MS2LQQYH.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
var _chunkHGLRZZ56js = require('./chunk-HGLRZZ56.js');
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var _chunkDLLLH5HNjs = require('./chunk-DLLLH5HN.js');
|
|
7
|
-
|
|
8
|
-
// src/common/endowments/math.ts
|
|
9
|
-
function createMath() {
|
|
10
|
-
const keys = Object.getOwnPropertyNames(
|
|
11
|
-
_chunkDLLLH5HNjs.rootRealmGlobal.Math
|
|
12
|
-
);
|
|
13
|
-
const math = keys.reduce((target, key) => {
|
|
14
|
-
if (key === "random") {
|
|
15
|
-
return target;
|
|
16
|
-
}
|
|
17
|
-
return { ...target, [key]: _chunkDLLLH5HNjs.rootRealmGlobal.Math[key] };
|
|
18
|
-
}, {});
|
|
19
|
-
const { crypto: hardenedCrypto } = _chunkHGLRZZ56js.createCrypto.call(void 0, );
|
|
20
|
-
return harden({
|
|
21
|
-
Math: {
|
|
22
|
-
...math,
|
|
23
|
-
random: () => {
|
|
24
|
-
return hardenedCrypto.getRandomValues(new Uint32Array(1))[0] / 2 ** 32;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
var endowmentModule = {
|
|
30
|
-
names: ["Math"],
|
|
31
|
-
factory: createMath
|
|
32
|
-
};
|
|
33
|
-
var math_default = endowmentModule;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
exports.math_default = math_default;
|
|
38
|
-
//# sourceMappingURL=chunk-MS2LQQYH.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/common/endowments/math.ts"],"names":[],"mappings":";;;;;;;;AAUA,SAAS,aAAa;AAGpB,QAAM,OAAO,OAAO;AAAA,IAClB,gBAAgB;AAAA,EAClB;AAEA,QAAM,OAAO,KAAK,OAAsB,CAAC,QAAQ,QAAQ;AACvD,QAAI,QAAQ,UAAU;AACpB,aAAO;AAAA,IACT;AAEA,WAAO,EAAE,GAAG,QAAQ,CAAC,GAAG,GAAG,gBAAgB,KAAK,GAAG,EAAE;AAAA,EACvD,GAAG,CAAC,CAAC;AAGL,QAAM,EAAE,QAAQ,eAAe,IAAI,aAAa;AAEhD,SAAO,OAAO;AAAA,IACZ,MAAM;AAAA,MACJ,GAAG;AAAA,MACH,QAAQ,MAAM;AAiBZ,eAAO,eAAe,gBAAgB,IAAI,YAAY,CAAC,CAAC,EAAE,CAAC,IAAI,KAAK;AAAA,MACtE;AAAA,IACF;AAAA,EACF,CAAC;AACH;AAEA,IAAM,kBAAkB;AAAA,EACtB,OAAO,CAAC,MAAM;AAAA,EACd,SAAS;AACX;AAEA,IAAO,eAAQ","sourcesContent":["import { rootRealmGlobal } from '../globalObject';\nimport { createCrypto } from './crypto';\n\n/**\n * Create a {@link Math} object, with the same properties as the global\n * {@link Math} object, but with the {@link Math.random} method replaced.\n *\n * @returns The {@link Math} object with the {@link Math.random} method\n * replaced.\n */\nfunction createMath() {\n // `Math` does not work with `Object.keys`, `Object.entries`, etc., so we\n // need to create a new object with the same properties.\n const keys = Object.getOwnPropertyNames(\n rootRealmGlobal.Math,\n ) as (keyof typeof Math)[];\n\n const math = keys.reduce<Partial<Math>>((target, key) => {\n if (key === 'random') {\n return target;\n }\n\n return { ...target, [key]: rootRealmGlobal.Math[key] };\n }, {});\n\n // Since the math endowment requires crypto, we can leverage the crypto endowment factory to get a hardened and platform agnostic instance of webcrypto\n const { crypto: hardenedCrypto } = createCrypto();\n\n return harden({\n Math: {\n ...math,\n random: () => {\n // NOTE: This is not intended to be a secure replacement for the weak\n // random number generator used by `Math.random`. It is only intended to\n // prevent side channel attacks of `Math.random` by replacing it with an\n // alternative implementation that is not vulnerable to the same\n // attacks.\n //\n // This does not mean that this implementation is secure. It is not\n // intended to be used in a security context, and this implementation\n // may change at any time.\n //\n // To securely generate random numbers, use a cryptographically secure\n // random number generator, such as the one provided by the Web Crypto\n // API:\n //\n // - https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/generateKey\n // - https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues\n return hardenedCrypto.getRandomValues(new Uint32Array(1))[0] / 2 ** 32;\n },\n },\n });\n}\n\nconst endowmentModule = {\n names: ['Math'] as const,\n factory: createMath,\n};\n\nexport default endowmentModule;\n"]}
|
package/dist/chunk-MXNMMTJW.mjs
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
// src/common/lockdown/lockdown-more.ts
|
|
2
|
-
import { logError } from "@metamask/snaps-utils";
|
|
3
|
-
function executeLockdownMore() {
|
|
4
|
-
try {
|
|
5
|
-
const namedIntrinsics = Reflect.ownKeys(new Compartment().globalThis);
|
|
6
|
-
const shouldHardenManually = /* @__PURE__ */ new Set(["eval", "Function"]);
|
|
7
|
-
const globalProperties = /* @__PURE__ */ new Set([
|
|
8
|
-
// universalPropertyNames is a constant added by lockdown to global scope
|
|
9
|
-
// at the time of writing, it is initialized in 'ses/src/whitelist'.
|
|
10
|
-
// These properties tend to be non-enumerable.
|
|
11
|
-
...namedIntrinsics
|
|
12
|
-
// TODO: Also include the named platform globals
|
|
13
|
-
// This grabs every enumerable property on globalThis.
|
|
14
|
-
// ...Object.keys(globalThis),
|
|
15
|
-
]);
|
|
16
|
-
globalProperties.forEach((propertyName) => {
|
|
17
|
-
const descriptor = Reflect.getOwnPropertyDescriptor(
|
|
18
|
-
globalThis,
|
|
19
|
-
propertyName
|
|
20
|
-
);
|
|
21
|
-
if (descriptor) {
|
|
22
|
-
if (descriptor.configurable) {
|
|
23
|
-
if (hasAccessor(descriptor)) {
|
|
24
|
-
Object.defineProperty(globalThis, propertyName, {
|
|
25
|
-
configurable: false
|
|
26
|
-
});
|
|
27
|
-
} else {
|
|
28
|
-
Object.defineProperty(globalThis, propertyName, {
|
|
29
|
-
configurable: false,
|
|
30
|
-
writable: false
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
if (shouldHardenManually.has(propertyName)) {
|
|
35
|
-
harden(globalThis[propertyName]);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
} catch (error) {
|
|
40
|
-
logError("Protecting intrinsics failed:", error);
|
|
41
|
-
throw error;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
function hasAccessor(descriptor) {
|
|
45
|
-
return "set" in descriptor || "get" in descriptor;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export {
|
|
49
|
-
executeLockdownMore
|
|
50
|
-
};
|
|
51
|
-
//# sourceMappingURL=chunk-MXNMMTJW.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/common/lockdown/lockdown-more.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/triple-slash-reference, spaced-comment\n/// <reference path=\"../../../../../node_modules/ses/types.d.ts\" />\n\nimport { logError } from '@metamask/snaps-utils';\n\n/**\n * The SES `lockdown` function only hardens the properties enumerated by the\n * universalPropertyNames constant specified in 'ses/src/whitelist'. This\n * function makes all function and object properties on the start compartment\n * global non-configurable and non-writable, unless they are already\n * non-configurable.\n *\n * It is critical that this function runs at the right time during\n * initialization, which should always be immediately after `lockdown` has been\n * called. At the time of writing, the modifications this function makes to the\n * runtime environment appear to be non-breaking, but that could change with\n * the addition of dependencies, or the order of our scripts in our HTML files.\n * Exercise caution.\n *\n * See inline comments for implementation details.\n *\n * We write this function in IIFE format to avoid polluting global scope.\n *\n * @throws If the lockdown failed.\n */\nexport function executeLockdownMore() {\n // Make all \"object\" and \"function\" own properties of globalThis\n // non-configurable and non-writable, when possible.\n // We call a property that is non-configurable and non-writable,\n // \"non-modifiable\".\n try {\n const namedIntrinsics = Reflect.ownKeys(new Compartment().globalThis);\n\n // These named intrinsics are not automatically hardened by `lockdown`\n const shouldHardenManually = new Set<symbol | string>(['eval', 'Function']);\n\n const globalProperties = new Set([\n // universalPropertyNames is a constant added by lockdown to global scope\n // at the time of writing, it is initialized in 'ses/src/whitelist'.\n // These properties tend to be non-enumerable.\n ...namedIntrinsics,\n\n // TODO: Also include the named platform globals\n // This grabs every enumerable property on globalThis.\n // ...Object.keys(globalThis),\n ]);\n\n globalProperties.forEach((propertyName) => {\n const descriptor = Reflect.getOwnPropertyDescriptor(\n globalThis,\n propertyName,\n );\n\n if (descriptor) {\n if (descriptor.configurable) {\n // If the property on globalThis is configurable, make it\n // non-configurable. If it has no accessor properties, also make it\n // non-writable.\n if (hasAccessor(descriptor)) {\n Object.defineProperty(globalThis, propertyName, {\n configurable: false,\n });\n } else {\n Object.defineProperty(globalThis, propertyName, {\n configurable: false,\n writable: false,\n });\n }\n }\n\n if (shouldHardenManually.has(propertyName)) {\n harden((globalThis as any)[propertyName]);\n }\n }\n });\n } catch (error) {\n logError('Protecting intrinsics failed:', error);\n throw error;\n }\n}\n\n/**\n * Checks whether the given propertyName descriptor has any accessors, i.e. the\n * properties `get` or `set`.\n *\n * We want to make globals non-writable, and we can't set the `writable`\n * property and accessor properties at the same time.\n *\n * @param descriptor - The propertyName descriptor to check.\n * @returns Whether the propertyName descriptor has any accessors.\n */\nfunction hasAccessor(descriptor: any): boolean {\n return 'set' in descriptor || 'get' in descriptor;\n}\n"],"mappings":";AAGA,SAAS,gBAAgB;AAsBlB,SAAS,sBAAsB;AAKpC,MAAI;AACF,UAAM,kBAAkB,QAAQ,QAAQ,IAAI,YAAY,EAAE,UAAU;AAGpE,UAAM,uBAAuB,oBAAI,IAAqB,CAAC,QAAQ,UAAU,CAAC;AAE1E,UAAM,mBAAmB,oBAAI,IAAI;AAAA;AAAA;AAAA;AAAA,MAI/B,GAAG;AAAA;AAAA;AAAA;AAAA,IAKL,CAAC;AAED,qBAAiB,QAAQ,CAAC,iBAAiB;AACzC,YAAM,aAAa,QAAQ;AAAA,QACzB;AAAA,QACA;AAAA,MACF;AAEA,UAAI,YAAY;AACd,YAAI,WAAW,cAAc;AAI3B,cAAI,YAAY,UAAU,GAAG;AAC3B,mBAAO,eAAe,YAAY,cAAc;AAAA,cAC9C,cAAc;AAAA,YAChB,CAAC;AAAA,UACH,OAAO;AACL,mBAAO,eAAe,YAAY,cAAc;AAAA,cAC9C,cAAc;AAAA,cACd,UAAU;AAAA,YACZ,CAAC;AAAA,UACH;AAAA,QACF;AAEA,YAAI,qBAAqB,IAAI,YAAY,GAAG;AAC1C,iBAAQ,WAAmB,YAAY,CAAC;AAAA,QAC1C;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACH,SAAS,OAAO;AACd,aAAS,iCAAiC,KAAK;AAC/C,UAAM;AAAA,EACR;AACF;AAYA,SAAS,YAAY,YAA0B;AAC7C,SAAO,SAAS,cAAc,SAAS;AACzC;","names":[]}
|
package/dist/chunk-OBT45IWW.js
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
var _chunkDLLLH5HNjs = require('./chunk-DLLLH5HN.js');
|
|
4
|
-
|
|
5
|
-
// src/common/endowments/console.ts
|
|
6
|
-
var _utils = require('@metamask/utils');
|
|
7
|
-
var consoleAttenuatedMethods = /* @__PURE__ */ new Set([
|
|
8
|
-
"log",
|
|
9
|
-
"assert",
|
|
10
|
-
"error",
|
|
11
|
-
"debug",
|
|
12
|
-
"info",
|
|
13
|
-
"warn"
|
|
14
|
-
]);
|
|
15
|
-
var consoleMethods = /* @__PURE__ */ new Set([
|
|
16
|
-
"debug",
|
|
17
|
-
"error",
|
|
18
|
-
"info",
|
|
19
|
-
"log",
|
|
20
|
-
"warn",
|
|
21
|
-
"dir",
|
|
22
|
-
"dirxml",
|
|
23
|
-
"table",
|
|
24
|
-
"trace",
|
|
25
|
-
"group",
|
|
26
|
-
"groupCollapsed",
|
|
27
|
-
"groupEnd",
|
|
28
|
-
"clear",
|
|
29
|
-
"count",
|
|
30
|
-
"countReset",
|
|
31
|
-
"assert",
|
|
32
|
-
"profile",
|
|
33
|
-
"profileEnd",
|
|
34
|
-
"time",
|
|
35
|
-
"timeLog",
|
|
36
|
-
"timeEnd",
|
|
37
|
-
"timeStamp",
|
|
38
|
-
"context"
|
|
39
|
-
]);
|
|
40
|
-
var consoleFunctions = ["log", "error", "debug", "info", "warn"];
|
|
41
|
-
function getMessage(snapId, message, ...args) {
|
|
42
|
-
const prefix = `[Snap: ${snapId}]`;
|
|
43
|
-
if (typeof message === "string") {
|
|
44
|
-
return [`${prefix} ${message}`, ...args];
|
|
45
|
-
}
|
|
46
|
-
return [prefix, message, ...args];
|
|
47
|
-
}
|
|
48
|
-
function createConsole({ snapId } = {}) {
|
|
49
|
-
_utils.assert.call(void 0, snapId !== void 0);
|
|
50
|
-
const keys = Object.getOwnPropertyNames(
|
|
51
|
-
_chunkDLLLH5HNjs.rootRealmGlobal.console
|
|
52
|
-
);
|
|
53
|
-
const attenuatedConsole = keys.reduce((target, key) => {
|
|
54
|
-
if (consoleMethods.has(key) && !consoleAttenuatedMethods.has(key)) {
|
|
55
|
-
return { ...target, [key]: _chunkDLLLH5HNjs.rootRealmGlobal.console[key] };
|
|
56
|
-
}
|
|
57
|
-
return target;
|
|
58
|
-
}, {});
|
|
59
|
-
return harden({
|
|
60
|
-
console: {
|
|
61
|
-
...attenuatedConsole,
|
|
62
|
-
assert: (value, message, ...optionalParams) => {
|
|
63
|
-
_chunkDLLLH5HNjs.rootRealmGlobal.console.assert(
|
|
64
|
-
value,
|
|
65
|
-
...getMessage(snapId, message, ...optionalParams)
|
|
66
|
-
);
|
|
67
|
-
},
|
|
68
|
-
...consoleFunctions.reduce((target, key) => {
|
|
69
|
-
return {
|
|
70
|
-
...target,
|
|
71
|
-
[key]: (message, ...optionalParams) => {
|
|
72
|
-
_chunkDLLLH5HNjs.rootRealmGlobal.console[key](
|
|
73
|
-
...getMessage(snapId, message, ...optionalParams)
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
}, {})
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
var endowmentModule = {
|
|
82
|
-
names: ["console"],
|
|
83
|
-
factory: createConsole
|
|
84
|
-
};
|
|
85
|
-
var console_default = endowmentModule;
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
exports.consoleAttenuatedMethods = consoleAttenuatedMethods; exports.consoleMethods = consoleMethods; exports.console_default = console_default;
|
|
92
|
-
//# sourceMappingURL=chunk-OBT45IWW.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/common/endowments/console.ts"],"names":[],"mappings":";;;;;AAAA,SAAS,cAAc;AAKhB,IAAM,2BAA2B,oBAAI,IAAI;AAAA,EAC9C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAMM,IAAM,iBAAiB,oBAAI,IAAI;AAAA,EACpC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAED,IAAM,mBAAmB,CAAC,OAAO,SAAS,SAAS,QAAQ,MAAM;AAejE,SAAS,WAAW,QAAgB,YAAqB,MAAiB;AACxE,QAAM,SAAS,UAAU,MAAM;AAI/B,MAAI,OAAO,YAAY,UAAU;AAC/B,WAAO,CAAC,GAAG,MAAM,IAAI,OAAO,IAAI,GAAG,IAAI;AAAA,EACzC;AAIA,SAAO,CAAC,QAAQ,SAAS,GAAG,IAAI;AAClC;AAUA,SAAS,cAAc,EAAE,OAAO,IAA6B,CAAC,GAAG;AAC/D,SAAO,WAAW,MAAS;AAC3B,QAAM,OAAO,OAAO;AAAA,IAClB,gBAAgB;AAAA,EAClB;AAEA,QAAM,oBAAoB,KAAK,OAAO,CAAC,QAAQ,QAAQ;AACrD,QAAI,eAAe,IAAI,GAAG,KAAK,CAAC,yBAAyB,IAAI,GAAG,GAAG;AACjE,aAAO,EAAE,GAAG,QAAQ,CAAC,GAAG,GAAG,gBAAgB,QAAQ,GAAG,EAAE;AAAA,IAC1D;AAEA,WAAO;AAAA,EACT,GAAG,CAAC,CAAC;AAEL,SAAO,OAAO;AAAA,IACZ,SAAS;AAAA,MACP,GAAG;AAAA,MACH,QAAQ,CACN,OACA,YACG,mBACA;AACH,wBAAgB,QAAQ;AAAA,UACtB;AAAA,UACA,GAAG,WAAW,QAAQ,SAAS,GAAG,cAAc;AAAA,QAClD;AAAA,MACF;AAAA,MACA,GAAG,iBAAiB,OAAyB,CAAC,QAAQ,QAAQ;AAC5D,eAAO;AAAA,UACL,GAAG;AAAA,UACH,CAAC,GAAG,GAAG,CAAC,YAAsB,mBAA0B;AACtD,4BAAgB,QAAQ,GAAG;AAAA,cACzB,GAAG,WAAW,QAAQ,SAAS,GAAG,cAAc;AAAA,YAClD;AAAA,UACF;AAAA,QACF;AAAA,MACF,GAAG,CAAC,CAAqB;AAAA,IAC3B;AAAA,EACF,CAAC;AACH;AAEA,IAAM,kBAAkB;AAAA,EACtB,OAAO,CAAC,SAAS;AAAA,EACjB,SAAS;AACX;AAEA,IAAO,kBAAQ","sourcesContent":["import { 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: string, 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"]}
|
package/dist/chunk-OCNPLHS2.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/common/lockdown/lockdown-more.ts
|
|
2
|
-
var _snapsutils = require('@metamask/snaps-utils');
|
|
3
|
-
function executeLockdownMore() {
|
|
4
|
-
try {
|
|
5
|
-
const namedIntrinsics = Reflect.ownKeys(new Compartment().globalThis);
|
|
6
|
-
const shouldHardenManually = /* @__PURE__ */ new Set(["eval", "Function"]);
|
|
7
|
-
const globalProperties = /* @__PURE__ */ new Set([
|
|
8
|
-
// universalPropertyNames is a constant added by lockdown to global scope
|
|
9
|
-
// at the time of writing, it is initialized in 'ses/src/whitelist'.
|
|
10
|
-
// These properties tend to be non-enumerable.
|
|
11
|
-
...namedIntrinsics
|
|
12
|
-
// TODO: Also include the named platform globals
|
|
13
|
-
// This grabs every enumerable property on globalThis.
|
|
14
|
-
// ...Object.keys(globalThis),
|
|
15
|
-
]);
|
|
16
|
-
globalProperties.forEach((propertyName) => {
|
|
17
|
-
const descriptor = Reflect.getOwnPropertyDescriptor(
|
|
18
|
-
globalThis,
|
|
19
|
-
propertyName
|
|
20
|
-
);
|
|
21
|
-
if (descriptor) {
|
|
22
|
-
if (descriptor.configurable) {
|
|
23
|
-
if (hasAccessor(descriptor)) {
|
|
24
|
-
Object.defineProperty(globalThis, propertyName, {
|
|
25
|
-
configurable: false
|
|
26
|
-
});
|
|
27
|
-
} else {
|
|
28
|
-
Object.defineProperty(globalThis, propertyName, {
|
|
29
|
-
configurable: false,
|
|
30
|
-
writable: false
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
if (shouldHardenManually.has(propertyName)) {
|
|
35
|
-
harden(globalThis[propertyName]);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
} catch (error) {
|
|
40
|
-
_snapsutils.logError.call(void 0, "Protecting intrinsics failed:", error);
|
|
41
|
-
throw error;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
function hasAccessor(descriptor) {
|
|
45
|
-
return "set" in descriptor || "get" in descriptor;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
exports.executeLockdownMore = executeLockdownMore;
|
|
51
|
-
//# sourceMappingURL=chunk-OCNPLHS2.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/common/lockdown/lockdown-more.ts"],"names":[],"mappings":";AAGA,SAAS,gBAAgB;AAsBlB,SAAS,sBAAsB;AAKpC,MAAI;AACF,UAAM,kBAAkB,QAAQ,QAAQ,IAAI,YAAY,EAAE,UAAU;AAGpE,UAAM,uBAAuB,oBAAI,IAAqB,CAAC,QAAQ,UAAU,CAAC;AAE1E,UAAM,mBAAmB,oBAAI,IAAI;AAAA;AAAA;AAAA;AAAA,MAI/B,GAAG;AAAA;AAAA;AAAA;AAAA,IAKL,CAAC;AAED,qBAAiB,QAAQ,CAAC,iBAAiB;AACzC,YAAM,aAAa,QAAQ;AAAA,QACzB;AAAA,QACA;AAAA,MACF;AAEA,UAAI,YAAY;AACd,YAAI,WAAW,cAAc;AAI3B,cAAI,YAAY,UAAU,GAAG;AAC3B,mBAAO,eAAe,YAAY,cAAc;AAAA,cAC9C,cAAc;AAAA,YAChB,CAAC;AAAA,UACH,OAAO;AACL,mBAAO,eAAe,YAAY,cAAc;AAAA,cAC9C,cAAc;AAAA,cACd,UAAU;AAAA,YACZ,CAAC;AAAA,UACH;AAAA,QACF;AAEA,YAAI,qBAAqB,IAAI,YAAY,GAAG;AAC1C,iBAAQ,WAAmB,YAAY,CAAC;AAAA,QAC1C;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACH,SAAS,OAAO;AACd,aAAS,iCAAiC,KAAK;AAC/C,UAAM;AAAA,EACR;AACF;AAYA,SAAS,YAAY,YAA0B;AAC7C,SAAO,SAAS,cAAc,SAAS;AACzC","sourcesContent":["// eslint-disable-next-line @typescript-eslint/triple-slash-reference, spaced-comment\n/// <reference path=\"../../../../../node_modules/ses/types.d.ts\" />\n\nimport { logError } from '@metamask/snaps-utils';\n\n/**\n * The SES `lockdown` function only hardens the properties enumerated by the\n * universalPropertyNames constant specified in 'ses/src/whitelist'. This\n * function makes all function and object properties on the start compartment\n * global non-configurable and non-writable, unless they are already\n * non-configurable.\n *\n * It is critical that this function runs at the right time during\n * initialization, which should always be immediately after `lockdown` has been\n * called. At the time of writing, the modifications this function makes to the\n * runtime environment appear to be non-breaking, but that could change with\n * the addition of dependencies, or the order of our scripts in our HTML files.\n * Exercise caution.\n *\n * See inline comments for implementation details.\n *\n * We write this function in IIFE format to avoid polluting global scope.\n *\n * @throws If the lockdown failed.\n */\nexport function executeLockdownMore() {\n // Make all \"object\" and \"function\" own properties of globalThis\n // non-configurable and non-writable, when possible.\n // We call a property that is non-configurable and non-writable,\n // \"non-modifiable\".\n try {\n const namedIntrinsics = Reflect.ownKeys(new Compartment().globalThis);\n\n // These named intrinsics are not automatically hardened by `lockdown`\n const shouldHardenManually = new Set<symbol | string>(['eval', 'Function']);\n\n const globalProperties = new Set([\n // universalPropertyNames is a constant added by lockdown to global scope\n // at the time of writing, it is initialized in 'ses/src/whitelist'.\n // These properties tend to be non-enumerable.\n ...namedIntrinsics,\n\n // TODO: Also include the named platform globals\n // This grabs every enumerable property on globalThis.\n // ...Object.keys(globalThis),\n ]);\n\n globalProperties.forEach((propertyName) => {\n const descriptor = Reflect.getOwnPropertyDescriptor(\n globalThis,\n propertyName,\n );\n\n if (descriptor) {\n if (descriptor.configurable) {\n // If the property on globalThis is configurable, make it\n // non-configurable. If it has no accessor properties, also make it\n // non-writable.\n if (hasAccessor(descriptor)) {\n Object.defineProperty(globalThis, propertyName, {\n configurable: false,\n });\n } else {\n Object.defineProperty(globalThis, propertyName, {\n configurable: false,\n writable: false,\n });\n }\n }\n\n if (shouldHardenManually.has(propertyName)) {\n harden((globalThis as any)[propertyName]);\n }\n }\n });\n } catch (error) {\n logError('Protecting intrinsics failed:', error);\n throw error;\n }\n}\n\n/**\n * Checks whether the given propertyName descriptor has any accessors, i.e. the\n * properties `get` or `set`.\n *\n * We want to make globals non-writable, and we can't set the `writable`\n * property and accessor properties at the same time.\n *\n * @param descriptor - The propertyName descriptor to check.\n * @returns Whether the propertyName descriptor has any accessors.\n */\nfunction hasAccessor(descriptor: any): boolean {\n return 'set' in descriptor || 'get' in descriptor;\n}\n"]}
|
package/dist/chunk-ODICKSGZ.mjs
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
interval_default
|
|
3
|
-
} from "./chunk-S5NWI5Z7.mjs";
|
|
4
|
-
import {
|
|
5
|
-
math_default
|
|
6
|
-
} from "./chunk-BCBKEUCG.mjs";
|
|
7
|
-
import {
|
|
8
|
-
network_default
|
|
9
|
-
} from "./chunk-XPCW7TKM.mjs";
|
|
10
|
-
import {
|
|
11
|
-
textDecoder_default
|
|
12
|
-
} from "./chunk-53ZULHPK.mjs";
|
|
13
|
-
import {
|
|
14
|
-
textEncoder_default
|
|
15
|
-
} from "./chunk-HWS4QSOC.mjs";
|
|
16
|
-
import {
|
|
17
|
-
timeout_default
|
|
18
|
-
} from "./chunk-Y7AK2VVC.mjs";
|
|
19
|
-
import {
|
|
20
|
-
console_default
|
|
21
|
-
} from "./chunk-W7EDURT5.mjs";
|
|
22
|
-
import {
|
|
23
|
-
crypto_default
|
|
24
|
-
} from "./chunk-Q42NNJFY.mjs";
|
|
25
|
-
import {
|
|
26
|
-
date_default
|
|
27
|
-
} from "./chunk-UOPIRTJX.mjs";
|
|
28
|
-
import {
|
|
29
|
-
rootRealmGlobal
|
|
30
|
-
} from "./chunk-IX5S3V47.mjs";
|
|
31
|
-
|
|
32
|
-
// src/common/endowments/commonEndowmentFactory.ts
|
|
33
|
-
var commonEndowments = [
|
|
34
|
-
{ endowment: AbortController, name: "AbortController" },
|
|
35
|
-
{ endowment: AbortSignal, name: "AbortSignal" },
|
|
36
|
-
{ endowment: ArrayBuffer, name: "ArrayBuffer" },
|
|
37
|
-
{ endowment: atob, name: "atob", bind: true },
|
|
38
|
-
{ endowment: BigInt, name: "BigInt" },
|
|
39
|
-
{ endowment: BigInt64Array, name: "BigInt64Array" },
|
|
40
|
-
{ endowment: BigUint64Array, name: "BigUint64Array" },
|
|
41
|
-
{ endowment: btoa, name: "btoa", bind: true },
|
|
42
|
-
{ endowment: DataView, name: "DataView" },
|
|
43
|
-
{ endowment: Float32Array, name: "Float32Array" },
|
|
44
|
-
{ endowment: Float64Array, name: "Float64Array" },
|
|
45
|
-
{ endowment: Int8Array, name: "Int8Array" },
|
|
46
|
-
{ endowment: Int16Array, name: "Int16Array" },
|
|
47
|
-
{ endowment: Int32Array, name: "Int32Array" },
|
|
48
|
-
{ endowment: Uint8Array, name: "Uint8Array" },
|
|
49
|
-
{ endowment: Uint8ClampedArray, name: "Uint8ClampedArray" },
|
|
50
|
-
{ endowment: Uint16Array, name: "Uint16Array" },
|
|
51
|
-
{ endowment: Uint32Array, name: "Uint32Array" },
|
|
52
|
-
{ endowment: URL, name: "URL" },
|
|
53
|
-
{ endowment: WebAssembly, name: "WebAssembly" }
|
|
54
|
-
];
|
|
55
|
-
var buildCommonEndowments = () => {
|
|
56
|
-
const endowmentFactories = [
|
|
57
|
-
crypto_default,
|
|
58
|
-
interval_default,
|
|
59
|
-
math_default,
|
|
60
|
-
network_default,
|
|
61
|
-
timeout_default,
|
|
62
|
-
textDecoder_default,
|
|
63
|
-
textEncoder_default,
|
|
64
|
-
date_default,
|
|
65
|
-
console_default
|
|
66
|
-
];
|
|
67
|
-
commonEndowments.forEach((endowmentSpecification) => {
|
|
68
|
-
const endowment = {
|
|
69
|
-
names: [endowmentSpecification.name],
|
|
70
|
-
factory: () => {
|
|
71
|
-
const boundEndowment = typeof endowmentSpecification.endowment === "function" && endowmentSpecification.bind ? endowmentSpecification.endowment.bind(rootRealmGlobal) : endowmentSpecification.endowment;
|
|
72
|
-
return {
|
|
73
|
-
[endowmentSpecification.name]: harden(boundEndowment)
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
endowmentFactories.push(endowment);
|
|
78
|
-
});
|
|
79
|
-
return endowmentFactories;
|
|
80
|
-
};
|
|
81
|
-
var commonEndowmentFactory_default = buildCommonEndowments;
|
|
82
|
-
|
|
83
|
-
export {
|
|
84
|
-
commonEndowmentFactory_default
|
|
85
|
-
};
|
|
86
|
-
//# sourceMappingURL=chunk-ODICKSGZ.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/common/endowments/commonEndowmentFactory.ts"],"sourcesContent":["import type { NotifyFunction } from '../BaseSnapExecutor';\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?: string;\n notify?: NotifyFunction;\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,IAAM,mBAAmD;AAAA,EACvD,EAAE,WAAW,iBAAiB,MAAM,kBAAkB;AAAA,EACtD,EAAE,WAAW,aAAa,MAAM,cAAc;AAAA,EAC9C,EAAE,WAAW,aAAa,MAAM,cAAc;AAAA,EAC9C,EAAE,WAAW,MAAM,MAAM,QAAQ,MAAM,KAAK;AAAA,EAC5C,EAAE,WAAW,QAAQ,MAAM,SAAS;AAAA,EACpC,EAAE,WAAW,eAAe,MAAM,gBAAgB;AAAA,EAClD,EAAE,WAAW,gBAAgB,MAAM,iBAAiB;AAAA,EACpD,EAAE,WAAW,MAAM,MAAM,QAAQ,MAAM,KAAK;AAAA,EAC5C,EAAE,WAAW,UAAU,MAAM,WAAW;AAAA,EACxC,EAAE,WAAW,cAAc,MAAM,eAAe;AAAA,EAChD,EAAE,WAAW,cAAc,MAAM,eAAe;AAAA,EAChD,EAAE,WAAW,WAAW,MAAM,YAAY;AAAA,EAC1C,EAAE,WAAW,YAAY,MAAM,aAAa;AAAA,EAC5C,EAAE,WAAW,YAAY,MAAM,aAAa;AAAA,EAC5C,EAAE,WAAW,YAAY,MAAM,aAAa;AAAA,EAC5C,EAAE,WAAW,mBAAmB,MAAM,oBAAoB;AAAA,EAC1D,EAAE,WAAW,aAAa,MAAM,cAAc;AAAA,EAC9C,EAAE,WAAW,aAAa,MAAM,cAAc;AAAA,EAC9C,EAAE,WAAW,KAAK,MAAM,MAAM;AAAA,EAC9B,EAAE,WAAW,aAAa,MAAM,cAAc;AAChD;AASA,IAAM,wBAAwB,MAA0B;AACtD,QAAM,qBAAyC;AAAA,IAC7C;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,mBAAiB,QAAQ,CAAC,2BAA2B;AACnD,UAAM,YAAY;AAAA,MAChB,OAAO,CAAC,uBAAuB,IAAI;AAAA,MACnC,SAAS,MAAM;AACb,cAAM,iBACJ,OAAO,uBAAuB,cAAc,cAC5C,uBAAuB,OACnB,uBAAuB,UAAU,KAAK,eAAe,IACrD,uBAAuB;AAC7B,eAAO;AAAA,UACL,CAAC,uBAAuB,IAAI,GAAG,OAAO,cAAc;AAAA,QACtD;AAAA,MACF;AAAA,IACF;AACA,uBAAmB,KAAK,SAAS;AAAA,EACnC,CAAC;AAED,SAAO;AACT;AAEA,IAAO,iCAAQ;","names":[]}
|
package/dist/chunk-Q42NNJFY.mjs
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
rootRealmGlobal
|
|
3
|
-
} from "./chunk-IX5S3V47.mjs";
|
|
4
|
-
import {
|
|
5
|
-
__require
|
|
6
|
-
} from "./chunk-YRZVIDCF.mjs";
|
|
7
|
-
|
|
8
|
-
// src/common/endowments/crypto.ts
|
|
9
|
-
var createCrypto = () => {
|
|
10
|
-
if ("crypto" in rootRealmGlobal && typeof rootRealmGlobal.crypto === "object" && "SubtleCrypto" in rootRealmGlobal && typeof rootRealmGlobal.SubtleCrypto === "function") {
|
|
11
|
-
return {
|
|
12
|
-
crypto: harden(rootRealmGlobal.crypto),
|
|
13
|
-
SubtleCrypto: harden(rootRealmGlobal.SubtleCrypto)
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
const crypto = __require("crypto").webcrypto;
|
|
17
|
-
return {
|
|
18
|
-
crypto: harden(crypto),
|
|
19
|
-
SubtleCrypto: harden(crypto.subtle.constructor)
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
var endowmentModule = {
|
|
23
|
-
names: ["crypto", "SubtleCrypto"],
|
|
24
|
-
factory: createCrypto
|
|
25
|
-
};
|
|
26
|
-
var crypto_default = endowmentModule;
|
|
27
|
-
|
|
28
|
-
export {
|
|
29
|
-
createCrypto,
|
|
30
|
-
crypto_default
|
|
31
|
-
};
|
|
32
|
-
//# sourceMappingURL=chunk-Q42NNJFY.mjs.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"],"mappings":";;;;;;;;AAEO,IAAM,eAAe,MAAM;AAChC,MACE,YAAY,mBACZ,OAAO,gBAAgB,WAAW,YAClC,kBAAkB,mBAClB,OAAO,gBAAgB,iBAAiB,YACxC;AACA,WAAO;AAAA,MACL,QAAQ,OAAO,gBAAgB,MAAM;AAAA,MACrC,cAAc,OAAO,gBAAgB,YAAY;AAAA,IACnD;AAAA,EACF;AAIA,QAAM,SAAS,UAAQ,QAAQ,EAAE;AACjC,SAAO;AAAA,IACL,QAAQ,OAAO,MAAM;AAAA,IACrB,cAAc,OAAO,OAAO,OAAO,WAAW;AAAA,EAChD;AACF;AAEA,IAAM,kBAAkB;AAAA,EACtB,OAAO,CAAC,UAAU,cAAc;AAAA,EAChC,SAAS;AACX;AACA,IAAO,iBAAQ;","names":[]}
|