mirror of
https://github.com/verdaccio/verdaccio.git
synced 2025-03-04 02:02:39 -05:00
11 lines
273 B
TypeScript
11 lines
273 B
TypeScript
|
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);
|
||
|
}
|