fedipage/generateKeys.mts

21 lines
422 B
TypeScript
Raw Permalink Normal View History

2023-10-08 07:35:17 +02:00
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'
}
})
2023-10-11 17:35:52 +02:00
console.log(pair.publicKey.toString());
2023-10-08 07:35:17 +02:00
2023-10-11 17:35:52 +02:00
console.log(pair.privateKey.toString());