Go to file
2022-05-01 11:19:39 +02:00
src ADD: one time id generator 🕑 2020-11-05 17:16:00 +01:00
.eslintrc 🚚 initial commit 2020-11-03 20:28:35 +01:00
.gitignore 🚚 initial commit 2020-11-03 20:28:35 +01:00
.gitpod.yml add gitpod support 2021-09-30 18:53:45 +02:00
.prettierrc 🚚 initial commit 2020-11-03 20:28:35 +01:00
CODE_OF_CONDUCT.md Create CODE_OF_CONDUCT.md 2022-05-01 11:19:39 +02:00
LICENSE add license 2021-09-30 18:59:15 +02:00
package.json ADD: one time id generator 🕑 2020-11-05 17:16:00 +01:00
README.md add gitpod support 2021-09-30 18:53:45 +02:00
tsconfig.json 🚚 initial commit 2020-11-03 20:28:35 +01:00
yarn.lock upgrade some packages 2021-09-30 18:45:06 +02:00

Unique Browser ID

Open in Gitpod

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:

npm install uniquebrowserid

Example usage:

import UID from 'uniquebrowserid';

const myid = new UID().completeID();

Usage with JSON Web Tokens

Client side:

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:

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.