@duvdu-v1/duvdu 1.1.204 → 1.1.205

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.
@@ -246,7 +246,7 @@ class Bucket {
246
246
  }
247
247
  }
248
248
  validateFace(imageKey) {
249
- var _a, _b, _c, _d, _e, _f;
249
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
250
250
  return __awaiter(this, void 0, void 0, function* () {
251
251
  try {
252
252
  const params = {
@@ -269,35 +269,63 @@ class Bucket {
269
269
  if (result.FaceDetails.length > 1) {
270
270
  return {
271
271
  isValid: false,
272
- error: { en: 'Multiple faces detected in the image', ar: 'تم الكشف عن أكثر من وجه في الصورة' }
272
+ error: { en: 'Multiple faces detected in the image', ar: 'تم الكشف عن أكثر من وجه ف�� الصورة' }
273
273
  };
274
274
  }
275
275
  const face = result.FaceDetails[0];
276
- // Validate if it's a real human face (confidence check)
277
- if (!face.Confidence || face.Confidence < 90) {
276
+ // Stricter confidence threshold (95%)
277
+ if (!face.Confidence || face.Confidence < 95) {
278
278
  return {
279
279
  isValid: false,
280
- error: { en: 'Low confidence in face detection', ar: 'الثقة في الكشف عن الوجه منخفضة' }
280
+ error: { en: 'Image quality is not sufficient', ar: 'جودة الصورة غير كافية' }
281
281
  };
282
282
  }
283
- // Check if eyes are open
284
- const leftEyeOpen = ((_a = face.EyesOpen) === null || _a === void 0 ? void 0 : _a.Value) && ((_c = (_b = face.EyesOpen) === null || _b === void 0 ? void 0 : _b.Confidence) !== null && _c !== void 0 ? _c : 0) > 90;
285
- const rightEyeOpen = ((_d = face.EyesOpen) === null || _d === void 0 ? void 0 : _d.Value) && ((_f = (_e = face.EyesOpen) === null || _e === void 0 ? void 0 : _e.Confidence) !== null && _f !== void 0 ? _f : 0) > 90;
283
+ // Check for sunglasses or eyeglasses
284
+ if (((_a = face.Sunglasses) === null || _a === void 0 ? void 0 : _a.Value) || ((_b = face.Eyeglasses) === null || _b === void 0 ? void 0 : _b.Value)) {
285
+ return {
286
+ isValid: false,
287
+ error: { en: 'Please remove glasses or sunglasses', ar: 'يرجى إزالة النظارات أو النظارات الشمسية' }
288
+ };
289
+ }
290
+ // Check if eyes are open with higher confidence
291
+ const leftEyeOpen = ((_c = face.EyesOpen) === null || _c === void 0 ? void 0 : _c.Value) && ((_e = (_d = face.EyesOpen) === null || _d === void 0 ? void 0 : _d.Confidence) !== null && _e !== void 0 ? _e : 0) > 95;
292
+ const rightEyeOpen = ((_f = face.EyesOpen) === null || _f === void 0 ? void 0 : _f.Value) && ((_h = (_g = face.EyesOpen) === null || _g === void 0 ? void 0 : _g.Confidence) !== null && _h !== void 0 ? _h : 0) > 95;
286
293
  if (!leftEyeOpen || !rightEyeOpen) {
287
294
  return {
288
295
  isValid: false,
289
- error: { en: 'Eyes must be open and clearly visible', ar: 'يجب أن تكون العينين مفتوحة وواضحة بشكل مباشر' }
296
+ error: { en: 'Eyes must be fully open and clearly visible', ar: 'يجب أن تكون العينين مفتوحتين بالكامل وواضحتين' }
297
+ };
298
+ }
299
+ // Check for mouth open
300
+ if ((_j = face.MouthOpen) === null || _j === void 0 ? void 0 : _j.Value) {
301
+ return {
302
+ isValid: false,
303
+ error: { en: 'Mouth should be closed', ar: 'يجب أن يكون الفم مغلقاً' }
290
304
  };
291
305
  }
292
- // Check face orientation (looking straight ahead)
306
+ // Stricter face orientation check
293
307
  const pose = face.Pose;
294
- const poseThreshold = 20; // degrees
308
+ const poseThreshold = 15; // Stricter threshold (15 degrees)
295
309
  if (Math.abs((pose === null || pose === void 0 ? void 0 : pose.Pitch) || 0) > poseThreshold ||
296
310
  Math.abs((pose === null || pose === void 0 ? void 0 : pose.Roll) || 0) > poseThreshold ||
297
311
  Math.abs((pose === null || pose === void 0 ? void 0 : pose.Yaw) || 0) > poseThreshold) {
298
312
  return {
299
313
  isValid: false,
300
- error: { en: 'Face must be looking straight ahead', ar: 'يجب أن يكون الوجه منظراً مباشراً' }
314
+ error: { en: 'Face must be directly facing the camera', ar: 'يجب أن يكون الوجه مواجهاً للكاميرا مباشرة' }
315
+ };
316
+ }
317
+ // Check for facial occlusions
318
+ if ((_k = face.FaceOccluded) === null || _k === void 0 ? void 0 : _k.Value) {
319
+ return {
320
+ isValid: false,
321
+ error: { en: 'Face must be fully visible without any coverings', ar: 'يجب أن يكون الوجه مرئياً بالكامل بدون أي أغطية' }
322
+ };
323
+ }
324
+ // Check for neutral expression
325
+ if ((_l = face.Smile) === null || _l === void 0 ? void 0 : _l.Value) {
326
+ return {
327
+ isValid: false,
328
+ error: { en: 'Please maintain a neutral expression (no smiling)', ar: 'يرجى الحفاظ على تعبير محايد (بدون ابتسامة)' }
301
329
  };
302
330
  }
303
331
  return { isValid: true };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duvdu-v1/duvdu",
3
- "version": "1.1.204",
3
+ "version": "1.1.205",
4
4
  "main": "./build/index.js",
5
5
  "types": "./build/index.d.ts",
6
6
  "files": [