🧪
Multi-device (beta)
Using Multiple devices with one Keyless account
This process enables Keyless users to add and use multiple devices to their Keyless account, without the need to go through the enrollment process with each new device.
A Keyless device is identified by an ID (a signing key) and it contains any additional info specified
- 1.during the enrollment in the
withDeviceInfo
method; - 2.when adding a a new device in the
setupNewDevice
method;
Let's call the device you want to add the "new device" and any device already enrolled in the Keyless network "old device".
- The old device must be enrolled with Keyless.
- The new device must not be enrolled with Keyless.
The first step starts with the new device; the Keyless SDK will generate and encrypt the required data to add the new device to the Keyless network. In this step it is also possible to pass any additional info you want to associate to the device (similar to the
withDeviceInfo
method in the enrollment).Grab the
KeylessNewDeviceData
object containing the new device data. Android
iOS
val newDeviceData : KeylessNewDeviceData = Keyless.setupNewDevice(info = "device-info")
let newDeviceData = Keyless.setupNewDevice(info: "device-info")
You should now share the
newDeviceData
with your "old device". In fact, it is your "old device" that will add the "new device" to the Keyless network.The second step needs to be performed on the "old device" and it will require an authentication passing the
newDeviceData
.This informs your "old device" to add your "new device" to the KeylessNetwork.
Using
.addingNewDevice
in the AuthenticationConfiguration
will output some encrypted data: oldDeviceData
. The integretor is responsible to pass this oldDeviceData
to your "new device". You can see this oldDeviceData
as a confirmation blob necessary to complete the new device registration.Android
iOS
val configuration = AuthenticationConfiguration.builder
.addingNewDevice(newDeviceData = newDeviceData)
.build()
Keyless.authenticate(
authenticationConfiguration = configuration,
onCompletion = { result ->
when (result) {
is Keyless.KeylessResult.Success -> {
val oldDeviceData: KeylessOldDeviceData? = authResult.value.oldDeviceData
}
is Keyless.KeylessResult.Failure -> Log.d("KeylessSDK ", "Authentication failure - error code ${result.error.code}")
}
}
)
let configuration = Keyless.AuthenticationConfiguration.builder
.addingNewDevice( newDeviceData: newDeviceData)
.build()
Keyless.authenticate(
authenticationConfiguration: configuration,
onCompletion: { result in
switch result {
case .success(let success):
print(success.token)
case .failure(let error):
break
}
})
The third and last step is performed on the "new device". Authenticating providing the
oldDeviceData
from the previous step will finalize the "new device" registration with the Keyless network.Android
iOS
val configuration = AuthenticationConfiguration.builder
.confirmingNewDevice(oldDeviceData)
.build()
Keyless.authenticate(
authenticationConfiguration = configuration,
onCompletion = { result ->
when (result) {
is Keyless.KeylessResult.Success -> {
// new device added
}
is Keyless.KeylessResult.Failure -> Log.d("KeylessSDK ", "Authentication failure - error code ${result.error.code}")
}
}
)
let configuration = Keyless.AuthenticationConfiguration.builder
.confirmingNewDevice(oldDeviceData)
.build()
Keyless.authenticate(
authenticationConfiguration: configuration,
onCompletion: { result in
switch result {
case .success(let success):
// new device added
case .failure(let error):
break
}
})
It is possible to revoke any device for a given identifier. Revoking a device will make it impossible for the user to authenticate. Devices' identifiers are returned by the
Keyless.getDevicesList
method.Android
iOS
val configuration = AuthenticationConfiguration.builder
.revokingDevice(id = "device_identifier")
.build()
Keyless.authenticate(
authenticationConfiguration = configuration,
onCompletion = { result ->
when (result) {
is Keyless.KeylessResult.Success -> Log.d("KeylessSDK ", "Revoke device success")
is Keyless.KeylessResult.Failure -> Log.d("KeylessSDK ", "Revoke device - error code ${result.error.code}")
}
}
)
let configuration = Keyless.AuthenticationConfiguration.builder
.revokingDevice(id: "device_id")
.build()
Keyless.authenticate(
authenticationConfiguration: configuration,
onCompletion: { result in
switch result {
case .success(let success):
print("Revoke device success")
case .failure(let error):
print("Revoke device - error: \(error)")
}
})
Last modified 6mo ago