From 2cf80449876f1960c6816a231e663cb24b04d9c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Monda?= Date: Sat, 19 May 2018 14:07:18 +0200 Subject: [PATCH] Check the signature of the hardware configuration area instead of uniqueId. --- packages/uhk-common/src/util/helpers.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/uhk-common/src/util/helpers.ts b/packages/uhk-common/src/util/helpers.ts index 57f26916..185cb375 100644 --- a/packages/uhk-common/src/util/helpers.ts +++ b/packages/uhk-common/src/util/helpers.ts @@ -5,10 +5,11 @@ export const getHardwareConfigFromDeviceResponse = (json: string): HardwareConfi const hardwareConfig = new HardwareConfiguration(); hardwareConfig.fromBinary(UhkBuffer.fromArray(data)); - if (hardwareConfig.uniqueId > 0) { - return hardwareConfig; + if (hardwareConfig.signature !== 'UHK') { + throw Error('Invalid hardware configuration'); } - return null; + + return hardwareConfig; }; export const getUserConfigFromDeviceResponse = (json: string): UserConfiguration => {