[Pkg-javascript-commits] [node-randomfill] 26/47: browser: use safe-buffer
Bastien Roucariès
rouca at moszumanska.debian.org
Fri Dec 15 09:52:53 UTC 2017
This is an automated email from the git hooks/post-receive script.
rouca pushed a commit to branch master
in repository node-randomfill.
commit 800369c0f80dd22e3d720cf60d977c8e9a767b95
Author: Daniel Cousens <dcousens at users.noreply.github.com>
Date: Wed May 24 17:42:41 2017 +1000
browser: use safe-buffer
---
browser.js | 6 ++++--
package.json | 3 +++
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/browser.js b/browser.js
index 1aa3edc..357f996 100644
--- a/browser.js
+++ b/browser.js
@@ -4,6 +4,7 @@ function oldBrowser () {
throw new Error('secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11')
}
+var Buffer = require('safe-buffer')
var crypto = global.crypto || global.msCrypto
if (crypto && crypto.getRandomValues) {
@@ -23,8 +24,9 @@ function randomBytes (size, cb) {
if (size > 0) { // getRandomValues fails on IE if size == 0
crypto.getRandomValues(rawBytes)
}
- // phantomjs doesn't like a buffer being passed here
- var bytes = new Buffer(rawBytes.buffer)
+
+ // XXX: phantomjs doesn't like a buffer being passed here
+ var bytes = Buffer.from(rawBytes.buffer)
if (typeof cb === 'function') {
return process.nextTick(function () {
diff --git a/package.json b/package.json
index 0bd6031..12803fb 100644
--- a/package.json
+++ b/package.json
@@ -29,5 +29,8 @@
"tap-spec": "^2.1.2",
"tape": "^3.0.3",
"zuul": "^3.7.2"
+ },
+ "dependencies": {
+ "safe-buffer": "^5.0.1"
}
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-randomfill.git
More information about the Pkg-javascript-commits
mailing list