mirror of
https://github.com/verdaccio/verdaccio.git
synced 2025-03-04 02:02:39 -05:00
* feat: improve legacy token signature by removing deprecated crypto.createDecipher * fix: wrong reference * chore: add debug
10 lines
273 B
TypeScript
10 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);
|
|
}
|