mirror of
https://git.coolaj86.com/coolaj86/greenlock-store-memory.js.git
synced 2025-04-19 12:40:36 +00:00
v3.0.0: reference implementation for Greenlock v2.7+ (and v3)
This commit is contained in:
parent
a89791ddba
commit
169cdb6c6a
@ -1,4 +1,4 @@
|
||||
# le-store-memory
|
||||
# greenlock-store-memory
|
||||
|
||||
An in-memory reference implementation of a Certificate and Keypair storage strategy for Greenlock v2.7+ (and v3)
|
||||
|
||||
@ -11,7 +11,7 @@ var greenlock = require('greenlock');
|
||||
// We could have It's used so that we can peek and poke at the store.
|
||||
var cache = {};
|
||||
var gl = greenlock.create({
|
||||
store: require('le-store-memory').create({ cache: cache })
|
||||
store: require('greenlock-store-memory').create({ cache: cache })
|
||||
, approveDomains: approveDomains
|
||||
...
|
||||
});
|
||||
@ -24,6 +24,8 @@ var gl = greenlock.create({
|
||||
Also, you have the flexibility to get really fancy. _Don't!_
|
||||
You probably don't need to (unless you already know that you do).
|
||||
|
||||
**DON'T BE CLEVER.** Do it the **dumb way first**.
|
||||
|
||||
In most cases you're just implementing dumb storage.
|
||||
If all you do is `JSON.stringify()` on `set` (save) and `JSON.parse()` after `check` (get)
|
||||
and just treat it as a blob with an ID, you'll do just fine. You can always optimize later.
|
||||
|
38
index.js
38
index.js
@ -1,5 +1,36 @@
|
||||
'use strict';
|
||||
|
||||
// IMPORTANT
|
||||
// IMPORTANT
|
||||
// IMPORTANT
|
||||
//
|
||||
// Ready? DON'T OVERTHINK IT!!! (Seriously, this is a huge problem)
|
||||
//
|
||||
// If you get confused, you're probably smart and thinking too deep.
|
||||
//
|
||||
// Want an explanation of how and why? Okay...
|
||||
// https://coolaj86.com/articles/lets-encrypt-v2-step-by-step/
|
||||
//
|
||||
// But really, you probably don't want to know how and why (because then you'd be implementing your own from scratch)
|
||||
//
|
||||
// IMPORTANT
|
||||
// IMPORTANT
|
||||
// IMPORTANT
|
||||
//
|
||||
// If you want to create a storage strategy quick-and-easy, treat everything as either dumb strings or JSON blobs
|
||||
// (just as is done here), don't try to do clever optimizations, 5th normal form, etc (you ain't gonna need it),
|
||||
// but DO use the simple test provided by `greenlock-store-test`.
|
||||
//
|
||||
// IMPORTANT
|
||||
// IMPORTANT
|
||||
// IMPORTANT
|
||||
//
|
||||
// Don't get fancy. Don't overthink it.
|
||||
// If you want to be fancy and clever, do that after you can pass `greenlock-store-test` the dumb way shown here.
|
||||
//
|
||||
// Also: please do contribute clarifying comments.
|
||||
|
||||
|
||||
module.exports.create = function (opts) {
|
||||
// pass in database url, connection string, filepath,
|
||||
// or whatever it is you need to get your job done well
|
||||
@ -73,10 +104,15 @@ module.exports.create = function (opts) {
|
||||
|
||||
|
||||
|
||||
// The certificate keypairs must not be the same as any account keypair
|
||||
// The certificate keypairs (properly named privkey.pem, though sometimes sutpidly called cert.key)
|
||||
// https://community.letsencrypt.org/t/what-are-those-pem-files/18402
|
||||
// Certificate Keypairs must not be used for Accounts and vice-versamust not be the same as any account keypair
|
||||
//
|
||||
store.certificates.setKeypair = function (opts) {
|
||||
console.log('certificates.setKeypair:', opts.certificate, opts.subject, opts.keypair);
|
||||
|
||||
// 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).
|
||||
var id = opts.certificate.kid || opts.certificate.id || opts.subject;
|
||||
var keypair = opts.keypair;
|
||||
|
||||
|
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "le-store-memory",
|
||||
"version": "1.0.1",
|
||||
"name": "greenlock-store-memory",
|
||||
"version": "3.0.0",
|
||||
"lockfileVersion": 1
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "le-store-memory",
|
||||
"version": "1.0.1",
|
||||
"name": "greenlock-store-memory",
|
||||
"version": "3.0.0",
|
||||
"description": "An in-memory reference implementation for account, certificate, and keypair storage strategies in Greenlock",
|
||||
"homepage": "https://git.coolaj86.com/coolaj86/le-store-memory.js",
|
||||
"main": "index.js",
|
||||
|
Loading…
x
Reference in New Issue
Block a user