v3.0.2: clarify with comments and docs

This commit is contained in:
AJ ONeal 2019-04-07 11:39:49 -06:00
parent 5a66693cdb
commit 6922fb2e97
3 changed files with 10 additions and 15 deletions

View File

@ -69,12 +69,10 @@ module.exports.create = function (opts) {
var id = opts.account.id || opts.email || 'default';
var keypair = opts.keypair;
saveKeypair(id, JSON.stringify({
return saveKeypair(id, JSON.stringify({
privateKeyPem: keypair.privateKeyPem
, privateKeyJwk: keypair.privateKeyJwk
}));
return null; // or Promise.resolve(null);
})); // Must return or Promise `null` instead of `undefined`
};
@ -121,14 +119,13 @@ module.exports.create = function (opts) {
var id = opts.certificate.kid || opts.certificate.id || opts.subject;
var keypair = opts.keypair;
saveKeypair(id, JSON.stringify({
return saveKeypair(id, JSON.stringify({
privateKeyPem: keypair.privateKeyPem
, privateKeyJwk: keypair.privateKeyJwk
}));
// Note: you can use the "keypairs" package to convert between
// public and private for jwk and pem, as well as convert JWK <-> PEM
})); // Must return or Promise `null` instead of `undefined`
return null;
// Side Note: you can use the "keypairs" package to convert between
// public and private for jwk and pem, as well as convert JWK <-> PEM
};
@ -155,16 +152,14 @@ module.exports.create = function (opts) {
var id = opts.certificate.id || opts.subject;
var pems = opts.pems;
saveCertificate(id, JSON.stringify({
return saveCertificate(id, JSON.stringify({
cert: pems.cert
, chain: pems.chain
, subject: pems.subject
, altnames: pems.altnames
, issuedAt: pems.issuedAt // a.k.a. NotBefore
, expiresAt: pems.expiresAt // a.k.a. NotAfter
}));
return null;
})); // Must return or Promise `null` instead of `undefined`
};

2
package-lock.json generated
View File

@ -1,5 +1,5 @@
{
"name": "greenlock-store-memory",
"version": "3.0.1",
"version": "3.0.2",
"lockfileVersion": 1
}

View File

@ -1,6 +1,6 @@
{
"name": "greenlock-store-memory",
"version": "3.0.1",
"version": "3.0.2",
"description": "An in-memory reference implementation for account, certificate, and keypair storage strategies in Greenlock",
"homepage": "https://git.coolaj86.com/coolaj86/greenlock-store-memory.js",
"main": "index.js",