diff --git a/lib/secure-random-string.js b/lib/secure-random-string.js index 398087b..4350aca 100644 --- a/lib/secure-random-string.js +++ b/lib/secure-random-string.js @@ -32,7 +32,7 @@ function srs(options, cb) { string = string.replace(/\//g, '_').replace(/\+/g, '-'); } if (string.length < length) { - throw new Error(`Generated string is too short. Please catch this Error and try again.`); + return _finish(crypto.randomBytes(length)); } return string.substr(0, length); }