@kazion/create-app
Version:
A cli tool to help you get started with graphql and rest api's with typescript
26 lines (21 loc) • 540 B
text/typescript
import { generateKeyPairSync } from 'crypto';
import * as jose from 'jose';
const generateSecretKey = async () => {
const { privateKey } = generateKeyPairSync('rsa', {
modulusLength: 4096, // the length of your key in bits
publicKeyEncoding: {
type: 'spki',
format: 'pem',
},
privateKeyEncoding: {
type: 'pkcs8',
format: 'pem',
},
});
const ecPrivateKey = await jose.importPKCS8(
privateKey,
process.env.ALGO as string,
);
console.log(ecPrivateKey);
};
generateSecretKey();