From 17df564f696b53297fbd4c487b7717fa56c2db9b Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Tue, 9 Aug 2016 15:58:11 -0400 Subject: [PATCH] minor cleanup --- lib/client.js | 17 ----------------- lib/get-certificate.js | 16 ++++++++-------- 2 files changed, 8 insertions(+), 25 deletions(-) delete mode 100644 lib/client.js diff --git a/lib/client.js b/lib/client.js deleted file mode 100644 index ee9167f..0000000 --- a/lib/client.js +++ /dev/null @@ -1,17 +0,0 @@ -/*! - * letiny - * Copyright(c) 2015 Anatol Sommer - * Some code used from https://github.com/letsencrypt/boulder/tree/master/test/js - * MPL 2.0 -*/ - -'use strict'; - -exports.Acme = require('./acme-client'); -exports.registerNewAccount = require('./register-new-account'); -exports.getCertificate = require('./get-certificate'); -exports.getCert=function (options, cb) { - exports.registerNewAccount(options, function () { - exports.getCertificate(options, cb); - }); -}; diff --git a/lib/get-certificate.js b/lib/get-certificate.js index b520ee9..0a80ad8 100644 --- a/lib/get-certificate.js +++ b/lib/get-certificate.js @@ -17,8 +17,14 @@ function _toStandardBase64(str) { return b64; } +function certBufferToPem(cert) { + cert = _toStandardBase64(cert.toString('base64')); + cert = cert.match(/.{1,64}/g).join('\r\n'); + return '-----BEGIN CERTIFICATE-----\r\n'+cert+'\r\n-----END CERTIFICATE-----\r\n'; +} + module.exports.create = function (deps) { - var request=deps.request; + var request = deps.request; var Acme = deps.Acme; var RSA = deps.RSA; @@ -321,7 +327,7 @@ module.exports.create = function (deps) { return handleErr(err, 'Failed to fetch issuer certificate'); } - state.chainPem=certBufferToPem(body); + state.chainPem = certBufferToPem(body); log('Requesting issuer certificate: done'); done(); }); @@ -402,11 +408,5 @@ module.exports.create = function (deps) { nextDomain(); } - function certBufferToPem(cert) { - cert=_toStandardBase64(cert.toString('base64')); - cert=cert.match(/.{1,64}/g).join('\r\n'); - return '-----BEGIN CERTIFICATE-----\r\n'+cert+'\r\n-----END CERTIFICATE-----\r\n'; - } - return getCert; };