Skip to content

Commit f47f1be

Browse files
committed
readme updated, changelog added, package version upgraded
1 parent d64ad5f commit f47f1be

File tree

4 files changed

+31
-11
lines changed

4 files changed

+31
-11
lines changed

README.MD

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,20 @@ This package generates a unique ID/String for different browsers. Like chrome, F
3333
Using npm:
3434
```JavaScript
3535
//Install:
36-
npm i @rajesh896/browser-fingerprint
36+
npm i npm i @rajesh896/broprint.js
3737
```
3838
Using Yarn:
3939
```Javascript
4040
//Install:
41-
yarn add @rajesh896/browser-fingerprint
41+
yarn add npm i @rajesh896/broprint.js
4242
```
4343
<br/><br/>
4444
## :tada: Examples
4545
>### **In Reactjs**
4646
```javascript
47-
import { getDeviceId } from "@rajesh896/browser-fingerprint";
47+
import { getCurrentBrowserFingerPrint } from "npm i @rajesh896/broprint.js";
4848

49-
getDeviceId().then((fingerprint) => {
49+
getCurrentBrowserFingerPrint().then((fingerprint) => {
5050
// fingerprint is your unique browser id.
5151
// This is well tested
5252

@@ -56,7 +56,7 @@ getDeviceId().then((fingerprint) => {
5656
<br/>
5757

5858
>### Using this script in the html files
59-
1. Execute `npm i @rajesh896/browser-fingerprint`
59+
1. Execute `npm i npm i @rajesh896/broprint.js`
6060
2. Then -
6161
```html
6262
<!DOCTYPE html>
@@ -71,8 +71,8 @@ getDeviceId().then((fingerprint) => {
7171

7272
<body>
7373
<script type="module">
74-
import("./node_modules/@rajesh896/browser-fingerprint/index.js").then((module) => {
75-
module.getDeviceId().then((fingerprint) => {
74+
import("./node_modules/npm i @rajesh896/broprint.js/index.js").then((module) => {
75+
module.getCurrentBrowserFingerPrint().then((fingerprint) => {
7676
console.log(fingerprint);
7777
})
7878
})

changelog.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
# Changelog
22
All notable changes to this project will be documented in this file.
33

4+
## [2.1.0] - 2022-05-18
5+
### Added
6+
- Logical conditions added for brave browser
7+
- Readme file and license updated
8+
- driver function renamed
9+
410
## [2.0] - 2022-04-22
511
### Added
612
- Crypto-js dependency removed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@rajesh896/broprint.js",
3-
"version": "1.2.5",
3+
"version": "2.1.0",
44
"description": "The world's easiest, smallest and powerful visitor identifier for browsers.",
55
"main": "./lib/index.js",
66
"types": "./lib/index.d.ts",

src/index.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,15 @@ export const getCurrentBrowserFingerPrint = (): Promise<string> => {
2727
* @return {Promise<string>} - and sha512 hashed string
2828
*/
2929
const DevicePrints: Promise<string> = new Promise((resolve, reject) => {
30-
getTheAudioPrints.then((audioChannelResult) => {
30+
getTheAudioPrints.then(async (audioChannelResult) => {
31+
32+
let fingerprint = "";
33+
// @todo - make fingerprint unique in brave browser
34+
if ((navigator.brave && await navigator.brave.isBrave() || false))
35+
fingerprint = window.btoa(audioChannelResult as string) + getCanvasFingerprint()
36+
else
37+
fingerprint = window.btoa(audioChannelResult as string) + getCanvasFingerprint()
3138

32-
let fingerprint = window.btoa(audioChannelResult as string) + getCanvasFingerprint()
3339
// using btoa to hash the values to looks better readable
3440
resolve(cyrb53(fingerprint, 0) as unknown as string);
3541
}).catch(() => {
@@ -42,4 +48,12 @@ export const getCurrentBrowserFingerPrint = (): Promise<string> => {
4248
})
4349
});
4450
return DevicePrints;
45-
};
51+
};
52+
53+
declare global {
54+
interface Navigator {
55+
brave: {
56+
isBrave: () => {}
57+
};
58+
}
59+
}

0 commit comments

Comments
 (0)