Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions test/helpers/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,17 @@ function createContext() {
// used by crypto-browserify & friends
Int32Array: Int32Array,
DataView: DataView,
crypto: {
getRandomValues: function(typedArray) {
var randomBuffer = require('crypto').randomBytes(typedArray.length);
// This implementation is not secure: we take random 8bit values
// and assign them to 8/16/32bit values, leaving high-order bits
// filled with zeroes.
// Fortunately, the bootstrapping process does not rely on secure
// random numbers, therefore we can afford such shortcut.
typedArray.set(randomBuffer);
},
},

// allow the browserified code to log messages
// call `printContextLogs(context)` to print the accumulated messages
Expand Down