mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-28 11:53:24 +03:00
20 lines
443 B
TypeScript
20 lines
443 B
TypeScript
import crypto from 'node:crypto';
|
|
|
|
import { genSalt } from 'bcrypt';
|
|
|
|
const { privateKey, publicKey } = crypto.generateKeyPairSync('ec', {
|
|
namedCurve: 'prime256v1',
|
|
publicKeyEncoding: {
|
|
type: 'spki',
|
|
format: 'pem',
|
|
},
|
|
privateKeyEncoding: {
|
|
type: 'pkcs8',
|
|
format: 'pem',
|
|
},
|
|
});
|
|
|
|
console.log('Salt:\n', await genSalt(10));
|
|
console.log('ECDSA Public Key:\n', publicKey);
|
|
console.log('ECDSA Private Key:\n', privateKey);
|