EGOPOLY

Topics include: programming, Apple, Unix, gadgets, large-scale web sites and other nerdy stuff.

Can You Pass Wi-Fi SSID and Key to a Device?

2014-12-10 10:15

We have a project where we want an app to set up an external device with Wi-Fi info. The inspiration for this is the automatic setup feature of Apple TV, as described here

Essentially you can touch your iPhone to the Apple TV; using Bluetooth Low Engergy capabilities, the Apple TV and phone figure out that they are very close to each other, and the iPhone transmits SSID and credentials, along with a iTunes account info, to the Apple TV. This means you don't have to type your Wifi password or iTunes account through the horrible on-screen keyboard with the horrible Apple TV remote.

I presumed, at the time, that this was Apple using private APIs and to transfer this obviously highly sensitive information.

However recently, we ran across two products that do something similar: the Withings bathroom scale and the NetAtmo temperature recording device. Both of these seem to use CNCopyCurrentNetworkInfo to discover the SSID the phone is currently connected to.

But the next step is very interesting. There is an option to automatically set up the Wi-Fi on the accessory. When you choose this option, you get a system standard permissions alert window that asks this question: "Share Wi-Fi Settings? Do you want to share your Wi-Fi settings so this accessory can connect to the Wi-Fi network?"

This is clearly the same kind of permission access you get when an app wants to access the microphone, photos, contacts, etc. So some API call in the app is triggering a supported action where SSID and password are being passed to an accessory device.

This page is talking about this exact issue. But there's no answer there.

I did a name dump of the Withings app to see if I could find an API call it was making that would look promising. Nothing leapt out at me.

However, this Stack Overflow article mentioned the Wireless Accessory Configuration Feature which led me to this page of Apple documentation: adding capabilities

This article mentionds MFi Wi-Fi accessories. MFi is the "Made For iPod/iPhone/iPad" program Apple uses to support OEMs of accessories. This page of developer documentation (may require Apple Developer account) talks about the APIs in detail.

So, it appears that we can do this, but first we would have to enroll and certify our device in the MFi program, which is probably a bit of work.