Comparing version 1.6.1 to 1.7.0
## History | ||
## 1.7.0 | ||
* Add new endpoint to invalidate all accessTokens using current valid accessToken and clientToken | ||
* Fixed "call" function throwing an empty error message | ||
## 1.6.1 | ||
@@ -4,0 +8,0 @@ * Properly escape the username |
{ | ||
"name": "yggdrasil", | ||
"version": "1.6.1", | ||
"version": "1.7.0", | ||
"author": "Zeke Sonxx <zeke@zekesonxx.com>", | ||
@@ -31,4 +31,4 @@ "description": "Mojang authentication (Yggdrasil) client", | ||
"devDependencies": { | ||
"@types/node": "^16.0.0", | ||
"@types/node-fetch": "^2.5.8", | ||
"@types/node": "^17.0.4", | ||
"@types/node-fetch": "^3.0.3", | ||
"@types/uuid": "^8.3.0", | ||
@@ -35,0 +35,0 @@ "mocha": "^9.0.0", |
@@ -49,2 +49,8 @@ # yggdrasil | ||
//Invalidate all accessTokens using a current valid accessToken and clientToken. | ||
ygg.invalidate(accessToken, clientToken).then( | ||
(response)=>{}, | ||
(error)=>{} | ||
); | ||
//Invalidate all accessTokens | ||
@@ -51,0 +57,0 @@ ygg.signout(username, password).then( |
@@ -66,2 +66,11 @@ const uuid = require('uuid') | ||
} | ||
/** | ||
* Invalidates all access tokens using client/access token pair. | ||
* @param {String} clientToken Client Token | ||
* @param {String} accessToken Access Token | ||
*/ | ||
async function invalidate (accessToken, clientToken) { | ||
return await utils.call(moduleOptions?.host ?? defaultHost, 'invalidate', { accessToken, clientToken }, moduleOptions?.agent) | ||
} | ||
return { | ||
@@ -71,3 +80,4 @@ auth: utils.callbackify(auth, 1), | ||
signout: utils.callbackify(signout, 1), | ||
validate: utils.callbackify(validate, 2) | ||
validate: utils.callbackify(validate, 2), | ||
invalidate: utils.callbackify(invalidate, 2) | ||
} | ||
@@ -74,0 +84,0 @@ } |
@@ -35,3 +35,3 @@ const nf = require('node-fetch') | ||
} | ||
if (body?.error !== undefined) throw new Error(body?.errorMessage) | ||
if (body?.error !== undefined) throw new Error(body?.errorMessage ?? body?.error) | ||
return body | ||
@@ -38,0 +38,0 @@ } |
28203
639
94