fix(core): update

This commit is contained in:
2019-01-06 23:54:46 +01:00
parent ed4ba0cb61
commit ee300c3e12
4 changed files with 243 additions and 23 deletions

View File

@ -8,6 +8,7 @@ export interface ISmartAcmeStorage {}
export class SmartAcme {
// the acme client
private client: any;
private smartdns = new plugins.smartdns.Smartdns();
// the account private key
private privateKey: string;
@ -48,7 +49,7 @@ export class SmartAcme {
/* Get authorizations and select challenges */
const authorizations = await this.client.getAuthorizations(order);
const promises = authorizations.map(async authz => {
for (const authz of authorizations) {
console.log(authz);
const domainDnsName: string = `_acme-challenge.${authz.identifier.value}`;
const dnsChallenge: string = authz.challenges.find(challengeArg => {
@ -60,6 +61,8 @@ export class SmartAcme {
try {
/* Satisfy challenge */
await this.setChallenge(domainDnsName, keyAuthorization);
await this.smartdns.checkUntilAvailable(domainDnsName, 'TXT', keyAuthorization);
/* Verify that challenge is satisfied */
await this.client.verifyChallenge(authz, dnsChallenge);
@ -77,10 +80,7 @@ export class SmartAcme {
console.log(e);
}
}
});
/* Wait for challenges to complete */
await Promise.all(promises);
}
/* Finalize order */
const [key, csr] = await plugins.acme.forge.createCsr({

View File

@ -1,8 +1,9 @@
// @pushrocks scope
import * as smartpromise from '@pushrocks/smartpromise';
import * as smartdelay from '@pushrocks/smartdelay';
import * as smartdns from '@pushrocks/smartdns';
import * as smartpromise from '@pushrocks/smartpromise';
export { smartpromise, smartdelay };
export { smartdelay, smartdns, smartpromise };
// thirs party scope
import * as acme from 'acme-client';