[webkit-dev] Implementing Universal Second Factor (U2F)
xales at naveria.com
Wed Feb 22 05:52:47 PST 2017
The (USB) protocol itself works by sending USB HID reports (packets) to the key and getting USB HID reports back. There is a reference implementation by one of the members of the specification group - libu2f-host (by Yubico); however, it is licensed under GPL and LGPLv2.1. It also depends on two more libraries, hidapi and libusb. Figuring that adding all of these dependencies to Safari might be undesirable, I wrote a clean-room implementation outside of WebKit that uses IOKit directly to access the device (conveniently, IOKit exposes nice HID stuff). I’m now at the stage of adding this to WebKit.
Before I move forward, there are a couple of things that would be great to get some input on:
- What to do about other platforms - no implementation, use libu2f-host for them, or use libu2f-host everywhere
- UI for key access permission - malicious sites could (eventually) lock up a key, as well as possibly identifying a user; the specification suggests displaying an info bar for user to allow access - but, I’m not familiar with the process of designing/adding browser chromes
- What process should communicate with the token - the protocol is robust and designed for many simultaneous accesses and appropriate isolation of them, so this can (should?) be per-page; IOKit needs a CFRunLoop to schedule the report receive callback on: should this be on the main runloop or on another thread just for U2F?
- Presumably, this should be gated behind a macro; does a suitable one exist, or add a new one?
- Jacob Greenfield
More information about the webkit-dev