example/letsencrypt.js now “works” up until the point of not having a server to give proper challenge response
This commit is contained in:
parent
72646ced80
commit
72fb7b7c07
|
@ -6,7 +6,7 @@
|
|||
'use strict';
|
||||
|
||||
//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 domains = [process.argv[3] || 'example.com']; // CHANGE TO YOUR DOMAIN
|
||||
|
@ -17,8 +17,8 @@ var certStore = require('./cert-store');
|
|||
var serve = require('./serve');
|
||||
var closer;
|
||||
|
||||
var accountPrivateKeyPem = null;
|
||||
var domainPrivateKeyPem = null;
|
||||
var accountKeypair = null;
|
||||
var domainKeypair = null;
|
||||
var acmeUrls = null;
|
||||
|
||||
|
||||
|
@ -44,14 +44,14 @@ function init() {
|
|||
|
||||
function getPrivateKeys(cb) {
|
||||
console.log('Generating Account Keypair');
|
||||
console.log("(Note: if you're using forge and not ursa, this will take a long time");
|
||||
LeCore.leCrypto.generateRsaKeypair(2048, 65537, function (err, pems) {
|
||||
const RSA = require('rsa-compat').RSA;
|
||||
RSA.generateKeypair(2048, 65537, {}, function (err, pems) {
|
||||
|
||||
accountPrivateKeyPem = pems.privateKeyPem;
|
||||
accountKeypair = pems;
|
||||
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();
|
||||
});
|
||||
});
|
||||
|
@ -62,7 +62,7 @@ function runDemo() {
|
|||
LeCore.registerNewAccount(
|
||||
{ newRegUrl: acmeUrls.newReg
|
||||
, email: email
|
||||
, accountPrivateKeyPem: accountPrivateKeyPem
|
||||
, accountKeypair: accountKeypair
|
||||
, agreeToTerms: function (tosUrl, done) {
|
||||
|
||||
// agree to the exact version of these terms
|
||||
|
@ -82,8 +82,8 @@ function runDemo() {
|
|||
{ newAuthzUrl: acmeUrls.newAuthz
|
||||
, newCertUrl: acmeUrls.newCert
|
||||
|
||||
, domainPrivateKeyPem: domainPrivateKeyPem
|
||||
, accountPrivateKeyPem: accountPrivateKeyPem
|
||||
, domainKeypair: domainKeypair
|
||||
, accountKeypair: accountKeypair
|
||||
, domains: domains
|
||||
|
||||
, setChallenge: challengeStore.set
|
||||
|
@ -112,7 +112,7 @@ function runDemo() {
|
|||
closer = serve.init({
|
||||
LeCore: LeCore
|
||||
// needs a default key and cert chain, anything will do
|
||||
, httpsOptions: require('localhost.daplie.com-certificates')
|
||||
, httpsOptions: {}
|
||||
, challengeStore: challengeStore
|
||||
, certStore: certStore
|
||||
});
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
"test": "test"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "node example/letsencrypt.js"
|
||||
"test": "sudo node example/letsencrypt.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
Loading…
Reference in New Issue