fix(core): update
This commit is contained in:
parent
7277906851
commit
a2cf86b62f
@ -19,23 +19,35 @@ mirror:
|
||||
stage: security
|
||||
script:
|
||||
- npmci git mirror
|
||||
only:
|
||||
- tags
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
audit:
|
||||
auditProductionDependencies:
|
||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||
stage: security
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci command npm install --production --ignore-scripts
|
||||
- npmci command npm config set registry https://registry.npmjs.org
|
||||
- npmci command npm audit --audit-level=high --only=prod --production
|
||||
tags:
|
||||
- docker
|
||||
|
||||
auditDevDependencies:
|
||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||
stage: security
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci command npm install --ignore-scripts
|
||||
- npmci command npm config set registry https://registry.npmjs.org
|
||||
- npmci command npm audit --audit-level=high
|
||||
- npmci command npm audit --audit-level=high --only=dev
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
- notpriv
|
||||
allow_failure: true
|
||||
|
||||
# ====================
|
||||
# test stage
|
||||
@ -50,9 +62,7 @@ testStable:
|
||||
- npmci npm test
|
||||
coverage: /\d+.?\d+?\%\s*coverage/
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
- priv
|
||||
|
||||
testBuild:
|
||||
stage: test
|
||||
@ -63,9 +73,7 @@ testBuild:
|
||||
- npmci command npm run build
|
||||
coverage: /\d+.?\d+?\%\s*coverage/
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
release:
|
||||
stage: release
|
||||
@ -85,6 +93,8 @@ release:
|
||||
codequality:
|
||||
stage: metadata
|
||||
allow_failure: true
|
||||
only:
|
||||
- tags
|
||||
script:
|
||||
- npmci command npm install -g tslint typescript
|
||||
- npmci npm prepare
|
||||
|
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
@ -15,7 +15,7 @@
|
||||
"properties": {
|
||||
"projectType": {
|
||||
"type": "string",
|
||||
"enum": ["website", "element", "service", "npm"]
|
||||
"enum": ["website", "element", "service", "npm", "wcc"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
9236
package-lock.json
generated
9236
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
39
package.json
39
package.json
@ -7,7 +7,7 @@
|
||||
"typings": "dist_ts/index.d.ts",
|
||||
"scripts": {
|
||||
"test": "(tstest test/)",
|
||||
"build": "(tsbuild)"
|
||||
"build": "(tsbuild --web)"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@ -25,29 +25,29 @@
|
||||
},
|
||||
"homepage": "https://gitlab.com/umbrellazone/smartacme#README",
|
||||
"dependencies": {
|
||||
"@pushrocks/lik": "^3.0.19",
|
||||
"@pushrocks/smartdata": "^3.1.26",
|
||||
"@pushrocks/smartdelay": "^2.0.6",
|
||||
"@pushrocks/smartdns": "^4.0.2",
|
||||
"@pushrocks/smartexpress": "^3.0.57",
|
||||
"@pushrocks/smartlog": "^2.0.21",
|
||||
"@pushrocks/lik": "^4.0.17",
|
||||
"@pushrocks/smartdata": "^3.1.29",
|
||||
"@pushrocks/smartdelay": "^2.0.10",
|
||||
"@pushrocks/smartdns": "^4.0.4",
|
||||
"@pushrocks/smartexpress": "^3.0.76",
|
||||
"@pushrocks/smartlog": "^2.0.36",
|
||||
"@pushrocks/smartpromise": "^3.0.6",
|
||||
"@pushrocks/smartrequest": "^1.1.47",
|
||||
"@pushrocks/smartstring": "^3.0.18",
|
||||
"@pushrocks/smarttime": "^3.0.12",
|
||||
"@pushrocks/smartunique": "^3.0.1",
|
||||
"@tsclass/tsclass": "^3.0.7",
|
||||
"@pushrocks/smarttime": "^3.0.24",
|
||||
"@pushrocks/smartunique": "^3.0.3",
|
||||
"@tsclass/tsclass": "^3.0.21",
|
||||
"acme-client": "^3.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@gitzone/tsbuild": "^2.1.17",
|
||||
"@gitzone/tsrun": "^1.2.8",
|
||||
"@gitzone/tstest": "^1.0.28",
|
||||
"@mojoio/cloudflare": "^4.0.3",
|
||||
"@pushrocks/qenv": "^4.0.6",
|
||||
"@pushrocks/tapbundle": "^3.2.0",
|
||||
"@types/node": "^13.7.4",
|
||||
"tslint": "^6.0.0",
|
||||
"@gitzone/tsbuild": "^2.1.24",
|
||||
"@gitzone/tsrun": "^1.2.12",
|
||||
"@gitzone/tstest": "^1.0.43",
|
||||
"@mojoio/cloudflare": "^5.0.6",
|
||||
"@pushrocks/qenv": "^4.0.10",
|
||||
"@pushrocks/tapbundle": "^3.2.9",
|
||||
"@types/node": "^14.0.27",
|
||||
"tslint": "^6.1.3",
|
||||
"tslint-config-prettier": "^1.18.0"
|
||||
},
|
||||
"files": [
|
||||
@ -61,5 +61,8 @@
|
||||
"cli.js",
|
||||
"npmextra.json",
|
||||
"readme.md"
|
||||
],
|
||||
"browserslist": [
|
||||
"last 1 chrome versions"
|
||||
]
|
||||
}
|
||||
|
29
readme.md
29
readme.md
@ -8,13 +8,20 @@ acme with an easy yet powerful interface in TypeScript
|
||||
* [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/)
|
||||
|
||||
Status Category | Status Badge
|
||||
-- | --
|
||||
GitLab Pipelines | [![pipeline status](https://gitlab.com/pushrocks/smartuniverse/badges/master/pipeline.svg)](https://lossless.cloud)
|
||||
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/pushrocks/smartuniverse/badges/master/coverage.svg)](https://lossless.cloud)
|
||||
npm | [![npm downloads per month](https://badgen.net/npm/dy/@pushrocks/smartuniverse)](https://lossless.cloud)
|
||||
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/pushrocks/smartuniverse)](https://lossless.cloud)
|
||||
TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud)
|
||||
node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||
Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud)
|
||||
PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@pushrocks/smartuniverse)](https://lossless.cloud)
|
||||
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@pushrocks/smartuniverse)](https://lossless.cloud)
|
||||
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@pushrocks/smartuniverse)](https://lossless.cloud)
|
||||
Platform support | [![Supports Windows 10](https://badgen.net/badge/supports%20Windows%2010/yes/green?icon=windows)](https://lossless.cloud) [![Supports Mac OS X](https://badgen.net/badge/supports%20Mac%20OS%20X/yes/green?icon=apple)](https://lossless.cloud)
|
||||
|
||||
## Usage
|
||||
|
||||
@ -30,15 +37,15 @@ const run = async () => {
|
||||
mongoDescriptor: {
|
||||
mongoDbName: testQenv.getEnvVarRequired('MONGODB_DATABASE'),
|
||||
mongoDbPass: testQenv.getEnvVarRequired('MONGODB_PASSWORD'),
|
||||
mongoDbUrl: testQenv.getEnvVarRequired('MONGODB_URL')
|
||||
mongoDbUrl: testQenv.getEnvVarRequired('MONGODB_URL'),
|
||||
},
|
||||
removeChallenge: async dnsChallenge => {
|
||||
removeChallenge: async (dnsChallenge) => {
|
||||
// somehow provide a function that is able to remove the dns challenge
|
||||
},
|
||||
setChallenge: async dnsChallenge => {
|
||||
setChallenge: async (dnsChallenge) => {
|
||||
// somehow provide a function that is able to the dns challenge
|
||||
},
|
||||
environment: 'integration'
|
||||
environment: 'integration',
|
||||
});
|
||||
await smartAcmeInstance.init();
|
||||
|
||||
|
10
test/test.ts
10
test/test.ts
@ -5,7 +5,7 @@ import * as cloudflare from '@mojoio/cloudflare';
|
||||
const testQenv = new Qenv('./', './.nogit/');
|
||||
const testCloudflare = new cloudflare.CloudflareAccount({
|
||||
email: testQenv.getEnvVarOnDemand('CF_EMAIL'),
|
||||
key: testQenv.getEnvVarOnDemand('CF_KEY')
|
||||
key: testQenv.getEnvVarOnDemand('CF_KEY'),
|
||||
});
|
||||
|
||||
import * as smartacme from '../ts/index';
|
||||
@ -19,15 +19,15 @@ tap.test('should create a valid instance of SmartAcme', async () => {
|
||||
mongoDescriptor: {
|
||||
mongoDbName: testQenv.getEnvVarRequired('MONGODB_DATABASE'),
|
||||
mongoDbPass: testQenv.getEnvVarRequired('MONGODB_PASSWORD'),
|
||||
mongoDbUrl: testQenv.getEnvVarRequired('MONGODB_URL')
|
||||
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'
|
||||
environment: 'integration',
|
||||
});
|
||||
await smartAcmeInstance.init();
|
||||
});
|
||||
|
@ -40,13 +40,13 @@ export class Cert extends plugins.smartdata.SmartDataDbDoc<Cert, plugins.tsclass
|
||||
const shouldBeValidAtLeastUntil =
|
||||
Date.now() +
|
||||
plugins.smarttime.getMilliSecondsFromUnits({
|
||||
days: 10
|
||||
days: 10,
|
||||
});
|
||||
return !(this.validUntil >= shouldBeValidAtLeastUntil);
|
||||
}
|
||||
|
||||
public update(certDataArg: plugins.tsclass.network.ICert) {
|
||||
Object.keys(certDataArg).forEach(key => {
|
||||
Object.keys(certDataArg).forEach((key) => {
|
||||
this[key] = certDataArg[key];
|
||||
});
|
||||
}
|
||||
@ -54,7 +54,7 @@ export class Cert extends plugins.smartdata.SmartDataDbDoc<Cert, plugins.tsclass
|
||||
constructor(optionsArg: plugins.tsclass.network.ICert) {
|
||||
super();
|
||||
if (optionsArg) {
|
||||
Object.keys(optionsArg).forEach(key => {
|
||||
Object.keys(optionsArg).forEach((key) => {
|
||||
this[key] = optionsArg[key];
|
||||
});
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -44,7 +44,7 @@ export class CertManager {
|
||||
*/
|
||||
public async retrieveCertificate(certDomainNameArg: string): Promise<Cert> {
|
||||
const existingCertificate: Cert = await Cert.getInstance({
|
||||
domainName: certDomainNameArg
|
||||
domainName: certDomainNameArg,
|
||||
});
|
||||
|
||||
if (existingCertificate) {
|
||||
@ -70,7 +70,7 @@ export class CertManager {
|
||||
|
||||
public async deleteCertificate(certDomainNameArg: string) {
|
||||
const cert: Cert = await Cert.getInstance({
|
||||
domainName: certDomainNameArg
|
||||
domainName: certDomainNameArg,
|
||||
});
|
||||
await cert.delete();
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ export class SmartAcme {
|
||||
|
||||
// CertMangaer
|
||||
this.certmanager = new CertManager(this, {
|
||||
mongoDescriptor: this.options.mongoDescriptor
|
||||
mongoDescriptor: this.options.mongoDescriptor,
|
||||
});
|
||||
await this.certmanager.init();
|
||||
|
||||
@ -82,13 +82,13 @@ export class SmartAcme {
|
||||
return plugins.acme.directory.letsencrypt.staging;
|
||||
}
|
||||
})(),
|
||||
accountKey: this.privateKey
|
||||
accountKey: this.privateKey,
|
||||
});
|
||||
|
||||
/* Register account */
|
||||
await this.client.createAccount({
|
||||
termsOfServiceAgreed: true,
|
||||
contact: [`mailto:${this.options.accountEmail}`]
|
||||
contact: [`mailto:${this.options.accountEmail}`],
|
||||
});
|
||||
}
|
||||
|
||||
@ -134,8 +134,8 @@ export class SmartAcme {
|
||||
const order = await this.client.createOrder({
|
||||
identifiers: [
|
||||
{ type: 'dns', value: certDomainName },
|
||||
{ type: 'dns', value: `*.${certDomainName}` }
|
||||
]
|
||||
{ type: 'dns', value: `*.${certDomainName}` },
|
||||
],
|
||||
});
|
||||
|
||||
/* Get authorizations and select challenges */
|
||||
@ -144,7 +144,7 @@ export class SmartAcme {
|
||||
for (const authz of authorizations) {
|
||||
console.log(authz);
|
||||
const fullHostName: string = `_acme-challenge.${authz.identifier.value}`;
|
||||
const dnsChallenge: string = authz.challenges.find(challengeArg => {
|
||||
const dnsChallenge: string = authz.challenges.find((challengeArg) => {
|
||||
return challengeArg.type === 'dns-01';
|
||||
});
|
||||
// process.exit(1);
|
||||
@ -154,7 +154,7 @@ export class SmartAcme {
|
||||
/* Satisfy challenge */
|
||||
await this.setChallenge({
|
||||
hostName: fullHostName,
|
||||
challenge: keyAuthorization
|
||||
challenge: keyAuthorization,
|
||||
});
|
||||
await this.smartdns.checkUntilAvailable(fullHostName, 'TXT', keyAuthorization, 100, 5000);
|
||||
console.log('Cool down an extra 60 second for region availability');
|
||||
@ -173,7 +173,7 @@ export class SmartAcme {
|
||||
try {
|
||||
await this.removeChallenge({
|
||||
hostName: fullHostName,
|
||||
challenge: keyAuthorization
|
||||
challenge: keyAuthorization,
|
||||
});
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
@ -184,7 +184,7 @@ export class SmartAcme {
|
||||
/* Finalize order */
|
||||
const [key, csr] = await plugins.acme.forge.createCsr({
|
||||
commonName: `*.${certDomainName}`,
|
||||
altNames: [certDomainName]
|
||||
altNames: [certDomainName],
|
||||
});
|
||||
|
||||
await this.client.finalizeOrder(order, csr);
|
||||
@ -202,8 +202,8 @@ export class SmartAcme {
|
||||
validUntil:
|
||||
Date.now() +
|
||||
plugins.smarttime.getMilliSecondsFromUnits({
|
||||
days: 90
|
||||
})
|
||||
days: 90,
|
||||
}),
|
||||
});
|
||||
|
||||
const newCertificate = await this.certmanager.retrieveCertificate(certDomainName);
|
||||
|
@ -22,7 +22,7 @@ export {
|
||||
smartrequest,
|
||||
smartunique,
|
||||
smartstring,
|
||||
smarttime
|
||||
smarttime,
|
||||
};
|
||||
|
||||
// @tsclass scope
|
||||
|
Loading…
Reference in New Issue
Block a user