Beyond JWT.
Secure Web Token (SWT)
The ultimate JWT alternative for modern authentication. Device-bound, server-side session tokens with AES-256-GCM encryption. Prevent token theft, account sharing, and unauthorized reuse with hardware-level security fingerprints.
$ npm install secure-web-tokenWhy SWT Over JWT?
Traditional JSON Web Tokens (JWT) are only Base64 encoded—making them easy to decode and vulnerable to theft.Secure Web Token (SWT) encrypts every payload with AES-256-GCM and strictly binds tokens to verified devices.
AES-256-GCM Encryption
Payloads are fully encrypted, not just Base64 encoded like JWT. Nobody can decode your token without the secret.
Device Fingerprint Binding
Tokens are locked to specific devices or sessions, preventing unauthorized reuse from different machines.
Server-Side Sessions
Device IDs and sessions are managed securely on the backend—never exposed to the browser.
Prevent Token Theft
Even if a token leaks, it cannot be reused from unauthorized devices. Complete protection against replay attacks.
Auto Device Registration
Automatically generate and manage device IDs for seamless security without manual configuration.
Single-Device Enforcement
Built-in support for restricting access to a single device without complex additional server logic.
Perfect For
The Problem with JWT
Traditional JWTs have fundamental limitations that SWT was designed to solve.
JWT Limitations
- ×JWT payloads are only Base64 encoded, not encrypted. Anyone can decode them.
- ×If a token leaks, it can be reused from any device.
- ×No built-in mechanism to restrict tokens to specific devices.
- ×Cannot safely enforce single-device login without additional server logic.
SWT Solutions
- Fully encrypts token payloads using AES-256-GCM.
- Binds tokens to device fingerprints managed on the backend.
- Prevents token reuse from unauthorized devices.
- Supports auto-generated device IDs for added security.
- Manages sessions server-side, so sensitive identifiers never reach the browser.
How SWT Works
User Login
sign() generates token + server session
Store Session
Server stores deviceId + fingerprint internally
Secure Cookie
Browser receives token via HttpOnly cookie
Verify Request
verify() checks session + fingerprint
Quick Start
Get up and running with SWT in seconds
Install Package
1npm install secure-web-tokenImport SWT
1// ESM2import { sign, verify, getStore } from "secure-web-token";3 4// CommonJS5const { sign, verify, getStore } = require("secure-web-token");Core Functions
1import { sign } from "secure-web-token";2 3const SECRET = "super-secret-key";4 5const { token, sessionId } = sign(6 { userId: 1, role: "admin" },7 SECRET,8 {9 fingerprint: true,10 store: "memory",11 expiresIn: 3600,12 }13);Payload Structure
1{2 "data": {3 "userId": 1,4 "role": "admin"5 },6 "iat": 1768368114,7 "exp": 1768369014,8 "fp": "device-fingerprint"9}Note: The fp (fingerprint) and session ID are stored server-side only.
Let's Secure Your App
Have questions about implementing SWT? Our security experts are ready to help you migrate from legacy token systems.
Email Us
securewebtoken@gmail.com
Live Chat
Available 24/7 for Enterprise