From eed2e1047229c3a5c1c4fb303080becfbd992e94 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Wed, 31 Jul 2019 16:02:15 -0600 Subject: [PATCH] fix incorrect error message --- node.js | 23 ++++++++++++++++++----- package.json | 4 ++-- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/node.js b/node.js index d7e4442..e2d827e 100644 --- a/node.js +++ b/node.js @@ -184,14 +184,14 @@ ACME._registerAccount = function(me, options) { } else if (options.email) { contact = ['mailto:' + options.email]; } - var body = { + var req = { termsOfServiceAgreed: tosUrl === me._tos, onlyReturnExisting: false, contact: contact }; if (options.externalAccount) { // TODO is this really done by HMAC or is it arbitrary? - body.externalAccountBinding = me.RSA.signJws( + req.externalAccountBinding = me.RSA.signJws( options.externalAccount.secret, undefined, { @@ -202,7 +202,7 @@ ACME._registerAccount = function(me, options) { Buffer.from(JSON.stringify(jwk)) ); } - var payload = JSON.stringify(body); + var payload = JSON.stringify(req); var jws = me.RSA.signJws( options.accountKeypair, undefined, @@ -234,7 +234,17 @@ ACME._registerAccount = function(me, options) { var account = resp.body; if (2 !== Math.floor(resp.statusCode / 100)) { - throw new Error('account error: ' + JSON.stringify(body)); + if ('string' !== typeof account) { + account = JSON.stringify(account); + } + throw new Error( + 'account error: ' + + resp.statusCode + + ' ' + + account + + '\n' + + JSON.stringify(req) + ); } me._nonce = resp.toJSON().headers['replay-nonce']; @@ -1097,7 +1107,10 @@ ACME._getCertificate = function(me, options) { .toString('hex') + d ); }); - return ACME._depInit(me, options, dnsHosts).then(function(zonenames) { + return ACME._depInit(me, options, dnsHosts).then(function(nada) { + if (nada) { + // fake use of nada to make both _wrapCb and jshint happy + } return ACME._getZones(me, options, dnsHosts).then(function(zonenames) { options.zonenames = zonenames; // Do a little dry-run / self-test diff --git a/package.json b/package.json index 51b3b9b..cea2596 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "acme-v2", - "version": "1.8.2", + "version": "1.8.3", "description": "A lightweight library for getting Free SSL certifications through Let's Encrypt, using the ACME protocol.", "homepage": "https://git.coolaj86.com/coolaj86/acme-v2.js", "main": "node.js", @@ -9,7 +9,7 @@ }, "repository": { "type": "git", - "url": "ssh://gitea@git.coolaj86.com:22042/coolaj86/acme-v2.js.git" + "url": "https://git.coolaj86.com/coolaj86/acme-v2.js.git" }, "keywords": [ "Let's Encrypt",