Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async start(config: ITransparentProxyCaptureSessionConfig) {
this.config = config
const configPath = tmp.dirSync({ unsafeCleanup: true }).name
const certificateInfo = await mockttp.generateCACertificate({
bits: 2048,
commonName: 'Optic Labs Corp'
})
const certificatePath = path.join(configPath, '.optic', 'certificates')
await fs.ensureDir(certificatePath);
const certPath = path.join(certificatePath, 'ca.cert')
const keyPath = path.join(certificatePath, 'ca.key')
await fs.writeFile(certPath, certificateInfo.cert)
await fs.writeFile(keyPath, certificateInfo.key)
const https = {
certPath,
keyPath
}
const proxy = mockttp.getLocal({
cors: true,
async start(config: IHttpToolkitProxyCaptureSessionConfig) {
this.config = config
const configPath = tmp.dirSync({unsafeCleanup: true}).name
const certificateInfo = await mockttp.generateCACertificate({
bits: 2048,
commonName: 'Optic Labs Corp'
})
const certificatePath = path.join(configPath, '.optic', 'certificates')
await fs.ensureDir(certificatePath)
const certPath = path.join(certificatePath, 'ca.cert')
const keyPath = path.join(certificatePath, 'ca.key')
await fs.writeFile(certPath, certificateInfo.cert)
await fs.writeFile(keyPath, certificateInfo.key)
const https = {
certPath,
keyPath
}
const proxy = mockttp.getLocal({
cors: true,