Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion randombytes-native.android.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = function (length, cb) {
var output = Array.create("byte", length);
new java.security.SecureRandom().nextBytes(output);
var buf = new Buffer(android.util.Base64.encodeToString(output, android.util.Base64.DEFAULT), 'base64');
var buf = Buffer.from(android.util.Base64.encodeToString(output, android.util.Base64.DEFAULT), 'base64');

if (cb) {
cb (null, buf);
Expand Down
2 changes: 1 addition & 1 deletion randombytes-native.ios.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = function (length, cb) {
var bytes = NSMutableData.dataWithLength(length);
SecRandomCopyBytes(null, length, bytes.mutableBytes);
var buf = new Buffer(bytes.base64EncodedStringWithOptions(0), 'base64');
var buf = Buffer.from(bytes.base64EncodedStringWithOptions(0), 'base64');

if (cb) {
cb (null, buf);
Expand Down