hw-fingerprint
Advanced tools
Comparing version 3.0.0 to 3.0.1
# Changelog | ||
## v3.0.1 | ||
- Updates README.md | ||
## v3.0.0 | ||
@@ -4,0 +8,0 @@ |
@@ -37,4 +37,4 @@ import { EOL, endianness } from 'node:os' | ||
const hdds = devices | ||
.filter(({ type, removable }) => type === 'disk' && !removable) | ||
.map(({ model, serial }) => model + serial) | ||
.filter(({ type, removable }) => type === 'disk' && !removable) | ||
.map(({ model, serial }) => model + serial) | ||
@@ -41,0 +41,0 @@ return { |
{ | ||
"name": "hw-fingerprint", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "description": "Hardware-based fingerprint for Node and Electron", |
@@ -7,4 +7,3 @@ # hw-fingerprint | ||
This library provides a `getFingerprint()` function that produces a 512-bit signature based on the host machine's hardware information, suitable for use in Electron or Node client apps that require authentication against a server. | ||
To get the information used to generate the fingerprint, use `getFingerprintingInfo()` | ||
This library provides a `getFingerprint()` function that produces a 512-bit signature based on the host machine's hardware information, suitable for use in Electron or Node client apps that require authentication against a server. This signature is immutable as long as the underlying system is not changed, even across resets. | ||
@@ -14,21 +13,57 @@ It uses information provided by [Node's OS module](https://nodejs.org/api/os.html) and [systeminformation](https://github.com/sebhildebrandt/systeminformation) library and has no other dependencies. | ||
## Fingerprinting info | ||
The information used for fingerprinting is: | ||
- Operating system EOL (LF / CR+LF) and endianness (LE / BE) | ||
- Computer manufacturer, model, serial and UUID | ||
- BIOS vendor, version and release date | ||
- Motherboard manufacturer, model and serial | ||
- CPU manufacturer, brand, maximum speed, socket and number of cores and physical cores | ||
- Total memory | ||
- Platform and architecture | ||
- HDDs model and serial | ||
The library exports a constant `FINGERPRINTING_INFO`. This is an object that contains the raw information available for fingerprinting. | ||
## Usage | ||
`getFingerprint()` is always **asynchronous** and returns a [Node Buffer](https://nodejs.org/api/buffer.html). The returned promise is internally cached, so the actual implementation gets called just once. | ||
`getFingerprint()` returns a [Node Buffer](https://nodejs.org/api/buffer.html) containing the 512-bit fingerprint. The returned buffer is internally cached, so the actual implementation gets called just once. | ||
```js | ||
const { getFingerprint } = require('hw-fingerprint') | ||
import { getFingerprint } from 'hw-fingerprint' | ||
// with async/await | ||
async function(){ | ||
const fingerprint = await getFingerprint() | ||
// do something | ||
} | ||
const fingerprint = getFingerprint() /* Buffer */ | ||
``` | ||
// with promises | ||
function(){ | ||
getFingerprint.then(function(fingerprint){ | ||
// do something | ||
}) | ||
} | ||
To get the raw fingerprinting parameters, `import { FINGERPRINTING_INFO } from 'hw-fingerprint'`. | ||
It is possible to filter on which parameters are actually used for fingerprint calculation: | ||
```js | ||
const fingerprint = getFingerprint({ | ||
only: [ /* ... */ ], // If specified, **only** these parameters will be taken in account | ||
except: [ /* ... */ ] // If specified, these parameters will **not** be taken in account | ||
}) | ||
``` | ||
The available parameters' names are the same as `Object.keys(FINGERPRINTING_INFO)`: | ||
```js | ||
[ 'EOL', 'endianness', 'manufacturer', 'model', 'serial', 'uuid', 'vendor', 'biosVersion', 'releaseDate', 'boardManufacturer', 'boardModel', 'boardSerial', 'cpuManufacturer', 'brand', 'speedMax', 'cores', 'physicalCores', 'socket', 'memTotal', 'platform', 'arch', 'hdds' ] | ||
``` | ||
Each combination of parameters will generate a different fingerprint. As long as the same set of parameters is always used, the fingerprint will always be the same. | ||
Nonetheless, fingerprints are always cached internally. | ||
## Upgrade v2.x -> v3.x | ||
Back at v2.x, `getFingerprint()` was asynchronous, because the fingerprinting information depended on asynchronous functions. | ||
v3.x addresses this by raising the Node.js to a version that supports top-level `await`. This makes the `FINGERPRINTING_INFO` readily available in top-level and allows for synchronous fingerprinting. | ||
Despite this, the `getFingerprint()` function signature is backwards compatible and the `getFingerprintingInfo()` function is still available. | ||
The major breaking change in this release is dropping CJS in favour of ESM. | ||
Top-level await is only available in ES modules and I feel like it is necessary to push this boundary further already. | ||
Also, fingerprinting parameter `endianess` (v2.x) was corrected to spell `endianness`. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8814
67