Browse Source

fix incorrect error message

AJ ONeal 5 years ago
parent
commit
eed2e10472
  1. 23
      node.js
  2. 4
      package.json

23
node.js

@ -184,14 +184,14 @@ ACME._registerAccount = function(me, options) {
} else if (options.email) { } else if (options.email) {
contact = ['mailto:' + options.email]; contact = ['mailto:' + options.email];
} }
var body = { var req = {
termsOfServiceAgreed: tosUrl === me._tos, termsOfServiceAgreed: tosUrl === me._tos,
onlyReturnExisting: false, onlyReturnExisting: false,
contact: contact contact: contact
}; };
if (options.externalAccount) { if (options.externalAccount) {
// TODO is this really done by HMAC or is it arbitrary? // TODO is this really done by HMAC or is it arbitrary?
body.externalAccountBinding = me.RSA.signJws( req.externalAccountBinding = me.RSA.signJws(
options.externalAccount.secret, options.externalAccount.secret,
undefined, undefined,
{ {
@ -202,7 +202,7 @@ ACME._registerAccount = function(me, options) {
Buffer.from(JSON.stringify(jwk)) Buffer.from(JSON.stringify(jwk))
); );
} }
var payload = JSON.stringify(body); var payload = JSON.stringify(req);
var jws = me.RSA.signJws( var jws = me.RSA.signJws(
options.accountKeypair, options.accountKeypair,
undefined, undefined,
@ -234,7 +234,17 @@ ACME._registerAccount = function(me, options) {
var account = resp.body; var account = resp.body;
if (2 !== Math.floor(resp.statusCode / 100)) { 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']; me._nonce = resp.toJSON().headers['replay-nonce'];
@ -1097,7 +1107,10 @@ ACME._getCertificate = function(me, options) {
.toString('hex') + d .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) { return ACME._getZones(me, options, dnsHosts).then(function(zonenames) {
options.zonenames = zonenames; options.zonenames = zonenames;
// Do a little dry-run / self-test // Do a little dry-run / self-test

4
package.json

@ -1,6 +1,6 @@
{ {
"name": "acme-v2", "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.", "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", "homepage": "https://git.coolaj86.com/coolaj86/acme-v2.js",
"main": "node.js", "main": "node.js",
@ -9,7 +9,7 @@
}, },
"repository": { "repository": {
"type": "git", "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": [ "keywords": [
"Let's Encrypt", "Let's Encrypt",

Loading…
Cancel
Save