mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-15 16:42:13 +03:00
17 lines
365 B
TypeScript
17 lines
365 B
TypeScript
import crypto from 'node:crypto';
|
|
|
|
const { privateKey, publicKey } = crypto.generateKeyPairSync('ec', {
|
|
namedCurve: 'prime256v1',
|
|
publicKeyEncoding: {
|
|
type: 'spki',
|
|
format: 'pem',
|
|
},
|
|
privateKeyEncoding: {
|
|
type: 'pkcs8',
|
|
format: 'pem',
|
|
},
|
|
});
|
|
|
|
console.log('ECDSA Public Key:\n', publicKey);
|
|
console.log('ECDSA Private Key:\n', privateKey);
|