fix(core): update

This commit is contained in:
Philipp Kunz 2022-12-22 17:21:43 +01:00
parent 15525b4731
commit fcc2bc2759
6 changed files with 33 additions and 8 deletions

View File

@ -17,11 +17,14 @@
"@gitzone/tsbuild": "^2.1.25",
"@gitzone/tsbundle": "^2.0.5",
"@gitzone/tsdoc": "^1.1.10",
"@gitzone/tsrun": "^1.2.39",
"@gitzone/tstest": "^1.0.44",
"@pushrocks/tapbundle": "^5.0.3",
"@types/node": "^17.0.41"
},
"dependencies": {},
"dependencies": {
"@pushrocks/smartenv": "^5.0.3"
},
"browserslist": [
"last 1 chrome versions"
],

15
pnpm-lock.yaml generated
View File

@ -4,14 +4,20 @@ specifiers:
'@gitzone/tsbuild': ^2.1.25
'@gitzone/tsbundle': ^2.0.5
'@gitzone/tsdoc': ^1.1.10
'@gitzone/tsrun': ^1.2.39
'@gitzone/tstest': ^1.0.44
'@pushrocks/smartenv': ^5.0.3
'@pushrocks/tapbundle': ^5.0.3
'@types/node': ^17.0.41
dependencies:
'@pushrocks/smartenv': 5.0.3
devDependencies:
'@gitzone/tsbuild': 2.1.65
'@gitzone/tsbundle': 2.0.7
'@gitzone/tsdoc': 1.1.12
'@gitzone/tsrun': 1.2.39_@types+node@17.0.45
'@gitzone/tstest': 1.0.74_@types+node@17.0.45
'@pushrocks/tapbundle': 5.0.4
'@types/node': 17.0.45
@ -412,7 +418,6 @@ packages:
resolution: {integrity: sha512-/cgEDhOIo9LB5Vd2BVO9+QrjC38w872iy7w88UWuwz7obVILWOHl3MYMHAKFqXexuwKpQ/y/Klu2xQHtOPgi6Q==}
dependencies:
'@pushrocks/smartpromise': 3.1.7
dev: true
/@pushrocks/smarterror/2.0.1:
resolution: {integrity: sha512-3OrF5me+/sy5VgwR/tfCqs7qhb0Ywzgn8tTThRUZnCGas0aindISzMiW7cIro3RlFykmtPmdTztC9Ostu2ioeA==}
@ -643,7 +648,6 @@ packages:
/@pushrocks/smartpromise/3.1.7:
resolution: {integrity: sha512-2gLQCeviEJwZ+cHHtK2Ks98brZatGC6dPXKIs1tVgJsiNgRFjnp90fESuJ1Pmoe7RrS+7J3mO4NtsFHAJJ/y5w==}
dev: true
/@pushrocks/smartpuppeteer/2.0.2:
resolution: {integrity: sha512-l3tqnD6Evseofq1avHsMy2FXXEmCd4Z+nm3xmMWS7nWvP9qTbJIn0XguOBaUIAhR8zE53UKPXs5/qBqXVNZDDQ==}
@ -1328,6 +1332,11 @@ packages:
- utf-8-validate
dev: true
/@xmldom/xmldom/0.8.6:
resolution: {integrity: sha512-uRjjusqpoqfmRkTaNuLJ2VohVr67Q5YwDATW3VU7PfzTj6IRaihGrYI7zckGZjxQPBIp63nfvJbM+Yu5ICh0Bg==}
engines: {node: '>=10.0.0'}
dev: true
/accepts/1.3.8:
resolution: {integrity: sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==}
engines: {node: '>= 0.6'}
@ -3453,6 +3462,8 @@ packages:
resolution: {integrity: sha512-mXF9AIgnvq1DP/ZM2R28tAfxP2wKZHYa2DjV0R1KCwcqSzm5Iqh1XQq9rdfAt6dp2DuPP0VHZIaCALc2v1cL5A==}
engines: {node: '>=14.18.0', npm: '>=6.14.15'}
hasBin: true
dependencies:
'@xmldom/xmldom': 0.8.6
dev: true
bundledDependencies:
- '@xmldom/xmldom'

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@pushrocks/webjwt',
version: '1.0.2',
version: '1.0.3',
description: 'a package to handle jwt in the web'
}

View File

@ -1,8 +1,16 @@
import * as plugins from './webjwt.plugins.js';
export const getDataFromJwtString = <T = any>(jwtString: string): T => {
const smartenvInstance = new plugins.smartenv.Smartenv();
const splitted = jwtString.split('.');
const dataBase64 = splitted[1];
let plainJsonString: string;
if (smartenvInstance.isBrowser) {
// @ts-ignore
return JSON.parse(atob(dataBase64));
plainJsonString = atob(dataBase64);
} else if (smartenvInstance.isNode) {
let buff = new Buffer(dataBase64, 'base64');
plainJsonString = buff.toString('ascii');
}
return JSON.parse(plainJsonString);
}

View File

@ -1,2 +1,5 @@
const removeme = {};
export { removeme };
import * as smartenv from '@pushrocks/smartenv';
export {
smartenv
}