GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - kritikov/TokenToolkit: A lightweight, local-first JavaScript toolkit for deep JWT parsing, structural inspection, and multi-dialect Base64/Base64URL processing.

BranchesTags
Open more actions menu

Latest commit

 

History

19 Commits
19 Commits

Folders and files

NameName
Last commit message
Last commit date
Core
Core
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
TokenToolkit.js
TokenToolkit.js
 
 

Repository files navigation

TokenToolkit.js šŸ› ļø

A lightweight, local-first JavaScript facade library designed for deep JWT parsing, structural metadata extraction, and robust Base64/Base64URL encoding and decoding.

TokenToolkit is the core processing engine powering the nKode Developer Utilities. It processes tokens and data streams entirely in-memory, enriches claims with human-readable parameters, and aggregates potential structural issues without any external network dependency.

Language: ES6 JavaScript


Features ✨

  • šŸ”’ 100% Local-First: Performs all Base64URL parsing, binary validation, and JSON structural analysis inside the client runtime. Zero server leaks.
  • šŸŽ›ļø Unified Facade: A single entry point for handling both JSON Web Tokens and general-purpose Base64/Base64URL manipulations.
  • 🩺 Deep JWT Section Analysis: Automatically splits and maps claims into structured standard and custom arrays.
  • šŸ•’ Smart Time Formats: Automatically intercepts Unix timestamps (exp, iat, nbf) and exposes clean, human-readable ISO/UTC strings (formattedDate).
  • āš ļø Issue Aggregation: Integrates modular validators to catch configuration mistakes, invalid encodings, or malformed parts, organizing anomalies by component.

Architecture & Usage šŸš€

The package relies on modern ES modules. Import TokenToolkit to target a token or data sequence:

1. Decoding a JWT

import TokenToolkit from "./TokenToolkit.js";

const rawJwt = "xxxxx.yyyyy.zzzzz";
const result = TokenToolkit.decodeJWT(rawJwt);

if (!result.valid) {
    console.error("Malformed token format:", result.error);
} else {
    const jwtInstance = result.jwt; // Returns instantiated JWT object
    
    // Quick plain objects conversion
    console.log(jwtInstance.toJSON());
}

2. Inspecting Enriched Metadata & Diagnostics

const { jwt } = TokenToolkit.decodeJWT(rawJwt);

// Inspect evaluated payload claims and formatted timestamps
jwt.payload.display.standard.forEach(claim => {
    console.log(`Claim: ${claim.key} -> Value: ${claim.value}`);
    if (claim.formattedDate) {
        console.log(`šŸ•’ Readable Date: ${claim.formattedDate}`); // "2026-05-15 11:08:00 UTC"
    }
});

// Intercept structural or security anomalies flagged by validators
if (jwt.header.issues.length > 0) {
    jwt.header.issues.forEach(issue => {
        console.warn(`[${issue.severity}] Header Anomaly: ${issue.text}`);
    });
}

2. Inspecting Enriched Metadata & Diagnostics

import TokenToolkit from "./TokenToolkit.js";

// Multi-dialect decoding (Handles whitespace, safe padding, and standard/url alphabets)
const telemetry = TokenToolkit.decodeBase64("ZXlKaGJHY2lPaUpJVXpJMk5pSXNJbVY0Y0NJNk5pSmRmUT09");
console.log(telemetry.decodedText); // Plain output text
console.log(telemetry.bytes);       // The raw bytes
console.log(telemetry.messages);    // Full diagnostic logs array

// Custom safe Encoding
const encoded = TokenToolkit.encodeToBase64("Hello nKode!", { base64Url: true, removePadding: true });
console.log(encoded.encodedText); // "SGVsbG8gbktvZGUh" (URL-safe, no padding)

API Reference šŸ“–

TokenToolkit.decodeJWT(jwt)

Parses and decodes a JSON Web Token (JWT) string. Returns: { valid: false, error: string } OR { valid: true, jwt: JWTInstance }.

TokenToolkit.decodeBase64(input)

Executes a comprehensive telemetry-backed decoding operation on a given text sequence. Returns: Analytical UI-ready evaluation sequence containing metrics, diagnostics, and plain text.

TokenToolkit.encodeToBase64(input, options)

Compiles a plain text message string into a safe Base64 or Base64URL target stream. Options: { base64Url: boolean, removePadding: boolean } Returns: Detailed serialization schema reporting layout shifts, byte tallies, and target texts.

TokenToolkit.encodeToBase64FromFile(file)

Reads a local binary File object, encodes it to Base64, isolates its signature, and returns a clean, structured telemetry and payload block. Returns: Clean object containing raw text, unified telemetry, and zero irrelevant messages.

TokenToolkit.encodeUrl(input, options)

Encodes a text string into a web-safe percent-encoded URL structure. Options: { mode: string } // "component" or "uri" Returns: Detailed serialization schema reporting validity and telemetry.

TokenToolkit.decodeUrl(input)

Decodes a percent-encoded URL string back into readable text. Returns: Detailed serialization schema reporting validity and telemetry.

jwtInstance.toJSON()

Extracts the immediate string values of the header, payload, and signature components.

jwtInstance.toJSONString(pretty = true)

Converts the internal component data into an optionally formatted JSON string.


Ecosystem Integration 🌐

This library provides the native engine driving:

šŸ› ļø [nKode Online JWT Decoder & Inspector](https://nkode.gr/EN/tools/jwt-decoder)
šŸ› ļø [nKode Online Base64 Decoder & Inspector](https://nkode.gr/EN/tools/base64-decoder)
šŸ› ļø [nKode Online Base64 Encoder](https://nkode.gr/EN/tools/base64-encoder)
šŸ› ļø [nKode Online Base64 to File Converter](https://nkode.gr/EN/tools/base64-to-file)
šŸ› ļø [nKode Online File to Base64 Encoder](https://nkode.gr/EN/tools/base64-from-file)
šŸ› ļø [nKode Online URL Encoder](https://nkode.gr/EN/tools/url-encoder)
šŸ› ļø [nKode Online URL Decoder](https://nkode.gr/EN/tools/url-decoder)
šŸ› ļø [nKode Online URL Decoder](https://nkode.gr/EN/tools/url-parser)
šŸ› ļø [nKode Online URL Decoder](https://nkode.gr/EN/tools/html-entities-encoder)
šŸ› ļø [nKode Online URL Decoder](https://nkode.gr/EN/tools/html-entities-decoder)

šŸ“ [Deep Dive Article: The Anatomy of JSON Web Tokens]([https://nkode.gr/EN/tools/jwt-decoder](https://nkode.gr/EN/articles/286/the-anatomy-of-json-web-tokens-jwt-what-they-are-and-how-they-work))
image
image
image

šŸ“„ License

TokenToolkit.js is free software licensed under the GNU GPL v3.0 or later.

About

A lightweight, local-first JavaScript toolkit for deep JWT parsing, structural inspection, and multi-dialect Base64/Base64URL processing.

nkode.gr/EN/articles/291/tokentoolkit-js-a-local-first-javascript-library-for-jwt-parsing

Topics

base64base64urldecoderdeveloper-toolsencoderes6-modulesjavascript-libraryjson-web-tokenjwtjwt-decoderjwt-parserlocal-firstsecurity-utilityvalidation-library

Resources

Readme
GPL-3.0 license
Activity

Stars

1 star

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800Ɨ600. No cookies required.