Node.js module that generates a cryptographically secure random string with a given length
var srs = require('secure-random-string');
// Sync var result = srs(); // Async srs(function(sr) { console.log(sr); });
Optionally, you can specify a 'length' option to specify a length.
The 'urlsafe' option replaces a potential + character with - and the / character with _, created a valid base64url format string.
+
-
/
_
// sync var result = srs({length: 256, urlsafe:true}); // async srs({length: 256, urlsafe:true}, function(sr) { console.log(sr); });
Simon Santoro
Mark Stosberg
MIT