Compare commits
52 Commits
Author | SHA1 | Date | |
---|---|---|---|
d09b3fd1bc | |||
14fccd40d8 | |||
c0f45a10e0 | |||
f9db3d28fe | |||
c3fd8750b2 | |||
2b3c28c7a1 | |||
d6b1f942b3 | |||
7eff6ea36a | |||
1ef3615a49 | |||
3653cdc797 | |||
c0271648fc | |||
5546fa5f49 | |||
54fe89860e | |||
d1edf75f6f | |||
6f9c644221 | |||
0b26054687 | |||
e3323ed4ef | |||
24f692636c | |||
a9f709ee7b | |||
1b11b637a5 | |||
ad54bf41ea | |||
060ebf1b29 | |||
a87c6acb8a | |||
62d27619f4 | |||
0faebf2a79 | |||
29ea50796c | |||
26d1b7cbf0 | |||
c0c97835ea | |||
d4d50b7dcf | |||
2492fd4de2 | |||
bef54799b6 | |||
dbe09f320a | |||
18045dadaf | |||
ee300c3e12 | |||
ed4ba0cb61 | |||
a8ab27045d | |||
975c3ed190 | |||
a99dea549b | |||
f8b78c433a | |||
6c33111074 | |||
280335f6f6 | |||
b90092c043 | |||
9e1c73febf | |||
dcf1915816 | |||
748c911168 | |||
3a48cb4ea8 | |||
a035c5c0b0 | |||
f9c521b7b3 | |||
19cfe8bdc5 | |||
601d6b30d3 | |||
57ffc82c43 | |||
312d3c01cd |
123
.gitlab-ci.yml
123
.gitlab-ci.yml
@ -3,69 +3,148 @@ image: hosttoday/ht-docker-node:npmci
|
|||||||
|
|
||||||
cache:
|
cache:
|
||||||
paths:
|
paths:
|
||||||
- .yarn/
|
- .npmci_cache/
|
||||||
key: "$CI_BUILD_STAGE"
|
key: "$CI_BUILD_STAGE"
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
|
- security
|
||||||
- test
|
- test
|
||||||
- release
|
- release
|
||||||
- trigger
|
- metadata
|
||||||
- pages
|
|
||||||
|
|
||||||
testLEGACY:
|
# ====================
|
||||||
stage: test
|
# security stage
|
||||||
|
# ====================
|
||||||
|
mirror:
|
||||||
|
stage: security
|
||||||
script:
|
script:
|
||||||
- npmci test legacy
|
- npmci git mirror
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
|
- notpriv
|
||||||
|
|
||||||
|
snyk:
|
||||||
|
stage: security
|
||||||
|
script:
|
||||||
|
- npmci npm prepare
|
||||||
|
- npmci command npm install -g snyk
|
||||||
|
- npmci command npm install --ignore-scripts
|
||||||
|
- npmci command snyk test
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
- notpriv
|
||||||
|
|
||||||
|
sast:
|
||||||
|
stage: security
|
||||||
|
image: registry.gitlab.com/hosttoday/ht-docker-dbase:npmci
|
||||||
|
variables:
|
||||||
|
DOCKER_DRIVER: overlay2
|
||||||
allow_failure: true
|
allow_failure: true
|
||||||
|
services:
|
||||||
|
- docker:stable-dind
|
||||||
|
script:
|
||||||
|
- npmci npm prepare
|
||||||
|
- npmci npm install
|
||||||
|
- npmci command npm run build
|
||||||
|
- export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
|
||||||
|
- docker run
|
||||||
|
--env SAST_CONFIDENCE_LEVEL="${SAST_CONFIDENCE_LEVEL:-3}"
|
||||||
|
--volume "$PWD:/code"
|
||||||
|
--volume /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
"registry.gitlab.com/gitlab-org/security-products/sast:$SP_VERSION" /app/bin/run /code
|
||||||
|
artifacts:
|
||||||
|
reports:
|
||||||
|
sast: gl-sast-report.json
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
- priv
|
||||||
|
|
||||||
|
# ====================
|
||||||
|
# test stage
|
||||||
|
# ====================
|
||||||
|
|
||||||
testLTS:
|
testLTS:
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- npmci test lts
|
- npmci npm prepare
|
||||||
|
- npmci node install lts
|
||||||
|
- npmci npm install
|
||||||
|
- npmci npm test
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
coverage: /\d+.?\d+?\%\s*coverage/
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
|
- notpriv
|
||||||
|
|
||||||
testSTABLE:
|
testSTABLE:
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- npmci test stable
|
- npmci npm prepare
|
||||||
|
- npmci node install stable
|
||||||
|
- npmci npm install
|
||||||
|
- npmci npm test
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
coverage: /\d+.?\d+?\%\s*coverage/
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
|
- notpriv
|
||||||
|
|
||||||
release:
|
release:
|
||||||
stage: release
|
stage: release
|
||||||
script:
|
script:
|
||||||
- npmci publish
|
- npmci node install stable
|
||||||
|
- npmci npm publish
|
||||||
only:
|
only:
|
||||||
- tags
|
- tags
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
|
- notpriv
|
||||||
|
|
||||||
|
# ====================
|
||||||
|
# metadata stage
|
||||||
|
# ====================
|
||||||
|
codequality:
|
||||||
|
stage: metadata
|
||||||
|
image: docker:stable
|
||||||
|
allow_failure: true
|
||||||
|
services:
|
||||||
|
- docker:stable-dind
|
||||||
|
script:
|
||||||
|
- export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
|
||||||
|
- docker run
|
||||||
|
--env SOURCE_CODE="$PWD"
|
||||||
|
--volume "$PWD":/code
|
||||||
|
--volume /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
"registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code
|
||||||
|
artifacts:
|
||||||
|
paths: [codeclimate.json]
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
- priv
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
stage: trigger
|
stage: metadata
|
||||||
script:
|
script:
|
||||||
- npmci trigger
|
- npmci trigger
|
||||||
only:
|
only:
|
||||||
- tags
|
- tags
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
|
- notpriv
|
||||||
|
|
||||||
pages:
|
pages:
|
||||||
image: hosttoday/ht-docker-node:npmci
|
image: hosttoday/ht-docker-node:npmci
|
||||||
stage: pages
|
stage: metadata
|
||||||
script:
|
script:
|
||||||
- npmci command yarn global add npmpage
|
- npmci command npm install -g typedoc typescript
|
||||||
- npmci command npmpage
|
- npmci npm prepare
|
||||||
|
- npmci npm install
|
||||||
|
- npmci command typedoc --module "commonjs" --target "ES2016" --out public/ ts/
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
|
- notpriv
|
||||||
only:
|
only:
|
||||||
- tags
|
- tags
|
||||||
artifacts:
|
artifacts:
|
||||||
expire_in: 1 week
|
expire_in: 1 week
|
||||||
paths:
|
paths:
|
||||||
- public
|
- public
|
||||||
|
allow_failure: true
|
||||||
|
12
.snyk
Normal file
12
.snyk
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.
|
||||||
|
version: v1.12.0
|
||||||
|
# ignores vulnerabilities until expiry date; change duration by modifying expiry date
|
||||||
|
ignore:
|
||||||
|
'npm:node-forge:20180226':
|
||||||
|
- rsa-compat > node-forge:
|
||||||
|
reason: None given
|
||||||
|
expires: '2018-09-11T19:17:24.148Z'
|
||||||
|
- acme-v2 > rsa-compat > node-forge:
|
||||||
|
reason: None given
|
||||||
|
expires: '2018-09-11T19:17:24.148Z'
|
||||||
|
patch: {}
|
40
README.md
40
README.md
@ -1,13 +1,16 @@
|
|||||||
# smartacme
|
# smartacme
|
||||||
|
|
||||||
acme implementation in TypeScript
|
acme implementation in TypeScript
|
||||||
|
|
||||||
## Availabililty
|
## Availabililty
|
||||||
|
|
||||||
[](https://www.npmjs.com/package/smartacme)
|
[](https://www.npmjs.com/package/smartacme)
|
||||||
[](https://GitLab.com/umbrellazone/smartacme)
|
[](https://GitLab.com/umbrellazone/smartacme)
|
||||||
[](https://github.com/umbrellazone/smartacme)
|
[](https://github.com/umbrellazone/smartacme)
|
||||||
[](https://umbrellazone.gitlab.io/smartacme/)
|
[](https://umbrellazone.gitlab.io/smartacme/)
|
||||||
|
|
||||||
## Status for master
|
## Status for master
|
||||||
|
|
||||||
[](https://GitLab.com/umbrellazone/smartacme/commits/master)
|
[](https://GitLab.com/umbrellazone/smartacme/commits/master)
|
||||||
[](https://GitLab.com/umbrellazone/smartacme/commits/master)
|
[](https://GitLab.com/umbrellazone/smartacme/commits/master)
|
||||||
[](https://www.npmjs.com/package/smartacme)
|
[](https://www.npmjs.com/package/smartacme)
|
||||||
@ -19,11 +22,42 @@ acme implementation in TypeScript
|
|||||||
[](http://standardjs.com/)
|
[](http://standardjs.com/)
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
Use TypeScript for best in class instellisense.
|
Use TypeScript for best in class instellisense.
|
||||||
|
|
||||||
For further information read the linked docs at the top of this README.
|
```javascript
|
||||||
|
import { SmartAcme } from 'smartacme';
|
||||||
|
|
||||||
|
let smac = new SmartAcme()(async () => {
|
||||||
|
// learn async/await, it'll make your life easier
|
||||||
|
|
||||||
|
// optionally accepts a filePath Arg with a stored acmeaccount.json
|
||||||
|
// will create an account and
|
||||||
|
let myAccount = await smac.createAcmeAccount();
|
||||||
|
|
||||||
|
// will return a dnsHash to set in your DNS record
|
||||||
|
let myCert = await myAccount.createAcmeCert('example.com');
|
||||||
|
|
||||||
|
// gets and accepts the specified challenge
|
||||||
|
// first argument optional, defaults to dns-01 (which is the cleanest method for production use)
|
||||||
|
let myChallenge = await myCert.getChallenge('dns-01');
|
||||||
|
|
||||||
|
/* ----------
|
||||||
|
Now you need to set the challenge in your DNS
|
||||||
|
myChallenge.domainNamePrefixed is the address for the record
|
||||||
|
myChallenge.dnsKeyHash is the ready to use txt record value expected by letsencrypt
|
||||||
|
-------------*/
|
||||||
|
})();
|
||||||
|
```
|
||||||
|
|
||||||
|
## Other relevant npm modules
|
||||||
|
|
||||||
|
| module name | description |
|
||||||
|
| ----------- | ------------------------------------------------------------------- |
|
||||||
|
| cert | a higlevel production module that uses smartacme to manage certs |
|
||||||
|
| smartnginx | a highlevel production tool for docker environments to manage nginx |
|
||||||
|
|
||||||
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
||||||
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
|
> | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
|
||||||
|
|
||||||
[](https://umbrella.zone)
|
[](https://umbrella.zone
|
||||||
|
@ -1,59 +0,0 @@
|
|||||||
# smartacme
|
|
||||||
acme implementation in TypeScript
|
|
||||||
|
|
||||||
## Availabililty
|
|
||||||
[](https://www.npmjs.com/package/smartacme)
|
|
||||||
[](https://GitLab.com/umbrellazone/smartacme)
|
|
||||||
[](https://github.com/umbrellazone/smartacme)
|
|
||||||
[](https://umbrellazone.gitlab.io/smartacme/)
|
|
||||||
|
|
||||||
## Status for master
|
|
||||||
[](https://GitLab.com/umbrellazone/smartacme/commits/master)
|
|
||||||
[](https://GitLab.com/umbrellazone/smartacme/commits/master)
|
|
||||||
[](https://www.npmjs.com/package/smartacme)
|
|
||||||
[](https://david-dm.org/umbrellazone/smartacme)
|
|
||||||
[](https://www.bithound.io/github/umbrellazone/smartacme/master/dependencies/npm)
|
|
||||||
[](https://www.bithound.io/github/umbrellazone/smartacme)
|
|
||||||
[](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
|
||||||
[](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
|
||||||
[](http://standardjs.com/)
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
Use TypeScript for best in class instellisense.
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
import { SmartAcme } from 'smartacme'
|
|
||||||
|
|
||||||
let smac = new SmartAcme()
|
|
||||||
|
|
||||||
(async () => { // learn async/await, it'll make your life easier
|
|
||||||
|
|
||||||
// optionally accepts a filePath Arg with a stored acmeaccount.json
|
|
||||||
// will create an account and
|
|
||||||
let myAccount = await smac.createAcmeAccount()
|
|
||||||
|
|
||||||
// will return a dnsHash to set in your DNS record
|
|
||||||
let myCert = await myAccount.createAcmeCert('example.com')
|
|
||||||
|
|
||||||
// gets and accepts the specified challenge
|
|
||||||
// first argument optional, defaults to dns-01 (which is the cleanest method for production use)
|
|
||||||
let myChallenge = await myCert.getChallenge('dns-01')
|
|
||||||
|
|
||||||
/* ----------
|
|
||||||
Now you need to set the challenge in your DNS
|
|
||||||
myChallenge.domainNamePrefixed is the address for the record
|
|
||||||
myChallenge.dnsKeyHash is the ready to use txt record value expected by letsencrypt
|
|
||||||
-------------*/
|
|
||||||
})()
|
|
||||||
```
|
|
||||||
|
|
||||||
## Other relevant npm modules
|
|
||||||
module name | description
|
|
||||||
--- | ---
|
|
||||||
cert | a higlevel production module that uses smartacme to manage certs
|
|
||||||
smartnginx | a highlevel production tool for docker environments to manage nginx
|
|
||||||
|
|
||||||
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
|
||||||
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
|
|
||||||
|
|
||||||
[](https://umbrella.zone
|
|
@ -1,7 +1,6 @@
|
|||||||
{
|
{
|
||||||
"npmci": {
|
"npmci": {
|
||||||
"globalNpmTools": [
|
"npmGlobalTools": [],
|
||||||
"npmts"
|
"npmAccessLevel": "public"
|
||||||
]
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
2434
package-lock.json
generated
2434
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
35
package.json
35
package.json
@ -1,11 +1,13 @@
|
|||||||
{
|
{
|
||||||
"name": "smartacme",
|
"name": "@pushrocks/smartacme",
|
||||||
"version": "1.1.1",
|
"version": "2.0.23",
|
||||||
|
"private": false,
|
||||||
"description": "acme implementation in TypeScript",
|
"description": "acme implementation in TypeScript",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"typings": "dist/index.d.ts",
|
"typings": "dist/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(tstest test/)"
|
"test": "(tstest test/)",
|
||||||
|
"build": "(tsbuild)"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@ -23,18 +25,27 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://gitlab.com/umbrellazone/smartacme#README",
|
"homepage": "https://gitlab.com/umbrellazone/smartacme#README",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@pushrocks/lik": "^3.0.4",
|
||||||
|
"@pushrocks/smartdata": "^3.1.13",
|
||||||
"@pushrocks/smartdelay": "^2.0.2",
|
"@pushrocks/smartdelay": "^2.0.2",
|
||||||
|
"@pushrocks/smartdns": "^3.0.8",
|
||||||
|
"@pushrocks/smartexpress": "^3.0.0",
|
||||||
"@pushrocks/smartpromise": "^2.0.5",
|
"@pushrocks/smartpromise": "^2.0.5",
|
||||||
"acme-v2": "^1.2.0",
|
"@pushrocks/smartrequest": "^1.1.14",
|
||||||
"rsa-compat": "^1.5.1"
|
"@pushrocks/smartstring": "^3.0.8",
|
||||||
|
"@pushrocks/smarttime": "^3.0.5",
|
||||||
|
"@pushrocks/smartunique": "^3.0.1",
|
||||||
|
"acme-client": "^2.2.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.0.22",
|
"@gitzone/tsbuild": "^2.1.4",
|
||||||
"@gitzone/tsrun": "^1.1.12",
|
"@gitzone/tsrun": "^1.1.17",
|
||||||
"@gitzone/tstest": "^1.0.13",
|
"@gitzone/tstest": "^1.0.18",
|
||||||
"@types/node": "^10.5.8",
|
"@mojoio/cloudflare": "^2.0.0",
|
||||||
"cflare": "^1.0.5",
|
"@pushrocks/qenv": "^3.0.2",
|
||||||
"qenv": "^1.1.7",
|
"@pushrocks/tapbundle": "^3.0.7",
|
||||||
"tapbundle": "^2.0.2"
|
"@types/node": "^10.12.18",
|
||||||
|
"tslint": "^5.12.0",
|
||||||
|
"tslint-config-prettier": "^1.17.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
9
qenv.yml
9
qenv.yml
@ -1,3 +1,6 @@
|
|||||||
vars:
|
required:
|
||||||
- CF_EMAIL
|
- CF_EMAIL
|
||||||
- CF_KEY
|
- CF_KEY
|
||||||
|
- MONGODB_URL
|
||||||
|
- MONGODB_PASSWORD
|
||||||
|
- MONGODB_DATABASE
|
||||||
|
46
test/test.ts
46
test/test.ts
@ -1,14 +1,44 @@
|
|||||||
import { tap, expect } from 'tapbundle';
|
import { tap, expect } from '@pushrocks/tapbundle';
|
||||||
|
import { Qenv } from '@pushrocks/qenv';
|
||||||
|
|
||||||
|
const testQenv = new Qenv('./', './.nogit/');
|
||||||
|
|
||||||
import * as smartacme from '../ts/index';
|
import * as smartacme from '../ts/index';
|
||||||
|
|
||||||
let smartAcmeInstance: smartacme.SmartAcme;
|
let smartAcmeInstance: smartacme.SmartAcme;
|
||||||
|
|
||||||
tap.test('should create a valid instance of SmartAcme' , async () => {
|
tap.test('should create a valid instance of SmartAcme', async () => {
|
||||||
smartAcmeInstance = new smartacme.SmartAcme();
|
smartAcmeInstance = new smartacme.SmartAcme({
|
||||||
await smartAcmeInstance.init()
|
accountEmail: 'domains@lossless.org',
|
||||||
console.log(smartAcmeInstance.directoryUrls);
|
accountPrivateKey: null,
|
||||||
await smartAcmeInstance.getCertificateForDomain('bleu.de');
|
mongoDescriptor: {
|
||||||
})
|
mongoDbName: testQenv.getEnvVarOnDemand('MONGODB_DATABASE'),
|
||||||
|
mongoDbPass: testQenv.getEnvVarOnDemand('MONGODB_PASSWORD'),
|
||||||
|
mongoDbUrl: testQenv.getEnvVarOnDemand('MONGODB_URL')
|
||||||
|
},
|
||||||
|
removeChallenge: async (...args) => {
|
||||||
|
console.log(args);
|
||||||
|
},
|
||||||
|
setChallenge: async (...args) => {
|
||||||
|
console.log(args);
|
||||||
|
},
|
||||||
|
validateRemoteRequest: async () => {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
await smartAcmeInstance.init();
|
||||||
|
// await smartAcmeInstance.getCertificateForDomain('bleu.de');
|
||||||
|
});
|
||||||
|
|
||||||
tap.start();
|
tap.test('certmatcher should correctly match domains', async () => {
|
||||||
|
const certMatcherMod = await import('../ts/smartacme.classes.certmatcher');
|
||||||
|
const certMatcher = new certMatcherMod.CertMatcher();
|
||||||
|
const matchedCert = certMatcher.getCertificateDomainNameByDomainName('level3.level2.level1');
|
||||||
|
expect(matchedCert).to.equal('level2.level1');
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test('should stop correctly', async () => {
|
||||||
|
await smartAcmeInstance.stop();
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.start();
|
||||||
|
@ -1 +1,3 @@
|
|||||||
export * from './smartacme.classes.smartacme'
|
export * from './smartacme.classes.smartacme';
|
||||||
|
|
||||||
|
export * from './smartacme.classes.certremoteclient';
|
||||||
|
8
ts/interfaces/accountdata.ts
Normal file
8
ts/interfaces/accountdata.ts
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
export interface IAccountData {
|
||||||
|
id: number;
|
||||||
|
key: { kty: 'RSA'; n: string; e: string; kid: string };
|
||||||
|
contact: string[];
|
||||||
|
initialIp: string;
|
||||||
|
createdAt: string;
|
||||||
|
status: string;
|
||||||
|
}
|
9
ts/interfaces/cert.ts
Normal file
9
ts/interfaces/cert.ts
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
export type TCertStatus = 'existing' | 'nonexisting' | 'pending' | 'failed';
|
||||||
|
|
||||||
|
export interface ICert {
|
||||||
|
domainName: string;
|
||||||
|
created: number;
|
||||||
|
privateKey: string;
|
||||||
|
publicKey: string;
|
||||||
|
csr: string;
|
||||||
|
}
|
11
ts/interfaces/certremote.ts
Normal file
11
ts/interfaces/certremote.ts
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import { ICert, TCertStatus } from './cert';
|
||||||
|
|
||||||
|
export interface ICertRemoteRequest {
|
||||||
|
secret: string;
|
||||||
|
domainName: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ICertRemoteResponse {
|
||||||
|
status: TCertStatus;
|
||||||
|
certificate?: ICert;
|
||||||
|
}
|
3
ts/interfaces/index.ts
Normal file
3
ts/interfaces/index.ts
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
export * from './accountdata';
|
||||||
|
export * from './cert';
|
||||||
|
export * from './certremote';
|
40
ts/smartacme.classes.cert.ts
Normal file
40
ts/smartacme.classes.cert.ts
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
import * as plugins from './smartacme.plugins';
|
||||||
|
|
||||||
|
import * as interfaces from './interfaces';
|
||||||
|
|
||||||
|
import { CertManager } from './smartacme.classes.certmanager';
|
||||||
|
|
||||||
|
import { Collection, svDb, unI } from '@pushrocks/smartdata';
|
||||||
|
import { ICert } from './interfaces';
|
||||||
|
|
||||||
|
@plugins.smartdata.Collection(() => {
|
||||||
|
return CertManager.activeDB;
|
||||||
|
})
|
||||||
|
export class Cert extends plugins.smartdata.SmartDataDbDoc<Cert> implements interfaces.ICert {
|
||||||
|
@unI()
|
||||||
|
public index: string;
|
||||||
|
|
||||||
|
@svDb()
|
||||||
|
public domainName: string;
|
||||||
|
|
||||||
|
@svDb()
|
||||||
|
public created: number;
|
||||||
|
|
||||||
|
@svDb()
|
||||||
|
public privateKey: string;
|
||||||
|
|
||||||
|
@svDb()
|
||||||
|
public publicKey: string;
|
||||||
|
|
||||||
|
@svDb()
|
||||||
|
public csr: string;
|
||||||
|
|
||||||
|
constructor(optionsArg: ICert) {
|
||||||
|
super();
|
||||||
|
if (optionsArg) {
|
||||||
|
Object.keys(optionsArg).forEach(key => {
|
||||||
|
this[key] = optionsArg[key];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
93
ts/smartacme.classes.certmanager.ts
Normal file
93
ts/smartacme.classes.certmanager.ts
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
import * as plugins from './smartacme.plugins';
|
||||||
|
import { Cert } from './smartacme.classes.cert';
|
||||||
|
import { SmartAcme } from './smartacme.classes.smartacme';
|
||||||
|
|
||||||
|
import * as interfaces from './interfaces';
|
||||||
|
import { ICert } from './interfaces';
|
||||||
|
|
||||||
|
|
||||||
|
export class CertManager {
|
||||||
|
// =========
|
||||||
|
// STATIC
|
||||||
|
// =========
|
||||||
|
public static activeDB: plugins.smartdata.SmartdataDb;
|
||||||
|
|
||||||
|
|
||||||
|
// =========
|
||||||
|
// INSTANCE
|
||||||
|
// =========
|
||||||
|
private mongoDescriptor: plugins.smartdata.IMongoDescriptor;
|
||||||
|
public smartdataDb: plugins.smartdata.SmartdataDb;
|
||||||
|
|
||||||
|
public pendingMap: plugins.lik.Stringmap;
|
||||||
|
|
||||||
|
constructor(smartAcmeArg: SmartAcme,optionsArg: {
|
||||||
|
mongoDescriptor: plugins.smartdata.IMongoDescriptor;
|
||||||
|
}) {
|
||||||
|
this.mongoDescriptor = optionsArg.mongoDescriptor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async init () {
|
||||||
|
// Smartdata DB
|
||||||
|
this.smartdataDb = new plugins.smartdata.SmartdataDb(this.mongoDescriptor);
|
||||||
|
await this.smartdataDb.init();
|
||||||
|
CertManager.activeDB = this.smartdataDb;
|
||||||
|
|
||||||
|
// Pending Map
|
||||||
|
this.pendingMap = new plugins.lik.Stringmap();
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* retrieves a certificate
|
||||||
|
* @returns the Cert class or null
|
||||||
|
* @param domainName the domain Name to retrieve the vcertificate for
|
||||||
|
*/
|
||||||
|
public async retrieveCertificate(domainName: string): Promise<Cert> {
|
||||||
|
await this.checkCerts();
|
||||||
|
const existingCertificate: Cert = await Cert.getInstance({
|
||||||
|
domainName
|
||||||
|
});
|
||||||
|
|
||||||
|
if(existingCertificate) {
|
||||||
|
return existingCertificate;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* stores the certificate with the
|
||||||
|
* @param publicKeyArg
|
||||||
|
* @param privateKeyArg
|
||||||
|
* @param csrArg
|
||||||
|
*/
|
||||||
|
public async storeCertificate(optionsArg: ICert) {
|
||||||
|
const cert = new Cert(optionsArg);
|
||||||
|
cert.save();
|
||||||
|
};
|
||||||
|
|
||||||
|
public async deleteCertificate(domainNameArg: string) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public async getCertificateStatus(domainNameArg: string): Promise<interfaces.TCertStatus> {
|
||||||
|
const isPending = this.pendingMap.checkString('domainNameArg');
|
||||||
|
if (isPending) {
|
||||||
|
return 'pending';
|
||||||
|
}
|
||||||
|
|
||||||
|
// otherwise lets continue
|
||||||
|
const existingCertificate = this.retrieveCertificate(domainNameArg);
|
||||||
|
if (existingCertificate) {
|
||||||
|
return 'existing';
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'nonexisting';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* checks all certs for expiration
|
||||||
|
*/
|
||||||
|
private async checkCerts() {};
|
||||||
|
}
|
10
ts/smartacme.classes.certmatcher.ts
Normal file
10
ts/smartacme.classes.certmatcher.ts
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import * as plugins from './smartacme.plugins';
|
||||||
|
|
||||||
|
export class CertMatcher {
|
||||||
|
public getCertificateDomainNameByDomainName(domainNameArg: string): string {
|
||||||
|
const originalDomain = new plugins.smartstring.Domain(domainNameArg);
|
||||||
|
if (!originalDomain.level4) {
|
||||||
|
return `${originalDomain.level2}.${originalDomain.level1}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
47
ts/smartacme.classes.certremoteclient.ts
Normal file
47
ts/smartacme.classes.certremoteclient.ts
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
import * as plugins from './smartacme.plugins';
|
||||||
|
import * as interfaces from './interfaces';
|
||||||
|
import { ICertRemoteResponse } from './interfaces';
|
||||||
|
|
||||||
|
// tslint:disable-next-line: max-classes-per-file
|
||||||
|
export class CertRemoteClient {
|
||||||
|
private remoteUrl: string;
|
||||||
|
private secret: string;
|
||||||
|
|
||||||
|
constructor(optionsArg: {
|
||||||
|
remoteUrl: string;
|
||||||
|
secret: string;
|
||||||
|
}) {
|
||||||
|
this.remoteUrl = optionsArg.remoteUrl;
|
||||||
|
this.secret = optionsArg.secret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param domainNameArg
|
||||||
|
*/
|
||||||
|
async getCertificateForDomain(domainNameArg: string): Promise<interfaces.ICert> {
|
||||||
|
let certificate: interfaces.ICert;
|
||||||
|
const doRequestCycle = async (): Promise<interfaces.ICert> => {
|
||||||
|
const response: ICertRemoteResponse = (await plugins.smartrequest.postJson(this.remoteUrl, {
|
||||||
|
requestBody: <interfaces.ICertRemoteRequest>{
|
||||||
|
domainName: domainNameArg,
|
||||||
|
secret: this.secret
|
||||||
|
}
|
||||||
|
})).body;
|
||||||
|
switch(response.status) {
|
||||||
|
case 'pending':
|
||||||
|
await plugins.smartdelay.delayFor(5000);
|
||||||
|
const finalResponse = await doRequestCycle();
|
||||||
|
return finalResponse;
|
||||||
|
case 'existing':
|
||||||
|
return response.certificate;
|
||||||
|
case 'failed':
|
||||||
|
default:
|
||||||
|
console.log(`could not retrieve certificate for ${domainNameArg}`);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
certificate = await doRequestCycle();
|
||||||
|
return certificate;
|
||||||
|
}
|
||||||
|
}
|
@ -1,27 +0,0 @@
|
|||||||
import * as plugins from './smartacme.plugins';
|
|
||||||
const rsa = require('rsa-compat').RSA;
|
|
||||||
|
|
||||||
export class KeyPair {
|
|
||||||
rsaKeyPair: any
|
|
||||||
|
|
||||||
/**
|
|
||||||
* generates a fresh rsa keyPair
|
|
||||||
*/
|
|
||||||
static async generateFresh(): Promise<KeyPair> {
|
|
||||||
const done = plugins.smartpromise.defer();
|
|
||||||
var options = { bitlen: 2048, exp: 65537, public: true, pem: true, internal: true };
|
|
||||||
rsa.generateKeypair(options, function(err, keypair) {
|
|
||||||
if(err) {
|
|
||||||
console.log(err);
|
|
||||||
}
|
|
||||||
done.resolve(keypair);
|
|
||||||
});
|
|
||||||
const result: any = await done.promise;
|
|
||||||
const keyPair = new KeyPair(result);
|
|
||||||
return keyPair;
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor(rsaKeyPairArg) {
|
|
||||||
this.rsaKeyPair = rsaKeyPairArg;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,89 +1,199 @@
|
|||||||
const acme = require('acme-v2').ACME.create({
|
|
||||||
RSA: require('rsa-compat').RSA,
|
|
||||||
|
|
||||||
// other overrides
|
|
||||||
promisify: require('util').promisify,
|
|
||||||
|
|
||||||
// used for constructing user-agent
|
|
||||||
os: require('os'),
|
|
||||||
process: require('process'),
|
|
||||||
|
|
||||||
// used for overriding the default user-agent
|
|
||||||
userAgent: 'My custom UA String',
|
|
||||||
getUserAgentString: function(deps) {
|
|
||||||
return 'My custom UA String';
|
|
||||||
},
|
|
||||||
|
|
||||||
// don't try to validate challenges locally
|
|
||||||
skipChallengeTest: true
|
|
||||||
});
|
|
||||||
|
|
||||||
import { KeyPair } from './smartacme.classes.keypair';
|
|
||||||
import * as plugins from './smartacme.plugins';
|
import * as plugins from './smartacme.plugins';
|
||||||
const rsa = require('rsa-compat').RSA;
|
import { Cert } from './smartacme.classes.cert';
|
||||||
|
import { CertManager } from './smartacme.classes.certmanager';
|
||||||
|
import { CertMatcher } from './smartacme.classes.certmatcher';
|
||||||
|
|
||||||
|
import * as interfaces from './interfaces';
|
||||||
|
import { request } from 'http';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the options for the class @see SmartAcme
|
||||||
|
*/
|
||||||
|
export interface ISmartAcmeOptions {
|
||||||
|
accountPrivateKey?: string;
|
||||||
|
accountEmail: string;
|
||||||
|
mongoDescriptor: plugins.smartdata.IMongoDescriptor;
|
||||||
|
setChallenge: (domainName: string, keyAuthorization: string) => Promise<any>;
|
||||||
|
removeChallenge: (domainName: string) => Promise<any>;
|
||||||
|
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 {
|
export class SmartAcme {
|
||||||
domainKeyPair: KeyPair;
|
private options: ISmartAcmeOptions;
|
||||||
accountKeyPair: KeyPair;
|
|
||||||
accountData: any;
|
|
||||||
directoryUrls: any;
|
|
||||||
|
|
||||||
async init() {
|
// the acme client
|
||||||
// get directory url
|
private client: any;
|
||||||
this.directoryUrls = await acme.init('https://acme-staging-v02.api.letsencrypt.org/directory');
|
private smartdns = new plugins.smartdns.Smartdns();
|
||||||
|
|
||||||
// create keyPairs
|
// the account private key
|
||||||
this.domainKeyPair = await KeyPair.generateFresh();
|
private privateKey: string;
|
||||||
this.accountKeyPair = await KeyPair.generateFresh();
|
|
||||||
|
|
||||||
// get account
|
// challenge fullfillment
|
||||||
const registrationData = await acme.accounts
|
private setChallenge: (domainName: string, keyAuthorization: string) => Promise<any>;
|
||||||
.create({
|
private removeChallenge: (domainName: string) => Promise<any>;
|
||||||
email: 'domains@lossless.org', // valid email (server checks MX records)
|
private validateRemoteRequest: () => Promise<boolean>;
|
||||||
accountKeypair: this.accountKeyPair.rsaKeyPair,
|
|
||||||
agreeToTerms: async tosUrl => {
|
// certmanager
|
||||||
return tosUrl;
|
private certmanager: CertManager;
|
||||||
}
|
private certmatcher: CertMatcher;
|
||||||
})
|
private certremoteHandler: plugins.smartexpress.Handler;
|
||||||
.catch(e => {
|
|
||||||
console.log(e);
|
constructor(optionsArg: ISmartAcmeOptions) {
|
||||||
});
|
this.options = optionsArg;
|
||||||
this.accountData = registrationData;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async getCertificateForDomain(domain) {
|
/**
|
||||||
const result = await acme.certificates
|
* inits the instance
|
||||||
.create({
|
* ```ts
|
||||||
domainKeypair: this.domainKeyPair.rsaKeyPair,
|
* await myCloudlyInstance.init() // does not support options
|
||||||
accountKeypair: this.accountKeyPair.rsaKeyPair,
|
* ```
|
||||||
domains: ['bleu.de'],
|
*/
|
||||||
challengeType: 'dns-01',
|
public async init() {
|
||||||
|
this.privateKey =
|
||||||
|
this.options.accountPrivateKey || (await plugins.acme.forge.createPrivateKey());
|
||||||
|
this.setChallenge = this.options.setChallenge;
|
||||||
|
this.removeChallenge = this.options.removeChallenge;
|
||||||
|
|
||||||
setChallenge: async (hostname, key, val, cb) => {
|
// CertMangaer
|
||||||
console.log('set challenge');
|
this.certmanager = new CertManager(this, {
|
||||||
console.log(hostname);
|
mongoDescriptor: this.options.mongoDescriptor
|
||||||
//console.log(key);
|
});
|
||||||
//console.log(val);
|
await this.certmanager.init();
|
||||||
const dnsKey = rsa.utils.toWebsafeBase64(
|
|
||||||
require('crypto')
|
|
||||||
.createHash('sha256')
|
|
||||||
.update(val)
|
|
||||||
.digest('base64')
|
|
||||||
);
|
|
||||||
|
|
||||||
console.log(dnsKey);
|
// CertMatcher
|
||||||
await plugins.smartdelay.delayFor(20000);
|
this.certmatcher = new CertMatcher();
|
||||||
console.log('ready!');
|
|
||||||
cb();
|
// CertRemoteHandler
|
||||||
}, // return Promise
|
this.certremoteHandler = new plugins.smartexpress.Handler('POST', async (req, res) => {
|
||||||
removeChallenge: async (hostname, key) => {
|
const requestBody: interfaces.ICertRemoteRequest = req.body;
|
||||||
console.log('removing challenge');
|
const status: interfaces.TCertStatus = await this.certmanager.getCertificateStatus(requestBody.domainName);
|
||||||
return;
|
const existingCertificate = await this.certmanager.retrieveCertificate(
|
||||||
} // return Promise
|
requestBody.domainName
|
||||||
})
|
);
|
||||||
.catch(e => {
|
let response: interfaces.ICertRemoteResponse;
|
||||||
console.log(e);
|
switch (status) {
|
||||||
}); // returns Promise<pems={ privkey (key), cert, chain (ca) }>
|
case 'existing':
|
||||||
console.log(result);
|
response = {
|
||||||
|
status,
|
||||||
|
certificate: {
|
||||||
|
created: existingCertificate.created,
|
||||||
|
csr: existingCertificate.csr,
|
||||||
|
domainName: existingCertificate.domainName,
|
||||||
|
privateKey: existingCertificate.privateKey,
|
||||||
|
publicKey: existingCertificate.publicKey
|
||||||
|
}
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
response = {
|
||||||
|
status
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
res.status(200);
|
||||||
|
res.send(response);
|
||||||
|
res.end();
|
||||||
|
});
|
||||||
|
|
||||||
|
// ACME Client
|
||||||
|
this.client = new plugins.acme.Client({
|
||||||
|
directoryUrl: plugins.acme.directory.letsencrypt.staging,
|
||||||
|
accountKey: this.privateKey
|
||||||
|
});
|
||||||
|
|
||||||
|
/* Register account */
|
||||||
|
await this.client.createAccount({
|
||||||
|
termsOfServiceAgreed: true,
|
||||||
|
contact: [`mailto:${this.options.accountEmail}`]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public async stop() {
|
||||||
|
await this.certmanager.smartdataDb.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async getCertificateForDomain(domainArg: string): Promise<Cert> {
|
||||||
|
const certDomain = this.certmatcher.getCertificateDomainNameByDomainName(domainArg);
|
||||||
|
|
||||||
|
const retrievedCertificate = await this.certmanager.retrieveCertificate(certDomain);
|
||||||
|
|
||||||
|
if (retrievedCertificate) {
|
||||||
|
return retrievedCertificate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Place new order */
|
||||||
|
const order = await this.client.createOrder({
|
||||||
|
identifiers: [{ type: 'dns', value: certDomain }, { type: 'dns', value: `*.${certDomain}` }]
|
||||||
|
});
|
||||||
|
|
||||||
|
/* Get authorizations and select challenges */
|
||||||
|
const authorizations = await this.client.getAuthorizations(order);
|
||||||
|
|
||||||
|
for (const authz of authorizations) {
|
||||||
|
console.log(authz);
|
||||||
|
const domainDnsName: string = `_acme-challenge.${authz.identifier.value}`;
|
||||||
|
const dnsChallenge: string = authz.challenges.find(challengeArg => {
|
||||||
|
return challengeArg.type === 'dns-01';
|
||||||
|
});
|
||||||
|
// process.exit(1);
|
||||||
|
const keyAuthorization: string = await this.client.getChallengeKeyAuthorization(dnsChallenge);
|
||||||
|
|
||||||
|
try {
|
||||||
|
/* Satisfy challenge */
|
||||||
|
await this.setChallenge(domainDnsName, keyAuthorization);
|
||||||
|
await this.smartdns.checkUntilAvailable(domainDnsName, 'TXT', keyAuthorization, 100, 5000);
|
||||||
|
|
||||||
|
/* Verify that challenge is satisfied */
|
||||||
|
await this.client.verifyChallenge(authz, dnsChallenge);
|
||||||
|
|
||||||
|
/* Notify ACME provider that challenge is satisfied */
|
||||||
|
await this.client.completeChallenge(dnsChallenge);
|
||||||
|
|
||||||
|
/* Wait for ACME provider to respond with valid status */
|
||||||
|
await this.client.waitForValidStatus(dnsChallenge);
|
||||||
|
} finally {
|
||||||
|
/* Clean up challenge response */
|
||||||
|
try {
|
||||||
|
await this.removeChallenge(domainDnsName);
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Finalize order */
|
||||||
|
const [key, csr] = await plugins.acme.forge.createCsr({
|
||||||
|
commonName: `*.${certDomain}`,
|
||||||
|
altNames: [certDomain]
|
||||||
|
});
|
||||||
|
|
||||||
|
await this.client.finalizeOrder(order, csr);
|
||||||
|
const cert = await this.client.getCertificate(order);
|
||||||
|
|
||||||
|
/* Done */
|
||||||
|
console.log(`CSR:\n${csr.toString()}`);
|
||||||
|
console.log(`Private key:\n${key.toString()}`);
|
||||||
|
console.log(`Certificate:\n${cert.toString()}`);
|
||||||
|
|
||||||
|
await this.certmanager.storeCertificate({
|
||||||
|
domainName: certDomain,
|
||||||
|
privateKey: key.toString(),
|
||||||
|
publicKey: cert.toString(),
|
||||||
|
csr: csr.toString(),
|
||||||
|
created: Date.now()
|
||||||
|
});
|
||||||
|
|
||||||
|
const newCertificate = await this.certmanager.retrieveCertificate(certDomain);
|
||||||
|
return newCertificate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,18 @@
|
|||||||
import * as smartpromise from '@pushrocks/smartpromise';
|
// @pushrocks scope
|
||||||
|
import * as lik from '@pushrocks/lik';
|
||||||
|
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 smartexpress from '@pushrocks/smartexpress';
|
||||||
|
import * as smartpromise from '@pushrocks/smartpromise';
|
||||||
|
import * as smartrequest from '@pushrocks/smartrequest';
|
||||||
|
import * as smartunique from '@pushrocks/smartunique';
|
||||||
|
import * as smartstring from '@pushrocks/smartstring';
|
||||||
|
import * as smarttime from '@pushrocks/smarttime';
|
||||||
|
|
||||||
export {
|
export { lik, smartdata, smartdelay, smartdns, smartexpress, smartpromise, smartrequest, smartunique, smartstring, smarttime };
|
||||||
smartpromise,
|
|
||||||
smartdelay
|
// thirs party scope
|
||||||
}
|
import * as acme from 'acme-client';
|
||||||
|
|
||||||
|
export { acme };
|
||||||
|
7
tsconfig.json
Normal file
7
tsconfig.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"target": "es2017",
|
||||||
|
"module": "commonjs"
|
||||||
|
}
|
||||||
|
}
|
16
tslint.json
16
tslint.json
@ -1,3 +1,17 @@
|
|||||||
{
|
{
|
||||||
"extends": "tslint-config-standard"
|
"extends": ["tslint:latest", "tslint-config-prettier"],
|
||||||
|
"rules": {
|
||||||
|
"semicolon": [true, "always"],
|
||||||
|
"no-console": false,
|
||||||
|
"ordered-imports": false,
|
||||||
|
"object-literal-sort-keys": false,
|
||||||
|
"member-ordering": {
|
||||||
|
"options":{
|
||||||
|
"order": [
|
||||||
|
"static-method"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"defaultSeverity": "warning"
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user