Skip to content

Possible nodeHAP port #69

Description

@diogoviannaaraujo

Hi, I've been wondering how hard would it be a nodeHAP port to moddable. Ive some JS background but am fairly new to hardware and stuff. Been playing with BLE on esp32 and was studying to implement a HomeKit accecory.

Ive read that ESpressif SDK has some HomeKit support baked in, but since I suck at C, freeRTOS and such, I was asking myself if it was feasible to port from NodeHAP.

As first notice it looks like its just a strange http server, something I think its possible with moddable tcp stack. Here a comment on HAPServer.js describes a little bit:

It turns out that the IP-based version of HomeKit's HAP protocol operates over a sort of pseudo-HTTP. Accessories are meant to host a TCP socket server that initially behaves exactly as an HTTP/1.1 server. So iOS devices will open up a long-lived connection to this server and begin issuing HTTP requests. So far, this conforms with HTTP/1.1 Keepalive. However, after the "pairing" process is complete, the connection is expected to be "upgraded" to support full-packet encryption of both HTTP headers and data. This encryption is NOT SSL. It is a customized ChaCha20+Poly1305 encryption layer.
Additionally, this "HTTP Server" supports sending "event" responses at any time without warning. The iOS device simply keeps the connection open after it's finished with HTTP request/response traffic, and while the connection is open, the server can elect to issue "EVENT/1.0 200 OK" HTTP-style responses. These are typically sent to inform the iOS device of a characteristic change for the accessory (like "Door was Unlocked").

The part that concerns me is that one:

This encryption is NOT SSL. It is a customized ChaCha20+Poly1305 encryption layer.

I don't have much experience with encryption, would that be a problem on the moddable on esp32?

Thanks for the attention in advance,
Diogo Vianna

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions