capawesome-team / capacitor-plugins

⚡️ Community plugins for Capacitor. Supports Android, iOS and the Web.
https://capawesome.io/plugins/
235 stars 39 forks source link

feat: Authorisation support for NFC cards #321

Open pefka opened 3 days ago

pefka commented 3 days ago

Plugin(s)

Current problem

I can't find a way to make communication between the card and smartphone encrypted.

Preferred solution

There is a MiFare desFire card, it supports encrypted communication through authorisation.

Can you add to your plugin the possibility of read with authorisation and write with authorisation?

Alternative options

No response

Additional context

No response

Before submitting

robingenz commented 2 days ago

Thank you for reaching out! Which platforms must be supported?

pefka commented 2 days ago

iOS and Android

robingenz commented 2 days ago

I'm not sure if it's possible on iOS. Core NFC only offers two methods for MiFare tags:

  1. sendMiFareCommand
  2. sendMiFareISO7816Command

The first is already available via the plugin. You may simply have to send a special command to the tag. However, I have never tested this myself. Feel free to give it a try using the transceive(...) method of the plugin.

Android, on the other hand, offers the following two methods:

  1. authenticateSectorWithKeyA
  2. authenticateSectorWithKeyB

I guess these are the methods you are looking for. Both should be easy to implement.