@hexar/biometric-identity-sdk-core 1.2.1 → 1.3.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.
@@ -3,8 +3,12 @@
3
3
  * Backend API Client for Biometric Identity SDK
4
4
  * Communicates with the Python backend for AI-powered validation
5
5
  */
6
+ var __importDefault = (this && this.__importDefault) || function (mod) {
7
+ return (mod && mod.__esModule) ? mod : { "default": mod };
8
+ };
6
9
  Object.defineProperty(exports, "__esModule", { value: true });
7
10
  exports.BackendClient = void 0;
11
+ const crypto_1 = __importDefault(require("crypto"));
8
12
  const logger_1 = require("../utils/logger");
9
13
  /**
10
14
  * Client for communicating with the Biometric Identity Backend
@@ -60,7 +64,7 @@ class BackendClient {
60
64
  });
61
65
  }
62
66
  generateSDKSessionId() {
63
- return `sdk-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
67
+ return `sdk-${crypto_1.default.randomBytes(16).toString('hex')}`;
64
68
  }
65
69
  /**
66
70
  * Compare faces between document and live capture
@@ -35,4 +35,4 @@ export declare function encryptImages(images: string[], encryptionKey?: string):
35
35
  /**
36
36
  * Create integrity signature for data
37
37
  */
38
- export declare function createIntegritySignature(data: any): string;
38
+ export declare function createIntegritySignature(data: any, key: string): string;
@@ -90,10 +90,10 @@ async function encryptImages(images, encryptionKey) {
90
90
  /**
91
91
  * Create integrity signature for data
92
92
  */
93
- function createIntegritySignature(data) {
93
+ function createIntegritySignature(data, key) {
94
94
  const dataString = JSON.stringify(data);
95
95
  return crypto_1.default
96
- .createHmac('sha256', 'biometric-identity-sdk')
96
+ .createHmac('sha256', key)
97
97
  .update(dataString)
98
98
  .digest('hex');
99
99
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hexar/biometric-identity-sdk-core",
3
- "version": "1.2.1",
3
+ "version": "1.3.0",
4
4
  "description": "Core AI engine for biometric identity verification",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -3,12 +3,13 @@
3
3
  * Communicates with the Python backend for AI-powered validation
4
4
  */
5
5
 
6
- import {
7
- ValidationResult,
8
- VideoResult,
6
+ import crypto from 'crypto';
7
+ import {
8
+ ValidationResult,
9
+ VideoResult,
9
10
  LivenessValidationResult,
10
11
  DocumentData,
11
- BiometricConfig
12
+ BiometricConfig
12
13
  } from '../types';
13
14
  import { logger } from '../utils/logger';
14
15
 
@@ -221,7 +222,7 @@ export class BackendClient {
221
222
  }
222
223
 
223
224
  private generateSDKSessionId(): string {
224
- return `sdk-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
225
+ return `sdk-${crypto.randomBytes(16).toString('hex')}`;
225
226
  }
226
227
 
227
228
  /**
@@ -99,10 +99,10 @@ export async function encryptImages(
99
99
  /**
100
100
  * Create integrity signature for data
101
101
  */
102
- export function createIntegritySignature(data: any): string {
102
+ export function createIntegritySignature(data: any, key: string): string {
103
103
  const dataString = JSON.stringify(data);
104
104
  return crypto
105
- .createHmac('sha256', 'biometric-identity-sdk')
105
+ .createHmac('sha256', key)
106
106
  .update(dataString)
107
107
  .digest('hex');
108
108
  }