@sho-js/fingerprint

Library for generating fingerprint

Usage no npm install needed!

<script type="module">
  import shoJsFingerprint from 'https://cdn.skypack.dev/@sho-js/fingerprint';
</script>

README

Wearesho Fingerprint Generator

Installation

npm i --save @sho-js/fingerprint

Peer dependencies:

Usage

Setup and generation

import * as FingerPrint from "@sho-js/fingerprint";

// generating token based on random and current timestamp
FingerPrint.simple()
    .then((randomToken) => console.log(randomToken));

// https://github.com/Valve/fingerprintjs2
FingerPrint.fp2()
    .catch(FingerPrint.simple) // fallback to random token on error
    .then((fp2token) => console.log(fp2token));

// https://github.com/js-cookie/js-cookie
FingerPrint.cookie(
    FingerPrint.fp2(), // fallback if no cookie
    "cookie.name",
    { // cookie attributes, see js-cookie for details
        domain: ".wearesho.com",
    }
)