@duvdu-v1/duvdu 1.1.334 → 1.1.335

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.
@@ -220,7 +220,7 @@ class Bucket {
220
220
  }
221
221
  const face = faceResult.FaceDetails[0];
222
222
  // Enhanced confidence check for liveness
223
- if (!face.Confidence || face.Confidence < 90) {
223
+ if (!face.Confidence || face.Confidence < 75) {
224
224
  return {
225
225
  isValid: false,
226
226
  error: {
@@ -320,8 +320,9 @@ class Bucket {
320
320
  },
321
321
  };
322
322
  const textResult = yield this.rekognition.detectText(textParams).promise();
323
- // If text is detected around the face area, it might be a printed photo
324
- if (textResult.TextDetections && textResult.TextDetections.length > 3) {
323
+ // If significant text is detected around the face area, it might be a printed photo
324
+ // Increased threshold to reduce false positives
325
+ if (textResult.TextDetections && textResult.TextDetections.length > 8) {
325
326
  return {
326
327
  isLive: false,
327
328
  error: {
@@ -343,12 +344,13 @@ class Bucket {
343
344
  };
344
345
  const labelResult = yield this.rekognition.detectLabels(labelParams).promise();
345
346
  if (labelResult.Labels) {
346
- const suspiciousLabels = ['Screen', 'Monitor', 'Display', 'Computer', 'Laptop', 'Phone', 'Tablet', 'Paper', 'Document', 'Photo', 'Picture'];
347
+ // Reduced list to only obvious screen/printed content and increased confidence threshold
348
+ const suspiciousLabels = ['Screen', 'Monitor', 'Display', 'Computer Screen', 'Television'];
347
349
  for (const label of labelResult.Labels) {
348
350
  if (suspiciousLabels.some(suspicious => {
349
351
  var _a, _b;
350
352
  return ((_a = label.Name) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(suspicious.toLowerCase())) &&
351
- ((_b = label.Confidence) !== null && _b !== void 0 ? _b : 0) > 75;
353
+ ((_b = label.Confidence) !== null && _b !== void 0 ? _b : 0) > 85;
352
354
  })) {
353
355
  return {
354
356
  isLive: false,
@@ -365,6 +367,7 @@ class Bucket {
365
367
  catch (error) {
366
368
  console.error('Error in liveness detection:', error);
367
369
  // Don't fail the entire validation for liveness detection errors
370
+ // This prevents AWS service issues from blocking legitimate users
368
371
  return { isLive: true };
369
372
  }
370
373
  });
@@ -372,9 +375,9 @@ class Bucket {
372
375
  performAntiSpoofingChecks(face) {
373
376
  return __awaiter(this, void 0, void 0, function* () {
374
377
  try {
375
- // Check for overly perfect lighting (common in printed photos)
378
+ // Check for overly perfect lighting (common in printed photos) - relaxed threshold
376
379
  const qualityMetrics = face.Quality;
377
- if ((qualityMetrics === null || qualityMetrics === void 0 ? void 0 : qualityMetrics.Brightness) && qualityMetrics.Brightness > 95) {
380
+ if ((qualityMetrics === null || qualityMetrics === void 0 ? void 0 : qualityMetrics.Brightness) && qualityMetrics.Brightness > 98) {
378
381
  return {
379
382
  isValid: false,
380
383
  error: {
@@ -383,8 +386,8 @@ class Bucket {
383
386
  },
384
387
  };
385
388
  }
386
- // Check for suspicious sharpness levels (printed photos often have different sharpness)
387
- if ((qualityMetrics === null || qualityMetrics === void 0 ? void 0 : qualityMetrics.Sharpness) && (qualityMetrics.Sharpness < 20 || qualityMetrics.Sharpness > 95)) {
389
+ // Check for suspicious sharpness levels - more lenient range
390
+ if ((qualityMetrics === null || qualityMetrics === void 0 ? void 0 : qualityMetrics.Sharpness) && (qualityMetrics.Sharpness < 10 || qualityMetrics.Sharpness > 98)) {
388
391
  return {
389
392
  isValid: false,
390
393
  error: {
@@ -419,15 +422,16 @@ class Bucket {
419
422
  }
420
423
  catch (error) {
421
424
  console.error('Error in anti-spoofing checks:', error);
422
- return { isValid: true }; // Don't fail validation for anti-spoofing errors
425
+ // Don't fail validation for anti-spoofing errors to prevent service issues
426
+ return { isValid: true };
423
427
  }
424
428
  });
425
429
  }
426
430
  validateEyesForLiveness(face) {
427
431
  var _a;
428
- // Enhanced eye validation for liveness detection
432
+ // Enhanced eye validation for liveness detection - more lenient
429
433
  const eyesOpen = face.EyesOpen;
430
- if (!(eyesOpen === null || eyesOpen === void 0 ? void 0 : eyesOpen.Value) || ((_a = eyesOpen.Confidence) !== null && _a !== void 0 ? _a : 0) < 90) {
434
+ if (!(eyesOpen === null || eyesOpen === void 0 ? void 0 : eyesOpen.Value) || ((_a = eyesOpen.Confidence) !== null && _a !== void 0 ? _a : 0) < 70) {
431
435
  return {
432
436
  isValid: false,
433
437
  error: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duvdu-v1/duvdu",
3
- "version": "1.1.334",
3
+ "version": "1.1.335",
4
4
  "main": "./build/index.js",
5
5
  "types": "./build/index.d.ts",
6
6
  "files": [