example/letsencrypt.js now “works” up until the point of not having a server to give proper challenge response
This commit is contained in:
Kelly Johnson 2017-03-11 11:36:07 -08:00
parent 72646ced80
commit 72fb7b7c07
2 changed files with 13 additions and 13 deletions

View File

@ -6,7 +6,7 @@
'use strict'; 'use strict';
//var LeCore = require('letiny-core'); //var LeCore = require('letiny-core');
var LeCore = require('../'); var LeCore = require('../').ACME.create();
var email = process.argv[2] || 'user@example.com'; // CHANGE TO YOUR EMAIL var email = process.argv[2] || 'user@example.com'; // CHANGE TO YOUR EMAIL
var domains = [process.argv[3] || 'example.com']; // CHANGE TO YOUR DOMAIN var domains = [process.argv[3] || 'example.com']; // CHANGE TO YOUR DOMAIN
@ -17,8 +17,8 @@ var certStore = require('./cert-store');
var serve = require('./serve'); var serve = require('./serve');
var closer; var closer;
var accountPrivateKeyPem = null; var accountKeypair = null;
var domainPrivateKeyPem = null; var domainKeypair = null;
var acmeUrls = null; var acmeUrls = null;
@ -44,14 +44,14 @@ function init() {
function getPrivateKeys(cb) { function getPrivateKeys(cb) {
console.log('Generating Account Keypair'); console.log('Generating Account Keypair');
console.log("(Note: if you're using forge and not ursa, this will take a long time"); const RSA = require('rsa-compat').RSA;
LeCore.leCrypto.generateRsaKeypair(2048, 65537, function (err, pems) { RSA.generateKeypair(2048, 65537, {}, function (err, pems) {
accountPrivateKeyPem = pems.privateKeyPem; accountKeypair = pems;
console.log('Generating Domain Keypair'); console.log('Generating Domain Keypair');
LeCore.leCrypto.generateRsaKeypair(2048, 65537, function (err, pems) { RSA.generateKeypair(2048, 65537, {}, function (err, pems2) {
domainPrivateKeyPem = pems.privateKeyPem; domainKeypair = pems2;
cb(); cb();
}); });
}); });
@ -62,7 +62,7 @@ function runDemo() {
LeCore.registerNewAccount( LeCore.registerNewAccount(
{ newRegUrl: acmeUrls.newReg { newRegUrl: acmeUrls.newReg
, email: email , email: email
, accountPrivateKeyPem: accountPrivateKeyPem , accountKeypair: accountKeypair
, agreeToTerms: function (tosUrl, done) { , agreeToTerms: function (tosUrl, done) {
// agree to the exact version of these terms // agree to the exact version of these terms
@ -82,8 +82,8 @@ function runDemo() {
{ newAuthzUrl: acmeUrls.newAuthz { newAuthzUrl: acmeUrls.newAuthz
, newCertUrl: acmeUrls.newCert , newCertUrl: acmeUrls.newCert
, domainPrivateKeyPem: domainPrivateKeyPem , domainKeypair: domainKeypair
, accountPrivateKeyPem: accountPrivateKeyPem , accountKeypair: accountKeypair
, domains: domains , domains: domains
, setChallenge: challengeStore.set , setChallenge: challengeStore.set
@ -112,7 +112,7 @@ function runDemo() {
closer = serve.init({ closer = serve.init({
LeCore: LeCore LeCore: LeCore
// needs a default key and cert chain, anything will do // needs a default key and cert chain, anything will do
, httpsOptions: require('localhost.daplie.com-certificates') , httpsOptions: {}
, challengeStore: challengeStore , challengeStore: challengeStore
, certStore: certStore , certStore: certStore
}); });

View File

@ -9,7 +9,7 @@
"test": "test" "test": "test"
}, },
"scripts": { "scripts": {
"test": "node example/letsencrypt.js" "test": "sudo node example/letsencrypt.js"
}, },
"repository": { "repository": {
"type": "git", "type": "git",