From cc0dd5bb35217fae2bc630699b6e328a534bbae7 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Mon, 28 Oct 2019 22:57:05 -0600 Subject: [PATCH] v3.0.5: update for greenlock express v3 --- lib/index.js | 47 ++++++++++++++++++++++++++--------------------- package.json | 3 ++- 2 files changed, 28 insertions(+), 22 deletions(-) diff --git a/lib/index.js b/lib/index.js index 5495c0a..8601b55 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1,49 +1,54 @@ 'use strict'; -//var request; - var defaults = {}; +var _memdb = {}; module.exports.create = function(config) { - var memdb = config.cache || {}; + var memdb = config.cache || _memdb; return { init: function(opts) { //request = opts.request; - return null; + return Promise.resolve(null); }, 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 key = ch.identifier.value + '#' + ch.token; - memdb[key] = ch.keyAuthorization; + var ch = data.challenge; + var key = ch.identifier.value + '#' + ch.token; + memdb[key] = ch.keyAuthorization; - return null; + return null; + }); }, 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 key = ch.identifier.value + '#' + ch.token; + var ch = data.challenge; + var key = ch.identifier.value + '#' + ch.token; - if (memdb[key]) { - return { keyAuthorization: memdb[key] }; - } + if (memdb[key]) { + return { keyAuthorization: memdb[key] }; + } - return null; + return null; + }); }, 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 key = ch.identifier.value + '#' + ch.token; + var ch = data.challenge; + var key = ch.identifier.value + '#' + ch.token; - delete memdb[key]; - return null; + delete memdb[key]; + return null; + }); } }; }; diff --git a/package.json b/package.json index 94055c5..8e3a16c 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,10 @@ { "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", "main": "index.js", "files": [ + "*.js", "lib", "test.js" ],