* Create a self-signed certificate for signing MCPB extensions
(certPath: string, keyPath: string)
| 25 | * Create a self-signed certificate for signing MCPB extensions |
| 26 | */ |
| 27 | function createSelfSignedCertificate(certPath: string, keyPath: string): void { |
| 28 | const subject = "/CN=MCPB Self-Signed Certificate/O=MCPB Extensions/C=US"; |
| 29 | |
| 30 | try { |
| 31 | // Generate a self-signed certificate valid for 10 years, no password |
| 32 | execSync( |
| 33 | `openssl req -x509 -newkey rsa:4096 -keyout "${keyPath}" -out "${certPath}" -days 3650 -nodes -subj "${subject}"`, |
| 34 | { stdio: "pipe" }, |
| 35 | ); |
| 36 | } catch (error) { |
| 37 | throw new Error(`Failed to create self-signed certificate: ${error}`); |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | // Create the CLI program |
| 42 | const program = new Command(); |
no outgoing calls
no test coverage detected
searching dependent graphs…