mirror of
https://github.com/logto-io/logto.git
synced 2025-01-06 20:40:08 -05:00
08ce66f317
* refactor(core): use SSOT for env variables * fix(core): tests
29 lines
649 B
JavaScript
29 lines
649 B
JavaScript
/* eslint-disable unicorn/prefer-module */
|
|
/**
|
|
* Generate private key for tests
|
|
*/
|
|
const { generateKeyPairSync } = require('crypto');
|
|
const { writeFileSync } = require('fs');
|
|
|
|
const privateKeyPath = 'oidc-private-key.test.pem';
|
|
|
|
module.exports = () => {
|
|
const { privateKey } = generateKeyPairSync('rsa', {
|
|
modulusLength: 4096,
|
|
publicKeyEncoding: {
|
|
type: 'spki',
|
|
format: 'pem',
|
|
},
|
|
privateKeyEncoding: {
|
|
type: 'pkcs8',
|
|
format: 'pem',
|
|
},
|
|
});
|
|
|
|
writeFileSync(privateKeyPath, privateKey);
|
|
};
|
|
|
|
exports = module.exports;
|
|
exports.privateKeyPath = privateKeyPath;
|
|
|
|
/* eslint-enable unicorn/prefer-module */
|