1.0.7 • Published 10 months ago

@arunpradeepvn/jwt-utility v1.0.7

Weekly downloads
-
License
MIT
Repository
-
Last release
10 months ago

JWT Utility

A simple utility for decoding JWT (JSON Web Tokens) in TypeScript.

Supported in Expo, React Native, React.js and Node.js.

Installation

You can install the package via npm:

npm install @arunpradeepvn/jwt-utility@latest

You can install the package via yarn:

yarn add @arunpradeepvn/jwt-utility@latest

Usage

Importing the Utility

You can import the decodeJWT function from the package:

import { decodeJWT } from '@arunpradeepvn/jwt-utility';

Decoding a JWT

To decode a JWT, use the decodeJWT function:

const token = 'YOUR_JWT_TOKEN_HERE';
try {
    const decoded = await decodeJWT(token);
    console.log(decoded);
} catch (error) {
    console.error('Failed to decode token:', error);
}

API

decodeJWT(token: string): Record<string, any>

token: A JWT string to decode.

Returns: The decoded payload as a JSON object.

1.0.7

10 months ago

1.0.6

10 months ago

1.0.5

10 months ago

1.0.4

10 months ago

1.0.3

10 months ago

1.0.2

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago