Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
c3fd8750b2 | |||
2b3c28c7a1 | |||
d6b1f942b3 | |||
7eff6ea36a | |||
1ef3615a49 | |||
3653cdc797 | |||
c0271648fc | |||
5546fa5f49 |
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartacme",
|
"name": "@pushrocks/smartacme",
|
||||||
"version": "2.0.17",
|
"version": "2.0.21",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartacme",
|
"name": "@pushrocks/smartacme",
|
||||||
"version": "2.0.17",
|
"version": "2.0.21",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "acme implementation in TypeScript",
|
"description": "acme implementation in TypeScript",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
|
@ -30,4 +30,8 @@ tap.test('should create a valid instance of SmartAcme', async () => {
|
|||||||
// await smartAcmeInstance.getCertificateForDomain('bleu.de');
|
// await smartAcmeInstance.getCertificateForDomain('bleu.de');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
tap.test('should stop correctly', async () => {
|
||||||
|
await smartAcmeInstance.stop();
|
||||||
|
});
|
||||||
|
|
||||||
tap.start();
|
tap.start();
|
||||||
|
@ -31,10 +31,10 @@ export class Cert extends plugins.smartdata.SmartDataDbDoc<Cert> implements inte
|
|||||||
|
|
||||||
constructor(optionsArg: ICert) {
|
constructor(optionsArg: ICert) {
|
||||||
super();
|
super();
|
||||||
this.created = optionsArg.created;
|
if (optionsArg) {
|
||||||
this.domainName = optionsArg.domainName;
|
Object.keys(optionsArg).forEach(key => {
|
||||||
this.privateKey = optionsArg.privateKey;
|
this[key] = optionsArg[key];
|
||||||
this.publicKey = optionsArg.publicKey;
|
});
|
||||||
this.csr = optionsArg.csr;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ export class CertManager {
|
|||||||
public async retrieveCertificate(domainName: string): Promise<Cert> {
|
public async retrieveCertificate(domainName: string): Promise<Cert> {
|
||||||
await this.checkCerts();
|
await this.checkCerts();
|
||||||
const existingCertificate: Cert = await Cert.getInstance({
|
const existingCertificate: Cert = await Cert.getInstance({
|
||||||
name: domainName
|
domainName
|
||||||
});
|
});
|
||||||
|
|
||||||
if(existingCertificate) {
|
if(existingCertificate) {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import * as plugins from './smartacme.plugins';
|
import * as plugins from './smartacme.plugins';
|
||||||
|
import { Cert } from './smartacme.classes.cert';
|
||||||
import { CertManager } from './smartacme.classes.certmanager';
|
import { CertManager } from './smartacme.classes.certmanager';
|
||||||
|
|
||||||
import * as interfaces from './interfaces';
|
import * as interfaces from './interfaces';
|
||||||
@ -112,9 +113,11 @@ export class SmartAcme {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public async stop() {};
|
public async stop() {
|
||||||
|
await this.certmanager.smartdataDb.close();
|
||||||
|
}
|
||||||
|
|
||||||
public async getCertificateForDomain(domainArg: string) {
|
public async getCertificateForDomain(domainArg: string): Promise<Cert> {
|
||||||
const domain = domainArg;
|
const domain = domainArg;
|
||||||
|
|
||||||
const retrievedCertificate = await this.certmanager.retrieveCertificate(domain);
|
const retrievedCertificate = await this.certmanager.retrieveCertificate(domain);
|
||||||
|
Reference in New Issue
Block a user