Skip to content

Commit

Permalink
Meilleur gestion de l'échec d'auth
Browse files Browse the repository at this point in the history
  • Loading branch information
johan-perso committed Oct 16, 2023
1 parent 51ceb3d commit 5a652dc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": [
Expand Down

0 comments on commit 5a652dc

Please sign in to comment.