update to new standards

This commit is contained in:
Philipp Kunz 2017-01-15 22:30:33 +01:00
parent dfd7edd330
commit c8d2cfd4ce
15 changed files with 112 additions and 25 deletions

View File

@ -1,6 +1,7 @@
/// <reference types="q" />
import * as q from 'q';
import { SmartAcme } from './smartacme.classes.smartacme';
import { AcmeCert } from './smartacme.classes.acmecert';
/**
* class AcmeAccount represents an AcmeAccount
*/
@ -18,5 +19,5 @@ export declare class AcmeAccount {
* agree to letsencrypr terms of service
*/
agreeTos(): q.Promise<{}>;
createAcmeCert(domainNameArg: string, countryArg?: string, countryShortArg?: string, city?: string, companyArg?: string, companyShortArg?: string): q.Promise<{}>;
createAcmeCert(domainNameArg: string, countryArg?: string, countryShortArg?: string, city?: string, companyArg?: string, companyShortArg?: string): q.Promise<AcmeCert>;
}

View File

@ -68,4 +68,4 @@ class AcmeAccount {
}
}
exports.AcmeAccount = AcmeAccount;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRhY21lLmNsYXNzZXMuYWNtZWFjY291bnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGFjbWUuY2xhc3Nlcy5hY21lYWNjb3VudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsdUJBQXNCO0FBTXRCLDZFQUF1RDtBQUV2RDs7R0FFRztBQUNIO0lBS0ksWUFBWSxrQkFBNkI7UUFDckMsSUFBSSxDQUFDLGVBQWUsR0FBRyxrQkFBa0IsQ0FBQTtJQUM3QyxDQUFDO0lBRUQ7O09BRUc7SUFDSCxRQUFRO1FBQ0osSUFBSSxJQUFJLEdBQUcsQ0FBQyxDQUFDLEtBQUssRUFBRSxDQUFBO1FBQ3BCLElBQUksQ0FBQyxlQUFlLENBQUMsYUFBYSxDQUFDLE1BQU0sQ0FDckM7WUFDSSxPQUFPLEVBQUUsQ0FBQyw2QkFBNkIsQ0FBQztTQUMzQyxFQUNELENBQUMsR0FBRyx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LEVBQUUsSUFBSTtZQUNsQixpQkFBaUIsRUFBRSxJQUFJO1NBQzFCLEVBQ0QsSUFBSSxDQUNQLENBQUE7UUFDRCxJQUFJLENBQUMsT0FBTyxDQUFDLFFBQVEsQ0FBQyxDQUFBO1FBQ3RCLE1BQU0sQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFBO0lBQ3ZCLENBQUM7Q0FDSjtBQWxGRCxrQ0FrRkMifQ==

View File

@ -18,7 +18,9 @@ export interface ISmartAcmeChallenge {
keyAuthorization: string;
}
export interface ISmartAcmeChallengeAccepted extends ISmartAcmeChallenge {
keyHash: string;
dnsKeyHash: string;
domainName: string;
domainNamePrefixed: string;
}
export interface IAcmeCsrConstructorOptions {
bit: number;
@ -54,6 +56,10 @@ export declare class AcmeCert {
* @param challengeType - the challenge type to request
*/
requestChallenge(challengeTypeArg?: TChallengeType): q.Promise<ISmartAcmeChallengeAccepted>;
/**
* checks if DNS records are set
*/
checkDns(): Promise<any>;
/**
* validates a challenge, only call after you have set the challenge at the expected location
*/

File diff suppressed because one or more lines are too long

View File

@ -4,3 +4,7 @@ import { IRsaKeypair } from './smartacme.classes.smartacme';
* creates a keypair to use with requests and to generate JWK from
*/
export declare let createKeypair: (bit?: number) => IRsaKeypair;
/**
* prefix a domain name to make sure it complies with letsencrypt
*/
export declare let prefixName: (domainNameArg: string) => string;

View File

@ -12,6 +12,12 @@ exports.createKeypair = (bit = 2048) => {
privateKey: result.private_key
};
};
/**
* prefix a domain name to make sure it complies with letsencrypt
*/
exports.prefixName = (domainNameArg) => {
return '_acme-challenge.' + domainNameArg;
};
/**
* gets an existing registration
* @executes ASYNC
@ -31,4 +37,4 @@ let getReg = (SmartAcmeArg, location) => {
});
return done.promise;
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRhY21lLmhlbHBlcnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGFjbWUuaGVscGV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LGFBQWEsQ0FBQyxJQUFJLENBQzNCLFFBQVEsRUFDUixJQUFJLEVBQ0osWUFBWSxDQUFDLE9BQU8sRUFDcEIsQ0FBQyxHQUFHLEVBQUUsR0FBRztRQUNMLEVBQUUsQ0FBQyxDQUFDLEdBQUcsQ0FBQyxDQUFDLENBQUM7WUFDTixPQUFPLENBQUMsS0FBSyxDQUFDLGtDQUFrQyxDQUFDLENBQUE7WUFDakQsT0FBTyxDQUFDLEdBQUcsQ0FBQyxHQUFHLENBQUMsQ0FBQTtZQUNoQixJQUFJLENBQUMsTUFBTSxDQUFDLEdBQUcsQ0FBQyxDQUFBO1lBQ2hCLE1BQU0sQ0FBQTtRQUNWLENBQUM7UUFDRCxPQUFPLENBQUMsR0FBRyxDQUFDLElBQUksQ0FBQyxTQUFTLENBQUMsR0FBRyxDQUFDLElBQUksQ0FBQyxDQUFDLENBQUE7UUFDckMsSUFBSSxDQUFDLE9BQU8sRUFBRSxDQUFBO0lBQ2xCLENBQUMsQ0FDSixDQUFBO0lBQ0QsTUFBTSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUE7QUFDdkIsQ0FBQyxDQUFBIn0=

View File

@ -2,7 +2,7 @@ import 'typings-global';
declare let rsaKeygen: any;
declare let rawacme: any;
declare let nodeForge: any;
import * as dnsly from 'dnsly';
import * as smartfile from 'smartfile';
import * as smartstring from 'smartstring';
import * as paths from './smartacme.paths';
export { rsaKeygen, rawacme, nodeForge, smartfile, smartstring, paths };
export { dnsly, rsaKeygen, rawacme, nodeForge, smartfile, smartstring };

View File

@ -7,10 +7,10 @@ exports.rawacme = rawacme;
let nodeForge = require('node-forge');
exports.nodeForge = nodeForge;
// push.rocks modules here
const dnsly = require("dnsly");
exports.dnsly = dnsly;
const smartfile = require("smartfile");
exports.smartfile = smartfile;
const smartstring = require("smartstring");
exports.smartstring = smartstring;
const paths = require("./smartacme.paths");
exports.paths = paths;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxl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UFLO0FBSlQsdUNBQXNDO0FBUWxDLDhCQUFTO0FBUGIsMkNBQTBDO0FBUXRDLGtDQUFXIn0=

View File

@ -25,18 +25,20 @@
"dependencies": {
"@types/node-forge": "^0.6.5",
"@types/q": "0.x.x",
"node-forge": "^0.6.46",
"dnsly": "^1.0.7",
"node-forge": "^0.6.47",
"q": "^1.4.1",
"rawacme": "^0.2.1",
"rsa-keygen": "^1.0.6",
"smartfile": "^4.1.0",
"smartstring": "^2.0.20",
"smartfile": "^4.1.2",
"smartstring": "^2.0.22",
"typings-global": "^1.0.14"
},
"devDependencies": {
"@types/should": "^8.1.30",
"cflare": "0.0.10",
"should": "^11.1.1",
"qenv": "^1.1.1",
"should": "^11.1.2",
"typings-test": "^1.0.3"
}
}

View File

@ -43,6 +43,12 @@ describe('smartacme', function () {
done();
});
});
it('should check for a DNS record', function (done) {
testAcmeCert.checkDns().then(x => {
console.log(x);
done();
});
});
it('should poll for validation of a challenge', function (done) {
this.timeout(10000);
testAcmeCert.requestValidation().then(x => {
@ -50,4 +56,4 @@ describe('smartacme', function () {
});
});
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLHdCQUFxQjtBQUNyQixpQ0FBZ0M7QUFHaEMsNEJBQTRCO0FBQzVCLDJDQUEwQztBQUUxQyxRQUFRLENBQUMsV0FBVyxFQUFFO0lBQ2xCLElBQUksYUFBa0MsQ0FBQTtJQUN0QyxJQUFJLGVBQXNDLENBQUE7SUFDMUMsSUFBSSxZQUFnQyxDQUFBO0lBQ3BDLElBQUksYUFBb0QsQ0FBQTtJQUV4RCxFQUFFLENBQUMsZ0NBQWdDLEVBQUUsVUFBVSxJQUFJO1FBQy9DLElBQUksQ0FBQyxPQUFPLENBQUMsS0FBSyxDQUFDLENBQUE7UUFDb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ksQ0FBQyxDQUFDO1lBQzFCLE9BQU8sQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFDLENBQUE7WUFDZCxJQUFJLEVBQUUsQ0FBQTtRQUNWLENBQUMsQ0FBQyxDQUFBO0lBQ04sQ0FBQyxDQUFDLENBQUE7SUFFRixFQUFFLENBQUMsMkNBQTJDLEVBQUUsVUFBVSxJQUFJO1FBQzFELElBQUksQ0FBQyxPQUFPLENBQUMsS0FBSyxDQUFDLENBQUE7UUFDbkIsWUFBWSxDQUFDLGlCQUFpQixFQUFFLENBQUMsSUFBSSxDQUFDLENBQUM7WUFDbkMsSUFBSSxFQUFFLENBQUE7UUFDVixDQUFDLENBQUMsQ0FBQTtJQUNOLENBQUMsQ0FBQyxDQUFBO0FBQ04sQ0FBQyxDQUFDLENBQUEifQ==

View File

@ -1,6 +1,7 @@
import 'typings-test'
import * as should from 'should'
import * as cflare from 'cflare'
import * as qenv from 'qenv'
// import the module to test
import * as smartacme from '../dist/index'
@ -51,7 +52,14 @@ describe('smartacme', function () {
})
})
it('should poll for validation of a challenge', function (done) {
it('should check for a DNS record', function(done) {
testAcmeCert.checkDns().then(x => {
console.log(x)
done()
})
})
it.skip('should poll for validation of a challenge', function (done) {
this.timeout(10000)
testAcmeCert.requestValidation().then(x => {
done()

View File

@ -71,7 +71,7 @@ export class AcmeAccount {
companyShortArg = 'SC'
) {
let done = q.defer()
let done = q.defer<AcmeCert>()
let acmeCert = new AcmeCert(
{
bit: 2064,

View File

@ -25,7 +25,9 @@ export interface ISmartAcmeChallenge {
}
export interface ISmartAcmeChallengeAccepted extends ISmartAcmeChallenge {
keyHash: string
dnsKeyHash: string
domainName: string
domainNamePrefixed: string
}
export interface IAcmeCsrConstructorOptions {
@ -42,6 +44,9 @@ export interface IAcmeCsrConstructorOptions {
subject_alt_names: string[]
}
// Dnsly instance (we really just need one)
let myDnsly = new plugins.dnsly.Dnsly('google')
/**
* class AcmeCert represents a cert for domain
*/
@ -125,6 +130,19 @@ export class AcmeCert {
return done.promise
}
/**
* checks if DNS records are set
*/
async checkDns() {
let myRecord
try {
myRecord = await myDnsly.getRecord(helpers.prefixName(this.domainName), 'TXT')
} catch (err) {
await this.checkDns()
}
return myRecord[0][0]
}
/**
* validates a challenge, only call after you have set the challenge at the expected location
*/
@ -227,8 +245,10 @@ export class AcmeCert {
type: res.body.type,
token: res.body.token,
keyAuthorization: res.body.keyAuthorization,
keyHash: keyHash,
status: res.body.status
status: res.body.status,
dnsKeyHash: keyHash,
domainName: this.domainName,
domainNamePrefixed: helpers.prefixName(this.domainName)
}
this.acceptedChallenge = returnDNSChallenge
done.resolve(returnDNSChallenge)

View File

@ -17,6 +17,13 @@ export let createKeypair = (bit = 2048): IRsaKeypair => {
}
}
/**
* prefix a domain name to make sure it complies with letsencrypt
*/
export let prefixName = (domainNameArg: string): string => {
return '_acme-challenge.' + domainNameArg
}
/**
* gets an existing registration
* @executes ASYNC

View File

@ -6,15 +6,15 @@ let rawacme = require('rawacme') // acme helper functions
let nodeForge = require('node-forge')
// push.rocks modules here
import * as dnsly from 'dnsly'
import * as smartfile from 'smartfile'
import * as smartstring from 'smartstring'
import * as paths from './smartacme.paths'
export {
dnsly,
rsaKeygen,
rawacme,
nodeForge,
smartfile,
smartstring,
paths
smartstring
}