From 7004c92c1da6319cdfc523677f7b8e26cd310146 Mon Sep 17 00:00:00 2001 From: Timemaster111 <53912018+Timemaster111@users.noreply.github.com> Date: Tue, 20 Oct 2020 11:07:40 +0100 Subject: [PATCH] Update KSoftClient.js Added checks to ensure correct token format --- lib/KSoftClient.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/KSoftClient.js b/lib/KSoftClient.js index befc7ab..49bd26f 100644 --- a/lib/KSoftClient.js +++ b/lib/KSoftClient.js @@ -7,7 +7,8 @@ class KSoftClient extends EventEmitter { constructor(token) { super(); - + if(!token) throw new Error('Missing token'); + if(!/^[A-Za-z0-9]{40}$/.test(token)) throw new Error('Incorrect token format'); Object.defineProperty(this, 'token', { value: token }); this.endpoints = {}; this.init();