This commit is contained in:
AJ ONeal 2015-12-16 02:57:17 +00:00
parent 4767d14517
commit 8102cc11a0
3 changed files with 15 additions and 10 deletions

View File

@ -41,7 +41,7 @@ function init() {
});
}
function getPrivateKeys() {
function getPrivateKeys(cb) {
console.log('Generating Account Keypair');
LeCore.leCrypto.generateRsaKeypair(2048, 65537, function (err, pems) {
@ -50,7 +50,7 @@ function getPrivateKeys() {
LeCore.leCrypto.generateRsaKeypair(2048, 65537, function (err, pems) {
domainPrivateKeyPem = pems.privateKeyPem;
runDemo();
cb();
});
});
}

View File

@ -10,6 +10,8 @@ module.exports.create = function (deps) {
var knownUrls = deps.LeCore.knownEndpoints;
function getAcmeUrls(acmeDiscoveryUrl, cb) {
console.log('acmeDiscoveryUrl');
console.log(acmeDiscoveryUrl);
// TODO check response header on request for cache time
return request({
@ -43,12 +45,12 @@ module.exports.create = function (deps) {
console.warn(data);
}
return {
cb(null, {
newAuthz: data['new-authz']
, newCert: data['new-cert']
, newReg: data['new-reg']
, revokeCert: data['revoke-cert']
};
});
});
}

15
node.js
View File

@ -8,12 +8,6 @@
function create(deps) {
var LeCore = {};
LeCore.leCrypto = deps.leCrypto;
LeCore.getAcmeUrls = require('./lib/get-acme-urls').create(deps);
deps.Acme = LeCore.Acme = require('./lib/acme-client').create(deps);
LeCore.registerNewAccount = require('./lib/register-new-account').create(deps);
LeCore.getCertificate = require('./lib/get-certificate').create(deps);
// Note: these are NOT DEFAULTS
// They are de facto standards that you may
// or may not use in your implementation
@ -25,6 +19,15 @@ function create(deps) {
LeCore.workDir = "/var/lib/letsencrypt/";
LeCore.knownEndpoints = ['new-authz', 'new-cert', 'new-reg', 'revoke-cert'];
deps.LeCore = LeCore;
deps.Acme = LeCore.Acme = require('./lib/acme-client').create(deps);
LeCore.getAcmeUrls = require('./lib/get-acme-urls').create(deps);
LeCore.registerNewAccount = require('./lib/register-new-account').create(deps);
LeCore.getCertificate = require('./lib/get-certificate').create(deps);
LeCore.leCrypto = deps.leCrypto;
return LeCore;
}