fedipage/generateKeys.mts
Jeffrey Phillips Freeman 1afe272ca0
initial commit
2023-10-08 01:35:17 -04:00

20 lines
No EOL
399 B
TypeScript

import { promisify } from 'util';
import { generateKeyPair } from 'crypto';
const generateKeyPairAsync = promisify(generateKeyPair);
const pair = await generateKeyPairAsync('rsa', {
modulusLength: 4096,
publicKeyEncoding: {
type: 'spki',
format: 'pem'
},
privateKeyEncoding: {
type: 'pkcs8',
format: 'pem'
}
})
console.log(pair.publicKey);
console.log(pair.privateKey);