Compare commits

...

8 Commits

Author SHA1 Message Date
7277906851 3.0.6 2020-05-17 16:21:26 +00:00
9da9ebb01e fix(core): update 2020-05-17 16:21:25 +00:00
f70684b773 3.0.5 2020-02-21 10:48:09 +00:00
8b19b206a4 fix(core): update 2020-02-21 10:48:08 +00:00
6be2866ddd 3.0.4 2020-02-19 19:17:59 +00:00
ab55d3c91a fix(core): update 2020-02-19 19:17:58 +00:00
c7ee7eb774 3.0.3 2020-02-19 18:48:50 +00:00
02daa13a2f fix(core): update 2020-02-19 18:48:49 +00:00
11 changed files with 118 additions and 101 deletions

4
.gitignore vendored
View File

@ -15,8 +15,6 @@ node_modules/
# builds
dist/
dist_web/
dist_serve/
dist_ts_web/
dist_*/
# custom

View File

@ -24,13 +24,14 @@ mirror:
- docker
- notpriv
snyk:
image: registry.gitlab.com/hosttoday/ht-docker-node:snyk
audit:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci npm prepare
- npmci command npm install --ignore-scripts
- npmci command snyk test
- npmci command npm config set registry https://registry.npmjs.org
- npmci command npm audit --audit-level=high
tags:
- lossless
- docker

View File

@ -1,36 +0,0 @@
# @pushrocks/smartuniverse
acme with an easy yet powerful interface in TypeScript
## Availabililty and Links
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smartuniverse)
* [gitlab.com (source)](https://gitlab.com/pushrocks/smartuniverse)
* [github.com (source mirror)](https://github.com/pushrocks/smartuniverse)
* [docs (typedoc)](https://pushrocks.gitlab.io/smartuniverse/)
## Status for master
[![build status](https://gitlab.com/pushrocks/smartuniverse/badges/master/build.svg)](https://gitlab.com/pushrocks/smartuniverse/commits/master)
[![coverage report](https://gitlab.com/pushrocks/smartuniverse/badges/master/coverage.svg)](https://gitlab.com/pushrocks/smartuniverse/commits/master)
[![npm downloads per month](https://img.shields.io/npm/dm/@pushrocks/smartuniverse.svg)](https://www.npmjs.com/package/@pushrocks/smartuniverse)
[![Known Vulnerabilities](https://snyk.io/test/npm/@pushrocks/smartuniverse/badge.svg)](https://snyk.io/test/npm/@pushrocks/smartuniverse)
[![TypeScript](https://img.shields.io/badge/TypeScript->=%203.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
[![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
## Usage
Use TypeScript for best in class instellisense.
```javascript
import { SmartAcme } from 'smartacme';
let smac = new SmartAcme()
// TODO
```
For further information read the linked docs at the top of this readme.
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
[![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://maintainedby.lossless.com)

63
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "@pushrocks/smartacme",
"version": "3.0.2",
"version": "3.0.6",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -109,9 +109,9 @@
}
},
"@pushrocks/lik": {
"version": "3.0.17",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2flik/-/lik-3.0.17.tgz",
"integrity": "sha512-Ip56GDuW/ReBPhRVIhaqosqXu12SBW1DT3GkY8hOTiF1YNdKxiaw13QOPva6KPeTffb9DTThOu352KvjMrfxRw==",
"version": "3.0.19",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2flik/-/lik-3.0.19.tgz",
"integrity": "sha512-N9uTtQmTJ/iZ/V7LMCKbVx/ZAmP+b8uId0pxV9Au9T0Ulu9wcg3vNpyTQARgdWfG+tI9Qc0NHgOEa9H5mbDcDA==",
"requires": {
"@pushrocks/smartdelay": "^2.0.6",
"@pushrocks/smartpromise": "^3.0.6",
@ -157,19 +157,19 @@
}
},
"@pushrocks/smartdata": {
"version": "3.1.25",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartdata/-/smartdata-3.1.25.tgz",
"integrity": "sha512-omgb42HnDaaZKkhbVRx9Zfxumkg7lVyp526eA93eQaoNHZGPkIPo7H9f4+rWHbN3VZehB/PTmPGcY5IUd5rWUA==",
"version": "3.1.26",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartdata/-/smartdata-3.1.26.tgz",
"integrity": "sha512-nfHBjkjdZU6R5MlkzilR3pdY52kRiNoqp96JPV53xFfVUptP5F6JppPw9Zmnbu2EM5vYfCimSGawms1Xeb9jRQ==",
"requires": {
"@pushrocks/lik": "^3.0.17",
"@pushrocks/lik": "^3.0.19",
"@pushrocks/smartlog": "^2.0.21",
"@pushrocks/smartpromise": "^3.0.6",
"@pushrocks/smartstring": "^3.0.18",
"@pushrocks/smartunique": "^3.0.1",
"@types/lodash": "^4.14.149",
"@types/mongodb": "^3.3.15",
"@types/mongodb": "^3.3.16",
"lodash": "^4.17.15",
"mongodb": "^3.5.2",
"mongodb": "^3.5.3",
"runtime-type-checks": "0.0.4"
}
},
@ -182,19 +182,14 @@
}
},
"@pushrocks/smartdns": {
"version": "3.0.8",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartdns/-/smartdns-3.0.8.tgz",
"integrity": "sha512-f6cyO3FOnUJQTjHUjcePP6xMDytjk4DrmRDpqooQtMipTf8t0R25Yvg7GooSdWiBJDrIXHrXVu+oq82L5mFuUQ==",
"version": "4.0.2",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartdns/-/smartdns-4.0.2.tgz",
"integrity": "sha512-4PZUsv8VpEGuUkfnXolzZH9KrRlvBYXNnmK3bvoyP3cgC4Ocad/Pk9eE5JxVIB0t8ehljmYyOrP1McHmXOma4A==",
"requires": {
"@pushrocks/smartdelay": "^2.0.2",
"@pushrocks/smartpromise": "^2.0.5"
},
"dependencies": {
"@pushrocks/smartpromise": {
"version": "2.0.5",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartpromise/-/smartpromise-2.0.5.tgz",
"integrity": "sha512-9j/chLtIiNkR0MDw7Mpxg9slxAVvAQwUZuiaPYX5KpHdKxQaHLI1VZ8IN0vPhwlfgNO4i4vGXV0wB8BvSDj03g=="
}
"@pushrocks/smartdelay": "^2.0.6",
"@pushrocks/smartpromise": "^3.0.6",
"@pushrocks/smartrequest": "^1.1.47",
"@tsclass/tsclass": "^3.0.6"
}
},
"@pushrocks/smartevent": {
@ -536,9 +531,9 @@
}
},
"@tsclass/tsclass": {
"version": "3.0.4",
"resolved": "https://verdaccio.lossless.one/@tsclass%2ftsclass/-/tsclass-3.0.4.tgz",
"integrity": "sha512-q9PnwBFDTTlwKp6jYn/tL6zhqWvwaKyGsf81xI8xcV6IhjmFo3hk0iM4L3ydw7iTwqR+WmhYaWO5WdMy3/KA+w==",
"version": "3.0.7",
"resolved": "https://verdaccio.lossless.one/@tsclass%2ftsclass/-/tsclass-3.0.7.tgz",
"integrity": "sha512-3s3pU0xrQsMpsvxby0eUgz6z3DpJTaRghLpoFSJ+uJMzi7n0QhwuEiydLbp1CgVvDnIByvQcN8LvU9q3tOswSA==",
"requires": {
"@pushrocks/tapbundle": "^3.0.13"
}
@ -684,18 +679,18 @@
"integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA=="
},
"@types/mongodb": {
"version": "3.3.15",
"resolved": "https://verdaccio.lossless.one/@types%2fmongodb/-/mongodb-3.3.15.tgz",
"integrity": "sha512-q2dL0VEdFdE9iS0xrTP0NSgJJBFH4hBvt3beglCwU3qMWrz7dCuu/CrRjPB4+R8jLjCi/Gik2Mkd+lU0sYsZgQ==",
"version": "3.3.16",
"resolved": "https://verdaccio.lossless.one/@types%2fmongodb/-/mongodb-3.3.16.tgz",
"integrity": "sha512-i1Ov36BXdp+urtPsaSvrNfCdsaVn4Ukq1m1kGyzdWB1+eg3gJ68unXU5LNmnF4EAMRFY6FXZzA7/W3NST40b8g==",
"requires": {
"@types/bson": "*",
"@types/node": "*"
}
},
"@types/node": {
"version": "13.7.0",
"resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-13.7.0.tgz",
"integrity": "sha512-GnZbirvmqZUzMgkFn70c74OQpTTUcCzlhQliTzYjQMqg+hVKcDnxdL19Ne3UdYzdMA/+W3eb646FWn/ZaT1NfQ=="
"version": "13.7.4",
"resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-13.7.4.tgz",
"integrity": "sha512-oVeL12C6gQS/GAExndigSaLxTrKpQPxewx9bOcwfvJiJge4rr7wNaph4J+ns5hrmIV2as5qxqN8YKthn9qh0jw=="
},
"@types/range-parser": {
"version": "1.2.3",
@ -2081,9 +2076,9 @@
}
},
"mongodb": {
"version": "3.5.2",
"resolved": "https://verdaccio.lossless.one/mongodb/-/mongodb-3.5.2.tgz",
"integrity": "sha512-Lxt4th2tK2MxmkDBR5cMik+xEnkvhwg0BC5kGcHm9RBwaNEsrIryvV5istGXOHbnif5KslMpY1FbX6YbGJ/Trg==",
"version": "3.5.3",
"resolved": "https://verdaccio.lossless.one/mongodb/-/mongodb-3.5.3.tgz",
"integrity": "sha512-II7P7A3XUdPiXRgcN96qIoRa1oesM6qLNZkzfPluNZjVkgQk3jnQwOT6/uDk4USRDTTLjNFw2vwfmbRGTA7msg==",
"requires": {
"bl": "^2.2.0",
"bson": "^1.1.1",

View File

@ -1,10 +1,10 @@
{
"name": "@pushrocks/smartacme",
"version": "3.0.2",
"version": "3.0.6",
"private": false,
"description": "acme with an easy yet powerful interface in TypeScript",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",
"scripts": {
"test": "(tstest test/)",
"build": "(tsbuild)"
@ -25,10 +25,10 @@
},
"homepage": "https://gitlab.com/umbrellazone/smartacme#README",
"dependencies": {
"@pushrocks/lik": "^3.0.17",
"@pushrocks/smartdata": "^3.1.25",
"@pushrocks/lik": "^3.0.19",
"@pushrocks/smartdata": "^3.1.26",
"@pushrocks/smartdelay": "^2.0.6",
"@pushrocks/smartdns": "^3.0.8",
"@pushrocks/smartdns": "^4.0.2",
"@pushrocks/smartexpress": "^3.0.57",
"@pushrocks/smartlog": "^2.0.21",
"@pushrocks/smartpromise": "^3.0.6",
@ -36,7 +36,7 @@
"@pushrocks/smartstring": "^3.0.18",
"@pushrocks/smarttime": "^3.0.12",
"@pushrocks/smartunique": "^3.0.1",
"@tsclass/tsclass": "^3.0.4",
"@tsclass/tsclass": "^3.0.7",
"acme-client": "^3.3.1"
},
"devDependencies": {
@ -46,7 +46,7 @@
"@mojoio/cloudflare": "^4.0.3",
"@pushrocks/qenv": "^4.0.6",
"@pushrocks/tapbundle": "^3.2.0",
"@types/node": "^13.7.0",
"@types/node": "^13.7.4",
"tslint": "^6.0.0",
"tslint-config-prettier": "^1.18.0"
},
@ -54,7 +54,8 @@
"ts/**/*",
"ts_web/**/*",
"dist/**/*",
"dist_web/**/*",
"dist_*/**/*",
"dist_ts/**/*",
"dist_ts_web/**/*",
"assets/**/*",
"cli.js",

59
readme.md Normal file
View File

@ -0,0 +1,59 @@
# @pushrocks/smartuniverse
acme with an easy yet powerful interface in TypeScript
## Availabililty and Links
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smartuniverse)
* [gitlab.com (source)](https://gitlab.com/pushrocks/smartuniverse)
* [github.com (source mirror)](https://github.com/pushrocks/smartuniverse)
* [docs (typedoc)](https://pushrocks.gitlab.io/smartuniverse/)
## Status for master
[![pipeline status](https://gitlab.com/pushrocks/smartuniverse/badges/master/pipeline.svg)](https://gitlab.com/pushrocks/smartuniverse/commits/master)
[![coverage report](https://gitlab.com/pushrocks/smartuniverse/badges/master/coverage.svg)](https://gitlab.com/pushrocks/smartuniverse/commits/master)
[![npm downloads per month](https://img.shields.io/npm/dm/@pushrocks/smartuniverse.svg)](https://www.npmjs.com/package/@pushrocks/smartuniverse)
[![Known Vulnerabilities](https://snyk.io/test/npm/@pushrocks/smartuniverse/badge.svg)](https://snyk.io/test/npm/@pushrocks/smartuniverse)
[![TypeScript](https://img.shields.io/badge/TypeScript->=%203.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
[![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-prettier-ff69b4.svg)](https://prettier.io/)
## Usage
Use TypeScript for best in class instellisense.
```javascript
import { SmartAcme } from 'smartacme';
const run = async () => {
smartAcmeInstance = new smartacme.SmartAcme({
accountEmail: 'domains@lossless.org',
accountPrivateKey: null,
mongoDescriptor: {
mongoDbName: testQenv.getEnvVarRequired('MONGODB_DATABASE'),
mongoDbPass: testQenv.getEnvVarRequired('MONGODB_PASSWORD'),
mongoDbUrl: testQenv.getEnvVarRequired('MONGODB_URL')
},
removeChallenge: async dnsChallenge => {
// somehow provide a function that is able to remove the dns challenge
},
setChallenge: async dnsChallenge => {
// somehow provide a function that is able to the dns challenge
},
environment: 'integration'
});
await smartAcmeInstance.init();
// myCert has properties for public/private keys and csr ;)
const myCert = await smartAcmeInstance.getCertificateForDomain('bleu.de');
};
```
## Contribution
We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :)
For further information read the linked docs at the top of this readme.
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
[![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com)

View File

@ -21,10 +21,10 @@ tap.test('should create a valid instance of SmartAcme', async () => {
mongoDbPass: testQenv.getEnvVarRequired('MONGODB_PASSWORD'),
mongoDbUrl: testQenv.getEnvVarRequired('MONGODB_URL')
},
removeChallenge: async (dnsChallenge) => {
removeChallenge: async dnsChallenge => {
testCloudflare.convenience.acmeRemoveDnsChallenge(dnsChallenge);
},
setChallenge: async (dnsChallenge) => {
setChallenge: async dnsChallenge => {
testCloudflare.convenience.acmeSetDnsChallenge(dnsChallenge);
},
environment: 'integration'

View File

@ -9,7 +9,8 @@ import { Collection, svDb, unI } from '@pushrocks/smartdata';
@plugins.smartdata.Collection(() => {
return CertManager.activeDB;
})
export class Cert extends plugins.smartdata.SmartDataDbDoc<Cert> implements plugins.tsclass.network.ICert {
export class Cert extends plugins.smartdata.SmartDataDbDoc<Cert, plugins.tsclass.network.ICert>
implements plugins.tsclass.network.ICert {
@unI()
public id: string;
@ -50,7 +51,6 @@ export class Cert extends plugins.smartdata.SmartDataDbDoc<Cert> implements plug
});
}
constructor(optionsArg: plugins.tsclass.network.ICert) {
super();
if (optionsArg) {

View File

@ -34,7 +34,7 @@ export class CertManager {
CertManager.activeDB = this.smartdataDb;
// Pending Map
this.interestMap = new plugins.lik.InterestMap((certName) => certName);
this.interestMap = new plugins.lik.InterestMap(certName => certName);
}
/**

View File

@ -31,7 +31,7 @@ export class SmartAcme {
// the acme client
private client: any;
private smartdns = new plugins.smartdns.Smartdns();
private smartdns = new plugins.smartdns.Smartdns({});
public logger: plugins.smartlog.Smartlog;
// the account private key
@ -114,22 +114,21 @@ export class SmartAcme {
const certDomainName = this.certmatcher.getCertificateDomainNameByDomainName(domainArg);
const retrievedCertificate = await this.certmanager.retrieveCertificate(certDomainName);
const shouldberenewed = retrievedCertificate.shouldBeRenewed();
const isStillValid = retrievedCertificate.isStillValid();
if (!retrievedCertificate && await this.certmanager.interestMap.checkInterest(certDomainName)) {
if (
!retrievedCertificate &&
(await this.certmanager.interestMap.checkInterest(certDomainName))
) {
const existingCertificateInterest = this.certmanager.interestMap.findInterest(certDomainName);
const certificate = existingCertificateInterest.interestFullfilled;
return certificate;
} else if (retrievedCertificate && !retrievedCertificate.shouldBeRenewed()) {
return retrievedCertificate;
} else if (retrievedCertificate && retrievedCertificate.shouldBeRenewed()) {
// await retrievedCertificate.delete();
await retrievedCertificate.delete();
}
// lets make sure others get the same interest
await this.certmanager.interestMap.addInterest(certDomainName);
const currentDomainInterst = await this.certmanager.interestMap.addInterest(certDomainName);
/* Place new order */
const order = await this.client.createOrder({
@ -208,6 +207,8 @@ export class SmartAcme {
});
const newCertificate = await this.certmanager.retrieveCertificate(certDomainName);
currentDomainInterst.fullfillInterest(newCertificate);
currentDomainInterst.destroy();
return newCertificate;
}
}

View File

@ -28,9 +28,7 @@ export {
// @tsclass scope
import * as tsclass from '@tsclass/tsclass';
export {
tsclass
}
export { tsclass };
// third party scope
import * as acme from 'acme-client';