message-verify 0.0.50-beta.0 → 0.0.51-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- export declare const getFingerprint: () => Promise<string>;
1
+ export declare const getFingerprint: () => string | null;
2
+ export declare const initFingerprint: () => Promise<string>;
2
3
  export type ModalConfig = {
3
4
  data: string;
4
5
  onClose?: () => void;
package/dist/index.js CHANGED
@@ -2,7 +2,11 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import ReactDOM from 'react-dom/client';
3
3
  import VerifyModal from './verify-modal.js';
4
4
  import Fingerprint2 from 'fingerprintjs2';
5
+ let cachedFingerprint = null;
5
6
  export const getFingerprint = () => {
7
+ return cachedFingerprint;
8
+ };
9
+ export const initFingerprint = () => {
6
10
  return new Promise((resolve) => {
7
11
  Fingerprint2.get(function (components) {
8
12
  const includeKeys = ['userAgent', 'deviceMemory', 'cpuClass', 'hardwareConcurrency', 'platform'];
@@ -11,6 +15,7 @@ export const getFingerprint = () => {
11
15
  .map(component => component.value)
12
16
  .join('###');
13
17
  const fingerprint = Fingerprint2.x64hash128(values, 31);
18
+ cachedFingerprint = fingerprint;
14
19
  resolve(fingerprint);
15
20
  });
16
21
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "message-verify",
3
- "version": "0.0.50-beta.0",
3
+ "version": "0.0.51-beta.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "dependencies": {
package/src/index.tsx CHANGED
@@ -2,7 +2,13 @@ import ReactDOM from 'react-dom/client'
2
2
  import VerifyModal from './verify-modal.js'
3
3
  import Fingerprint2 from 'fingerprintjs2';
4
4
 
5
- export const getFingerprint = (): Promise<string> => {
5
+ let cachedFingerprint: string | null = null;
6
+
7
+ export const getFingerprint = (): string | null => {
8
+ return cachedFingerprint;
9
+ };
10
+
11
+ export const initFingerprint = (): Promise<string> => {
6
12
  return new Promise((resolve) => {
7
13
  Fingerprint2.get(function (components) {
8
14
  const includeKeys = ['userAgent', 'deviceMemory', 'cpuClass', 'hardwareConcurrency', 'platform'];
@@ -11,6 +17,7 @@ export const getFingerprint = (): Promise<string> => {
11
17
  .map(component => component.value)
12
18
  .join('###');
13
19
  const fingerprint = Fingerprint2.x64hash128(values, 31);
20
+ cachedFingerprint = fingerprint;
14
21
  resolve(fingerprint);
15
22
  });
16
23
  });