www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Apple HomeKit Accessory Protocol in D

Hi,

implemented Proof of Concept for HomeKit Accessory Protocol for D 
on Linux.
a lot of stuff was ported from HAP-NodeJS project and 
homekit_python.

https://github.com/shabunin/hap-d

Works: pairing procedure and basic lightbulb accessory control - 
[GET /characteristics] and [PUT /characteristics] method. Not 
implemented: persisted pairing(at a moment no info is saved), 
better abstractions to work with accessories(callbacks, etc).

Dependencies are only libsodium for cryptographic methods. 
Multicast DNS advertisement is implemented in pure D.
I didn't use vibe-d or some other HTTP-server framework due to 
nature of HomeKit protocol. At first, when pairing was not 
established yet, HTTP-requests are pretty normal. But when 
pairing is done all communications become encrypted. Socket is 
still open(like keep-alive session) but now every message has no 
HTTP structure - you should decrypt it first. So, kind of 
middleware function is required for vibe-d. I couldn't find the 
way to do it and used own HTTP-server.

---

First things I would like to do next is to review code with fresh 
look, create better file structures and think about general app 
architecture - how abstractions for accessories should be done - 
classes, callbacks, etc.

Debugging pairing procedure was hard part but it is done at this 
moment. I'm asking now community to join me in next development. 
Critiques, advises, propositions, code commits will help in 
making great project.
Oct 15 2020