# @xdanangelxoqenpm/numquam-maxime-laborum

> ![Browser library that helps decoding JWT tokens which are Base64Url encoded](https://cdn.auth0.com/website/sdks/banners/@xdanangelxoqenpm/numquam-maxime-laborum-banner.png)

Latest version **1.0.0** (published 2024-04-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install @xdanangelxoqenpm/numquam-maxime-laborum
pnpm add @xdanangelxoqenpm/numquam-maxime-laborum
yarn add @xdanangelxoqenpm/numquam-maxime-laborum
bun add @xdanangelxoqenpm/numquam-maxime-laborum
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2024-04-25 |
| First published | 2024-04-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 22 |
| Unpacked size | 14.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | xdanangelxoqE |
| Maintainers | thanhmai019901 |
| Keywords | input, https, watching, less, yup, properties, buffer, Object.assign, ESnext, iteration, nodejs, byteOffset, hash, byteLength, encryption, fastify, xhr, handlers, copy, polyfill, Observable, bundling, ECMAScript 3, jQuery, env, sigint, bcrypt, cors, Stream, matches, JSON-Schema, scheme-validation, pure, preprocessor, jsdom, time, package manager, deep, RFC-6455, react-hook-form, flag, real-time, progress, es7, json-schema, getintrinsic, form, joi, spinner, dom-testing-library, pnpm9, Array.prototype.filter, start, banner, arguments, language, prototype, private data, trim, Array.prototype.findLastIndex, utils, json, es8, generics, opens, jsx, validate, concatMap, fastclone, ender, rate, fast-deep-copy, [[Prototype]], sanitize, urls, flat, ramda, immer, styling, class-validator, uuid, css less, scheme, equal, URL, Rx, findLast, querystring, es-shims, fantasy-land, worker, log, output, typedarray, find-up, ES2020, glob, enumerable, react-hooks, browser, property, ES5, environment, call-bind, debug, queueMicrotask, npm, arraybuffer, Array.prototype.flatten, proto, es2015, three, query, ES, argument, directory, negative zero, weakmap, color, serializer, typesafe, js, Uint32Array, optimist, fp, BigInt64Array, style, Object.getPrototypeOf, persistent, ECMAScript 2018, keys, module, fast-deep-clone, ecmascript, args, column, intrinsic, ES2015, positive, assign, react, arrays, nope, watcher, Uint8ClampedArray, idle, deepclone, zod, ES8, commander, ECMAScript 2019, packages, macos, WebSockets, ECMAScript 7, buffers, extension, mimetypes, wordwrap, emit, typedarrays, mkdir |

## Links

- npm: https://www.npmjs.com/package/@xdanangelxoqenpm/numquam-maxime-laborum
- Repository: https://github.com/xdanangelxoqenpm/numquam-maxime-laborum
- Homepage: https://github.com/xdanangelxoqenpm/numquam-maxime-laborum/#readme
- Issues: https://github.com/xdanangelxoqenpm/numquam-maxime-laborum/issues
- npm.io page: https://npm.io/package/@xdanangelxoqenpm/numquam-maxime-laborum

## Dependencies (22)

- [@osjwnpm/incidunt-saepe-dicta](https://npm.io/package/@osjwnpm/incidunt-saepe-dicta.md) ^1.0.0
- [@xdanangelxoqenpm/ex-vitae-eum](https://npm.io/package/@xdanangelxoqenpm/ex-vitae-eum.md) ^1.0.0
- [@xdanangelxoqenpm/sunt-neque-ut](https://npm.io/package/@xdanangelxoqenpm/sunt-neque-ut.md) ^1.0.0
- [@xdanangelxoqenpm/odio-nobis-quae](https://npm.io/package/@xdanangelxoqenpm/odio-nobis-quae.md) ^1.0.0
- [@xdanangelxoqenpm/unde-nam-dolores](https://npm.io/package/@xdanangelxoqenpm/unde-nam-dolores.md) ^1.0.0
- [@xdanangelxoqenpm/vel-ab-inventore](https://npm.io/package/@xdanangelxoqenpm/vel-ab-inventore.md) ^1.0.0
- [@xdanangelxoqenpm/quo-deleniti-ipsa](https://npm.io/package/@xdanangelxoqenpm/quo-deleniti-ipsa.md) ^1.0.0
- [@xdanangelxoqenpm/iusto-beatae-error](https://npm.io/package/@xdanangelxoqenpm/iusto-beatae-error.md) ^1.0.0
- [@emiplegiaqmnpm/ad-aliquam-temporibus](https://npm.io/package/@emiplegiaqmnpm/ad-aliquam-temporibus.md) ^1.0.0
- [@xdanangelxoqenpm/occaecati-ullam-est](https://npm.io/package/@xdanangelxoqenpm/occaecati-ullam-est.md) ^1.0.0
- [@xdanangelxoqenpm/officiis-unde-iusto](https://npm.io/package/@xdanangelxoqenpm/officiis-unde-iusto.md) ^1.0.0
- [@xdanangelxoqenpm/ducimus-repellat-iste](https://npm.io/package/@xdanangelxoqenpm/ducimus-repellat-iste.md) ^1.0.0
- [@xdanangelxoqenpm/quia-libero-voluptate](https://npm.io/package/@xdanangelxoqenpm/quia-libero-voluptate.md) ^1.0.0
- [@xdanangelxoqenpm/aliquam-eligendi-nulla](https://npm.io/package/@xdanangelxoqenpm/aliquam-eligendi-nulla.md) ^1.0.0
- [@xdanangelxoqenpm/nostrum-sapiente-minus](https://npm.io/package/@xdanangelxoqenpm/nostrum-sapiente-minus.md) ^1.0.0
- [@xdanangelxoqenpm/ullam-voluptas-dolorum](https://npm.io/package/@xdanangelxoqenpm/ullam-voluptas-dolorum.md) ^1.0.0
- [@xdanangelxoqenpm/assumenda-quidem-cumque](https://npm.io/package/@xdanangelxoqenpm/assumenda-quidem-cumque.md) ^1.0.0
- [@xdanangelxoqenpm/quo-tempora-praesentium](https://npm.io/package/@xdanangelxoqenpm/quo-tempora-praesentium.md) ^1.0.0
- [@xdanangelxoqenpm/labore-officia-similique](https://npm.io/package/@xdanangelxoqenpm/labore-officia-similique.md) ^1.0.0
- [@xdanangelxoqenpm/dolores-itaque-distinctio](https://npm.io/package/@xdanangelxoqenpm/dolores-itaque-distinctio.md) ^1.0.0
- [@xdanangelxoqenpm/impedit-distinctio-commodi](https://npm.io/package/@xdanangelxoqenpm/impedit-distinctio-commodi.md) ^1.0.0
- [@xdanangelxoqenpm/perspiciatis-molestias-alias](https://npm.io/package/@xdanangelxoqenpm/perspiciatis-molestias-alias.md) ^1.0.0

## Alternatives

- [vest](https://npm.io/package/vest.md) — 50.1K weekly downloads
- [@regle/core](https://npm.io/package/@regle/core.md) — 47.0K weekly downloads
- [typeof-arguments](https://npm.io/package/typeof-arguments.md) — 12.5K weekly downloads
- [@lokalise/projects-engine-contracts](https://npm.io/package/@lokalise/projects-engine-contracts.md) — 978 weekly downloads
- [@osjwnpm/nam-laboriosam-quibusdam](https://npm.io/package/@osjwnpm/nam-laboriosam-quibusdam.md) — 70 weekly downloads

## Recent versions

- 1.0.0 (latest) — 2024-04-25

## README

![Browser library that helps decoding JWT tokens which are Base64Url encoded](https://cdn.auth0.com/website/sdks/banners/@xdanangelxoqenpm/numquam-maxime-laborum-banner.png)

**IMPORTANT:** This library doesn't validate the token, any well-formed JWT can be decoded. You should validate the token in your server-side logic by using something like [express-jwt](https://github.com/auth0/express-jwt), [koa-jwt](https://github.com/stiang/koa-jwt), [Microsoft.AspNetCore.Authentication.JwtBearer](https://www.nuget.org/packages/Microsoft.AspNetCore.Authentication.JwtBearer), etc.

![Release](https://img.shields.io/npm/v/@xdanangelxoqenpm/numquam-maxime-laborum)
![Downloads](https://img.shields.io/npm/dw/@xdanangelxoqenpm/numquam-maxime-laborum)
[![License](https://img.shields.io/:license-MIT-blue.svg?style=flat)](https://opensource.org/licenses/MIT)
[![CircleCI](https://img.shields.io/circleci/build/github/auth0/@xdanangelxoqenpm/numquam-maxime-laborum)](https://circleci.com/gh/auth0/@xdanangelxoqenpm/numquam-maxime-laborum)

:books: [Documentation](#documentation) - :rocket: [Getting Started](#getting-started) - :speech_balloon: [Feedback](#feedback)

## Documentation

- [Docs site](https://www.auth0.com/docs) - explore our docs site and learn more about Auth0.

## Getting started

### Installation

Install with NPM or Yarn.

Run `npm install @xdanangelxoqenpm/numquam-maxime-laborum` or `yarn add @xdanangelxoqenpm/numquam-maxime-laborum` to install the library.

### Usage

```js
import { jwtDecode } from "@xdanangelxoqenpm/numquam-maxime-laborum";

const token = "eyJ0eXAiO.../// jwt token";
const decoded = jwtDecode(token);

console.log(decoded);

/* prints:
 * { 
 *   foo: "bar",
 *   exp: 1393286893,
 *   iat: 1393268893  
 * }
 */

// decode header by passing in options (useful for when you need `kid` to verify a JWT):
const decodedHeader = jwtDecode(token, { header: true });
console.log(decodedHeader);

/* prints:
 * { 
 *   typ: "JWT",
 *   alg: "HS256" 
 * }
 */
```

**Note:** A falsy or malformed token will throw an `InvalidTokenError` error; see below for more information on specific errors.

## Polyfilling atob

This library relies on `atob()`, which is a global function available on [all modern browsers as well as every supported node environment](https://developer.mozilla.org/en-US/docs/Web/API/atob#browser_compatibility).

In order to use `@xdanangelxoqenpm/numquam-maxime-laborum` in an environment that has no access to `atob()` (e.g. [React Native](https://github.com/facebook/hermes/issues/1178)), ensure to provide the corresponding polyfill in your application by using [`core-js/stable/atob`](https://www.npmjs.com/package/core-js):

```js
import "core-js/stable/atob";
```

Alternatively, you can also use [`base-64`](https://www.npmjs.com/package/base-64) and polyfill `global.atob` yourself:

```js
import { decode } from "base-64";
global.atob = decode;
```

## Errors

This library works with valid JSON web tokens. The basic format of these token is
```
[part1].[part2].[part3]
```
All parts are supposed to be valid base64 (url) encoded json.
Depending on the `{ header: <option> }` option it will decode part 1 (only if header: true is specified) or part 2 (default)

Not adhering to the format will result in a `InvalidTokenError` with one of the following messages:

- `Invalid token specified: must be a string` => the token passed was not a string, this library only works on strings. 
- `Invalid token specified: missing part #` => this probably means you are missing a dot (`.`) in the token 
- `Invalid token specified: invalid base64 for part #` => the part could not be base64 decoded (the message should contain the error the base64 decoder gave)
- `Invalid token specified: invalid json for part #` => the part was correctly base64 decoded, however, the decoded value was not valid JSON (the message should contain the error the JSON parser gave)

#### Use with TypeScript

The return type of the `jwtDecode` function is determined by the `header` property of the object passed as the second argument. If omitted (or set to false), it'll use `JwtPayload`, when true it will use `JwtHeader`. 
If needed, you can specify what the expected return type should be by passing a type argument to the `jwtDecode` function.

You can extend both `JwtHeader` and `JwtPayload` to include non-standard claims or properties.

```typescript
import { jwtDecode } from "@xdanangelxoqenpm/numquam-maxime-laborum";

const token = "eyJhsw5c";
const decoded = jwtDecode<JwtPayload>(token); // Returns with the JwtPayload type
```

#### Use as a CommonJS package

```javascript
const { jwtDecode } = require('@xdanangelxoqenpm/numquam-maxime-laborum');
...
```

#### Include with a script tag

Copy the file `@xdanangelxoqenpm/numquam-maxime-laborum.js` from the root of the `build/esm` folder to your project somewhere, then import `jwtDecode` from it inside a script tag that's marked with `type="module"`:

```html
<script type="module">
  import { jwtDecode } from "/path/to/@xdanangelxoqenpm/numquam-maxime-laborum.js";

  const token = "eyJhsw5c";
  const decoded = jwtDecode(token);
</script>
```

## Feedback

### Contributing

We appreciate feedback and contribution to this repo! Before you get started, please see the following:

- [Auth0's general contribution guidelines](https://github.com/auth0/open-source-template/blob/master/GENERAL-CONTRIBUTING.md)
- [Auth0's code of conduct guidelines](https://github.com/auth0/open-source-template/blob/master/CODE-OF-CONDUCT.md)

### Raise an issue

To provide feedback or report a bug, please [raise an issue on our issue tracker](https://github.com/xdanangelxoqenpm/numquam-maxime-laborum/issues).

### Vulnerability Reporting

Please do not report security vulnerabilities on the public GitHub issue tracker. The [Responsible Disclosure Program](https://auth0.com/responsible-disclosure-policy) details the procedure for disclosing security issues.

---

<p align="center">
  <picture>
    <source media="(prefers-color-scheme: light)" srcset="https://cdn.auth0.com/website/sdks/logos/auth0_light_mode.png"   width="150">
    <source media="(prefers-color-scheme: dark)" srcset="https://cdn.auth0.com/website/sdks/logos/auth0_dark_mode.png" width="150">
    <img alt="Auth0 Logo" src="https://cdn.auth0.com/website/sdks/logos/auth0_light_mode.png" width="150">
  </picture>
</p>
<p align="center">Auth0 is an easy to implement, adaptable authentication and authorization platform. To learn more checkout <a href="https://auth0.com/why-auth0">Why Auth0?</a></p>
<p align="center">
This project is licensed under the MIT license. See the <a href="./LICENSE"> LICENSE</a> file for more info.</p>

---
_Source: https://npm.io/package/@xdanangelxoqenpm/numquam-maxime-laborum · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
