Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Alex Potsides
committed
Aug 16, 2016
0 parents
commit c7fe6cb
Showing
6 changed files
with
132 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
node_modules | ||
*.heapsnapshot | ||
.nyc_output | ||
coverage | ||
*.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
language: node_js | ||
node_js: | ||
- "4" | ||
- "6" | ||
# node_js 4 requires gcc 4.8 | ||
env: | ||
- NODE_ENV=travis CXX="g++-4.8" | ||
# gcc 4.8 requires ubuntu-toolchain-r-test | ||
addons: | ||
apt: | ||
sources: | ||
- ubuntu-toolchain-r-test | ||
packages: | ||
- g++-4.8 | ||
- gcc-4.8 | ||
script: npm run test:coverage:check | ||
after_script: npm run coveralls |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# pem-promise | ||
|
||
[![Dependency status][david-image]][david-url] [![Build status][travis-image]][travis-url] [![Coverage status][coveralls-image]][coveralls-url] | ||
|
||
Wraps [pem](https://libraries.io/npm/pem) in a promise compatible API. | ||
|
||
## Installation | ||
|
||
``` | ||
$ npm install --save pem-promise | ||
``` | ||
|
||
## Usage | ||
|
||
```javascript | ||
const pem = require('pem-promise') | ||
const https = require('https') | ||
|
||
pem.createCertificate({ | ||
days: 1, | ||
selfSigned: true | ||
}) | ||
.then((keys) => { | ||
https.createServer({key: keys.serviceKey, cert: keys.certificate}, function(req, res) { | ||
res.end('o hai!') | ||
}).listen(443) | ||
}) | ||
.catch((error) => { | ||
console.error(`Could not create certificate because ${error}`) | ||
}) | ||
``` | ||
|
||
All pem methods are wrapped. See the [pem documentation][] for full details of the API. | ||
|
||
[david-image]: https://david-dm.org/achingbrain/pem-promise.svg?theme=shields.io | ||
[david-url]: https://david-dm.org/achingbrain/pem-promise | ||
[travis-image]: https://img.shields.io/travis/achingbrain/pem-promise/master.svg | ||
[travis-url]: https://travis-ci.org/achingbrain/pem-promise | ||
[coveralls-image]: http://img.shields.io/coveralls/achingbrain/pem-promise/master.svg | ||
[coveralls-url]: https://coveralls.io/r/achingbrain/pem-promise | ||
[pem documentation]: https://github.com/andris9/pem/blob/master/README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
const pem = require('pem') | ||
const promisify = require('es6-promisify') | ||
|
||
module.exports = {} | ||
|
||
Object.keys(pem).forEach(key => { | ||
module.exports[key] = promisify(pem[key]) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{ | ||
"name": "pem-promise", | ||
"version": "0.0.0", | ||
"description": "The pem module wrapped in a promises API", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "ava --verbose", | ||
"test:coverage": "nyc --reporter=html ava", | ||
"test:coverage:check": "nyc --reporter=lcov ava && nyc check-coverage --lines 100 --functions 100 --branches 100", | ||
"lint": "standard", | ||
"coveralls": "cat ./coverage/lcov.info | coveralls" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/achingbrain/pem-promise.git" | ||
}, | ||
"author": "Alex Potsides", | ||
"license": "ISC", | ||
"bugs": { | ||
"url": "https://github.com/achingbrain/pem-promise/issues" | ||
}, | ||
"homepage": "https://github.com/achingbrain/pem-promise#readme", | ||
"keywords": [ | ||
"pem", | ||
"promise", | ||
"ssl", | ||
"certificates", | ||
"generate" | ||
], | ||
"dependencies": { | ||
"es6-promisify": "^4.1.0", | ||
"pem": "^1.8.3" | ||
}, | ||
"devDependencies": { | ||
"ava": "^0.16.0", | ||
"coveralls": "^2.11.12", | ||
"fs-promise": "^0.5.0", | ||
"nyc": "^8.1.0", | ||
"pre-commit": "^1.1.3", | ||
"proxyquire": "^1.7.10", | ||
"sinon": "^1.17.5", | ||
"standard": "^7.1.2" | ||
}, | ||
"pre-commit": [ | ||
"test:coverage:check", | ||
"lint" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
const test = require('ava') | ||
const pem = require('../') | ||
|
||
test('should create a certificate', t => { | ||
return pem.createCertificate({ | ||
days: 1, | ||
selfSigned: true | ||
}) | ||
.then(keys => { | ||
t.truthy(keys.serviceKey) | ||
t.truthy(keys.certificate) | ||
}) | ||
}) |