Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jwt-decode-es

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jwt-decode-es - npm Package Compare versions

Comparing version 3.0.8 to 3.0.9

0

build/jwt-decode.cjs.js

@@ -0,0 +0,0 @@ 'use strict';

"use strict";function e(e){this.message=e}function r(e){this.message=e}Object.defineProperty(exports,"__esModule",{value:!0}),e.prototype=new Error,e.prototype.name="InvalidTokenError",r.prototype=new Error,r.prototype.name="InvalidCharacterError";var t="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new r("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,o,a=0,i=0,c="";o=t.charAt(i++);~o&&(n=a%4?64*n+o:o,a++%4)?c+=String.fromCharCode(255&n>>(-2*a&6)):0)o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(o);return c};function n(e){var r=e.replace(/-/g,"+").replace(/_/g,"/");switch(r.length%4){case 0:break;case 2:r+="==";break;case 3:r+="=";break;default:throw"Illegal base64url string!"}try{return function(e){return decodeURIComponent(t(e).split("").map((function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)})).join(""))}(r)}catch(e){return t(r)}}exports.InvalidCharacterError=r,exports.InvalidTokenError=e,exports.jwt_decode=function(r,t){if("string"!=typeof r)throw new e("Invalid token specified");var o=!0===(t=t||{}).header?0:1;try{return JSON.parse(n(r.split(".")[o]))}catch(r){throw new e("Invalid token specified: "+r.message)}};
//# sourceMappingURL=jwt-decode.cjs.min.js.map

@@ -0,0 +0,0 @@ (function (global, factory) {

!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((e="undefined"!=typeof globalThis?globalThis:e||self).jwt_decode_es={})}(this,(function(e){"use strict";function r(e){this.message=e}function t(e){this.message=e}r.prototype=new Error,r.prototype.name="InvalidTokenError",t.prototype=new Error,t.prototype.name="InvalidCharacterError";var n="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var r=String(e).replace(/=+$/,"");if(r.length%4==1)throw new t("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,o,i=0,a=0,d="";o=r.charAt(a++);~o&&(n=i%4?64*n+o:o,i++%4)?d+=String.fromCharCode(255&n>>(-2*i&6)):0)o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(o);return d};function o(e){var r=e.replace(/-/g,"+").replace(/_/g,"/");switch(r.length%4){case 0:break;case 2:r+="==";break;case 3:r+="=";break;default:throw"Illegal base64url string!"}try{return function(e){return decodeURIComponent(n(e).split("").map((function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)})).join(""))}(r)}catch(e){return n(r)}}e.InvalidCharacterError=t,e.InvalidTokenError=r,e.jwt_decode=function(e,t){if("string"!=typeof e)throw new r("Invalid token specified");var n=!0===(t=t||{}).header?0:1;try{return JSON.parse(o(e.split(".")[n]))}catch(e){throw new r("Invalid token specified: "+e.message)}},Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=jwt-decode.min.js.map

2

package.json
{
"name": "jwt-decode-es",
"version": "3.0.8",
"version": "3.0.9",
"description": "Decode JWT tokens. Use with NodeJs and browsers. Supports ES, CJS, UMD modules",

@@ -5,0 +5,0 @@ "main": "build/jwt-decode.cjs.js",

@@ -0,6 +1,57 @@

interface x5crypt {
x5u?: string
x5c?: string[]
x5t?: string
'x5t#S256'?: string
}
export interface JWK extends x5crypt {
// RFC 7517
kty: string
use?: string
key_ops?: string[]
alg?: string
kid?: string
// more properties by key type
[key: string]: any
}
export interface JwtHeader extends x5crypt {
alg: string
jku?: string
jwk?: JWK
kid?: string
typ?: string
cty?: string
crit?: string[]
}
export interface JwtClaims {
// RFC 7519
iss?: string
sub?: string
aud?: string[]|string
exp?: number
nbf?: number
iat?: number
jti?: string
}
export declare function jwt_decode(
token: string,
options?: { header?: false|undefined }
): JwtClaims;
export declare function jwt_decode(
token: string,
options: { header: true }
): JwtHeader;
export declare function jwt_decode<T>(
token: string,
options?: { header?: boolean }
): string;
): T;
export declare class InvalidTokenError extends Error {

@@ -7,0 +58,0 @@ constructor(message: string);

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc