Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
1ef3615a49 | |||
3653cdc797 | |||
c0271648fc | |||
5546fa5f49 | |||
54fe89860e | |||
d1edf75f6f | |||
6f9c644221 | |||
0b26054687 | |||
e3323ed4ef | |||
24f692636c |
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pushrocks/smartacme",
|
||||
"version": "2.0.14",
|
||||
"version": "2.0.19",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pushrocks/smartacme",
|
||||
"version": "2.0.14",
|
||||
"version": "2.0.19",
|
||||
"private": false,
|
||||
"description": "acme implementation in TypeScript",
|
||||
"main": "dist/index.js",
|
||||
|
@ -30,4 +30,8 @@ tap.test('should create a valid instance of SmartAcme', async () => {
|
||||
// await smartAcmeInstance.getCertificateForDomain('bleu.de');
|
||||
});
|
||||
|
||||
tap.test('should stop correctly', async () => {
|
||||
await smartAcmeInstance.stop();
|
||||
});
|
||||
|
||||
tap.start();
|
||||
|
@ -45,7 +45,7 @@ export class CertManager {
|
||||
public async retrieveCertificate(domainName: string): Promise<Cert> {
|
||||
await this.checkCerts();
|
||||
const existingCertificate: Cert = await Cert.getInstance({
|
||||
name: domainName
|
||||
domainName
|
||||
});
|
||||
|
||||
if(existingCertificate) {
|
||||
|
@ -1,11 +1,12 @@
|
||||
import * as plugins from './smartacme.plugins';
|
||||
import { Cert } from './smartacme.classes.cert';
|
||||
import { CertManager } from './smartacme.classes.certmanager';
|
||||
|
||||
import * as interfaces from './interfaces';
|
||||
import { request } from 'http';
|
||||
|
||||
/**
|
||||
*
|
||||
* the options for the class @see SmartAcme
|
||||
*/
|
||||
export interface ISmartAcmeOptions {
|
||||
accountPrivateKey?: string;
|
||||
@ -16,6 +17,16 @@ export interface ISmartAcmeOptions {
|
||||
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 {
|
||||
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 retrievedCertificate = await this.certmanager.retrieveCertificate(domain);
|
||||
|
Reference in New Issue
Block a user