Device hash locking
About device hash locking
One physical device can be tied to several registrations. For example, this could happen after an end-user has re-registered using the same device.
You can use our device hash locking feature to get and lock all registrations tied to a particular device hash using a single operation.
This feature is distinct from the Device hash blocking feature, which prevents new registrations from being created on the device at all.
Device hash locking in comparison locks existing registrations.
Example use case
An end-user reports their device as stolen. Using the device hash, you can immediately lock all active registrations associated with that physical device, without needing to track down each individual device ID.
What is a device hash?
A device hash is a SHA-256 hash of the unique hardware ID of a physical device.
- For Android, the hardware ID is derived from the
Settings.Secure.ANDROID_IDvalue in the Android SDK. - For iOS, the hardware ID is generated by the SDK using Apple's
CFUUIDCreatefunction and stored in the end-user's iCloud Keychain.
How locking works
Platform behavior
Depending on the mobile platform, the device hash behaves differently when an app is reinstalled on the same device:
Scoping
The applicationId query parameter controls the scope of the operation:
API integration
We provide endpoints for device hash management in the Encap REST API. With these endpoints, you can carry out operations such as:
- Get all registrations tied to a physical device using its device hash.
- Lock all registrations tied to a physical device using its device hash.
Device hash response object
Both device hash management endpoints return a device hash response object. For an overview of all response object fields, see the table below:
{
"devices": [
{
"device_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"lock_status": "OPEN",
"device_status": "ACTIVATED"
}
]
}
Lock statuses
For an overview of all lock statuses, see the table below:
Device statuses
For an overview of all device statuses, see the table below:
Get registrations by device hash
You can use the Get registrations by device hash endpoint to retrieve all registrations associated with a physical device, identified by its device hash.
- This operation retrieves both active and deactivated registrations within your organisation.
- The
deviceHashpath parameter must be URL-safe Base64 encoded. - The
applicationIdquery parameter is optional.
GET /api/smart-device/v1/devices/deviceHashes/{deviceHash}?applicationId={applicationId}
Example
GET /api/smart-device/v1/devices/deviceHashes/wBHQ4HC3yLEUvEwnX5EBTBAbKkCia35WwO1dxqiFvYo=?applicationId=myApp
{
"devices": [
{
"device_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"lock_status": "OPEN",
"device_status": "ACTIVATED"
},
{
"device_id": "1cb72f91-3344-4812-a1de-7d845e22bcf1",
"lock_status": "OPEN",
"device_status": "DEACTIVATED"
}
]
}
Lock registrations by device hash
You can use the Lock registrations by device hash endpoint to lock all active and unlocked registrations associated with a physical device, identified by its device hash.
- This operation does not include registrations that have already been locked or deactivated.
- The
deviceHashpath parameter must be URL-safe Base64 encoded. - The
applicationIdquery parameter is optional.
If event callbacks are configured for DEVICE_LOCKED, then this operation sends one event callback for each locked registration by default.
To suppress these event callbacks for this operation, you can add suppressEventCallback=true to the request.
POST /api/smart-device/v1/devices/deviceHashes/{deviceHash}/lock?applicationId={applicationId}
Example
POST /api/smart-device/v1/devices/deviceHashes/wBHQ4HC3yLEUvEwnX5EBTBAbKkCia35WwO1dxqiFvYo=/lock?applicationId=myApp
{
"devices": [
{
"device_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"lock_status": "LOCKED_BY_ADMIN",
"device_status": "ACTIVATED"
}
]
}