You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-07-03 23:50:33 +02:00
10 lines
327 B
TypeScript
10 lines
327 B
TypeScript
![]() |
/* eslint-disable import/prefer-default-export */
|
||
|
|
||
|
import { randomBytes } from 'crypto';
|
||
|
|
||
|
export const getSecureRandomString = (length: number): string => {
|
||
|
const bytes = randomBytes(Math.ceil(length * 2));
|
||
|
const randomString = bytes.toString('base64').replace(/[^a-zA-Z0-9]/g, '');
|
||
|
return randomString.slice(0, length);
|
||
|
};
|