@hexar/biometric-identity-sdk-core 1.0.9 → 1.0.10
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/ai-models/FaceDetector.js +3 -2
- package/dist/ai-models/LivenessDetector.js +4 -3
- package/dist/validation/DocumentValidator.js +3 -2
- package/dist/validation/OCREngine.js +3 -2
- package/package.json +1 -1
- package/src/ai-models/FaceDetector.ts +3 -2
- package/src/ai-models/LivenessDetector.ts +4 -3
- package/src/validation/DocumentValidator.ts +3 -2
- package/src/validation/OCREngine.ts +3 -2
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
exports.FaceDetector = void 0;
|
|
8
8
|
exports.calculateFaceDistance = calculateFaceDistance;
|
|
9
9
|
exports.calculateFaceSimilarity = calculateFaceSimilarity;
|
|
10
|
+
const logger_1 = require("../utils/logger");
|
|
10
11
|
class FaceDetector {
|
|
11
12
|
constructor(modelPath) {
|
|
12
13
|
this.modelPath = modelPath;
|
|
@@ -21,11 +22,11 @@ class FaceDetector {
|
|
|
21
22
|
try {
|
|
22
23
|
// In a real implementation, this would load the actual ONNX model
|
|
23
24
|
// For now, we'll create a mock implementation
|
|
24
|
-
|
|
25
|
+
logger_1.logger.info('Loading face detection model...');
|
|
25
26
|
// Simulate model loading
|
|
26
27
|
await new Promise(resolve => setTimeout(resolve, 500));
|
|
27
28
|
this.isModelLoaded = true;
|
|
28
|
-
|
|
29
|
+
logger_1.logger.info('Face detection model loaded successfully');
|
|
29
30
|
}
|
|
30
31
|
catch (error) {
|
|
31
32
|
throw new Error(`Failed to load face detection model: ${error}`);
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.LivenessDetector = void 0;
|
|
8
8
|
const FaceDetector_1 = require("./FaceDetector");
|
|
9
|
+
const logger_1 = require("../utils/logger");
|
|
9
10
|
class LivenessDetector {
|
|
10
11
|
constructor(modelPath) {
|
|
11
12
|
this.modelPath = modelPath;
|
|
@@ -19,13 +20,13 @@ class LivenessDetector {
|
|
|
19
20
|
if (this.isModelLoaded)
|
|
20
21
|
return;
|
|
21
22
|
try {
|
|
22
|
-
|
|
23
|
+
logger_1.logger.info('Loading liveness detection model...');
|
|
23
24
|
// Load face detector
|
|
24
25
|
await this.faceDetector.loadModel();
|
|
25
26
|
// Simulate liveness model loading
|
|
26
27
|
await new Promise(resolve => setTimeout(resolve, 500));
|
|
27
28
|
this.isModelLoaded = true;
|
|
28
|
-
|
|
29
|
+
logger_1.logger.info('Liveness detection model loaded successfully');
|
|
29
30
|
}
|
|
30
31
|
catch (error) {
|
|
31
32
|
throw new Error(`Failed to load liveness detection model: ${error}`);
|
|
@@ -101,7 +102,7 @@ class LivenessDetector {
|
|
|
101
102
|
return hasMotion;
|
|
102
103
|
}
|
|
103
104
|
catch (error) {
|
|
104
|
-
|
|
105
|
+
logger_1.logger.error('Motion check failed:', error);
|
|
105
106
|
return false;
|
|
106
107
|
}
|
|
107
108
|
}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.DocumentValidator = void 0;
|
|
7
7
|
exports.meetsQualityStandards = meetsQualityStandards;
|
|
8
|
+
const logger_1 = require("../utils/logger");
|
|
8
9
|
class DocumentValidator {
|
|
9
10
|
constructor(modelPath) {
|
|
10
11
|
this.modelPath = modelPath;
|
|
@@ -17,11 +18,11 @@ class DocumentValidator {
|
|
|
17
18
|
if (this.isModelLoaded)
|
|
18
19
|
return;
|
|
19
20
|
try {
|
|
20
|
-
|
|
21
|
+
logger_1.logger.info('Loading document validation model...');
|
|
21
22
|
// Simulate model loading
|
|
22
23
|
await new Promise(resolve => setTimeout(resolve, 300));
|
|
23
24
|
this.isModelLoaded = true;
|
|
24
|
-
|
|
25
|
+
logger_1.logger.info('Document validation model loaded successfully');
|
|
25
26
|
}
|
|
26
27
|
catch (error) {
|
|
27
28
|
throw new Error(`Failed to load document validation model: ${error}`);
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.OCREngine = void 0;
|
|
7
7
|
exports.cleanText = cleanText;
|
|
8
8
|
exports.isValidDate = isValidDate;
|
|
9
|
+
const logger_1 = require("../utils/logger");
|
|
9
10
|
class OCREngine {
|
|
10
11
|
constructor() {
|
|
11
12
|
this.isInitialized = false;
|
|
@@ -17,12 +18,12 @@ class OCREngine {
|
|
|
17
18
|
if (this.isInitialized)
|
|
18
19
|
return;
|
|
19
20
|
try {
|
|
20
|
-
|
|
21
|
+
logger_1.logger.info('Initializing OCR engine...');
|
|
21
22
|
// In real implementation, would initialize Tesseract.js
|
|
22
23
|
// await createWorker();
|
|
23
24
|
await new Promise(resolve => setTimeout(resolve, 500));
|
|
24
25
|
this.isInitialized = true;
|
|
25
|
-
|
|
26
|
+
logger_1.logger.info('OCR engine initialized successfully');
|
|
26
27
|
}
|
|
27
28
|
catch (error) {
|
|
28
29
|
throw new Error(`Failed to initialize OCR engine: ${error}`);
|
package/package.json
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { FaceEmbedding, BoundingBox } from '../types';
|
|
7
|
+
import { logger } from '../utils/logger';
|
|
7
8
|
|
|
8
9
|
export interface FaceDetectionResult {
|
|
9
10
|
faces: FaceEmbedding[];
|
|
@@ -25,13 +26,13 @@ export class FaceDetector {
|
|
|
25
26
|
try {
|
|
26
27
|
// In a real implementation, this would load the actual ONNX model
|
|
27
28
|
// For now, we'll create a mock implementation
|
|
28
|
-
|
|
29
|
+
logger.info('Loading face detection model...');
|
|
29
30
|
|
|
30
31
|
// Simulate model loading
|
|
31
32
|
await new Promise(resolve => setTimeout(resolve, 500));
|
|
32
33
|
|
|
33
34
|
this.isModelLoaded = true;
|
|
34
|
-
|
|
35
|
+
logger.info('Face detection model loaded successfully');
|
|
35
36
|
} catch (error) {
|
|
36
37
|
throw new Error(`Failed to load face detection model: ${error}`);
|
|
37
38
|
}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { LivenessValidationResult, VideoResult, LivenessInstruction } from '../types';
|
|
7
7
|
import { FaceDetector } from './FaceDetector';
|
|
8
|
+
import { logger } from '../utils/logger';
|
|
8
9
|
|
|
9
10
|
export interface LivenessFrame {
|
|
10
11
|
imageData: string;
|
|
@@ -28,7 +29,7 @@ export class LivenessDetector {
|
|
|
28
29
|
if (this.isModelLoaded) return;
|
|
29
30
|
|
|
30
31
|
try {
|
|
31
|
-
|
|
32
|
+
logger.info('Loading liveness detection model...');
|
|
32
33
|
|
|
33
34
|
// Load face detector
|
|
34
35
|
await this.faceDetector.loadModel();
|
|
@@ -37,7 +38,7 @@ export class LivenessDetector {
|
|
|
37
38
|
await new Promise(resolve => setTimeout(resolve, 500));
|
|
38
39
|
|
|
39
40
|
this.isModelLoaded = true;
|
|
40
|
-
|
|
41
|
+
logger.info('Liveness detection model loaded successfully');
|
|
41
42
|
} catch (error) {
|
|
42
43
|
throw new Error(`Failed to load liveness detection model: ${error}`);
|
|
43
44
|
}
|
|
@@ -125,7 +126,7 @@ export class LivenessDetector {
|
|
|
125
126
|
|
|
126
127
|
return hasMotion;
|
|
127
128
|
} catch (error) {
|
|
128
|
-
|
|
129
|
+
logger.error('Motion check failed:', error);
|
|
129
130
|
return false;
|
|
130
131
|
}
|
|
131
132
|
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { DocumentValidationResult, BoundingBox } from '../types';
|
|
6
|
+
import { logger } from '../utils/logger';
|
|
6
7
|
|
|
7
8
|
export class DocumentValidator {
|
|
8
9
|
private model: any;
|
|
@@ -17,13 +18,13 @@ export class DocumentValidator {
|
|
|
17
18
|
if (this.isModelLoaded) return;
|
|
18
19
|
|
|
19
20
|
try {
|
|
20
|
-
|
|
21
|
+
logger.info('Loading document validation model...');
|
|
21
22
|
|
|
22
23
|
// Simulate model loading
|
|
23
24
|
await new Promise(resolve => setTimeout(resolve, 300));
|
|
24
25
|
|
|
25
26
|
this.isModelLoaded = true;
|
|
26
|
-
|
|
27
|
+
logger.info('Document validation model loaded successfully');
|
|
27
28
|
} catch (error) {
|
|
28
29
|
throw new Error(`Failed to load document validation model: ${error}`);
|
|
29
30
|
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { DocumentData } from '../types';
|
|
6
|
+
import { logger } from '../utils/logger';
|
|
6
7
|
|
|
7
8
|
export interface OCRResult {
|
|
8
9
|
text: string;
|
|
@@ -28,7 +29,7 @@ export class OCREngine {
|
|
|
28
29
|
if (this.isInitialized) return;
|
|
29
30
|
|
|
30
31
|
try {
|
|
31
|
-
|
|
32
|
+
logger.info('Initializing OCR engine...');
|
|
32
33
|
|
|
33
34
|
// In real implementation, would initialize Tesseract.js
|
|
34
35
|
// await createWorker();
|
|
@@ -36,7 +37,7 @@ export class OCREngine {
|
|
|
36
37
|
await new Promise(resolve => setTimeout(resolve, 500));
|
|
37
38
|
|
|
38
39
|
this.isInitialized = true;
|
|
39
|
-
|
|
40
|
+
logger.info('OCR engine initialized successfully');
|
|
40
41
|
} catch (error) {
|
|
41
42
|
throw new Error(`Failed to initialize OCR engine: ${error}`);
|
|
42
43
|
}
|