Skip to content

Commit 97961e2

Browse files
committed
chore: wip
1 parent c5bce74 commit 97961e2

File tree

2 files changed

+4
-15
lines changed

2 files changed

+4
-15
lines changed

bin/cli.ts

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { log } from '@stacksjs/logging'
33
import { CAC } from 'cac'
44
import { version } from '../package.json'
55

6-
import { CreateRootCA, addCertToSystemTrustStoreAndSaveCerts, generateCert } from '../src'
6+
import { addCertToSystemTrustStoreAndSaveCerts, createRootCA, generateCert } from '../src'
77
const cli = new CAC('tlsx')
88

99
interface Options {
@@ -28,22 +28,11 @@ cli
2828
.action(async (domain: string, options?: Options) => {
2929
domain = domain ?? options?.domain
3030

31-
log.debug(`Generating a self-signed SSL certificate for domain: ${domain}`)
31+
log.info(`Generating a self-signed SSL certificate for: ${domain}`)
3232
log.debug('Options:', options)
3333

34-
const certFilePath = `${os.homedir()}/.stacks/ssl/stacks.localhost.crt`
35-
36-
// Check if the certificate is expired or domain already exists
37-
38-
log.info(`Start to generate a new certificate for domain: ${domain}`)
39-
40-
// Create a new Root CA
41-
const CAcert = await CreateRootCA()
42-
43-
// await generateCert()
34+
const CAcert = await createRootCA()
4435
const HostCert = await generateCert('Tlsx Stacks RootCA', domain, CAcert)
45-
46-
// await addCertToSystemTrustStoreAndSaveCerts()
4736
await addCertToSystemTrustStoreAndSaveCerts(HostCert, CAcert.certificate)
4837

4938
log.success('Certificate generated')

src/keys.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ const DEFAULT_L = 'Melbourne'
120120
const DEFAULT_O = 'Tlsx Stacks RootCA'
121121

122122
// Generate a new Root CA Certificate
123-
export async function CreateRootCA() {
123+
export async function createRootCA() {
124124
// Create a new Keypair for the Root CA
125125
const { privateKey, publicKey } = pki.rsa.generateKeyPair(2048)
126126

0 commit comments

Comments
 (0)