@krypton-org/krypton-auth
Version:
Express authentication middleware, using GraphQL and JSON Web Tokens.
27 lines • 784 B
JavaScript
;
/**
* Module defining functions for Public & Private keys generation.
* @module crypto/RSAKeysGeneration
*/
Object.defineProperty(exports, "__esModule", { value: true });
const crypto_1 = require("crypto");
/**
* Generating rsa public and private keys.
* @returns {{ publicKey: string; privateKey: string }}
*/
const generateKeys = () => {
const { publicKey, privateKey } = crypto_1.generateKeyPairSync('rsa', {
modulusLength: 2048,
privateKeyEncoding: {
format: 'pem',
type: 'pkcs8',
},
publicKeyEncoding: {
format: 'pem',
type: 'spki',
},
});
return { publicKey, privateKey };
};
exports.generateKeys = generateKeys;
//# sourceMappingURL=RSAKeysGeneration.js.map