Compare commits

...

10 Commits

Author SHA1 Message Date
1ef3615a49 2.0.19 2019-01-13 00:06:00 +01:00
3653cdc797 fix(core): update 2019-01-13 00:06:00 +01:00
c0271648fc 2.0.18 2019-01-12 21:06:29 +01:00
5546fa5f49 fix(core): update 2019-01-12 21:06:29 +01:00
54fe89860e 2.0.17 2019-01-12 19:12:53 +01:00
d1edf75f6f fix(core): update 2019-01-12 19:12:52 +01:00
6f9c644221 2.0.16 2019-01-12 19:11:39 +01:00
0b26054687 fix(core): update 2019-01-12 19:11:39 +01:00
e3323ed4ef 2.0.15 2019-01-12 13:52:21 +01:00
24f692636c fix(core): update 2019-01-12 13:52:21 +01:00
5 changed files with 23 additions and 6 deletions

2
package-lock.json generated
View File

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

View File

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

View File

@ -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();

View File

@ -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) {

View File

@ -1,11 +1,12 @@
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';
import { request } from 'http'; import { request } from 'http';
/** /**
* * the options for the class @see SmartAcme
*/ */
export interface ISmartAcmeOptions { export interface ISmartAcmeOptions {
accountPrivateKey?: string; accountPrivateKey?: string;
@ -16,6 +17,16 @@ export interface ISmartAcmeOptions {
validateRemoteRequest: () => Promise<boolean>; validateRemoteRequest: () => Promise<boolean>;
} }
/**
* class SmartAcme
* can be used for setting up communication with an ACME authority
*
* ```ts
* const mySmartAcmeInstance = new SmartAcme({
* // see ISmartAcmeOptions for options
* })
* ```
*/
export class SmartAcme { export class SmartAcme {
private options: ISmartAcmeOptions; private options: ISmartAcmeOptions;
@ -102,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);