From 28fa3fa795d564135940e8aff52b987a5960f15c Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Fri, 2 Apr 2021 12:43:37 -0400 Subject: Move test VM crypto definition (#1584) --- dev/vm.js | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'dev') diff --git a/dev/vm.js b/dev/vm.js index 98a1f7bf..363cc115 100644 --- a/dev/vm.js +++ b/dev/vm.js @@ -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 -- cgit v1.2.3