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
dist/
dist_web/
dist_serve/
dist_ts_web/
dist_*/
# custom

View File

@ -3,14 +3,14 @@ image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
cache:
paths:
- .npmci_cache/
key: "$CI_BUILD_STAGE"
- .npmci_cache/
key: '$CI_BUILD_STAGE'
stages:
- security
- test
- release
- metadata
- security
- test
- release
- metadata
# ====================
# security stage
@ -18,21 +18,36 @@ stages:
mirror:
stage: security
script:
- npmci git mirror
- npmci git mirror
only:
- tags
tags:
- docker
- notpriv
- lossless
- docker
- notpriv
snyk:
auditProductionDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci npm prepare
- npmci command npm install -g snyk
- npmci command npm install --ignore-scripts
- npmci command snyk test
- 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
- notpriv
- 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 --only=dev
tags:
- docker
allow_failure: true
# ====================
# test stage
@ -41,37 +56,36 @@ snyk:
testStable:
stage: test
script:
- npmci npm prepare
- npmci node install stable
- npmci npm install
- npmci npm test
- npmci npm prepare
- npmci node install stable
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
- priv
- docker
testBuild:
stage: test
script:
- npmci npm prepare
- npmci node install stable
- npmci npm install
- npmci command npm run build
- npmci npm prepare
- npmci node install stable
- npmci npm install
- npmci command npm run build
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
- notpriv
- docker
release:
stage: release
script:
- npmci node install stable
- npmci npm publish
- npmci node install stable
- npmci npm publish
only:
- tags
- tags
tags:
- docker
- notpriv
- lossless
- docker
- notpriv
# ====================
# metadata stage
@ -79,36 +93,39 @@ release:
codequality:
stage: metadata
allow_failure: true
only:
- tags
script:
- npmci command npm install -g tslint typescript
- npmci npm prepare
- npmci npm install
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
tags:
- docker
- priv
- lossless
- docker
- priv
trigger:
stage: metadata
script:
- npmci trigger
- npmci trigger
only:
- tags
- tags
tags:
- docker
- notpriv
- lossless
- docker
- notpriv
pages:
image: hosttoday/ht-docker-dbase:npmci
services:
- docker:stable-dind
stage: metadata
script:
- npmci node install lts
- npmci command npm install -g @gitzone/tsdoc
- npmci npm prepare
- npmci npm install
- npmci command tsdoc
tags:
- lossless
- docker
- notpriv
only:
@ -116,5 +133,5 @@ pages:
artifacts:
expire_in: 1 week
paths:
- public
- public
allow_failure: true

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": {
"projectType": "npm",
"module": {
"githost": "gitlab.com",
"gitscope": "pushrocks",

95
package-lock.json generated
View File

@ -1232,6 +1232,33 @@
"integrity": "sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw==",
"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": {
"version": "1.11.0",
"resolved": "https://verdaccio.lossless.one/@parcel%2ffs/-/fs-1.11.0.tgz",
@ -1381,20 +1408,13 @@
}
},
"@pushrocks/smartcrypto": {
"version": "1.0.9",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartcrypto/-/smartcrypto-1.0.9.tgz",
"integrity": "sha512-zu4ZYPu0/eeFvtE9L+mX9yIy8zwfT0Tmrl4tEvrHPS/ijzAH7MBf63SzoaLPmujVw6tnHsMejfPh1XUm1qLmnA==",
"version": "1.0.11",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartcrypto/-/smartcrypto-1.0.11.tgz",
"integrity": "sha512-jMrHxtXeGutVugoq+RQcYV8pbhepNIy/NX6um4Ty+unyj91bf+MK4gRhceG466AYCtu/q4OGq9lTeasDzlZF4A==",
"requires": {
"@pushrocks/smartpromise": "^3.0.5",
"@types/node-forge": "^0.8.6",
"node-forge": "^0.9.1"
},
"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/smartpromise": "^3.1.3",
"@types/node-forge": "^0.9.7",
"node-forge": "^0.10.0"
}
},
"@pushrocks/smartdelay": {
@ -1890,8 +1910,7 @@
"@pushrocks/smartpromise": {
"version": "3.1.3",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartpromise/-/smartpromise-3.1.3.tgz",
"integrity": "sha512-KENdm++8uuzxDz1cbUbXtz6InfReP28TYC5zxRgRtwsXh7ZWUkSA+/82IbO97PcSCAfIpg7dwj77G6KGSsTKEQ==",
"dev": true
"integrity": "sha512-KENdm++8uuzxDz1cbUbXtz6InfReP28TYC5zxRgRtwsXh7ZWUkSA+/82IbO97PcSCAfIpg7dwj77G6KGSsTKEQ=="
},
"@pushrocks/smartpuppeteer": {
"version": "1.0.21",
@ -2024,11 +2043,12 @@
}
},
"@pushrocks/tapbundle": {
"version": "3.2.10",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2ftapbundle/-/tapbundle-3.2.10.tgz",
"integrity": "sha512-EPFSiFMx6uxWcZgANT1yDigTknVl1FCRIaiuf2AEkpg4vR5ZIZQKDIWkrFZY0ajUWJ6vCM631TmIcJvUnyWJXw==",
"version": "3.2.14",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2ftapbundle/-/tapbundle-3.2.14.tgz",
"integrity": "sha512-Hu7SHFww6i17mZ3F8orvzXV7B8nPBRY6PB2Lw2sRfq9+ZbrvUvz7qmbc7d7mXkTGcLx7/7wbH3NHo1V5mplMCQ==",
"dev": true,
"requires": {
"@open-wc/testing-helpers": "^1.8.12",
"@pushrocks/smartdelay": "^2.0.10",
"@pushrocks/smartenv": "^4.0.16",
"@pushrocks/smartpromise": "^3.1.3",
@ -2169,9 +2189,9 @@
"dev": true
},
"@types/chai": {
"version": "4.2.14",
"resolved": "https://verdaccio.lossless.one/@types%2fchai/-/chai-4.2.14.tgz",
"integrity": "sha512-G+ITQPXkwTrslfG5L/BksmbLUA0M1iybEsmCWPqzSxsRRhJZimBKJkoMi8fr/CPygPTj4zO5pJH7I2/cm9M7SQ==",
"version": "4.2.15",
"resolved": "https://verdaccio.lossless.one/@types%2fchai/-/chai-4.2.15.tgz",
"integrity": "sha512-rYff6FI+ZTKAPkJUoyz7Udq3GaoDZnxYDEvdEdFZASiA7PoErltHezDishqQiSDWrGxvxmplH304jyzQmjp0AQ==",
"dev": true
},
"@types/chai-as-promised": {
@ -2356,14 +2376,14 @@
"dev": true
},
"@types/node": {
"version": "14.14.25",
"resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-14.14.25.tgz",
"integrity": "sha512-EPpXLOVqDvisVxtlbvzfyqSsFeQxltFbluZNRndIb8tr9KiBnYNLzrc1N3pyKUCww2RNrfHDViqDWWE1LCJQtQ=="
"version": "14.14.31",
"resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-14.14.31.tgz",
"integrity": "sha512-vFHy/ezP5qI0rFgJ7aQnjDXwAMrG0KqqIH7tQG5PPv3BWBayOPIQNBjVc/P6hhdZfMx51REc6tfDNXHUio893g=="
},
"@types/node-forge": {
"version": "0.8.7",
"resolved": "https://verdaccio.lossless.one/@types%2fnode-forge/-/node-forge-0.8.7.tgz",
"integrity": "sha512-xDtriZLWYx21QvMeTUD7EYQ+kPUxsKzNK+3Wl037RsRotR57MwrzTv6jy2vOJtWQV7S7jMI/hqMxunEqdLHK8Q==",
"version": "0.9.7",
"resolved": "https://verdaccio.lossless.one/@types%2fnode-forge/-/node-forge-0.9.7.tgz",
"integrity": "sha512-AX7Mqk5ztzSvxqsA/q8y0k0/znJpW6QAqnoLQMEi7A3tio+laRmC/8Q3gbATHT4kZnvhnDmGAy1CpWFzlzCfeA==",
"requires": {
"@types/node": "*"
}
@ -7202,6 +7222,21 @@
"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": {
"version": "5.0.0",
"resolved": "https://verdaccio.lossless.one/locate-path/-/locate-path-5.0.0.tgz",
@ -7716,9 +7751,9 @@
"dev": true
},
"node-forge": {
"version": "0.9.2",
"resolved": "https://verdaccio.lossless.one/node-forge/-/node-forge-0.9.2.tgz",
"integrity": "sha512-naKSScof4Wn+aoHU6HBsifh92Zeicm1GDQKd1vp3Y/kOi8ub0DozCa9KpvYNCXslFHYRmLNiqRopGdTGwNLpNw=="
"version": "0.10.0",
"resolved": "https://verdaccio.lossless.one/node-forge/-/node-forge-0.10.0.tgz",
"integrity": "sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA=="
},
"node-libs-browser": {
"version": "2.2.1",

View File

@ -15,25 +15,29 @@
"devDependencies": {
"@gitzone/tsbuild": "^2.1.25",
"@gitzone/tstest": "^1.0.52",
"@pushrocks/tapbundle": "^3.2.10",
"@types/node": "^14.14.25",
"@pushrocks/tapbundle": "^3.2.14",
"@types/node": "^14.14.31",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.15.0"
},
"dependencies": {
"@pushrocks/smartcrypto": "^1.0.9",
"@pushrocks/smartcrypto": "^1.0.11",
"@types/jsonwebtoken": "^8.5.0",
"jsonwebtoken": "^8.5.1"
},
"files": [
"ts/*",
"ts_web/*",
"dist/*",
"dist_web/*",
"dist_ts_web/*",
"assets/*",
"ts/**/*",
"ts_web/**/*",
"dist/**/*",
"dist_*/**/*",
"dist_ts/**/*",
"dist_ts_web/**/*",
"assets/**/*",
"cli.js",
"npmextra.json",
"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/)
## 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)
[![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)
[![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/smartjwt/badges/master/pipeline.svg)](https://lossless.cloud)
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/pushrocks/smartjwt/badges/master/coverage.svg)](https://lossless.cloud)
npm | [![npm downloads per month](https://badgen.net/npm/dy/@pushrocks/smartjwt)](https://lossless.cloud)
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
## 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)

View File

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