https://github.com/bubkoo/cert-generator
Generate a root certificate.
https://github.com/bubkoo/cert-generator
Last synced: over 1 year ago
JSON representation
Generate a root certificate.
- Host: GitHub
- URL: https://github.com/bubkoo/cert-generator
- Owner: bubkoo
- License: mit
- Created: 2016-08-29T16:13:17.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2017-03-13T00:46:05.000Z (over 9 years ago)
- Last Synced: 2024-10-10T09:30:00.579Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 17.6 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cert-generator
> Generate a root certificate.
[](https://github.com/bubkoo/cert-generator/blob/master/LICENSE)
## Installation
```
$ npm install --save cert-generator
```
## Usage
```js
import Generator from 'cert-generator';
/*
options.dir // where should the certificates be save
options.name // the root certificate name
*/
let generator = new Generator([options]);
generator.generateRootCA()
.then(() => console.log('success'))
.catch(error => console.log(error));
// get certificate for special hostname
generator.getCertificate('example.com')
.then(({cert, key}) => {
console.log(cert); // the certificate
console.log(key); // the private key
})
.catch(error => console.log(error));
// check if the root CA is exists
generator.isRootCAExists()
.then((exists) => console.log(exists));
// clear all certs
generator.clearCerts()
.then(() => console.log('certs ware cleared.'));
```
## Contributing
Pull requests and stars are highly welcome.
For bugs and feature requests, please [create an issue](https://github.com/bubkoo/cert-generator/issues/new).