minor cleanup

This commit is contained in:
AJ ONeal 2016-08-09 15:58:11 -04:00
parent 60e4ed8f7b
commit 17df564f69
2 changed files with 8 additions and 25 deletions

View File

@ -1,17 +0,0 @@
/*!
* letiny
* Copyright(c) 2015 Anatol Sommer <anatol@anatol.at>
* 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);
});
};

View File

@ -17,6 +17,12 @@ function _toStandardBase64(str) {
return b64; 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) { module.exports.create = function (deps) {
var request = deps.request; var request = deps.request;
var Acme = deps.Acme; var Acme = deps.Acme;
@ -402,11 +408,5 @@ module.exports.create = function (deps) {
nextDomain(); 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; return getCert;
}; };