Correct random string length
This commit is contained in:
parent
9a1532f4ee
commit
87e66deb31
1 changed files with 2 additions and 1 deletions
|
|
@ -25,7 +25,8 @@ const FieldError = require('../fieldError')
|
||||||
|
|
||||||
const generateRandomString = (length = 16) =>
|
const generateRandomString = (length = 16) =>
|
||||||
new Promise((resolve, reject) => {
|
new Promise((resolve, reject) => {
|
||||||
Crypto.randomBytes(length, (err, buffer) => {
|
// Gotta halve because randomBytes returns a sequence twice the size
|
||||||
|
Crypto.randomBytes(length / 2, (err, buffer) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
reject(err)
|
reject(err)
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue