Code Monkey home page Code Monkey logo

uareu-node's Introduction

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.

  • Attention:

    • This library has only been tested in this environment(s):

      • SO: Windows;
      • Architecture: x64;
      • NodeJS: [12.17.0(x64), 12.13.0(x32)];
    • This library does not replace the original library provided by HID Global, only facilities the communication between it and the aplication.

    • Originally this library was created to a specific device (Digital Persona 4500 Fingerprint Reader), but while we were running the tests, another device worked (Synaptics FP sensor) a device built into the laptop.

    • If using the x32 dpfj and dpfpdd libraries, use a x32 node version, if using x64, use a x64 node version. :)

Requirements

  • A Digital Persona 4500 Fingerprint Reader or similar;

  • dpfj.dll, dpfpdd.dll for Windows, and dpfj.so, dpfpdd.so for Linux, both should be located in a folder named "bin" at the root of the project.

    .
    ├── ...
    ├── bin                     # Libraries files
    │   ├── dpfj.dll            # DPFJ library
    │   ├── dpfpdd.dll          # DPFPDD library
    │   └── ...                 # etc.
    └── ...
    
  • If you choose to keep the library files in another location, when loading the library you must provide the path to the libraries.

    • Example:
          // You just need to specific the path if the libs are not in a 'bin' folder at root.
          uareu.loadLibs('src/libs/dpfpdd.dll', 'src/libs/dpfj.dll')
              .then((res) => {
                  console.log(res);
              })
              .catch((err) => {throw err;});

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: [email protected].

License

MIT License. See the LICENSE file.

uareu-node's People

Contributors

dependabot[bot] avatar lucasfelipecdm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

uareu-node's Issues

Use this if listener callback won't work. uareu.dpfpddOpen(findCorrectDevice);

Our code sometimes would first find a device called this: broadcom corporation, control vault with fingerprint sensor. And other times find the digital persona device first.

And since the example code in the readme always used the first device, our code was periodically not working and we were so stumped why.

Finally figured it out that it was finding the wrong device.

Our fix looked like this:
const findCorrectDevice = res.devicesList.find((d: any) => d.dpfpddHwDescr.vendorName === 'DigitalPersona, Inc.')
return uareu.dpfpddOpen(findCorrectDevice);

Error: One or more parameters passed to the API call are invalid.

Hi bro, when i try to run example code, with dll into bin folder, get tittle error.

It happens when call uareu.dpfpddQueryDevices()

My sensor is working correctly with DigitalPersona workstation.

Environment

  • Sensor: DigitalPersona 4000b
  • SO: Windows 10;
  • Architecture: x64;
  • NodeJS: 12.13.0;

Stack trace:
Error: One or more parameters passed to the API call are invalid. at new ErrorHandler (C:\Users\Administrador\Desktop\project\node_modules\uareu-node\dist\modules\handlers\error\error.handler.js:13:23) at C:\Users\Administrador\Desktop\project\node_modules\uareu-node\dist\modules\index.js:179:24 at new Promise (<anonymous>) at UareU.dpfpddQueryDevices (C:\Users\Administrador\Desktop\project\node_modules\uareu-node\dist\modules\index.js:129:56) at C:\Users\Administrador\Desktop\project\main.js:20:26 at processTicksAndRejections (internal/process/task_queues.js:95:5) at async init (C:\Users\Administrador\Desktop\project\main.js:13:12)

Getting the empty device list after build in electron appliction

Hi @lucasfelipecdm
We implement the uareu-node NPM is working fine in development mode but when i am going to create electron build it gives the empty device list.
my machine is ubuntu 18.4
output is :
{
callbackRet: 0,
readableRet: 'Information about connected readers obtained.',
devicesNumber: 0,
devicesList: []
}

I don't understand what to do.
Please help me

Error: Unknown code error. (2)

I'm sorry for opening another issue with similar title with already open issue, but since the last one was quite old without any response, I figured it's better to open new one.

Environment:
OS: Windows 10
NodeJS: v18.10.0
TypeScript

the error is more or less the same as previous issue:

Error: Unknown code error.
    at new ErrorHandler (<omitted>\node_modules\uareu-node\dist\modules\handlers\error\error.handler.js:17:23)
    at <omitted>\node_modules\uareu-node\dist\modules\index.js:113:24
    at new Promise (<anonymous>)
    at UareU.dpfpddInit (<omitted>\node_modules\uareu-node\dist\modules\index.js:103:48)
    at <omitted>\test\app.js:455:17

At first, I used the code example you provided on readme, and decided to edit it a little to figure out where the code stopped working:

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(() => { console.log("Uareu lib loaded"); uareu.dpfpddInit(); }) // Init libs
    .then(() => { console.log("Uareu lib initialized"); uareu.dpfpddQueryDevices() }) // Search reader devices connected
    .then((res) => { console.log("Uareu device scanned", res); uareu.dpfpddOpen(res.devicesList[0]) }) // 'Open' the reader device, it's needed for use others functions like: dpfpddCaptureAsync
    .then((res) => { console.log("Uareu device opened"); if (res) reader = res; console.log("Uareu initialized") }) // Set reader variable
    .catch((err) => { throw err; });

With this code, it managed to run until the third callback:

Uareu lib loaded
Uareu lib initialized
Uareu device scanned undefined
Error: Unknown code error.

Notice that variable res is undefined, and the same error was thrown after that line on console.
Next I tried to check what's res type, so I changed the import line to this:

import { UareU, CONSTANTS } from "uareu-node";

And then from TypeScript compiler:

Property 'devicesList' does not exist on type 'void'.

I figured that you need to return the function in the previous callback to make it wait and receive the res variable, so the code changes to this:

uareu.loadLibs() // Load libs
    .then(() => { console.log("Uareu lib loaded"); return uareu.dpfpddInit(); }) // Init libs
    .then(() => { console.log("Uareu lib initialized"); return uareu.dpfpddQueryDevices() }) // Search reader devices connected
    .then((res) => { console.log("Uareu device scanned", res); return uareu.dpfpddOpen(res.devicesList[0]) }) // 'Open' the reader device, it's needed for use others functions like: dpfpddCaptureAsync
    .then((res) => { console.log("Uareu device opened"); if (res) reader = res; console.log("Uareu initialized") }) // Set reader variable
    .catch((err) => { throw err; });

And so the compiler accepted this code and run it after compiling it, but the result was quite different:

Uareu lib loaded
Error: Unknown code error.

It only manages to run on first callback, the next one failed, meaning the error originated from calling uareu.dpfpddInit();.

Not working on node 14

Hi @lucasfelipecdm ,
we are using this library for handling the bio-matrics device for last 1.5 year and it's working fine for us
but now to are thinking to upgrade the code base to node 14 . and we are done with that the issue is come into the picture uareu-node library is not working on node 14

Please help us to resove the issue

Error: Unknown code error.

Error: Unknown code error.
at new ErrorHandler (c:\Users\user\Downloads\uareu-node-master\dist\modules\handlers\error\error.handler.js:16:23)
at c:\Users\user\Downloads\uareu-node-master\dist\modules\index.js:113:24
at new Promise ()
at UareU.dpfpddInit (c:\Users\user\Downloads\uareu-node-master\dist\modules\index.js:103:48)
at c:\Users\user\Downloads\uareu-node-master\example\index.js:14:27
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async init (c:\Users\user\Downloads\uareu-node-master\example\index.js:13:12)

electron support

when trying to run in electron its crash with no error (npm run start = electron .), but when I am using the node command "node main.js" its works.

any ideas what crash in electron?

Thanks

How to import existing fingerprint data?

Hi,

I was looking at using this library for a project I am working on but one of the issues Im having is taking fingerprint data I get from the digitalpersona javascript SDK and importing it and having it read by this library.

Are there any examples of how to do this?

no such file or directory, open 'bin/dpfpdd.so'

Hi @lucasfelipecdm
i am trying to integrate the biometric Digital Persona 4500 Fingerprint Reader in node js
when I use uareu-node package to integrate then I have an error

Error: ENOENT: no such file or directory, open 'bin/dpfpdd.so'

I am using the Linux os

please help on this

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.