Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
6cfcf21d95 | |||
a33090bb5e | |||
3151829f85 | |||
eca63e588c | |||
9d23e205d8 | |||
5ecdf7c9fd | |||
2817a65e21 | |||
09a8bc5cb5 | |||
a1134cf227 | |||
4ee1c4b08c |
28
package-lock.json
generated
28
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartacme",
|
"name": "@pushrocks/smartacme",
|
||||||
"version": "2.0.27",
|
"version": "2.0.32",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@ -104,9 +104,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@pushrocks/qenv": {
|
"@pushrocks/qenv": {
|
||||||
"version": "3.0.2",
|
"version": "4.0.0",
|
||||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fqenv/-/qenv-3.0.2.tgz",
|
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fqenv/-/qenv-4.0.0.tgz",
|
||||||
"integrity": "sha512-gXW9Cib6izqY7W1MssryFBrjIoKwadftjv5G3y/BE4LboCkGazqjMJsea6z6G79rwvX1M+yxEEcIdIsDvBBSiA==",
|
"integrity": "sha512-3/odPJaGp3ALtcSG/+N3dGtFX/CVBed9a5XKDa0bv7LoKCgYZeQwpF3jkCnNPjs7GKyzOzALHHID1L+zcb1RXw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@pushrocks/smartfile": "^6.0.6",
|
"@pushrocks/smartfile": "^6.0.6",
|
||||||
@ -170,9 +170,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@pushrocks/smartexpress": {
|
"@pushrocks/smartexpress": {
|
||||||
"version": "3.0.4",
|
"version": "3.0.6",
|
||||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartexpress/-/smartexpress-3.0.4.tgz",
|
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartexpress/-/smartexpress-3.0.6.tgz",
|
||||||
"integrity": "sha512-sn6yQpTGylvT/t4arCN7te8EUzimhv9JB+73XOwv503u6HokE//nT8eCAhkjprH3hgHpIgvR3iPGI8UBSCJFsw==",
|
"integrity": "sha512-Y/Av43ttryHO93BtrKAalPMQxymEn3HTjylnkgXFOTE5Ir4epGX8cG7FDnKUQIuM9Gx8nzFJfW16a90KUpExxQ==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@pushrocks/lik": "^3.0.4",
|
"@pushrocks/lik": "^3.0.4",
|
||||||
"@pushrocks/smartfile": "^6.0.11",
|
"@pushrocks/smartfile": "^6.0.11",
|
||||||
@ -206,11 +206,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@pushrocks/smartlog": {
|
"@pushrocks/smartlog": {
|
||||||
"version": "2.0.9",
|
"version": "2.0.11",
|
||||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartlog/-/smartlog-2.0.9.tgz",
|
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartlog/-/smartlog-2.0.11.tgz",
|
||||||
"integrity": "sha512-F2u3O8OOQ7QXgg9o0lI7HnqEhSQZo2A8u0EuNbQH+Kj2oL62xDwjAg6KkINwH7ObSWpaldZ+I28prG0JxaRzvg==",
|
"integrity": "sha512-V8SMzAAqDpl1+CJ9b3w5e/1ARjk4JOPZ35qZIllVBhHr8meCqnPE2immlfBYWmEp1xy3ntdAA+Lgewtu+iVk6A==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@pushrocks/smartlog-interfaces": "^2.0.2"
|
"@pushrocks/smartlog-interfaces": "^2.0.5"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@pushrocks/smartlog-interfaces": {
|
"@pushrocks/smartlog-interfaces": {
|
||||||
@ -2351,9 +2351,9 @@
|
|||||||
"integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ=="
|
"integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ=="
|
||||||
},
|
},
|
||||||
"tslint": {
|
"tslint": {
|
||||||
"version": "5.12.0",
|
"version": "5.12.1",
|
||||||
"resolved": "https://verdaccio.lossless.one/tslint/-/tslint-5.12.0.tgz",
|
"resolved": "https://verdaccio.lossless.one/tslint/-/tslint-5.12.1.tgz",
|
||||||
"integrity": "sha512-CKEcH1MHUBhoV43SA/Jmy1l24HJJgI0eyLbBNSRyFlsQvb9v6Zdq+Nz2vEOH00nC5SUx4SneJ59PZUS/ARcokQ==",
|
"integrity": "sha512-sfodBHOucFg6egff8d1BvuofoOQ/nOeYNfbp7LDlKBcLNrL3lmS5zoiDGyOMdT7YsEXAwWpTdAHwOGOc8eRZAw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"babel-code-frame": "^6.22.0",
|
"babel-code-frame": "^6.22.0",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartacme",
|
"name": "@pushrocks/smartacme",
|
||||||
"version": "2.0.27",
|
"version": "2.0.32",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "acme implementation in TypeScript",
|
"description": "acme implementation in TypeScript",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
@ -29,7 +29,8 @@
|
|||||||
"@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.4",
|
"@pushrocks/smartexpress": "^3.0.6",
|
||||||
|
"@pushrocks/smartlog": "^2.0.11",
|
||||||
"@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",
|
||||||
@ -42,10 +43,10 @@
|
|||||||
"@gitzone/tsrun": "^1.1.17",
|
"@gitzone/tsrun": "^1.1.17",
|
||||||
"@gitzone/tstest": "^1.0.18",
|
"@gitzone/tstest": "^1.0.18",
|
||||||
"@mojoio/cloudflare": "^2.0.0",
|
"@mojoio/cloudflare": "^2.0.0",
|
||||||
"@pushrocks/qenv": "^3.0.2",
|
"@pushrocks/qenv": "^4.0.0",
|
||||||
"@pushrocks/tapbundle": "^3.0.7",
|
"@pushrocks/tapbundle": "^3.0.7",
|
||||||
"@types/node": "^10.12.18",
|
"@types/node": "^10.12.18",
|
||||||
"tslint": "^5.12.0",
|
"tslint": "^5.12.1",
|
||||||
"tslint-config-prettier": "^1.17.0"
|
"tslint-config-prettier": "^1.17.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
10
test/test.ts
10
test/test.ts
@ -12,9 +12,9 @@ tap.test('should create a valid instance of SmartAcme', async () => {
|
|||||||
accountEmail: 'domains@lossless.org',
|
accountEmail: 'domains@lossless.org',
|
||||||
accountPrivateKey: null,
|
accountPrivateKey: null,
|
||||||
mongoDescriptor: {
|
mongoDescriptor: {
|
||||||
mongoDbName: testQenv.getEnvVarOnDemand('MONGODB_DATABASE'),
|
mongoDbName: testQenv.getEnvVarRequired('MONGODB_DATABASE'),
|
||||||
mongoDbPass: testQenv.getEnvVarOnDemand('MONGODB_PASSWORD'),
|
mongoDbPass: testQenv.getEnvVarRequired('MONGODB_PASSWORD'),
|
||||||
mongoDbUrl: testQenv.getEnvVarOnDemand('MONGODB_URL')
|
mongoDbUrl: testQenv.getEnvVarRequired('MONGODB_URL')
|
||||||
},
|
},
|
||||||
removeChallenge: async (...args) => {
|
removeChallenge: async (...args) => {
|
||||||
console.log(args);
|
console.log(args);
|
||||||
@ -22,9 +22,7 @@ tap.test('should create a valid instance of SmartAcme', async () => {
|
|||||||
setChallenge: async (...args) => {
|
setChallenge: async (...args) => {
|
||||||
console.log(args);
|
console.log(args);
|
||||||
},
|
},
|
||||||
validateRemoteRequest: async () => {
|
environment: "integration"
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
await smartAcmeInstance.init();
|
await smartAcmeInstance.init();
|
||||||
// await smartAcmeInstance.getCertificateForDomain('bleu.de');
|
// await smartAcmeInstance.getCertificateForDomain('bleu.de');
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
export type TCertStatus = 'existing' | 'nonexisting' | 'pending' | 'failed';
|
export type TCertStatus = 'existing' | 'nonexisting' | 'pending' | 'failed';
|
||||||
|
|
||||||
export interface ICert {
|
export interface ICert {
|
||||||
|
id: string;
|
||||||
domainName: string;
|
domainName: string;
|
||||||
created: number;
|
created: number;
|
||||||
privateKey: string;
|
privateKey: string;
|
||||||
|
@ -12,7 +12,7 @@ import { ICert } from './interfaces';
|
|||||||
})
|
})
|
||||||
export class Cert extends plugins.smartdata.SmartDataDbDoc<Cert> implements interfaces.ICert {
|
export class Cert extends plugins.smartdata.SmartDataDbDoc<Cert> implements interfaces.ICert {
|
||||||
@unI()
|
@unI()
|
||||||
public index: string;
|
public id: string;
|
||||||
|
|
||||||
@svDb()
|
@svDb()
|
||||||
public domainName: string;
|
public domainName: string;
|
||||||
|
@ -56,28 +56,38 @@ export class CertManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* stores the certificate with the
|
* stores the certificate
|
||||||
* @param publicKeyArg
|
* @param optionsArg
|
||||||
* @param privateKeyArg
|
|
||||||
* @param csrArg
|
|
||||||
*/
|
*/
|
||||||
public async storeCertificate(optionsArg: interfaces.ICert) {
|
public async storeCertificate(optionsArg: interfaces.ICert) {
|
||||||
const cert = new Cert(optionsArg);
|
const cert = new Cert(optionsArg);
|
||||||
await cert.save();
|
await cert.save();
|
||||||
|
this.pendingMap.removeString(optionsArg.domainName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async deleteCertificate(domainNameArg: string) {
|
public async deleteCertificate(domainNameArg: string) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getCertificateStatus(domainNameArg: string): Promise<interfaces.TCertStatus> {
|
/**
|
||||||
const isPending = this.pendingMap.checkString('domainNameArg');
|
* announce a certificate as being in the process of being retrieved
|
||||||
|
*/
|
||||||
|
public async announceCertificate (domainNameArg: string) {
|
||||||
|
this.pendingMap.addString(domainNameArg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gets the status of a certificate by certDomain name
|
||||||
|
* @param certDomainArg
|
||||||
|
*/
|
||||||
|
public async getCertificateStatus(certDomainArg: string): Promise<interfaces.TCertStatus> {
|
||||||
|
const isPending = this.pendingMap.checkString(certDomainArg);
|
||||||
if (isPending) {
|
if (isPending) {
|
||||||
return 'pending';
|
return 'pending';
|
||||||
}
|
}
|
||||||
|
|
||||||
// otherwise lets continue
|
// otherwise lets continue
|
||||||
const existingCertificate = this.retrieveCertificate(domainNameArg);
|
const existingCertificate = await this.retrieveCertificate(certDomainArg);
|
||||||
if (existingCertificate) {
|
if (existingCertificate) {
|
||||||
return 'existing';
|
return 'existing';
|
||||||
}
|
}
|
||||||
@ -88,5 +98,7 @@ export class CertManager {
|
|||||||
/**
|
/**
|
||||||
* checks all certs for expiration
|
* checks all certs for expiration
|
||||||
*/
|
*/
|
||||||
private async checkCerts() {};
|
private async checkCerts() {
|
||||||
|
// TODO
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,40 +1,49 @@
|
|||||||
import * as plugins from './smartacme.plugins';
|
import * as plugins from './smartacme.plugins';
|
||||||
import * as interfaces from './interfaces';
|
import * as interfaces from './interfaces';
|
||||||
import { ICertRemoteResponse } from './interfaces';
|
|
||||||
|
|
||||||
// tslint:disable-next-line: max-classes-per-file
|
// tslint:disable-next-line: max-classes-per-file
|
||||||
export class CertRemoteClient {
|
export class CertRemoteClient {
|
||||||
private remoteUrl: string;
|
private remoteUrl: string;
|
||||||
private secret: string;
|
private secret: string;
|
||||||
|
private logger: plugins.smartlog.Smartlog;
|
||||||
|
|
||||||
constructor(optionsArg: {
|
constructor(optionsArg: {
|
||||||
remoteUrl: string;
|
remoteUrl: string;
|
||||||
secret: string;
|
secret: string;
|
||||||
|
logger?: plugins.smartlog.Smartlog;
|
||||||
}) {
|
}) {
|
||||||
this.remoteUrl = optionsArg.remoteUrl;
|
this.remoteUrl = optionsArg.remoteUrl;
|
||||||
this.secret = optionsArg.secret;
|
this.secret = optionsArg.secret;
|
||||||
|
optionsArg.logger
|
||||||
|
? (this.logger = optionsArg.logger)
|
||||||
|
: (this.logger = plugins.smartlog.defaultLogger);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param domainNameArg
|
* @param domainNameArg
|
||||||
*/
|
*/
|
||||||
async getCertificateForDomain(domainNameArg: string): Promise<interfaces.ICert> {
|
public async getCertificateForDomain(domainNameArg: string): Promise<interfaces.ICert> {
|
||||||
let certificate: interfaces.ICert;
|
let certificate: interfaces.ICert;
|
||||||
const doRequestCycle = async (): Promise<interfaces.ICert> => {
|
const doRequestCycle = async (): Promise<interfaces.ICert> => {
|
||||||
const response: ICertRemoteResponse = (await plugins.smartrequest.postJson(this.remoteUrl, {
|
const responseBody: interfaces.ICertRemoteResponse = (await plugins.smartrequest.postJson(
|
||||||
requestBody: <interfaces.ICertRemoteRequest>{
|
this.remoteUrl,
|
||||||
domainName: domainNameArg,
|
{
|
||||||
secret: this.secret
|
requestBody: <interfaces.ICertRemoteRequest>{
|
||||||
|
domainName: domainNameArg,
|
||||||
|
secret: this.secret
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})).body;
|
)).body;
|
||||||
switch(response.status) {
|
console.log(responseBody);
|
||||||
|
switch (responseBody.status as interfaces.TCertStatus) {
|
||||||
case 'pending':
|
case 'pending':
|
||||||
await plugins.smartdelay.delayFor(5000);
|
await plugins.smartdelay.delayFor(5000);
|
||||||
const finalResponse = await doRequestCycle();
|
const finalResponse = await doRequestCycle();
|
||||||
return finalResponse;
|
return finalResponse;
|
||||||
case 'existing':
|
case 'existing':
|
||||||
return response.certificate;
|
this.logger.log('ok', `got certificate for ${domainNameArg}`);
|
||||||
|
return responseBody.certificate;
|
||||||
case 'failed':
|
case 'failed':
|
||||||
default:
|
default:
|
||||||
console.log(`could not retrieve certificate for ${domainNameArg}`);
|
console.log(`could not retrieve certificate for ${domainNameArg}`);
|
||||||
|
@ -16,12 +16,13 @@ export interface ISmartAcmeOptions {
|
|||||||
setChallenge: (domainName: string, keyAuthorization: string) => Promise<any>;
|
setChallenge: (domainName: string, keyAuthorization: string) => Promise<any>;
|
||||||
removeChallenge: (domainName: string) => Promise<any>;
|
removeChallenge: (domainName: string) => Promise<any>;
|
||||||
environment: 'production' | 'integration';
|
environment: 'production' | 'integration';
|
||||||
|
logger?: plugins.smartlog.Smartlog;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* class SmartAcme
|
* class SmartAcme
|
||||||
* can be used for setting up communication with an ACME authority
|
* can be used for setting up communication with an ACME authority
|
||||||
*
|
*
|
||||||
* ```ts
|
* ```ts
|
||||||
* const mySmartAcmeInstance = new SmartAcme({
|
* const mySmartAcmeInstance = new SmartAcme({
|
||||||
* // see ISmartAcmeOptions for options
|
* // see ISmartAcmeOptions for options
|
||||||
@ -34,6 +35,7 @@ export class SmartAcme {
|
|||||||
// the acme client
|
// the acme client
|
||||||
private client: any;
|
private client: any;
|
||||||
private smartdns = new plugins.smartdns.Smartdns();
|
private smartdns = new plugins.smartdns.Smartdns();
|
||||||
|
public logger: plugins.smartlog.Smartlog;
|
||||||
|
|
||||||
// the account private key
|
// the account private key
|
||||||
private privateKey: string;
|
private privateKey: string;
|
||||||
@ -49,10 +51,46 @@ export class SmartAcme {
|
|||||||
/**
|
/**
|
||||||
* the remote handler to hand the request and response to.
|
* the remote handler to hand the request and response to.
|
||||||
*/
|
*/
|
||||||
public certremoteHandler: (req: plugins.smartexpress.Request, res: plugins.smartexpress.Response) => Promise<any>;
|
public certremoteHandler = async (
|
||||||
|
req: plugins.smartexpress.Request,
|
||||||
|
res: plugins.smartexpress.Response
|
||||||
|
) => {
|
||||||
|
const requestBody: interfaces.ICertRemoteRequest = req.body;
|
||||||
|
const certDomain = this.certmatcher.getCertificateDomainNameByDomainName(
|
||||||
|
requestBody.domainName
|
||||||
|
);
|
||||||
|
let status: interfaces.TCertStatus = await this.certmanager.getCertificateStatus(certDomain);
|
||||||
|
let response: interfaces.ICertRemoteResponse;
|
||||||
|
switch (status) {
|
||||||
|
case 'existing':
|
||||||
|
this.logger.log('ok', `certificate exists for ${certDomain}. Sending certificate!`);
|
||||||
|
response = {
|
||||||
|
status,
|
||||||
|
certificate: await (await this.certmanager.retrieveCertificate(
|
||||||
|
certDomain
|
||||||
|
)).createSavableObject()
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (status === 'nonexisting') {
|
||||||
|
this.getCertificateForDomain(certDomain);
|
||||||
|
status = 'pending';
|
||||||
|
}
|
||||||
|
response = {
|
||||||
|
status
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
res.status(200);
|
||||||
|
res.send(response);
|
||||||
|
res.end();
|
||||||
|
}
|
||||||
|
|
||||||
constructor(optionsArg: ISmartAcmeOptions) {
|
constructor(optionsArg: ISmartAcmeOptions) {
|
||||||
this.options = optionsArg;
|
this.options = optionsArg;
|
||||||
|
this.options.logger
|
||||||
|
? (this.logger = optionsArg.logger)
|
||||||
|
: (this.logger = plugins.smartlog.defaultLogger);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -76,36 +114,10 @@ export class SmartAcme {
|
|||||||
// CertMatcher
|
// CertMatcher
|
||||||
this.certmatcher = new CertMatcher();
|
this.certmatcher = new CertMatcher();
|
||||||
|
|
||||||
// CertRemoteHandler
|
|
||||||
this.certremoteHandler = async (req, res) => {
|
|
||||||
const requestBody: interfaces.ICertRemoteRequest = req.body;
|
|
||||||
const status: interfaces.TCertStatus = await this.certmanager.getCertificateStatus(requestBody.domainName);
|
|
||||||
const existingCertificate = await this.certmanager.retrieveCertificate(
|
|
||||||
requestBody.domainName
|
|
||||||
);
|
|
||||||
let response: interfaces.ICertRemoteResponse;
|
|
||||||
switch (status) {
|
|
||||||
case 'existing':
|
|
||||||
response = {
|
|
||||||
status,
|
|
||||||
certificate: await existingCertificate.createSavableObject()
|
|
||||||
};
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
response = {
|
|
||||||
status
|
|
||||||
};
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
res.status(200);
|
|
||||||
res.send(response);
|
|
||||||
res.end();
|
|
||||||
};
|
|
||||||
|
|
||||||
// ACME Client
|
// ACME Client
|
||||||
this.client = new plugins.acme.Client({
|
this.client = new plugins.acme.Client({
|
||||||
directoryUrl: (() => {
|
directoryUrl: (() => {
|
||||||
if(this.options.environment === 'production') {
|
if (this.options.environment === 'production') {
|
||||||
return plugins.acme.directory.letsencrypt.production;
|
return plugins.acme.directory.letsencrypt.production;
|
||||||
} else {
|
} else {
|
||||||
return plugins.acme.directory.letsencrypt.staging;
|
return plugins.acme.directory.letsencrypt.staging;
|
||||||
@ -127,7 +139,7 @@ export class SmartAcme {
|
|||||||
|
|
||||||
public async getCertificateForDomain(domainArg: string): Promise<Cert> {
|
public async getCertificateForDomain(domainArg: string): Promise<Cert> {
|
||||||
const certDomain = this.certmatcher.getCertificateDomainNameByDomainName(domainArg);
|
const certDomain = this.certmatcher.getCertificateDomainNameByDomainName(domainArg);
|
||||||
|
await this.certmanager.announceCertificate(certDomain);
|
||||||
const retrievedCertificate = await this.certmanager.retrieveCertificate(certDomain);
|
const retrievedCertificate = await this.certmanager.retrieveCertificate(certDomain);
|
||||||
|
|
||||||
if (retrievedCertificate) {
|
if (retrievedCertificate) {
|
||||||
@ -186,11 +198,9 @@ export class SmartAcme {
|
|||||||
const cert = await this.client.getCertificate(order);
|
const cert = await this.client.getCertificate(order);
|
||||||
|
|
||||||
/* Done */
|
/* Done */
|
||||||
console.log(`CSR:\n${csr.toString()}`);
|
|
||||||
console.log(`Private key:\n${key.toString()}`);
|
|
||||||
console.log(`Certificate:\n${cert.toString()}`);
|
|
||||||
|
|
||||||
await this.certmanager.storeCertificate({
|
await this.certmanager.storeCertificate({
|
||||||
|
id: plugins.smartunique.shortId(),
|
||||||
domainName: certDomain,
|
domainName: certDomain,
|
||||||
privateKey: key.toString(),
|
privateKey: key.toString(),
|
||||||
publicKey: cert.toString(),
|
publicKey: cert.toString(),
|
||||||
|
@ -4,13 +4,14 @@ import * as smartdata from '@pushrocks/smartdata';
|
|||||||
import * as smartdelay from '@pushrocks/smartdelay';
|
import * as smartdelay from '@pushrocks/smartdelay';
|
||||||
import * as smartdns from '@pushrocks/smartdns';
|
import * as smartdns from '@pushrocks/smartdns';
|
||||||
import * as smartexpress from '@pushrocks/smartexpress';
|
import * as smartexpress from '@pushrocks/smartexpress';
|
||||||
|
import * as smartlog from '@pushrocks/smartlog';
|
||||||
import * as smartpromise from '@pushrocks/smartpromise';
|
import * as smartpromise from '@pushrocks/smartpromise';
|
||||||
import * as smartrequest from '@pushrocks/smartrequest';
|
import * as smartrequest from '@pushrocks/smartrequest';
|
||||||
import * as smartunique from '@pushrocks/smartunique';
|
import * as smartunique from '@pushrocks/smartunique';
|
||||||
import * as smartstring from '@pushrocks/smartstring';
|
import * as smartstring from '@pushrocks/smartstring';
|
||||||
import * as smarttime from '@pushrocks/smarttime';
|
import * as smarttime from '@pushrocks/smarttime';
|
||||||
|
|
||||||
export { lik, smartdata, smartdelay, smartdns, smartexpress, smartpromise, smartrequest, smartunique, smartstring, smarttime };
|
export { lik, smartdata, smartdelay, smartdns, smartexpress, smartlog, smartpromise, smartrequest, smartunique, smartstring, smarttime };
|
||||||
|
|
||||||
// thirs party scope
|
// thirs party scope
|
||||||
import * as acme from 'acme-client';
|
import * as acme from 'acme-client';
|
||||||
|
Reference in New Issue
Block a user