1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-29 22:48:10 +02:00

Desktop: Resolves #11992: Multiple instances: Secure local server (#11999)

This commit is contained in:
Laurent Cozic
2025-03-25 19:48:11 +01:00
committed by GitHub
parent 0959a19d65
commit e3762dc3f8
11 changed files with 142 additions and 9 deletions

9
packages/utils/crypto.ts Normal file
View File

@@ -0,0 +1,9 @@
/* eslint-disable import/prefer-default-export */
import { randomBytes } from 'crypto';
export const getSecureRandomString = (length: number): string => {
const bytes = randomBytes(Math.ceil(length * 2));
const randomString = bytes.toString('base64').replace(/[^a-zA-Z0-9]/g, '');
return randomString.slice(0, length);
};