You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-11-23 22:36:32 +02:00
Chore: Add function to generate secure random values (#9409)
Co-authored-by: Laurent Cozic <laurent22@users.noreply.github.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import { customAlphabet } from 'nanoid/non-secure';
|
||||
import { nanoid as nanoidSecure } from 'nanoid';
|
||||
|
||||
// https://zelark.github.io/nano-id-cc/
|
||||
// https://security.stackexchange.com/a/41749/1873
|
||||
@@ -21,6 +22,10 @@ export default {
|
||||
},
|
||||
};
|
||||
|
||||
export const createSecureRandom = (size = 32) => {
|
||||
return nanoidSecure(size);
|
||||
};
|
||||
|
||||
type FuncUiidGen = (length?: number)=> string;
|
||||
|
||||
const cachedUuidgen: Record<number, FuncUiidGen> = {};
|
||||
|
||||
Reference in New Issue
Block a user