This commit is contained in:
AJ ONeal 2015-12-16 02:44:44 +00:00
parent db71fc5661
commit 9f5b52a7be
4 changed files with 34 additions and 7 deletions

View File

@ -1,8 +1,13 @@
/*!
* letiny-core
* Copyright(c) 2015 AJ ONeal <aj@daplie.com> https://daplie.com
* Apache-2.0 OR MIT (and hence also MPL 2.0)
*/
'use strict';
// It's good to have a place to store the certificates so you can,
// y'know, use them! :-)
'use strict';
// you receive a hostname and must give back an object
// with a public cert chain and a private key

View File

@ -1,7 +1,12 @@
// Finally, you need an implementation of `challengeStore`:
/*!
* letiny-core
* Copyright(c) 2015 AJ ONeal <aj@daplie.com> https://daplie.com
* Apache-2.0 OR MIT (and hence also MPL 2.0)
*/
'use strict';
// Finally, you need an implementation of `challengeStore`:
// Note:
// key is the xxxx part of `/.well-known/acme-challenge/xxxx`
// value is what is needs to be return the the requesting server

View File

@ -1,3 +1,8 @@
/*!
* letiny-core
* Copyright(c) 2015 AJ ONeal <aj@daplie.com> https://daplie.com
* Apache-2.0 OR MIT (and hence also MPL 2.0)
*/
'use strict';
//var LeCore = require('letiny-core');
@ -24,9 +29,11 @@ init();
function init() {
getPrivateKeys(function () {
LeCore.getAcmeUrls(acmeDiscoveryUrl, function (urls) {
console.log('Getting Acme Urls');
LeCore.getAcmeUrls(acmeDiscoveryUrl, function (err, urls) {
// in production choose LeCore.productionServerUrl
console.log('Got Acme Urls', err, urls);
acmeUrls = urls;
runDemo();
@ -35,18 +42,21 @@ function init() {
}
function getPrivateKeys() {
console.log('Generating Account Keypair');
LeCore.leCrypto.generateRsaKeypair(2048, 65537, function (err, pems) {
accountPrivateKeyPem = pems.privateKeyPem;
console.log('Generating Domain Keypair');
LeCore.leCrypto.generateRsaKeypair(2048, 65537, function (err, pems) {
domainPrivateKeyPem = pems.privateKeyPem;
runDemo();
});
});
}
function runDemo() {
console.log('Registering New Account');
LeCore.registerNewAccount(
{ newRegUrl: acmeUrls.newReg
, email: email
@ -66,6 +76,7 @@ function runDemo() {
console.log('[regr]');
console.log(regr);
console.log('Registering New Certificate');
LeCore.getCertificate(
{ domainPrivateKeyPem: domainPrivateKeyPem
, accountPrivateKeyPem: accountPrivateKeyPem

View File

@ -1,6 +1,12 @@
/*!
* letiny-core
* Copyright(c) 2015 AJ ONeal <aj@daplie.com> https://daplie.com
* Apache-2.0 OR MIT (and hence also MPL 2.0)
*/
'use strict';
// That will fail unless you have a webserver running on 80 and 443 (or 5001)
// to respond to `/.well-known/acme-challenge/xxxxxxxx` with the proper token
'use strict';
module.exports.init = function (deps) {
var tls = require('tls');