Skip to content

Commit

Permalink
chore: wip
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbbreuer committed Mar 9, 2024
1 parent fb0c716 commit 39f53c0
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { loadConfig } from 'c12'

// Get loaded config
const { config } = await loadConfig({
name: 'reverse-proxy',
name: 'tls',
})

export { config }
7 changes: 1 addition & 6 deletions src/keys.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import crypto from 'node:crypto'
import forge, { pki, tls } from 'node-forge'

interface GenerateCertOptions {
altNameIPs?: string[]
altNameURIs?: string[]
validityDays?: number
}
import type { GenerateCertOptions } from './types'

export function generateCert(options?: GenerateCertOptions) {
const def: GenerateCertOptions = {
Expand Down
17 changes: 17 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export interface TlsConfig {
ssl: {
commonName: string
countryName: string
stateName: string
localityName: string
organizationName: string
organizationalUnitName: string
validityYears: number
}
}

export interface GenerateCertOptions {
altNameIPs?: string[]
altNameURIs?: string[]
validityDays?: number
}
20 changes: 12 additions & 8 deletions tls.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import type { TlsConfig } from './src/types'

export default {
commonName: 'stacks.localhost',
countryName: 'US',
stateName: 'California',
localityName: 'Playa Vista',
organizationName: 'Stacks',
organizationalUnitName: 'Acme',
validityYears: 1,
}
ssl: {
commonName: 'stacks.localhost',
countryName: 'US',
stateName: 'California',
localityName: 'Playa Vista',
organizationName: 'Stacks',
organizationalUnitName: 'Acme',
validityYears: 1,
},
} satisfies TlsConfig

0 comments on commit 39f53c0

Please sign in to comment.