kormax / apple-home-key

Reverse-engineering Apple Home Key
273 stars 13 forks source link

Seeking Guidance on Implementing NFC Authentication for Home Key-based Door Lock using hap-nodejs #4

Closed FlyRenxing closed 1 year ago

FlyRenxing commented 1 year ago

Hello,

I am very interested in your project. Currently, I am working on creating a home key-based door lock using hap-nodejs. I have successfully replicated the part of adding accessories in hap-nodejs. Now, I would like to know what steps I should take next.

Firstly, I would like some guidance on selecting an NFC hardware for my project, specifically the esp32. Could you recommend a few models for me to consider?

Additionally, I would like to know how I can receive NFC data using hap-nodejs, authenticate the data, and use it to unlock the door. Any advice or suggestions on implementing this functionality would be greatly appreciated.

Thank you!

kormax commented 1 year ago

Hello.

Couple of aspects you should understand in advance:

  1. HAP-nodejs cannot run on esp32 or any other microcontroller. For it you need something that runs a proper OS, like a raspberry. You can implement homekey device on that kind of hardware, but you have to find other projects for that.
  2. HAP-nodejs is not responsible for NFC communication in any way.
    For NFC communication, you have to pick an NFC board/chip, implement drivers for that board, and then implement full nfc protocol stack iso1443a+ecp->isodep->homekey.
  3. As for hardware: Any controller/pc is ok for running code. As for NFC frontend, you can look at the info in ECP repository, any of the described ones there will work.
  4. This repo does not have full info on implementing the protocol yet*, only some parts plus puzzle pieces for some more advanced folk. We're working on making a final draft that will have sufficient info for everyone, but I can't give any exact dates right now.
FlyRenxing commented 1 year ago

Thank you for your response. I think I may have understood. I would like to try using ESP32 and PN532 for serial communication to implement the ECP repository's program. Then, I plan to use the Arduino-HomeKit-ESP32 library to publish the door lock accessory to HomeKit. However, I have a question regarding how to validate if the NFC data generated by Apple is correct?

kormax commented 1 year ago

Full-featured code example is being worked on.

For those who are interested, prepare (buy) a pn532 connected with a usb to uart adapter to PC (or to UART gpio on SBC). Stay tuned.

Gonna close this issue for now.

kormax commented 1 year ago

Hopefully, this is what you wanted :).