Added jwtDecode function
All checks were successful
Build / Build NPM Project (push) Successful in 27s
Build / Tag Version (push) Successful in 7s

This commit is contained in:
2024-09-30 16:02:21 -04:00
parent 67d9928a61
commit c1043e65e2
3 changed files with 4 additions and 4 deletions

View File

@ -6,7 +6,7 @@ import {JSONAttemptParse} from './objects.ts';
* @param {string} token JWT to decode
* @return {unknown} JWT payload
*/
function decodeJwt<T>(token: string): T {
export function decodeJwt<T>(token: string): T {
const base64 = token.split('.')[1]
.replace(/-/g, '+').replace(/_/g, '/');
return <T>JSONAttemptParse(decodeURIComponent(window.atob(base64).split('').map(function(c) {