diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2021-04-02 12:43:37 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-02 12:43:37 -0400 |
commit | 28fa3fa795d564135940e8aff52b987a5960f15c (patch) | |
tree | 36d36f62c14fd5cef8304539680480d47bc9eff2 /dev/vm.js | |
parent | 8179846e381eb0a87bf3bc266abec8f4400565bc (diff) |
Move test VM crypto definition (#1584)
Diffstat (limited to 'dev/vm.js')
-rw-r--r-- | dev/vm.js | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -150,6 +150,13 @@ class VM { constructor(context={}) { this._urlMap = new Map(); context.URL = createURLClass(this._urlMap); + context.crypto = { + getRandomValues: (array) => { + const buffer = crypto.randomBytes(array.byteLength); + buffer.copy(array); + return array; + } + }; this._context = vm.createContext(context); this._assert = { deepStrictEqual |