fix(core): update

This commit is contained in:
Philipp Kunz 2019-01-14 02:46:36 +01:00
parent f16dbeea32
commit 2717f08476
4 changed files with 14 additions and 18 deletions

7
package-lock.json generated
View File

@ -170,13 +170,14 @@
} }
}, },
"@pushrocks/smartexpress": { "@pushrocks/smartexpress": {
"version": "3.0.0", "version": "3.0.4",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartexpress/-/smartexpress-3.0.0.tgz", "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartexpress/-/smartexpress-3.0.4.tgz",
"integrity": "sha512-F3x+AFUxkKxb5WgQuIZsfkrNzMz0PaYYIw4gdQbAPn5N/UCEP4eE2OQWXnAcCSYwsXI8hgjEuUOC9gTbCSPDRg==", "integrity": "sha512-sn6yQpTGylvT/t4arCN7te8EUzimhv9JB+73XOwv503u6HokE//nT8eCAhkjprH3hgHpIgvR3iPGI8UBSCJFsw==",
"requires": { "requires": {
"@pushrocks/lik": "^3.0.4", "@pushrocks/lik": "^3.0.4",
"@pushrocks/smartfile": "^6.0.11", "@pushrocks/smartfile": "^6.0.11",
"@pushrocks/smartpromise": "^2.0.5", "@pushrocks/smartpromise": "^2.0.5",
"@pushrocks/smartrequest": "^1.1.14",
"@types/express": "^4.16.0", "@types/express": "^4.16.0",
"@types/finalhandler": "0.0.33", "@types/finalhandler": "0.0.33",
"@types/helmet": "0.0.42", "@types/helmet": "0.0.42",

View File

@ -29,7 +29,7 @@
"@pushrocks/smartdata": "^3.1.13", "@pushrocks/smartdata": "^3.1.13",
"@pushrocks/smartdelay": "^2.0.2", "@pushrocks/smartdelay": "^2.0.2",
"@pushrocks/smartdns": "^3.0.8", "@pushrocks/smartdns": "^3.0.8",
"@pushrocks/smartexpress": "^3.0.0", "@pushrocks/smartexpress": "^3.0.4",
"@pushrocks/smartpromise": "^2.0.5", "@pushrocks/smartpromise": "^2.0.5",
"@pushrocks/smartrequest": "^1.1.14", "@pushrocks/smartrequest": "^1.1.14",
"@pushrocks/smartstring": "^3.0.8", "@pushrocks/smartstring": "^3.0.8",

View File

@ -3,7 +3,6 @@ import { Cert } from './smartacme.classes.cert';
import { SmartAcme } from './smartacme.classes.smartacme'; import { SmartAcme } from './smartacme.classes.smartacme';
import * as interfaces from './interfaces'; import * as interfaces from './interfaces';
import { ICert } from './interfaces';
export class CertManager { export class CertManager {
@ -62,7 +61,7 @@ export class CertManager {
* @param privateKeyArg * @param privateKeyArg
* @param csrArg * @param csrArg
*/ */
public async storeCertificate(optionsArg: ICert) { public async storeCertificate(optionsArg: interfaces.ICert) {
const cert = new Cert(optionsArg); const cert = new Cert(optionsArg);
await cert.save(); await cert.save();
} }

View File

@ -15,7 +15,6 @@ export interface ISmartAcmeOptions {
mongoDescriptor: plugins.smartdata.IMongoDescriptor; mongoDescriptor: plugins.smartdata.IMongoDescriptor;
setChallenge: (domainName: string, keyAuthorization: string) => Promise<any>; setChallenge: (domainName: string, keyAuthorization: string) => Promise<any>;
removeChallenge: (domainName: string) => Promise<any>; removeChallenge: (domainName: string) => Promise<any>;
validateRemoteRequest: () => Promise<boolean>;
environment: 'production' | 'integration'; environment: 'production' | 'integration';
} }
@ -42,12 +41,15 @@ export class SmartAcme {
// challenge fullfillment // challenge fullfillment
private setChallenge: (domainName: string, keyAuthorization: string) => Promise<any>; private setChallenge: (domainName: string, keyAuthorization: string) => Promise<any>;
private removeChallenge: (domainName: string) => Promise<any>; private removeChallenge: (domainName: string) => Promise<any>;
private validateRemoteRequest: () => Promise<boolean>;
// certmanager // certmanager
private certmanager: CertManager; private certmanager: CertManager;
private certmatcher: CertMatcher; private certmatcher: CertMatcher;
private certremoteHandler: plugins.smartexpress.Handler;
/**
* the remote handler to hand the request and response to.
*/
public certremoteHandler: (req: plugins.smartexpress.Request, res: plugins.smartexpress.Response) => Promise<any>;
constructor(optionsArg: ISmartAcmeOptions) { constructor(optionsArg: ISmartAcmeOptions) {
this.options = optionsArg; this.options = optionsArg;
@ -75,7 +77,7 @@ export class SmartAcme {
this.certmatcher = new CertMatcher(); this.certmatcher = new CertMatcher();
// CertRemoteHandler // CertRemoteHandler
this.certremoteHandler = new plugins.smartexpress.Handler('POST', async (req, res) => { this.certremoteHandler = async (req, res) => {
const requestBody: interfaces.ICertRemoteRequest = req.body; const requestBody: interfaces.ICertRemoteRequest = req.body;
const status: interfaces.TCertStatus = await this.certmanager.getCertificateStatus(requestBody.domainName); const status: interfaces.TCertStatus = await this.certmanager.getCertificateStatus(requestBody.domainName);
const existingCertificate = await this.certmanager.retrieveCertificate( const existingCertificate = await this.certmanager.retrieveCertificate(
@ -86,13 +88,7 @@ export class SmartAcme {
case 'existing': case 'existing':
response = { response = {
status, status,
certificate: { certificate: await existingCertificate.createSavableObject()
created: existingCertificate.created,
csr: existingCertificate.csr,
domainName: existingCertificate.domainName,
privateKey: existingCertificate.privateKey,
publicKey: existingCertificate.publicKey
}
}; };
break; break;
default: default:
@ -104,7 +100,7 @@ export class SmartAcme {
res.status(200); res.status(200);
res.send(response); res.send(response);
res.end(); res.end();
}); };
// ACME Client // ACME Client
this.client = new plugins.acme.Client({ this.client = new plugins.acme.Client({