appidea / react-native-hce

Emulate smart cards inside React-Native application.
MIT License
67 stars 26 forks source link

Getting id of emulated card #25

Closed keakarsu closed 1 year ago

keakarsu commented 1 year ago

Hi,

I want to get emulated card unique id and match it to phone. When phone is readed to NFC device, I want to check uid of the card.

How can I get id of emulated card or is it possible to set card id manually?

Thank you !!

BhavyaKoshiya commented 1 year ago

@keakarsu Did you managed to find how to set the id?

appidea commented 1 year ago

As far as I know there are limited possibilities of manipulating the UID of the emulated card in HCE. UID is generated in the OS layer of the device, and - if I remember correctly - can rotate for the security purposes:

HCE devices should be assumed to have a random UID. This means that on every tap, the UID that is presented to the reader is a randomly generated UID. Because of this, NFC readers should not depend on the UID of HCE devices as a form of authentication or identification. https://developer.android.com/guide/topics/connectivity/nfc/hce#ProtocolParams

so sticking to the UID of the card emulated via HCE is not a good idea if we want to distinct the devices.

But if You want still read the UID: please, refer to the manuals of the reader library / reader device to find the answer to Your question.