From d1c2dd4dcfc60f39dc61ab4c1118ccb4a4e9b314 Mon Sep 17 00:00:00 2001 From: anatolsommer Date: Sun, 13 Dec 2015 18:22:16 +0100 Subject: [PATCH] small code improvements --- History.md | 5 +++++ lib/client.js | 16 ++++++++-------- package.json | 6 +++++- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/History.md b/History.md index d7d20db..3a4f558 100644 --- a/History.md +++ b/History.md @@ -1,3 +1,8 @@ +0.0.4-beta / 2015-12-13 +======================= + + * Small code improvements + 0.0.3-beta / 2015-12-13 ======================= diff --git a/lib/client.js b/lib/client.js index 706c56b..5a68ed8 100644 --- a/lib/client.js +++ b/lib/client.js @@ -112,14 +112,14 @@ function getCert(options, cb) { options.newReg=options.newReg || 'https://acme-v01.api.letsencrypt.org/acme/new-reg'; if (!options.email) { - return cb(new Error('No "email" option given!')); + return cb(new Error('No "email" option specified!')); } if (typeof options.domains==='string') { state.domains=options.domains.split(/[, ]+/); } else if (options.domains && options.domains instanceof Array) { state.domains=options.domains.slice(); } else { - return cb(new Error('No valid "domains" option given!')); + return cb(new Error('No valid "domains" option specified!')); } if ((_DEBUG=options.debug)) { @@ -235,7 +235,7 @@ function getCert(options, cb) { var links, authz, httpChallenges, challenge, thumbprint, keyAuthorization, challengePath; if (err || Math.floor(res.statusCode/100)!==2) { - return handleErr(err, 'Authorization request failed with code '+res.statusCode); + return handleErr(err, 'Authorization request failed ('+res.statusCode+')'); } links=parseLink(res.headers['link']); @@ -344,7 +344,7 @@ function getCert(options, cb) { links=parseLink(res.headers['link']); if (!links || !('up' in links)) { - return handleErr(err, 'Failed to fetch CA certificate'); + return handleErr(err, 'Failed to fetch issuer certificate'); } log('Requesting certificate: done'); @@ -365,16 +365,16 @@ function getCert(options, cb) { handleErr(null, 'Cert at '+certURL+' did not match returned cert'); } else { log('Successfully verified cert at '+certURL); - log('Requesting CA certificate...'); + log('Requesting issuer certificate...'); request.get({ url:links['up'], encoding:null }, function(err, res, body) { if (err || res.statusCode!==200) { - return handleErr(err, 'Failed to fetch CA certificate'); + return handleErr(err, 'Failed to fetch issuer certificate'); } state.caCert=certBufferToPEM(body); - log('Requesting CA certificate: done'); + log('Requesting issuer certificate: done'); done(); }); } @@ -410,7 +410,7 @@ function getCert(options, cb) { } cb(null, cert, state.certPrivateKeyPEM, state.caCert); } catch(err) { - handleErr(err, 'Could not write output files'); + handleErr(err, 'Could not write output files. Please check permissions!'); } } diff --git a/package.json b/package.json index d4b8b2d..602d990 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,13 @@ { "name": "letiny", - "version": "0.0.3-beta", + "version": "0.0.4-beta", "description": "Tiny ACME client library and CLI", "author": "Anatol Sommer ", "license": "MPL", + "repository": { + "type": "git", + "url": "https://github.com/anatolsommer/letiny.git" + }, "keywords": [ "tiny", "acme",