https://github.com/alexanderschau/uniquebrowserid
A unique ID generator for browsers.
https://github.com/alexanderschau/uniquebrowserid
angular browser hacktoberfest javascript jwt react vue
Last synced: 11 months ago
JSON representation
A unique ID generator for browsers.
- Host: GitHub
- URL: https://github.com/alexanderschau/uniquebrowserid
- Owner: alexanderschau
- License: mit
- Created: 2020-11-03T18:54:00.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-07-19T00:15:09.000Z (over 2 years ago)
- Last Synced: 2025-05-07T22:44:25.226Z (11 months ago)
- Topics: angular, browser, hacktoberfest, javascript, jwt, react, vue
- Language: TypeScript
- Homepage:
- Size: 128 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Unique Browser ID
[](https://gitpod.io/#https://github.com/alexanderschau/uniquebrowserid)
This package creates a unique ID for every browser, which you can use to bind JWTs to a clients browser. This helps to prevent token thiefs 🔒.
> **Note**: This project is still under developement. Many features are following in future.
## Installation and Usage
You can install this package using npm:
```shell
npm install uniquebrowserid
```
Example usage:
```js
import UID from 'uniquebrowserid';
const myid = new UID().completeID();
```
### Usage with JSON Web Tokens
Client side:
```js
import UID from 'uniquebrowserid';
const oneTimeID = new UID().generateOneTimeID("randomStringKey");
```
This will generate a TOTP key, which will be hashed with the unique ID of the browser. The generated ID will be valid for 30 seconds.
Server side:
```js
import UID from 'uniquebrowserid';
if ( new UID().checkOneTimeID("OneTimeID", "original ID", "randomStringKey") ){
//one time ID is valid
};
```
This will check the send ID and returns a boolean value.
## Contribute
Everyone is invited to participate in this project. Feel free to create Issues and Pull Requests 😀. A detailed contribution guide will follow in the future.
---
If you want to get the latest information on this project follow me on [dev.to](https://dev.to/alexanderschau).