From 58d6522121cc918bad09124adde28746188ba08a Mon Sep 17 00:00:00 2001 From: B3none <24966460+B3none@users.noreply.github.com> Date: Tue, 9 Apr 2024 14:57:56 +0100 Subject: [PATCH] Added appName and deviceName length check to Users.ts As documented here: https://github.com/peter-murray/node-hue-api/blob/HEAD/docs/users.md#createuser --- src/api/Users.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/api/Users.ts b/src/api/Users.ts index bdc8060..30487b1 100644 --- a/src/api/Users.ts +++ b/src/api/Users.ts @@ -83,7 +83,13 @@ export class Users extends ApiDefinition { if (state) { oldBridge = state.modelid === 'BSB001'; } - + + if (appName.length > 20) { + throw new Error("appName is too long"); + } else if (deviceName && deviceName.length > 19) { + throw new Error("deviceName is too long"); + } + return this.execute(configurationApi.createUser, { appName: appName, deviceName: deviceName,