AFFiNE/packages/backend/server/scripts/gen-auth-key.ts
2023-10-18 15:30:08 +00:00

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);