fix(core): update
This commit is contained in:
parent
ad54bf41ea
commit
1b11b637a5
6
package-lock.json
generated
6
package-lock.json
generated
@ -1614,9 +1614,9 @@
|
|||||||
"integrity": "sha1-k2pOMJ7zMKdkXtQUWYbIWuWyCAU="
|
"integrity": "sha1-k2pOMJ7zMKdkXtQUWYbIWuWyCAU="
|
||||||
},
|
},
|
||||||
"luxon": {
|
"luxon": {
|
||||||
"version": "1.9.0",
|
"version": "1.10.0",
|
||||||
"resolved": "https://verdaccio.lossless.one/luxon/-/luxon-1.9.0.tgz",
|
"resolved": "https://verdaccio.lossless.one/luxon/-/luxon-1.10.0.tgz",
|
||||||
"integrity": "sha512-N1kSwtIEhM/gIRGASXPgi1CwfQZX5VTjndYFjOsZdEEtWij2uSoRrgDGWwViZCUNY9Rwh4UVG/TLcUinHM20cA=="
|
"integrity": "sha512-ry3GKh//v3isD6oJN5pFWmdh+3GiScwv9q8VgG6fZ2j1guGOol2vVVdo4GBAWCrcq5RHOqSeipqHBnOu/u024Q=="
|
||||||
},
|
},
|
||||||
"make-error": {
|
"make-error": {
|
||||||
"version": "1.3.5",
|
"version": "1.3.5",
|
||||||
|
@ -5,6 +5,7 @@ import * as interfaces from './interfaces';
|
|||||||
import { CertManager } from './smartacme.classes.certmanager';
|
import { CertManager } from './smartacme.classes.certmanager';
|
||||||
|
|
||||||
import { Collection, svDb, unI } from '@pushrocks/smartdata';
|
import { Collection, svDb, unI } from '@pushrocks/smartdata';
|
||||||
|
import { ICert } from './interfaces';
|
||||||
|
|
||||||
@plugins.smartdata.Collection(() => {
|
@plugins.smartdata.Collection(() => {
|
||||||
return CertManager.activeDB;
|
return CertManager.activeDB;
|
||||||
@ -28,10 +29,12 @@ export class Cert extends plugins.smartdata.SmartDataDbDoc<Cert> implements inte
|
|||||||
@svDb()
|
@svDb()
|
||||||
public csr: string;
|
public csr: string;
|
||||||
|
|
||||||
constructor(privateKeyArg: string, publicKeyArg: string, csrArg: string) {
|
constructor(optionsArg: ICert) {
|
||||||
super();
|
super();
|
||||||
this.privateKey = privateKeyArg;
|
this.created = optionsArg.created;
|
||||||
this.publicKey = publicKeyArg;
|
this.domainName = optionsArg.domainName;
|
||||||
this.csr = csrArg;
|
this.privateKey = optionsArg.privateKey;
|
||||||
|
this.publicKey = optionsArg.publicKey;
|
||||||
|
this.csr = optionsArg.csr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ import { Cert } from './smartacme.classes.cert';
|
|||||||
import { SmartAcme } from './smartacme.classes.smartacme';
|
import { SmartAcme } from './smartacme.classes.smartacme';
|
||||||
|
|
||||||
import * as interfaces from './interfaces';
|
import * as interfaces from './interfaces';
|
||||||
|
import { ICert } from './interfaces';
|
||||||
|
|
||||||
|
|
||||||
export class CertManager {
|
export class CertManager {
|
||||||
@ -61,8 +62,8 @@ export class CertManager {
|
|||||||
* @param privateKeyArg
|
* @param privateKeyArg
|
||||||
* @param csrArg
|
* @param csrArg
|
||||||
*/
|
*/
|
||||||
public async storeCertificate(privateKeyArg: string, publicKeyArg: string, csrArg: string) {
|
public async storeCertificate(optionsArg: ICert) {
|
||||||
const cert = new Cert(privateKeyArg, publicKeyArg, csrArg);
|
const cert = new Cert(optionsArg);
|
||||||
cert.save();
|
cert.save();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -41,6 +41,9 @@ export class SmartAcme {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* inits the instance
|
* inits the instance
|
||||||
|
* ```ts
|
||||||
|
* await myCloudlyInstance.init() // does not support options
|
||||||
|
* ```
|
||||||
*/
|
*/
|
||||||
public async init() {
|
public async init() {
|
||||||
this.privateKey =
|
this.privateKey =
|
||||||
@ -99,6 +102,8 @@ export class SmartAcme {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async stop() {};
|
||||||
|
|
||||||
public async getCertificateForDomain(domainArg: string) {
|
public async getCertificateForDomain(domainArg: string) {
|
||||||
const domain = domainArg;
|
const domain = domainArg;
|
||||||
|
|
||||||
@ -162,6 +167,15 @@ export class SmartAcme {
|
|||||||
console.log(`Private key:\n${key.toString()}`);
|
console.log(`Private key:\n${key.toString()}`);
|
||||||
console.log(`Certificate:\n${cert.toString()}`);
|
console.log(`Certificate:\n${cert.toString()}`);
|
||||||
|
|
||||||
this.certmanager.storeCertificate(key.toString(), cert.toString(), csr.toString());
|
await this.certmanager.storeCertificate({
|
||||||
|
domainName: domainArg,
|
||||||
|
privateKey: key.toString(),
|
||||||
|
publicKey: cert.toString(),
|
||||||
|
csr: csr.toString(),
|
||||||
|
created: Date.now()
|
||||||
|
});
|
||||||
|
|
||||||
|
const newCertificate = await this.certmanager.retrieveCertificate(domainArg);
|
||||||
|
return newCertificate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user