Wraps pem in a promise compatible API.
$ npm install --save pem-promise
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.