etherpad-lite/src/node/utils/randomstring.ts

11 lines
292 B
TypeScript
Raw Normal View History

2021-01-21 21:06:52 +00:00
'use strict';
2012-01-28 13:24:58 +01:00
/**
2021-01-21 21:06:52 +00:00
* Generates a random String with the given length. Is needed to generate the
* Author, Group, readonly, session Ids
2012-01-28 13:24:58 +01:00
*/
const cryptoMod = require('crypto');
const randomString = (len: number) => cryptoMod.randomBytes(len).toString('hex');
2012-01-28 13:24:58 +01:00
module.exports = randomString;