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

This commit is contained in:
pedr
2023-12-20 19:05:59 +00:00
committed by GitHub
parent 8b09d71d5b
commit ddebeb68b2
+7 -4
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 };