Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
@enface/sdk
Advanced tools
This package works both in Node.js and Browser environment. Supported browsers:
npm i --save @enface/sdk
yarn add @enface/sdk
// ES2015 module import:
import { createEnfaceApi } from "@enface/sdk";
// CommonJS module require:
const { createEnfaceApi } = require("@enface/sdk");
// Initialization:
const enfaceApi = createEnfaceApi({
apiKey: 'YOUR_API_KEY'
});
// Request:
const result = await enfaceApi.recognize({
images: [image]
});
// Request:
const result = await enfaceApi.liveness({
images: [image1, image2, image3]
});
// Request:
const result = await enfaceApi.recognizeLiveness({
images: [image1, image2, image3]
});
Images should be in JPEG format with minimal resolution of 800x600 pixels (1280x720 is recommended for better performance). For liveness and complex requests 3 images are required. They should be taken from a camera with strict time frames - 160-200 milliseconds between each other. Supported images inputs:
<input type="file">
(browser environment)To completely pass the tests fill the values of the corresponding variables below with your own API keys in "__tests__/api.js"
.
// Running the tests
npm test
Get the minified "enface.web.js" script from "dist/" folder and link to your web page. Enface library constructor will become available in the global scope:
<script src="set_correct_path/enface.web.js"></script>
<script>
const enfaceApi = createEnfaceApi({
apiKey: 'YOUR_API_KEY'
});
enfaceApi.recognize({ images: [image] }).then(function(result){
console.log(result);
});
</script>
Enface supports 2 types of API requests - GraphQL & REST. Full GraphQL documentstion can be found here: http://docs.enface.io. REST API accepts data in multipart/form-data
format with following fields:
JavaScript examples:
const formData = new FormData();
formData.append('apiKey', 'YOUR_RECOGNITION_API_KEY');
formData.append('image', image, `image1.jpg`);
const result = await fetch('https://enface-api-server.herokuapp.com/rest/recognize', {
method: 'post',
body: formData,
});
const formData = new FormData();
formData.append('apiKey', 'YOUR_LIVENESS_API_KEY');
images.forEach((image, index) => formData.append('image', image, `${index}.jpg`));
const result = await fetch('https://enface-api-server.herokuapp.com/rest/liveness', {
method: 'post',
body: formData,
});
const formData = new FormData();
formData.append('apiKey', 'YOUR_RECOGNITION_LIVENESS_API_KEY');
images.forEach((image, index) => formData.append('image', image, `${index}.jpg`));
const result = await fetch('https://enface-api-server.herokuapp.com/rest/recognizeLiveness', {
method: 'post',
body: formData,
});
POST https://enface-api-server.herokuapp.com/rest/recognizeLiveness HTTP/1.1
Host: enface-api-server.herokuapp.com
Content-Type: multipart/form-data; boundary=----------------------------794180515515914733140144
----------------------------794180515515914733140144
Content-Disposition: form-data; name="apiKey"
9e9d58b2-d0c9-4465-a4a0-c96db3ebc3b4
----------------------------794180515515914733140144
Content-Disposition: form-data; name="image";
filename="0.jpg"
Content-Type: image/jpeg
binary image1
----------------------------794180515515914733140144
Content-Disposition: form-data; name="image";
filename="1.jpg"
Content-Type: image/jpeg
binary image2
----------------------------794180515515914733140144
Content-Disposition: form-data; name="image";
filename="2.jpg"
Content-Type: image/jpeg
binary image3
FAQs
Enface biometric services
We found that @enface/sdk demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.