@faceio/fiojs 1.0.8 → 1.0.9

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.
Files changed (3) hide show
  1. package/README.md +40 -3
  2. package/index.js +32 -1
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,7 +1,8 @@
1
1
  ## Release Updates & Announcments:
2
-
2
+ * [fio.js V2.1 Released with Age Verification & Minors Access Prevention](https://blog.pixlab.io/2023/06/age-verification-check-available-for-faceio-face-recognition)
3
+ * Introducing the `fetchAllErrorCodes()` method for the NPM Package for much better error logging experience.
3
4
  * [New REST API Endpoints Available for FACEIO](https://blog.pixlab.io/2023/04/new-rest-api-endpoints-available-for-faceio)
4
- * [**Livneness Detection & Face Anti-Spoofing Security Feature Available for FACEIO**](https://www.biometricupdate.com/202303/pixlab-adds-active-liveness-detection-to-faceio-biometrics-framework)
5
+ * [Liveness Detection & Face Anti-Spoofing Security Feature Available for FACEIO](https://www.biometricupdate.com/202303/pixlab-adds-active-liveness-detection-to-faceio-biometrics-framework)
5
6
  * [Webhooks Enhancements & Performance Improvements](https://blog.pixlab.io/2022/11/faceios-webhooks-enhancements-performance-improvements)
6
7
  * [fio.js V1.9 Released with Face Duplication Prevention](https://blog.pixlab.io/2022/10/fiojs-190-released-with-face-duplication-prevention)
7
8
 
@@ -57,7 +58,43 @@ async function authenticateUser(){
57
58
  // call to faceio.authenticate() here will automatically trigger the facial authentication process
58
59
  }
59
60
  function handleError(errCode){
60
- // Handle error here
61
+ // Handle error here
62
+ // Log all possible error codes during user interaction..
63
+ // Refer to: https://faceio.net/integration-guide#error-codes
64
+ // for a detailed overview when these errors are triggered.
65
+ const fioErrCode = faceio.fetchAllErrorCodes();
66
+ switch (errCode) {
67
+ case fioErrCode.PERMISSION_REFUSED:
68
+ console.log("Access to the Camera stream was denied by the end user");
69
+ break;
70
+ case fioErrCode.NO_FACES_DETECTED:
71
+ console.log("No faces were detected during the enroll or authentication process");
72
+ break;
73
+ case fioErrCode.UNRECOGNIZED_FACE:
74
+ console.log("Unrecognized face on this application's Facial Index");
75
+ break;
76
+ case fioErrCode.MANY_FACES:
77
+ console.log("Two or more faces were detected during the scan process");
78
+ break;
79
+ case fioErrCode.FACE_DUPLICATION:
80
+ console.log("User enrolled previously (facial features already recorded). Cannot enroll again!");
81
+ break;
82
+ case fioErrCode.MINORS_NOT_ALLOWED:
83
+ console.log("Minors are not allowed to enroll on this application!");
84
+ break;
85
+ case fioErrCode.PAD_ATTACK:
86
+ console.log("Presentation (Spoof) Attack (PAD) detected during the scan process");
87
+ break;
88
+ case fioErrCode.FACE_MISMATCH:
89
+ console.log("Calculated Facial Vectors of the user being enrolled do not matches");
90
+ break;
91
+ case fioErrCode.WRONG_PIN_CODE:
92
+ console.log("Wrong PIN code supplied by the user being authenticated");
93
+ break;
94
+ // ...
95
+ // Refer to the boilerplate at: https://gist.github.com/symisc/34203d2811a39f2a871373abc6dd1ce9
96
+ // for the list of all possible error codes.
97
+ }
61
98
  }
62
99
 
63
100
  export default App;
package/index.js CHANGED
@@ -68,4 +68,35 @@ module.exports = class faceio {
68
68
  async restartSession() {
69
69
  return await internalCDN.restartSession()
70
70
  }
71
- }
71
+
72
+ /**
73
+ * Return the list of all possible error codes than can be triggered during failed authentication or enrollment.
74
+ * @returns fioErrorCode object
75
+ */
76
+ fetchAllErrorCodes(){
77
+ return {
78
+ PERMISSION_REFUSED: 1, /* Access to the Camera stream was denied by the end user */
79
+ NO_FACES_DETECTED: 2, /* No faces were detected during the enroll or authentication process */
80
+ UNRECOGNIZED_FACE: 3, /* Unrecognized face on this application's Facial Index */
81
+ MANY_FACES: 4, /* Two or more faces were detected during the scan process */
82
+ PAD_ATTACK: 5, /* Presentation (Spoof) Attack (PAD) detected during the scan process */
83
+ FACE_MISMATCH: 6, /* Calculated Facial Vectors of the user being enrolled do not matches */
84
+ NETWORK_IO: 7, /* Error while establishing network connection with the target FACEIO processing node */
85
+ WRONG_PIN_CODE: 8, /* Wrong PIN code supplied by the user being authenticated */
86
+ PROCESSING_ERR: 9, /* Server side error */
87
+ UNAUTHORIZED: 10, /* Your application is not allowed to perform the requested operation (eg. Invalid ID, Blocked, Paused, etc.). Refer to the FACEIO Console for additional information */
88
+ TERMS_NOT_ACCEPTED: 11, /* Terms & Conditions set out by FACEIO/host application rejected by the end user */
89
+ UI_NOT_READY: 12, /* The FACEIO Widget code could not be (or is being) injected onto the client DOM */
90
+ SESSION_EXPIRED: 13, /* Client session expired. The first promise was already fulfilled but the host application failed to act accordingly */
91
+ TIMEOUT: 14, /* Ongoing operation timed out (eg, Camera access permission, ToS accept delay, Face not yet detected, Server Reply, etc.) */
92
+ TOO_MANY_REQUESTS: 15, /* Widget instantiation requests exceeded for freemium applications. Does not apply for upgraded applications */
93
+ EMPTY_ORIGIN: 16, /* Origin or Referer HTTP request header is empty or missing */
94
+ FORBIDDDEN_ORIGIN: 17, /* Domain origin is forbidden from instantiating fio.js */
95
+ FORBIDDDEN_COUNTRY: 18, /* Country ISO-3166-1 Code is forbidden from instantiating fio.js */
96
+ UNIQUE_PIN_REQUIRED: 19, /* Supplied PIN Code must be unique among other PIN's on this application */
97
+ SESSION_IN_PROGRESS: 20, /* Another authentication or enrollment session is in progress */
98
+ FACE_DUPLICATION: 21, /* Prevent face duplication during enrollment. Same user trying to enroll twice or more */
99
+ MINORS_NOT_ALLOWED: 22 /* Minors not allowed to enroll on this application */
100
+ };
101
+ }
102
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faceio/fiojs",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "Facial Authentication for the Web",
5
5
  "main": "index.js",
6
6
  "homepage": "https://faceio.net/",