From 5a652dc1c6433542c5ce37494b14dca78abbccba Mon Sep 17 00:00:00 2001 From: Johan le stickman Date: Mon, 16 Oct 2023 11:55:28 +0200 Subject: [PATCH] =?UTF-8?q?Meilleur=20gestion=20de=20l'=C3=A9chec=20d'auth?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.js | 3 ++- package.json | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index c01e9e2..a1b4874 100644 --- a/index.js +++ b/index.js @@ -252,9 +252,10 @@ async function authentificate(){ }) if(this.options.verbose) console.info("Got challenge:", challenge?.result?.challenge || challenge?.msg || challenge) if(!challenge.success) return challenge + if(!challenge?.result?.challenge) return { success: false, msg: `No challenge was given for an unknown reason: ${challenge?.msg || challenge?.message || challenge?.result?.msg || challenge?.result?.message || challenge?.status_code}`, challenge } // Déterminer le mot de passe - var password = createHmac("sha1", this.options.appToken).update(challenge.result.challenge).digest("hex") + var password = createHmac("sha1", this.options.appToken).update(challenge?.result?.challenge).digest("hex") if(this.options.verbose) console.info("Password for challenge:", password) // On s'authentifie diff --git a/package.json b/package.json index f7f45b8..2750ba3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "freebox-wrapper", - "version": "1.0.2", + "version": "1.0.3", "description": "Un wrapper pour l'API de Freebox OS, gère la connexion et facilite les requêtes.", "main": "index.js", "keywords": [