kormax / apple-home-key

Reverse-engineering Apple Home Key
267 stars 12 forks source link

Example of code #5

Closed Tomcuzz closed 10 months ago

Tomcuzz commented 1 year ago

Hey Big thanks for all this information

Do you have an example of the code you were using when you got the homekey to trigger on the phone? https://raw.githubusercontent.com/kormax/apple-enhanced-contactless-polling/main/assets/PN532.ECP.DEMO.webp

Having a look at: https://github.com/kormax/apple-enhanced-contactless-polling/blob/main/examples/implementations/nfcpy/main.py

Im trying to work out how to setup the broadcast variable, specifically where to obtain the "reader group identifier" or if there is other parts of the response that need to be sent after

Had managed to add the key to the phone via: https://github.com/KhaosT/HAP-NodeJS/blob/80cdb1535f5bee874cc06657ef283ee91f258815/lock.js

Many Thanks

kormax commented 1 year ago

Hello.

Info about calculation of reader group identifier can found in a following repository created by other person here. (Note that they call it reader identifier, but it means the same thing in that case), to calculate it you have to retrieve reader private key programmed via HAP and do a SHA256 over static data + your key, later taking a part of that data to be used inside of ECP frame. More info about calculation can be seen in this thread closer to the bottom. Beware that it covers just the NFC protocol activation part, with the whole communication/encryption part needed to be done on your own as there are no examples available yet.

Regarding the demo code. That is something we are working on, but I cannot give any exact timeframes.

Tomcuzz commented 1 year ago

Hey Many thanks for that, that makes more sense now

Tomcuzz commented 1 year ago

And thats great to hear that demo code something your working on, Look forward to seeing/testing this out

kormax commented 10 months ago

Here you can find what you've sought for.