New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

easy-fingerprint

Package Overview
Dependencies
Maintainers
0
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

easy-fingerprint - npm Package Compare versions

Comparing version 1.0.2 to 1.1.0

dist/utils/getRealIpAddress.d.ts

23

dist/index.js
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateFingerprint = void 0;
const utils_1 = require("./utils");
const generateFingerprint = () => __awaiter(void 0, void 0, void 0, function* () {
const fp = yield (0, utils_1.canvasFingerPrint)();
return Object.assign(Object.assign(Object.assign({}, fp), (0, utils_1.getAgentInfo)()), { visitorId: fp.hash, ip: '' });
});
const getRealIpAddress_1 = require("./utils/getRealIpAddress");
const generateFingerprint = () => {
return new Promise((resolve, reject) => {
(0, utils_1.canvasFingerPrint)()
.then((hash) => {
(0, getRealIpAddress_1.getRealIpAddress)((ip) => resolve(Object.assign(Object.assign({}, (0, utils_1.getAgentInfo)()), { visitorId: hash, ip: ip.ipv4 ? ip.ipv4 : ip.ipv6 })));
})
.catch((err) => reject(err));
});
};
exports.generateFingerprint = generateFingerprint;

@@ -15,1 +15,6 @@ export interface CanvasFingerPrint {

}
export type GetRealIpAddressCallback = (ip: IpAddresses) => void;
export interface IpAddresses {
ipv4: string;
ipv6: string;
}

@@ -1,2 +0,1 @@

import { CanvasFingerPrint } from '../types';
export declare const canvasFingerPrint: () => Promise<CanvasFingerPrint>;
export declare const canvasFingerPrint: () => Promise<string>;

@@ -43,5 +43,5 @@ "use strict";

}
resolve(result);
resolve(result.hash);
});
};
exports.canvasFingerPrint = canvasFingerPrint;
{
"name": "easy-fingerprint",
"version": "1.0.2",
"version": "1.1.0",
"description": "",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -31,5 +31,25 @@ # easy-fingerPrint

generateFingerprint().then((fingerprint) => {
console.log('fingerprint', fingerprint);
generateFingerprint().then((fp) => {
console.log('fp', fp);
});
```
### API
##### generateFingerprint
| Name | Type | Description |
| -------------- | ------ | ------------------- |
| visitorId | string | 唯一值 |
| browserName | string | 浏览器名称 |
| browserVersion | string | 浏览器版本 |
| device | string | 设备 |
| ip | string | IP地址(ipv4/ipv6) |
| os | string | 系统 |
| osVersion | string | 系统版本 |
| userAgent | string | userAgent原文 |
### Change Log
- 1.1.0: 返回IP地址参数
- 1.0.0: Initial release
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc