Compare commits

...

4 Commits

Author SHA1 Message Date
b26f7ac3e9 2.0.24 2019-01-13 19:15:04 +01:00
5129c5d601 fix(core): update 2019-01-13 19:15:03 +01:00
d09b3fd1bc 2.0.23 2019-01-13 02:11:56 +01:00
14fccd40d8 fix(core): update 2019-01-13 02:11:56 +01:00
3 changed files with 11 additions and 9 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "@pushrocks/smartacme",
"version": "2.0.22",
"version": "2.0.24",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,6 +1,6 @@
{
"name": "@pushrocks/smartacme",
"version": "2.0.22",
"version": "2.0.24",
"private": false,
"description": "acme implementation in TypeScript",
"main": "dist/index.js",

View File

@ -123,9 +123,9 @@ export class SmartAcme {
}
public async getCertificateForDomain(domainArg: string): Promise<Cert> {
const domain = this.certmatcher.getCertificateDomainNameByDomainName(domainArg);
const certDomain = this.certmatcher.getCertificateDomainNameByDomainName(domainArg);
const retrievedCertificate = await this.certmanager.retrieveCertificate(domain);
const retrievedCertificate = await this.certmanager.retrieveCertificate(certDomain);
if (retrievedCertificate) {
return retrievedCertificate;
@ -133,7 +133,7 @@ export class SmartAcme {
/* Place new order */
const order = await this.client.createOrder({
identifiers: [{ type: 'dns', value: domain }, { type: 'dns', value: `*.${domain}` }]
identifiers: [{ type: 'dns', value: certDomain }, { type: 'dns', value: `*.${certDomain}` }]
});
/* Get authorizations and select challenges */
@ -152,6 +152,8 @@ export class SmartAcme {
/* Satisfy challenge */
await this.setChallenge(domainDnsName, keyAuthorization);
await this.smartdns.checkUntilAvailable(domainDnsName, 'TXT', keyAuthorization, 100, 5000);
console.log('Cool down an extra 60 second for region availability');
await plugins.smartdelay.delayFor(60000);
/* Verify that challenge is satisfied */
await this.client.verifyChallenge(authz, dnsChallenge);
@ -173,8 +175,8 @@ export class SmartAcme {
/* Finalize order */
const [key, csr] = await plugins.acme.forge.createCsr({
commonName: `*.${domain}`,
altNames: [domain]
commonName: `*.${certDomain}`,
altNames: [certDomain]
});
await this.client.finalizeOrder(order, csr);
@ -186,14 +188,14 @@ export class SmartAcme {
console.log(`Certificate:\n${cert.toString()}`);
await this.certmanager.storeCertificate({
domainName: domainArg,
domainName: certDomain,
privateKey: key.toString(),
publicKey: cert.toString(),
csr: csr.toString(),
created: Date.now()
});
const newCertificate = await this.certmanager.retrieveCertificate(domainArg);
const newCertificate = await this.certmanager.retrieveCertificate(certDomain);
return newCertificate;
}
}