update
This commit is contained in:
@ -7,4 +7,4 @@ export interface ICert {
|
||||
privateKey: string;
|
||||
publicKey: string;
|
||||
csr: string;
|
||||
}
|
||||
}
|
||||
|
@ -22,10 +22,10 @@ export class Cert extends plugins.smartdata.SmartDataDbDoc<Cert> implements inte
|
||||
|
||||
@svDb()
|
||||
public privateKey: string;
|
||||
|
||||
|
||||
@svDb()
|
||||
public publicKey: string;
|
||||
|
||||
|
||||
@svDb()
|
||||
public csr: string;
|
||||
|
||||
|
@ -4,14 +4,12 @@ import { SmartAcme } from './smartacme.classes.smartacme';
|
||||
|
||||
import * as interfaces from './interfaces';
|
||||
|
||||
|
||||
export class CertManager {
|
||||
// =========
|
||||
// STATIC
|
||||
// =========
|
||||
public static activeDB: plugins.smartdata.SmartdataDb;
|
||||
|
||||
|
||||
|
||||
// =========
|
||||
// INSTANCE
|
||||
// =========
|
||||
@ -20,13 +18,16 @@ export class CertManager {
|
||||
|
||||
public pendingMap: plugins.lik.Stringmap;
|
||||
|
||||
constructor(smartAcmeArg: SmartAcme,optionsArg: {
|
||||
mongoDescriptor: plugins.smartdata.IMongoDescriptor;
|
||||
}) {
|
||||
constructor(
|
||||
smartAcmeArg: SmartAcme,
|
||||
optionsArg: {
|
||||
mongoDescriptor: plugins.smartdata.IMongoDescriptor;
|
||||
}
|
||||
) {
|
||||
this.mongoDescriptor = optionsArg.mongoDescriptor;
|
||||
}
|
||||
|
||||
public async init () {
|
||||
public async init() {
|
||||
// Smartdata DB
|
||||
this.smartdataDb = new plugins.smartdata.SmartdataDb(this.mongoDescriptor);
|
||||
await this.smartdataDb.init();
|
||||
@ -47,17 +48,16 @@ export class CertManager {
|
||||
domainName
|
||||
});
|
||||
|
||||
if(existingCertificate) {
|
||||
if (existingCertificate) {
|
||||
return existingCertificate;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* stores the certificate
|
||||
* @param optionsArg
|
||||
* @param optionsArg
|
||||
*/
|
||||
public async storeCertificate(optionsArg: interfaces.ICert) {
|
||||
const cert = new Cert(optionsArg);
|
||||
@ -65,14 +65,12 @@ export class CertManager {
|
||||
this.pendingMap.removeString(optionsArg.domainName);
|
||||
}
|
||||
|
||||
public async deleteCertificate(domainNameArg: string) {
|
||||
|
||||
}
|
||||
public async deleteCertificate(domainNameArg: string) {}
|
||||
|
||||
/**
|
||||
* announce a certificate as being in the process of being retrieved
|
||||
*/
|
||||
public async announceCertificate (domainNameArg: string) {
|
||||
public async announceCertificate(domainNameArg: string) {
|
||||
this.pendingMap.addString(domainNameArg);
|
||||
}
|
||||
|
||||
@ -100,5 +98,5 @@ export class CertManager {
|
||||
*/
|
||||
private async checkCerts() {
|
||||
// TODO
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ export class SmartAcme {
|
||||
res.status(200);
|
||||
res.send(response);
|
||||
res.end();
|
||||
}
|
||||
};
|
||||
|
||||
constructor(optionsArg: ISmartAcmeOptions) {
|
||||
this.options = optionsArg;
|
||||
@ -142,7 +142,7 @@ export class SmartAcme {
|
||||
/**
|
||||
* gets a certificate
|
||||
* it runs through the following steps
|
||||
*
|
||||
*
|
||||
* * look in the database
|
||||
* * if in the database return it
|
||||
* * of not in the database announce it
|
||||
@ -150,7 +150,7 @@ export class SmartAcme {
|
||||
* * store it
|
||||
* * remove it from the pending map (which it go onto by announcing it)
|
||||
* * retrieve it from the databse and return it
|
||||
*
|
||||
*
|
||||
* @param domainArg
|
||||
*/
|
||||
public async getCertificateForDomain(domainArg: string): Promise<Cert> {
|
||||
|
@ -11,7 +11,19 @@ import * as smartunique from '@pushrocks/smartunique';
|
||||
import * as smartstring from '@pushrocks/smartstring';
|
||||
import * as smarttime from '@pushrocks/smarttime';
|
||||
|
||||
export { lik, smartdata, smartdelay, smartdns, smartexpress, smartlog, smartpromise, smartrequest, smartunique, smartstring, smarttime };
|
||||
export {
|
||||
lik,
|
||||
smartdata,
|
||||
smartdelay,
|
||||
smartdns,
|
||||
smartexpress,
|
||||
smartlog,
|
||||
smartpromise,
|
||||
smartrequest,
|
||||
smartunique,
|
||||
smartstring,
|
||||
smarttime
|
||||
};
|
||||
|
||||
// thirs party scope
|
||||
import * as acme from 'acme-client';
|
||||
|
Reference in New Issue
Block a user