lucasfelipecdm / uareu-node

MIT License
15 stars 9 forks source link

uareu-node · npm version GitHub license

uareu-node is a typescript library that aims to allow communication between a nodejs application and the DLL / SO of the DPFJ and DPFPDD libraries created by DigitalPersona / HID Global.

Requirements

Installation

Just need to invoke:

$ npm install uareu-node

Examples

You can find this example inside the 'example' folder, and run it invoking:

$ node example/index.js

Code:

    const { UareU, CONSTANTS } = require('uareu-node'); // Import
    const uareu = UareU.getInstance(); // Get a unique instance of library handler.
    let reader; // Create a variable to keep the reader handle after 'open' the device.

    // Probably the code below will also work for you.
    uareu.loadLibs() // Load libs
        .then(() => uareu.dpfpddInit()) // Init libs
        .then(() => uareu.dpfpddQueryDevices()) // Search reader devices connected
        .then((res) => uareu.dpfpddOpen(res.devicesList[0])}) // 'Open' the reader device, it's needed for use others functions like: dpfpddCaptureAsync
        .then((res) => { if (res) reader = res }) // Set reader variable
        .catch((err) => { throw err; });

    // After this initial configuration you can create some functions to capture a fingerprint, identify it, compare it and etc...
    // Note: Identify and Compare are different, the main diference between it are: - Compare only compares two fingerprints;  - Identify compares a fingerprint against a list of fingerprints;

    uareu.dpfpddCaptureAsync(reader, CONSTANTS.DPFPDD_IMAGE_FMT.DPFPDD_IMG_FMT_ANSI381, CONSTANTS.DPFPDD_IMAGE_PROC.DPFPDD_IMG_PROC_DEFAULT, (data, dataSize) => {
        // Here you receive the data of a fingerprint image data (FID)
        // Before compare it, you need to generate a fingerprint minutie data (FMD)
        uareu.dpfjCreateFmdFromFid(data, CONSTANTS.DPFJ_FMD_FORMAT.DPFJ_FMD_ANSI_378_2004)
        .then((res) => {
            // Here you receive the FMD and then you can compare it, save it to compare with the next fingerprint, identify it with a database, etc...
            return uareu.dpfjIdentify(res, [FMD LIST]);
        })
        .then((res) => {
            // Finger was identified or not? The answer you get here.
        })
        .catch((err) => console.log(err));
    });

Contributing

One of the problems that we have already identified, but we have not been able to find a solution is the fact that nodejs stops running a few times when removing and placing the finger very quickly on the reader. Can you help us? Any help is welcome, open a issue, make a pull request, send me a email: lucasfelipecdm@gmail.com.

License

MIT License. See the LICENSE file.