mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-11-29 17:07:57 +03:00
20 lines
452 B
TypeScript
20 lines
452 B
TypeScript
import crypto from 'node:crypto';
|
|
|
|
import { genSalt } from '@node-rs/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);
|