Skip to content

6. Kontakt.io Secure

Starting with Kontakt.io Beacon Firmware 4.0 we have introduced a number of changes that make using and managing beacons more secure, officially called Kontakt.io Secure.

Since version 4.0 all beacon use Kontakt.io Secure Communication. This is mandatory and you can't go back to the old method of writing each setting to its own Bluetooth characteristic on a beacon. However, these changes are all handled by Kontakt.io iOS SDK. API for handling communication with newer and older firmwares is (mostly) the same, so you don't have to worry when managing fleets of beacons with mixed firmwares.

The other significant feature introduced in Kontakt.io Beacon Firmware 4.0 is Kontakt.io Secure Shuffling. This option is not on by default, since it requires a bit of preparation before you can use it.

Because Kontakt.io Secure Communication is rather transparent and does not require any additional steps to take advantage of, the rest of this section will focus exclusively on Kontakt.io Secure Shuffling.

Prerequisites

In order to use Kontakt.io Secure Shuffling you need to have beacons with firmware 4.0 or newer. By default all beacons in Kontakt.io Web Store are sold with such firmware, but if you already have beacons with firmware 3.1 or earlier you can update them either via Kontakt.io Administration App (Apple App Store link) or directly in your own app, if you want to implement firmware upgrade functionality.

Introduction to Kontakt.io Secure Shuffling

When you enable Kontakt.io Secure Shuffling on your beacon few things will happen. Most notably, if you do that on an iBeacon, it will start broadcasting a special Proximity UUID, unique to your Web Panel account. Additionally, Major and Minor values of such beacon will be pseudorandomly generated every 24 hours. Similarly with Eddystone – Namespace will be changed to a special one and a new Instance ID will be generated every day.

Apart from that beacon's name will be changed to K, it will stop broadcasting Eddystone-URL packets, if it was set to do that, and its MAC address will be randomized as well.

Detecting shuffled beacons

Monitoring and ranging shuffled beacons requires some additional steps, but in the end can give you the same results as if you were doing this with standard beacons.

The most important thing to remember it to set up your API key, since in order to get you the correct values from the shuffled beacons your app will need to contact our backend. Because of that you can only work with beacons belonging to your account or the ones that were shared with you.

Setting up a Secure Region

If you want to detect shuffled beacons in your app you need to define a special region that will represent them. In case of iBeacons it needs to an instance of KTKSecureBeaconRegion:

let myProximityUuid = UUID(uuidString: "f7826da6-4fa2-4e98-8024-bc5b71e0893c")
let secureRegion1 = KTKSecureBeaconRegion(proximityUUID: myProximityUuid!, identifier: "Secure region 1")

For Eddystone beacons you should use KTKSecureEddystoneRegion:

let secureRegion2 = KTKSecureEddystoneRegion(namespaceID: "f7826da6bc5b71e0893e")

Monitoring and ranging shuffled iBeacons

Starting shuffled iBeacon monitoring and ranging works nearly the same as with default, non-shuffled iBeacons. You will find detailed information how to do that in the Detecting iBeacons section.

The only difference concerns accessing details of detected beacons. To get stable identifiers from a ranged beacon your app needs to read them from extra properties added by our SDK to a standard CLBeacon class:

func beaconManager(_ manager: KTKBeaconManager, didRangeBeacons beacons: [CLBeacon], in region: KTKBeaconRegion) {
    for beacon in beacons {
        print("Shuffled Proximity UUID: \(beacon.proximityUUID), Major: \(beacon.major) and Minor: \(beacon.minor)")
        print("Original Proximity UUID: \(beacon.ktk_proximityUUID), Major: \(beacon.ktk_major) and Minor: \(beacon.ktk_minor)")
    }
}

ktk_proximityUUID, ktk_major and ktk_minor when accessed on non-shuffled beacon will return its standard Proximity UUID, Major and Minor values, exactly as they are broadcasted by it.

Discovering shuffled Eddystone beacons

There are no changes when it comes to detection of shuffled Eddystone beacons compared to the procedure for normal Eddystone beacons. Please refer to Detecting Eddystone beacons section to learn how to do that.