From e70f42efddf01d4edeb3a3bb53c19cb76fd66ad0 Mon Sep 17 00:00:00 2001 From: bluefoxy009 <59001842+bluefoxy009@users.noreply.github.com> Date: Thu, 20 Jun 2024 19:18:59 -0600 Subject: [PATCH] Remove jose dependency (#103) --- README.md | 2 +- package.json | 5 ++--- src/TokenManagers/XboxTokenManager.js | 5 +---- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 4f85009..e9ee2c9 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ const userIdentifier = 'any unique identifier' const cacheDir = './' // You can leave this as undefined unless you want to specify a caching directory const flow = new Authflow(userIdentifier, cacheDir) // Get a Minecraft Java Edition auth token, then log it -flow.getMinecraftJavaToken().then(console.log) +flow.getMinecraftJavaToken({ fetchProfile: true }).then(console.log) ``` ### Expected Response diff --git a/package.json b/package.json index 1b4fde0..f5c39b4 100644 --- a/package.json +++ b/package.json @@ -28,14 +28,13 @@ "chai": "^4.3.4", "chai-as-promised": "^7.1.1", "mocha": "^10.0.0", - "standard": "^17.0.0", - "prismarine-auth": "file:." + "prismarine-auth": "file:.", + "standard": "^17.0.0" }, "dependencies": { "@azure/msal-node": "^2.0.2", "@xboxreplay/xboxlive-auth": "^3.3.3", "debug": "^4.3.3", - "jose": "^4.1.4", "node-fetch": "^2.6.1", "smart-buffer": "^4.1.0", "uuid-1345": "^1.0.2" diff --git a/src/TokenManagers/XboxTokenManager.js b/src/TokenManagers/XboxTokenManager.js index 305db68..6df1b17 100644 --- a/src/TokenManagers/XboxTokenManager.js +++ b/src/TokenManagers/XboxTokenManager.js @@ -3,7 +3,6 @@ const crypto = require('crypto') const XboxLiveAuth = require('@xboxreplay/xboxlive-auth') const debug = require('debug')('prismarine-auth') const { SmartBuffer } = require('smart-buffer') -const { exportJWK } = require('jose') const fetch = require('node-fetch') const { Endpoints, xboxLiveErrors } = require('../common/Constants') @@ -22,9 +21,7 @@ const checkIfValid = (expires) => { class XboxTokenManager { constructor (ecKey, cache) { this.key = ecKey - exportJWK(ecKey.publicKey).then(jwk => { - this.jwk = { ...jwk, alg: 'ES256', use: 'sig' } - }) + this.jwk = { ...ecKey.publicKey.export({ format: 'jwk' }), alg: 'ES256', use: 'sig' } this.cache = cache this.headers = { 'Cache-Control': 'no-store, must-revalidate, no-cache', 'x-xbl-contract-version': 1 }