hidglobal / digitalpersona-devices

DigitalPersona Security Devices support library
https://hidglobal.github.io/digitalpersona-devices/index.html
MIT License
64 stars 41 forks source link

Compatibility Issue between @digitalpersona/devices and DPUruNet Libraries #58

Closed omarasael1980 closed 6 months ago

omarasael1980 commented 6 months ago

Dear @a-bronx,

I hope this message finds you well. I am writing to bring to your attention an issue regarding the compatibility of the @digitalpersona/devices library with the DPUruNet library, specifically within a React environment utilizing the WebSdk.

Recently, I have been working with the @digitalpersona/devices library within a React application to capture fingerprints using the WebSdk. However, I have encountered a compatibility issue when attempting to compare fingerprints obtained using the @digitalpersona/devices library with those stored in another system that utilizes the DPUruNet library.

Upon further investigation, it seems that the base64 representation of the fingerprints obtained from the @digitalpersona/devices library in React is not compatible with the fingerprints stored in the system using the DPUruNet library. As a result, I am unable to perform accurate comparisons or operations involving these fingerprints.

Given that there are numerous fingerprints stored over the years in the system using the DPUruNet library, it is imperative to find a solution to this compatibility issue. Therefore, I would like to inquire if there is a recommended method or utility provided by @digitalpersona/devices to convert fingerprints obtained from the WebSdk in React to a format compatible with those stored in systems using the DPUruNet library.

If there is no existing solution available, I would greatly appreciate any guidance or assistance you can provide in resolving this compatibility issue. Ensuring interoperability between these libraries within a React environment would greatly benefit users like myself who rely on fingerprint data across different systems.

Thank you for your attention to this matter. I look forward to your response and assistance in addressing this compatibility issue.

Best regards, Omar Hernandez

a-bronx commented 6 months ago

Hi, Omar, I need some additional information:

  1. What sample format do you use?
  2. Do you feed base64-encoded samples directly into DPUrUNet, or you decode it before?
omarasael1980 commented 6 months ago

Thanks Andrey I used PngImage. I send the base64 to a webservice that converts it to bytes and then to an FMD to perform the comparison with the records. This web service is also used with the old system, it recovers the base64 and sends it for comparison

any advice?

a-bronx commented 6 months ago

The PngImage format after decoding should give you a regular vanilla PNG image which should be compatible with any fingerprint engine. If you save the decoded bytes into a PNG file, can you open it in an image viewer? If not, then the issue most probably in a way you decode it.

Note though that

  1. encoding almost everywhere in the library is not just Base64, but Base64Url, so you need to be careful while decoding.
  2. the SamplesAcquired returned by the library is not just a single sample, but an array, and for PngImage it is an array of Base64Url-encoded PNG images. If you need Base64-encoded string which is, for example, sutable for <img src="" />, then following code should work (see also #11):
import { Base64 } from "@digitalpersona/core"
...
const base64ImageData = Base64.fromBase64Url(samples[0]);
const pngImageString = `data:image/png;base64, ${base64ImageData}`;
omarasael1980 commented 6 months ago

Thank you for your advice. I wanted to inform you that I was indeed able to obtain a PNG image from the base64 data obtained from SamplesAcquired. I just had to make some modifications in the decoding process. let base64 = ListaSamplesFingerPrints.samples[0]; base64 = base64.replace(/_/g, '/'); base64 = base64.replace(/-/g, '+'); Additionally, I can confirm that upon right-clicking and saving the image, I can open it successfully in an image viewer.

Based on these results, it's reasonable to assume that the obtained images are compatible with DPUruNet fingerprints. I will review the example you suggested.

Thank you again for your assistance.

Best regards, Omar