Comparing version 0.0.2 to 0.0.3
{ | ||
"name": "mkcert", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "Create Self Signed Development Certificates", | ||
@@ -5,0 +5,0 @@ "main": "lib/mkcert.js", |
@@ -10,3 +10,3 @@ Create Self Signed Development Certificates | ||
### Create Certificate Authority | ||
### Create a Certificate Authority | ||
``` | ||
@@ -28,3 +28,3 @@ $ mkcert create-ca --help | ||
### Create Certificate | ||
### Create a Certificate | ||
@@ -47,6 +47,8 @@ ``` | ||
## API | ||
### Create a Certificate Authority | ||
```js | ||
import * as mkcert from 'mkcert'; | ||
//Create Certificate Authority | ||
//Create a Certificate Authority | ||
mkcert.createCA({ | ||
@@ -61,20 +63,25 @@ organization: 'Hello CA', | ||
console.log(ca.key, ca.cert); | ||
}) | ||
.catch(err=> console.error(err)); | ||
``` | ||
//Create Certificate | ||
mkcert.createSSL({ | ||
addresses: ['127.0.0.1', 'localhost'], | ||
validityDays: 365, | ||
caKey: ca.key, | ||
caCert: ca.cert | ||
}) | ||
.then((cert)=> { | ||
console.log(cert.key, cert.cert); | ||
//Create a full chain certificate by merging CA and SSL certificates | ||
const fullChain = [ cert.cert, ca.cert ].join('\n'); | ||
console.log(fullChain); | ||
}) | ||
.catch(err=> console.error(err)); | ||
### Create a Certificate | ||
```js | ||
import * as mkcert from 'mkcert'; | ||
//Create a CA first | ||
//Then create the certificate | ||
mkcert.createSSL({ | ||
addresses: ['127.0.0.1', 'localhost'], | ||
validityDays: 365, | ||
caKey: ca.key, | ||
caCert: ca.cert | ||
}) | ||
.then((cert)=> { | ||
console.log(cert.key, cert.cert); | ||
//Create a full chain certificate by merging CA and SSL certificates | ||
console.log(`${cert.cert}\n${ca.cert}`); | ||
}) | ||
.catch(err=> console.error(err)); | ||
``` |
22055
83