... | ... | @@ -27,12 +27,20 @@ Each device starts by generating a fresh ephemeral key pair (pri, pub). The comm |
|
|
|
|
|
### QR codes
|
|
|
|
|
|
Each device creates a QR code containing a binary payload. The payload is encoded using Base32, as defined in [RFC 4648](https://tools.ietf.org/html/rfc4648), which allows the QR code to use alphanumeric mode. The first byte of the payload is the protocol version, which is 1 for the current version of BQP. The next HASH_LEN bytes of the payload are the commitment to the ephemeral public key. The remainder of the payload consists of zero or more byte strings containing information about how to connect to the device over various short-range transports. Each byte string may be 0 to 255 bytes long, and is preceded by a single byte giving its length. The order of the transports is defined by BQP. The following transports are defined for version 1 of BQP:
|
|
|
Each device creates a QR code containing a binary payload. The payload is encoded using Base32, as defined in [RFC 4648](https://tools.ietf.org/html/rfc4648), which allows the QR code to use alphanumeric mode. The first byte of the payload is the protocol version, which is 1 for the current version of BQP. The next HASH_LEN bytes of the payload are the commitment to the ephemeral public key. The remainder of the payload consists of zero or more transport records, as defined in the next section.
|
|
|
|
|
|
1. Bluetooth. The byte string contains the device's Bluetooth MAC address (6 bytes). The UUID of the Bluetooth service is generated by converting the first 16 bytes of the public key commitment into a UUID as specified in section 4.4 of [RFC 4122](https://tools.ietf.org/html/rfc4122).
|
|
|
### Transport records
|
|
|
|
|
|
2. IP. The byte string contains the device's link-local or site-local IPv4 or IPv6 address (4 or 16 bytes), followed by a port number as a 16-bit integer (2 bytes).
|
|
|
A transport record describes how to connect to a device over a short-range transport. Each record starts with a two-byte header. The first byte identifies the transport and the second byte gives the number of chunks in the record body. The chunks contain transport-dependent data. Each chunk is preceded by a byte giving the length of the chunk in bytes.
|
|
|
|
|
|
3. Wi-Fi. The byte string contains the SSID and password for a Wi-Fi access point, which may be a Wi-Fi Direct legacy mode access point. The SSID and password are separated by a null byte.
|
|
|
The following transports have been defined so far:
|
|
|
|
|
|
**0: Bluetooth** - The device registers a Bluetooth service to accept RFCOMM connections. The service UUID is generated by converting the first 16 bytes of the public key commitment into a UUID as specified in section 4.4 of [RFC 4122](https://tools.ietf.org/html/rfc4122). The record body consists of one chunk containing the device's Bluetooth MAC address (6 bytes).
|
|
|
|
|
|
**1: LAN** - The device connects to a local area network and opens a port to accept TCP connections. The record body consists of two chunks: (i) the device's link-local or site-local IPv4 or IPv6 address (4 or 16 bytes); (ii) the port number as a 16-bit integer (2 bytes).
|
|
|
|
|
|
**2: Wi-Fi** - The device connects to a Wi-Fi network and opens a port to accept TCP connections. The record body consists of three chunks: (i) the device's link-local or site-local IPv4 or IPv6 address (4 or 16 bytes); (ii) the port number as a 16-bit integer (2 bytes); (iii) the SSID of the Wi-Fi network (variable length).
|
|
|
|
|
|
**3: Wi-Fi Direct** - The device creates a Wi-Fi Direct legacy mode access point and opens a port to accept TCP connections. The record body consists of four chunks: (i) the device's link-local or site-local IPv4 or IPv6 address (4 or 16 bytes); (ii) the port number as a 16-bit integer (2 bytes); (iii) the SSID of the access point (variable length); (iv) the password of the access point (variable length).
|
|
|
|
|
|
This list of transports may be extended in future without incrementing the protocol version; devices must ignore any transports they do not recognise. |