v3.0.5: update for greenlock express v3

This commit is contained in:
AJ ONeal 2019-10-28 22:57:05 -06:00
parent b80ab1ae54
commit cc0dd5bb35
2 changed files with 28 additions and 22 deletions

View File

@ -1,49 +1,54 @@
'use strict'; 'use strict';
//var request;
var defaults = {}; var defaults = {};
var _memdb = {};
module.exports.create = function(config) { module.exports.create = function(config) {
var memdb = config.cache || {}; var memdb = config.cache || _memdb;
return { return {
init: function(opts) { init: function(opts) {
//request = opts.request; //request = opts.request;
return null; return Promise.resolve(null);
}, },
set: function(data) { set: function(data) {
// console.log('Add Key Auth URL', data); return Promise.resolve().then(function() {
// console.log('Add Key Auth URL', data);
var ch = data.challenge; var ch = data.challenge;
var key = ch.identifier.value + '#' + ch.token; var key = ch.identifier.value + '#' + ch.token;
memdb[key] = ch.keyAuthorization; memdb[key] = ch.keyAuthorization;
return null; return null;
});
}, },
get: function(data) { get: function(data) {
// console.log('List Key Auth URL', data); return Promise.resolve().then(function() {
// console.log('List Key Auth URL', data);
var ch = data.challenge; var ch = data.challenge;
var key = ch.identifier.value + '#' + ch.token; var key = ch.identifier.value + '#' + ch.token;
if (memdb[key]) { if (memdb[key]) {
return { keyAuthorization: memdb[key] }; return { keyAuthorization: memdb[key] };
} }
return null; return null;
});
}, },
remove: function(data) { remove: function(data) {
// console.log('Remove Key Auth URL', data); return Promise.resolve().then(function() {
// console.log('Remove Key Auth URL', data);
var ch = data.challenge; var ch = data.challenge;
var key = ch.identifier.value + '#' + ch.token; var key = ch.identifier.value + '#' + ch.token;
delete memdb[key]; delete memdb[key];
return null; return null;
});
} }
}; };
}; };

View File

@ -1,9 +1,10 @@
{ {
"name": "acme-http-01-standalone", "name": "acme-http-01-standalone",
"version": "3.0.0", "version": "3.0.5",
"description": "HTTP Authentication (In-Memory) for Let's Encrypt for Node.js - ACME http-01 challenges w/ ACME.js and Greenlock.js", "description": "HTTP Authentication (In-Memory) for Let's Encrypt for Node.js - ACME http-01 challenges w/ ACME.js and Greenlock.js",
"main": "index.js", "main": "index.js",
"files": [ "files": [
"*.js",
"lib", "lib",
"test.js" "test.js"
], ],