1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-21 09:38:01 +02:00

Chore: Add function exports to lib/uuid module (#9560)

This commit is contained in:
pedr 2023-12-20 16:05:59 -03:00 committed by GitHub
parent 8b09d71d5b
commit ddebeb68b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,6 @@
import { v4 as uuidv4 } from 'uuid';
import { customAlphabet } from 'nanoid/non-secure';
import { nanoid as nanoidSecure } from 'nanoid';
import { nanoid as nanoidSecure, customAlphabet as customAlphabetSecure } from 'nanoid';
// https://zelark.github.io/nano-id-cc/
// https://security.stackexchange.com/a/41749/1873
@ -17,9 +17,6 @@ export default {
createNano: function(): string {
return nanoid();
},
createNanoForInboxEmail: (): string => {
return customAlphabet('0123456789abcdefghijklmnopqrstuvwxyz', 8)();
},
};
export const createSecureRandom = (size = 32) => {
@ -42,3 +39,9 @@ export const uuidgen = (length = 22) => {
const cachedUuidgen = getCachedUuidgen(length);
return cachedUuidgen();
};
export const createNanoForInboxEmail = (): string => {
return customAlphabet('0123456789abcdefghijklmnopqrstuvwxyz', 8)();
};
export { customAlphabetSecure };