mirror of
https://github.com/logto-io/logto.git
synced 2024-12-16 20:26:19 -05:00
25 lines
524 B
TypeScript
25 lines
524 B
TypeScript
/**
|
|
* Generate private key for tests
|
|
*/
|
|
import { generateKeyPairSync } from 'crypto';
|
|
import { writeFileSync } from 'fs';
|
|
|
|
export const privateKeyPath = 'oidc-private-key.test.pem';
|
|
|
|
const globalSetup = () => {
|
|
const { privateKey } = generateKeyPairSync('rsa', {
|
|
modulusLength: 4096,
|
|
publicKeyEncoding: {
|
|
type: 'spki',
|
|
format: 'pem',
|
|
},
|
|
privateKeyEncoding: {
|
|
type: 'pkcs8',
|
|
format: 'pem',
|
|
},
|
|
});
|
|
|
|
writeFileSync(privateKeyPath, privateKey);
|
|
};
|
|
|
|
export default globalSetup;
|