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

9 lines
256 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
*/
2024-07-22 14:53:37 +02:00
import {randomBytes} from 'crypto';
2024-07-22 14:53:37 +02:00
export const randomString = (len: number) => randomBytes(len).toString('hex');