mirror of
https://git.coolaj86.com/coolaj86/greenlock-store-memory.js.git
synced 2025-04-20 13:00:36 +00:00
v3.0.3: clarifications in comments and docs
This commit is contained in:
parent
6922fb2e97
commit
4cf4abdb7a
27
index.js
27
index.js
@ -64,14 +64,15 @@ module.exports.create = function (opts) {
|
|||||||
|
|
||||||
// Whenever a new keypair is used to successfully create an account, we need to save its keypair
|
// Whenever a new keypair is used to successfully create an account, we need to save its keypair
|
||||||
store.accounts.setKeypair = function (opts) {
|
store.accounts.setKeypair = function (opts) {
|
||||||
console.log('accounts.setKeypair:', opts.account, opts.email, opts.keypair);
|
console.log('accounts.setKeypair:', opts.account, opts.email);
|
||||||
|
console.log(opts.keypair);
|
||||||
|
|
||||||
var id = opts.account.id || opts.email || 'default';
|
var id = opts.account.id || opts.email || 'default';
|
||||||
var keypair = opts.keypair;
|
var keypair = opts.keypair;
|
||||||
|
|
||||||
return saveKeypair(id, JSON.stringify({
|
return saveKeypair(id, JSON.stringify({
|
||||||
privateKeyPem: keypair.privateKeyPem
|
privateKeyPem: keypair.privateKeyPem // string PEM
|
||||||
, privateKeyJwk: keypair.privateKeyJwk
|
, privateKeyJwk: keypair.privateKeyJwk // object JWK
|
||||||
})); // Must return or Promise `null` instead of `undefined`
|
})); // Must return or Promise `null` instead of `undefined`
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -112,7 +113,8 @@ module.exports.create = function (opts) {
|
|||||||
// Certificate Keypairs must not be used for Accounts and vice-versamust not be the same as any account keypair
|
// Certificate Keypairs must not be used for Accounts and vice-versamust not be the same as any account keypair
|
||||||
//
|
//
|
||||||
store.certificates.setKeypair = function (opts) {
|
store.certificates.setKeypair = function (opts) {
|
||||||
console.log('certificates.setKeypair:', opts.certificate, opts.subject, opts.keypair);
|
console.log('certificates.setKeypair:', opts.certificate, opts.subject);
|
||||||
|
console.log(opts.keypair);
|
||||||
|
|
||||||
// The ID is a string that doesn't clash between accounts and certificates.
|
// The ID is a string that doesn't clash between accounts and certificates.
|
||||||
// That's all you need to know... unless you're doing something special (in which case you're on your own).
|
// That's all you need to know... unless you're doing something special (in which case you're on your own).
|
||||||
@ -120,8 +122,8 @@ module.exports.create = function (opts) {
|
|||||||
var keypair = opts.keypair;
|
var keypair = opts.keypair;
|
||||||
|
|
||||||
return saveKeypair(id, JSON.stringify({
|
return saveKeypair(id, JSON.stringify({
|
||||||
privateKeyPem: keypair.privateKeyPem
|
privateKeyPem: keypair.privateKeyPem // string PEM
|
||||||
, privateKeyJwk: keypair.privateKeyJwk
|
, privateKeyJwk: keypair.privateKeyJwk // object JWK
|
||||||
})); // Must return or Promise `null` instead of `undefined`
|
})); // Must return or Promise `null` instead of `undefined`
|
||||||
|
|
||||||
// Side Note: you can use the "keypairs" package to convert between
|
// Side Note: you can use the "keypairs" package to convert between
|
||||||
@ -149,16 +151,17 @@ module.exports.create = function (opts) {
|
|||||||
// the key using the "cert-info" package.
|
// the key using the "cert-info" package.
|
||||||
store.certificates.set = function (opts) {
|
store.certificates.set = function (opts) {
|
||||||
console.log('certificates.set:', opts.certificate, opts.subject);
|
console.log('certificates.set:', opts.certificate, opts.subject);
|
||||||
|
console.log(opts.pems);
|
||||||
|
|
||||||
var id = opts.certificate.id || opts.subject;
|
var id = opts.certificate.id || opts.subject;
|
||||||
var pems = opts.pems;
|
var pems = opts.pems;
|
||||||
return saveCertificate(id, JSON.stringify({
|
return saveCertificate(id, JSON.stringify({
|
||||||
cert: pems.cert
|
cert: pems.cert // string PEM
|
||||||
, chain: pems.chain
|
, chain: pems.chain // string PEM
|
||||||
, subject: pems.subject
|
, subject: pems.subject // string name 'example.com
|
||||||
, altnames: pems.altnames
|
, altnames: pems.altnames // Array of string names [ 'example.com', '*.example.com', 'foo.bar.example.com' ]
|
||||||
, issuedAt: pems.issuedAt // a.k.a. NotBefore
|
, issuedAt: pems.issuedAt // date number in ms (a.k.a. NotBefore)
|
||||||
, expiresAt: pems.expiresAt // a.k.a. NotAfter
|
, expiresAt: pems.expiresAt // date number in ms (a.k.a. NotAfter)
|
||||||
})); // Must return or Promise `null` instead of `undefined`
|
})); // Must return or Promise `null` instead of `undefined`
|
||||||
};
|
};
|
||||||
|
|
||||||
|
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "greenlock-store-memory",
|
"name": "greenlock-store-memory",
|
||||||
"version": "3.0.2",
|
"version": "3.0.3",
|
||||||
"lockfileVersion": 1
|
"lockfileVersion": 1
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "greenlock-store-memory",
|
"name": "greenlock-store-memory",
|
||||||
"version": "3.0.2",
|
"version": "3.0.3",
|
||||||
"description": "An in-memory reference implementation for account, certificate, and keypair storage strategies in Greenlock",
|
"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",
|
"homepage": "https://git.coolaj86.com/coolaj86/greenlock-store-memory.js",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user