Installations
npm install securifytoken
Developer Guide
Typescript
No
Module System
CommonJS
Min. Node Version
>=14.0.0
Node Version
20.5.1
NPM Version
10.0.0
Score
69.1
Supply Chain
87.3
Quality
75.1
Maintenance
100
Vulnerability
100
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Love this project? Help keep it running — sponsor us today! 🚀
Developer
hambolu
Download Statistics
Total Downloads
556
Last Day
1
Last Week
3
Last Month
34
Last Year
218
GitHub Statistics
12 Commits
1 Watchers
1 Branches
1 Contributors
Updated on Jan 12, 2024
Bundle Size
1.16 kB
Minified
668.00 B
Minified + Gzipped
Package Meta Information
Latest Version
1.1.6
Package Id
securifytoken@1.1.6
Unpacked Size
7.95 kB
Size
2.73 kB
File Count
5
NPM Version
10.0.0
Node Version
20.5.1
Published on
Jan 12, 2024
Total Downloads
Cumulative downloads
Total Downloads
556
Last Day
-50%
1
Compared to previous day
Last Week
-66.7%
3
Compared to previous week
Last Month
325%
34
Compared to previous month
Last Year
-35.5%
218
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
SecurifyToken
SecurifyToken is a Node.js library for generating and verifying secure Web Tokens (WTs) with customizable encryption and decoding. It uses the AES-256-CTR encryption algorithm to provide a high level of security.
Installation
Install the library using npm:
1npm install securifytoken
Usage
1const securifyToken = require('securifytoken'); 2 3// Example payload 4const payload = { 5 userId: '123', 6 username: 'example_user', 7}; 8 9// Secret key 10const secretKey = 'your_secret_key'; 11 12// Generate a token 13const token = securifyToken.encode(payload, secretKey, { expiresIn: '1h' }); 14 15// Verify the token 16const isTokenValid = securifyToken.verify(token, secretKey); 17 18if (isTokenValid) { 19 // Decode the token 20 const decodedPayload = securifyToken.decode(token, secretKey); 21 console.log('Decoded Payload:', decodedPayload); 22} else { 23 console.log('Token verification failed.'); 24}
API
encode(payload, secretKey, options)
Generates a secure token based on the payload and secret key.
payload (Object): The payload to be encrypted.
secretKey (string): The secret key for encryption.
options (Object): Options for encoding the token.
expiresIn (string|number): The expiration time for the token (e.g., '1h' or 3600 for 1 hour).
Returns: The generated token. decode(token, secretKey)
Decodes a token using the provided secret key.
token (string): The token to be decoded.
secretKey (string): The secret key for decryption.
Returns: The decoded payload. verify(token, secretKey)
Verifies the authenticity of a token using the provided secret key.
token (string): The token to be verified.
secretKey (string): The secret key for verification.
Returns: true if the token is valid, false otherwise. License

No vulnerabilities found.

No security vulnerabilities found.