fix(core): update

This commit is contained in:
Philipp Kunz 2021-02-20 18:02:53 +00:00
parent 96287ed710
commit d36056bd46
9 changed files with 217 additions and 95 deletions

4
.gitignore vendored
View File

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

View File

@ -4,7 +4,7 @@ image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
cache: cache:
paths: paths:
- .npmci_cache/ - .npmci_cache/
key: "$CI_BUILD_STAGE" key: '$CI_BUILD_STAGE'
stages: stages:
- security - security
@ -19,20 +19,35 @@ mirror:
stage: security stage: security
script: script:
- npmci git mirror - npmci git mirror
only:
- tags
tags: tags:
- lossless
- docker - docker
- notpriv - notpriv
snyk: auditProductionDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security stage: security
script: script:
- npmci npm prepare - npmci npm prepare
- npmci command npm install -g snyk - npmci command npm install --production --ignore-scripts
- npmci command npm install --ignore-scripts - npmci command npm config set registry https://registry.npmjs.org
- npmci command snyk test - npmci command npm audit --audit-level=high --only=prod --production
tags: tags:
- docker - docker
- notpriv
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 --only=dev
tags:
- docker
allow_failure: true
# ==================== # ====================
# test stage # test stage
@ -48,7 +63,6 @@ testStable:
coverage: /\d+.?\d+?\%\s*coverage/ coverage: /\d+.?\d+?\%\s*coverage/
tags: tags:
- docker - docker
- priv
testBuild: testBuild:
stage: test stage: test
@ -60,7 +74,6 @@ testBuild:
coverage: /\d+.?\d+?\%\s*coverage/ coverage: /\d+.?\d+?\%\s*coverage/
tags: tags:
- docker - docker
- notpriv
release: release:
stage: release stage: release
@ -70,6 +83,7 @@ release:
only: only:
- tags - tags
tags: tags:
- lossless
- docker - docker
- notpriv - notpriv
@ -79,12 +93,15 @@ release:
codequality: codequality:
stage: metadata stage: metadata
allow_failure: true allow_failure: true
only:
- tags
script: script:
- npmci command npm install -g tslint typescript - npmci command npm install -g tslint typescript
- npmci npm prepare - npmci npm prepare
- npmci npm install - npmci npm install
- npmci command "tslint -c tslint.json ./ts/**/*.ts" - npmci command "tslint -c tslint.json ./ts/**/*.ts"
tags: tags:
- lossless
- docker - docker
- priv - priv
@ -95,20 +112,20 @@ trigger:
only: only:
- tags - tags
tags: tags:
- lossless
- docker - docker
- notpriv - notpriv
pages: pages:
image: hosttoday/ht-docker-dbase:npmci
services:
- docker:stable-dind
stage: metadata stage: metadata
script: script:
- npmci node install lts
- npmci command npm install -g @gitzone/tsdoc - npmci command npm install -g @gitzone/tsdoc
- npmci npm prepare - npmci npm prepare
- npmci npm install - npmci npm install
- npmci command tsdoc - npmci command tsdoc
tags: tags:
- lossless
- docker - docker
- notpriv - notpriv
only: only:

29
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,29 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "current file",
"type": "node",
"request": "launch",
"args": [
"${relativeFile}"
],
"runtimeArgs": ["-r", "@gitzone/tsrun"],
"cwd": "${workspaceRoot}",
"protocol": "inspector",
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": "test.ts",
"type": "node",
"request": "launch",
"args": [
"test/test.ts"
],
"runtimeArgs": ["-r", "@gitzone/tsrun"],
"cwd": "${workspaceRoot}",
"protocol": "inspector",
"internalConsoleOptions": "openOnSessionStart"
}
]
}

26
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,26 @@
{
"json.schemas": [
{
"fileMatch": ["/npmextra.json"],
"schema": {
"type": "object",
"properties": {
"npmci": {
"type": "object",
"description": "settings for npmci"
},
"gitzone": {
"type": "object",
"description": "settings for gitzone",
"properties": {
"projectType": {
"type": "string",
"enum": ["website", "element", "service", "npm", "wcc"]
}
}
}
}
}
}
]
}

View File

@ -1,5 +1,6 @@
{ {
"gitzone": { "gitzone": {
"projectType": "npm",
"module": { "module": {
"githost": "gitlab.com", "githost": "gitlab.com",
"gitscope": "pushrocks", "gitscope": "pushrocks",

95
package-lock.json generated
View File

@ -1232,6 +1232,33 @@
"integrity": "sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw==", "integrity": "sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw==",
"dev": true "dev": true
}, },
"@open-wc/dedupe-mixin": {
"version": "1.3.0",
"resolved": "https://verdaccio.lossless.one/@open-wc%2fdedupe-mixin/-/dedupe-mixin-1.3.0.tgz",
"integrity": "sha512-UfdK1MPnR6T7f3svzzYBfu3qBkkZ/KsPhcpc3JYhsUY4hbpwNF9wEQtD4Z+/mRqMTJrKg++YSxIxE0FBhY3RIw==",
"dev": true
},
"@open-wc/scoped-elements": {
"version": "1.3.3",
"resolved": "https://verdaccio.lossless.one/@open-wc%2fscoped-elements/-/scoped-elements-1.3.3.tgz",
"integrity": "sha512-vFIQVYYjFw67odUE4JzZOpctnF7S/2DX+S+clrL3bQPql7HvEnV0wMFwOWUavQTuCJi0rfU8GTcNMiUybio+Yg==",
"dev": true,
"requires": {
"@open-wc/dedupe-mixin": "^1.3.0",
"lit-html": "^1.0.0"
}
},
"@open-wc/testing-helpers": {
"version": "1.8.12",
"resolved": "https://verdaccio.lossless.one/@open-wc%2ftesting-helpers/-/testing-helpers-1.8.12.tgz",
"integrity": "sha512-+4exEHYvnFqI1RGDDIKFHPZ7Ws5NK1epvEku3zLaOYN3zc+huX19SndNc5+X++v8A+quN/iXbHlh80ROyNaYDA==",
"dev": true,
"requires": {
"@open-wc/scoped-elements": "^1.2.4",
"lit-element": "^2.2.1",
"lit-html": "^1.0.0"
}
},
"@parcel/fs": { "@parcel/fs": {
"version": "1.11.0", "version": "1.11.0",
"resolved": "https://verdaccio.lossless.one/@parcel%2ffs/-/fs-1.11.0.tgz", "resolved": "https://verdaccio.lossless.one/@parcel%2ffs/-/fs-1.11.0.tgz",
@ -1381,20 +1408,13 @@
} }
}, },
"@pushrocks/smartcrypto": { "@pushrocks/smartcrypto": {
"version": "1.0.9", "version": "1.0.11",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartcrypto/-/smartcrypto-1.0.9.tgz", "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartcrypto/-/smartcrypto-1.0.11.tgz",
"integrity": "sha512-zu4ZYPu0/eeFvtE9L+mX9yIy8zwfT0Tmrl4tEvrHPS/ijzAH7MBf63SzoaLPmujVw6tnHsMejfPh1XUm1qLmnA==", "integrity": "sha512-jMrHxtXeGutVugoq+RQcYV8pbhepNIy/NX6um4Ty+unyj91bf+MK4gRhceG466AYCtu/q4OGq9lTeasDzlZF4A==",
"requires": { "requires": {
"@pushrocks/smartpromise": "^3.0.5", "@pushrocks/smartpromise": "^3.1.3",
"@types/node-forge": "^0.8.6", "@types/node-forge": "^0.9.7",
"node-forge": "^0.9.1" "node-forge": "^0.10.0"
},
"dependencies": {
"@pushrocks/smartpromise": {
"version": "3.1.3",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartpromise/-/smartpromise-3.1.3.tgz",
"integrity": "sha512-KENdm++8uuzxDz1cbUbXtz6InfReP28TYC5zxRgRtwsXh7ZWUkSA+/82IbO97PcSCAfIpg7dwj77G6KGSsTKEQ=="
}
} }
}, },
"@pushrocks/smartdelay": { "@pushrocks/smartdelay": {
@ -1890,8 +1910,7 @@
"@pushrocks/smartpromise": { "@pushrocks/smartpromise": {
"version": "3.1.3", "version": "3.1.3",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartpromise/-/smartpromise-3.1.3.tgz", "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartpromise/-/smartpromise-3.1.3.tgz",
"integrity": "sha512-KENdm++8uuzxDz1cbUbXtz6InfReP28TYC5zxRgRtwsXh7ZWUkSA+/82IbO97PcSCAfIpg7dwj77G6KGSsTKEQ==", "integrity": "sha512-KENdm++8uuzxDz1cbUbXtz6InfReP28TYC5zxRgRtwsXh7ZWUkSA+/82IbO97PcSCAfIpg7dwj77G6KGSsTKEQ=="
"dev": true
}, },
"@pushrocks/smartpuppeteer": { "@pushrocks/smartpuppeteer": {
"version": "1.0.21", "version": "1.0.21",
@ -2024,11 +2043,12 @@
} }
}, },
"@pushrocks/tapbundle": { "@pushrocks/tapbundle": {
"version": "3.2.10", "version": "3.2.14",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2ftapbundle/-/tapbundle-3.2.10.tgz", "resolved": "https://verdaccio.lossless.one/@pushrocks%2ftapbundle/-/tapbundle-3.2.14.tgz",
"integrity": "sha512-EPFSiFMx6uxWcZgANT1yDigTknVl1FCRIaiuf2AEkpg4vR5ZIZQKDIWkrFZY0ajUWJ6vCM631TmIcJvUnyWJXw==", "integrity": "sha512-Hu7SHFww6i17mZ3F8orvzXV7B8nPBRY6PB2Lw2sRfq9+ZbrvUvz7qmbc7d7mXkTGcLx7/7wbH3NHo1V5mplMCQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"@open-wc/testing-helpers": "^1.8.12",
"@pushrocks/smartdelay": "^2.0.10", "@pushrocks/smartdelay": "^2.0.10",
"@pushrocks/smartenv": "^4.0.16", "@pushrocks/smartenv": "^4.0.16",
"@pushrocks/smartpromise": "^3.1.3", "@pushrocks/smartpromise": "^3.1.3",
@ -2169,9 +2189,9 @@
"dev": true "dev": true
}, },
"@types/chai": { "@types/chai": {
"version": "4.2.14", "version": "4.2.15",
"resolved": "https://verdaccio.lossless.one/@types%2fchai/-/chai-4.2.14.tgz", "resolved": "https://verdaccio.lossless.one/@types%2fchai/-/chai-4.2.15.tgz",
"integrity": "sha512-G+ITQPXkwTrslfG5L/BksmbLUA0M1iybEsmCWPqzSxsRRhJZimBKJkoMi8fr/CPygPTj4zO5pJH7I2/cm9M7SQ==", "integrity": "sha512-rYff6FI+ZTKAPkJUoyz7Udq3GaoDZnxYDEvdEdFZASiA7PoErltHezDishqQiSDWrGxvxmplH304jyzQmjp0AQ==",
"dev": true "dev": true
}, },
"@types/chai-as-promised": { "@types/chai-as-promised": {
@ -2356,14 +2376,14 @@
"dev": true "dev": true
}, },
"@types/node": { "@types/node": {
"version": "14.14.25", "version": "14.14.31",
"resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-14.14.25.tgz", "resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-14.14.31.tgz",
"integrity": "sha512-EPpXLOVqDvisVxtlbvzfyqSsFeQxltFbluZNRndIb8tr9KiBnYNLzrc1N3pyKUCww2RNrfHDViqDWWE1LCJQtQ==" "integrity": "sha512-vFHy/ezP5qI0rFgJ7aQnjDXwAMrG0KqqIH7tQG5PPv3BWBayOPIQNBjVc/P6hhdZfMx51REc6tfDNXHUio893g=="
}, },
"@types/node-forge": { "@types/node-forge": {
"version": "0.8.7", "version": "0.9.7",
"resolved": "https://verdaccio.lossless.one/@types%2fnode-forge/-/node-forge-0.8.7.tgz", "resolved": "https://verdaccio.lossless.one/@types%2fnode-forge/-/node-forge-0.9.7.tgz",
"integrity": "sha512-xDtriZLWYx21QvMeTUD7EYQ+kPUxsKzNK+3Wl037RsRotR57MwrzTv6jy2vOJtWQV7S7jMI/hqMxunEqdLHK8Q==", "integrity": "sha512-AX7Mqk5ztzSvxqsA/q8y0k0/znJpW6QAqnoLQMEi7A3tio+laRmC/8Q3gbATHT4kZnvhnDmGAy1CpWFzlzCfeA==",
"requires": { "requires": {
"@types/node": "*" "@types/node": "*"
} }
@ -7202,6 +7222,21 @@
"type-check": "~0.3.2" "type-check": "~0.3.2"
} }
}, },
"lit-element": {
"version": "2.4.0",
"resolved": "https://verdaccio.lossless.one/lit-element/-/lit-element-2.4.0.tgz",
"integrity": "sha512-pBGLglxyhq/Prk2H91nA0KByq/hx/wssJBQFiYqXhGDvEnY31PRGYf1RglVzyLeRysu0IHm2K0P196uLLWmwFg==",
"dev": true,
"requires": {
"lit-html": "^1.1.1"
}
},
"lit-html": {
"version": "1.3.0",
"resolved": "https://verdaccio.lossless.one/lit-html/-/lit-html-1.3.0.tgz",
"integrity": "sha512-0Q1bwmaFH9O14vycPHw8C/IeHMk/uSDldVLIefu/kfbTBGIc44KGH6A8p1bDfxUfHdc8q6Ct7kQklWoHgr4t1Q==",
"dev": true
},
"locate-path": { "locate-path": {
"version": "5.0.0", "version": "5.0.0",
"resolved": "https://verdaccio.lossless.one/locate-path/-/locate-path-5.0.0.tgz", "resolved": "https://verdaccio.lossless.one/locate-path/-/locate-path-5.0.0.tgz",
@ -7716,9 +7751,9 @@
"dev": true "dev": true
}, },
"node-forge": { "node-forge": {
"version": "0.9.2", "version": "0.10.0",
"resolved": "https://verdaccio.lossless.one/node-forge/-/node-forge-0.9.2.tgz", "resolved": "https://verdaccio.lossless.one/node-forge/-/node-forge-0.10.0.tgz",
"integrity": "sha512-naKSScof4Wn+aoHU6HBsifh92Zeicm1GDQKd1vp3Y/kOi8ub0DozCa9KpvYNCXslFHYRmLNiqRopGdTGwNLpNw==" "integrity": "sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA=="
}, },
"node-libs-browser": { "node-libs-browser": {
"version": "2.2.1", "version": "2.2.1",

View File

@ -15,25 +15,29 @@
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.1.25", "@gitzone/tsbuild": "^2.1.25",
"@gitzone/tstest": "^1.0.52", "@gitzone/tstest": "^1.0.52",
"@pushrocks/tapbundle": "^3.2.10", "@pushrocks/tapbundle": "^3.2.14",
"@types/node": "^14.14.25", "@types/node": "^14.14.31",
"tslint": "^6.1.3", "tslint": "^6.1.3",
"tslint-config-prettier": "^1.15.0" "tslint-config-prettier": "^1.15.0"
}, },
"dependencies": { "dependencies": {
"@pushrocks/smartcrypto": "^1.0.9", "@pushrocks/smartcrypto": "^1.0.11",
"@types/jsonwebtoken": "^8.5.0", "@types/jsonwebtoken": "^8.5.0",
"jsonwebtoken": "^8.5.1" "jsonwebtoken": "^8.5.1"
}, },
"files": [ "files": [
"ts/*", "ts/**/*",
"ts_web/*", "ts_web/**/*",
"dist/*", "dist/**/*",
"dist_web/*", "dist_*/**/*",
"dist_ts_web/*", "dist_ts/**/*",
"assets/*", "dist_ts_web/**/*",
"assets/**/*",
"cli.js", "cli.js",
"npmextra.json", "npmextra.json",
"readme.md" "readme.md"
],
"browserslist": [
"last 1 chrome versions"
] ]
} }

View File

@ -8,16 +8,28 @@ a package for handling jwt
* [docs (typedoc)](https://pushrocks.gitlab.io/smartjwt/) * [docs (typedoc)](https://pushrocks.gitlab.io/smartjwt/)
## Status for master ## Status for master
[![build status](https://gitlab.com/pushrocks/smartjwt/badges/master/build.svg)](https://gitlab.com/pushrocks/smartjwt/commits/master)
[![coverage report](https://gitlab.com/pushrocks/smartjwt/badges/master/coverage.svg)](https://gitlab.com/pushrocks/smartjwt/commits/master) Status Category | Status Badge
[![npm downloads per month](https://img.shields.io/npm/dm/@pushrocks/smartjwt.svg)](https://www.npmjs.com/package/@pushrocks/smartjwt) -- | --
[![Known Vulnerabilities](https://snyk.io/test/npm/@pushrocks/smartjwt/badge.svg)](https://snyk.io/test/npm/@pushrocks/smartjwt) GitLab Pipelines | [![pipeline status](https://gitlab.com/pushrocks/smartjwt/badges/master/pipeline.svg)](https://lossless.cloud)
[![TypeScript](https://img.shields.io/badge/TypeScript->=%203.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/) GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/pushrocks/smartjwt/badges/master/coverage.svg)](https://lossless.cloud)
[![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/) npm | [![npm downloads per month](https://badgen.net/npm/dy/@pushrocks/smartjwt)](https://lossless.cloud)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-prettier-ff69b4.svg)](https://prettier.io/) Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/pushrocks/smartjwt)](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/smartjwt)](https://lossless.cloud)
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@pushrocks/smartjwt)](https://lossless.cloud)
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@pushrocks/smartjwt)](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 ## Usage
## 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. For further information read the linked docs at the top of this readme.
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh) > MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)

View File

@ -20,7 +20,7 @@ export class SmartJwt<T extends object = any> {
*/ */
public async createJWT(payloadArg: T) { public async createJWT(payloadArg: T) {
return plugins.jsonwebtoken.sign(payloadArg, this.privateKey.toPemString(), { return plugins.jsonwebtoken.sign(payloadArg, this.privateKey.toPemString(), {
algorithm: 'RS256' algorithm: 'RS256',
}); });
} }
@ -29,7 +29,7 @@ export class SmartJwt<T extends object = any> {
*/ */
public async verifyJWTAndGetData(jwtArg: string): Promise<T> { public async verifyJWTAndGetData(jwtArg: string): Promise<T> {
const result = plugins.jsonwebtoken.verify(jwtArg, this.publicKey.toPemString(), { const result = plugins.jsonwebtoken.verify(jwtArg, this.publicKey.toPemString(), {
algorithms: ['RS256'] algorithms: ['RS256'],
}); });
return result as any; return result as any;
} }
@ -54,7 +54,7 @@ export class SmartJwt<T extends object = any> {
public getKeyPairAsJson(): ISmartJWTJSONKeypair { public getKeyPairAsJson(): ISmartJWTJSONKeypair {
return { return {
privatePem: this.privateKey.toPemString(), privatePem: this.privateKey.toPemString(),
publicPem: this.publicKey.toPemString() publicPem: this.publicKey.toPemString(),
}; };
} }