0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2025-03-04 02:02:39 -05:00
verdaccio/packages/config/src/token.ts

11 lines
273 B
TypeScript
Raw Normal View History

import { randomBytes } from 'crypto';
export const TOKEN_VALID_LENGTH = 32;
/**
* Secret key must have 32 characters.
*/
export function generateRandomSecretKey(): string {
return randomBytes(TOKEN_VALID_LENGTH).toString('base64').substring(0, TOKEN_VALID_LENGTH);
}