1.0.7 • Published 1 year ago

@arunpradeepvn/jwt-utility v1.0.7

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year 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

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago