LINE Beacon device specification

This LINE Beacon specification is for corporate users who wish to deploy beacon devices to use LINE Beacon. Your beacon devices must comply with this specification.

Unlike LINE Simple Beacon packets, LINE Beacon packets have the secure message field as a mechanism for security.

Requirements for LINE Beacon compliant devices

A beacon device compliant with the LINE Beacon specification supports Bluetooth® Low Energy Version 4.0 and Apple's iBeacon and can advertise LINE Beacon packets. Specifically, the device must meet the following requirements:

  • Advertise LINE Beacon packets.
  • Generate a secure message from data hashed by SHA-256 and XOR (exclusive OR) operations.
  • Update the secure message every 15 seconds.
  • Have a unique HWID written to the device and displayed on the body of the device.

LINE Beacon packets

For LINE to detect your beacon device quickly, control beacon devices according to the broadcaster role (BLUETOOTH SPECIFICATION Version 4.0 Vol 3, Part C Section 2.2.2.1) specified in the generic access profile.

Packet transmission interval

We strongly recommend that you send LINE Beacon packets at 152.5ms intervals.

Advertising packet specification

Compose advertising packets with three AD structures, as illustrated below.

LINE Beacon packet

The advertising packet specification is as follows. The hexadecimal values in the value column are equivalent to the bracketed values in the description column.

OctetFieldValueDescription
00Length0x02The data length of the first AD structure (2 bytes)
01AD type0x01The AD type of the first AD structure (Flags)
02AD data0x06The flags set (LE General Discoverable Mode, BR/EDR Not Supported)
03Length0x03The data length of the second AD structure (3 bytes)
04AD type0x03The AD type of the second AD structure (Complete list of 16-bit UUIDs available)
0516-bit UUID0x6FThe 16-bit UUID of LINE, when joined with the next byte (0xFE6F)
0616-bit UUID0xFEThe 16-bit UUID of LINE, when joined with the previous byte (0xFE6F)
07Length0x11The data length of the third AD structure (17 bytes)
08AD type0x16The AD type of the third AD structure (Service Data - 16-bit UUID)
0916-bit UUID0x6FThe 16-bit UUID of LINE, when joined with the next byte (0xFE6F)
1016-bit UUID0xFEThe 16-bit UUID of LINE, when joined with the previous byte (0xFE6F)
11Frame type0x02The frame type (LINE Beacon)
12-16HWIDDevice-specific valueA 5-byte unique ID of the beacon device. For more information, see HWID.
17Measured TxPowerDevice-specific valueRSSI (Received Signal Strength Indicator) when the device with LINE installed and the beacon device is one meter apart. Set the same value as for the iBeacon packet. For more information, see the iBeacon documentation.
Set this field to 0x7F if you don't use RSSI data.
18-21Message authentication codeVariableA 4-byte code for message authentication
22-23Masked timestampVariableA 2-byte masked timestamp
24Battery levelVariableRemaining battery level
25-30Non-significant part0x00Unused. Set each byte to 0x00.

Generate a secure message

LINE requests you to send a secure message to prevent tampering of LINE Beacon packets and replay attacks. A secure message is 7-byte data that contains message authentication code, masked timestamp, and battery level. LINE passes the secure messages transmitted from beacon devices to the LINE Platform for verification.

To generate a secure message, perform XOR (exclusive OR) operation three times on a hash value computed with SHA-256, by the flow illustrated below. For more information about the required parameters, see Required parameters for secure messages.

Generation algorithm of the secure message

Generate a secure message by the instructions below.

1. Generate a message authentication code

  1. Concatenate these items in the order listed and generate a 32-byte hash value with SHA-256.
  2. Perform XOR operation on the first 16 bytes and the second 16 bytes of the hash value.
  3. Perform XOR operation on the first 8 bytes and second 8 bytes of the value computed in the previous step.
  4. Perform XOR operation on the first 4 bytes and second 4 bytes of the value computed in the previous step.

Now you have a message authentication code.

2. Generate a masked timestamp

Mask 6 bytes from the beginning of the timestamp and leave the last 2 bytes. This is a masked timestamp.

3. Concatenate items

To generate a secure message, concatenate these items in the order listed:

The result of concatenation is a secure message. See Sample code and data for generating secure messages to develop and test for your beacon device to generate secure messages.

Required parameters for secure messages

To generate a secure message, you need these parameters:

LY Corporation generates and manages the HWID, lot key, and vendor key. To obtain these required parameters, contact the LY Corporation representative for your organization. Only after you (corporate users) submit an application form and get permission, the required parameters will be issued to you.

Battery level

The battery level is the remaining battery capacity. Specify the level as guided below:

Decimal valueHexadecimal valueDescription
00x00Unknown or connected to an external power supply.
10x010% left. The battery is fully discharged.
20x0210% left
100x0A90% left
110x0B100%. The battery is fully charged.
12–2550x0C–0xFFReserved for future use. Don't use.

HWID

The HWID is the hardware ID of a beacon device issued by LY Corporation. The ID is a 10-character string in hexadecimal notation. Convert the HWID to a byte array and write the byte array to the beacon device as 5-byte binary data. Also, mark the HWID on the beacon device.

Lot key

A lot key is assigned to each lot, issued by LY Corporation. The keys are 16-character strings. Like HWID, convert the key to a byte array and write the byte array to the beacon device as 8-byte binary data.

Timestamp

A timestamp is an unsigned 64-bit integer.

  • Start incrementing the timestamp when the beacon device is switched on for the first time.
  • Start the timestamp at zero and increment the value every 15 seconds. For example, the timestamp for a beacon device one minute after the beacon is switched on is 4.
  • Don't reset the timestamp to zero when the beacon device is switched on again. Continue to increment the timestamp value at power-off.
  • Reset the timestamp to start at zero again when you rewrite the HWID of the beacon device to the newly issued HWID.

Vendor key

A vendor key is assigned to each vendor, issued by LY Corporation. The key is an 8-character string in hexadecimal notation. Like HWID, convert the key to a byte array and write the byte array to the beacon device as 4-byte binary data.

iBeacon packets

To notify iOS devices that a LINE Beacon device is nearby, you must send iBeacon packets. Include these LINE Beacon specific parameters in the iBeacon packets.

ParameterValue
UUIDD0D2CE24-9EFC-11E5-82C4-1C6A7A17EF38
Major0x4C49
Minor0x4E45

For more information about the AD structure and transmission interval of iBeacon packets, see Apple's Proximity Beacon Specification document. You can download this document from the iBeacon section of the Apple Developer site.