- // generate a random key (string)
- const generateKey = (prefix) => {
- let text = '';
- const possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
- for (let i = 0; i < 32; i += 1) {
- text += possible.charAt(Math.floor(Math.random() * possible.length));
- }
- return `${prefix}-${text}`;
- };
- export {
- generateKey
- };
|