Open link-discord opened 7 months ago
Sorry I noticed the generateKeyPairSync
function does actually exist now, but it doesn't change the issue.
This is due to an incompatibility with the library "jose" and bun's KeyObject, mineflayer or prismarineJS are not at fault.
This is due to an incompatibility with the library "jose" and bun's KeyObject, mineflayer or prismarineJS are not at fault.
Although this can be fixed on the prismarine-auth side by adding a compat layer like so:
prismarine-auth/src/TokenManagers/XboxTokenManager.js
change constructor of class XboxTokenManager to this
constructor (ecKey, cache) {
this.key = ecKey
importSPKI(ecKey.publicKey.export({ type: 'spki', format: 'pem' }), 'ES256', { extractable: true }).then(pubKey => {
exportJWK(pubKey).then(jwk => {
this.jwk = { ...jwk, alg: 'ES256', use: 'sig' }
})
})
this.cache = cache
this.headers = { 'Cache-Control': 'no-store, must-revalidate, no-cache', 'x-xbl-contract-version': 1 }
}
and import the "importSPKI" function at the top of the file with the "exportJWK"
const { exportJWK, importSPKI } = require('jose')
exact same issue, bun v1.1.8 on Windows 11
This issue is stale and may be closed due to inactivity. If you're still running into this, please leave a comment.
What version of Bun is running?
1.1.2+c8d072c2a
What platform is your computer?
Microsoft Windows NT 10.0.22631.0 x64
What steps can reproduce the bug?
Run this code with the mineflayer package installed and you get an error when you set the
auth
parameter to'microsoft'
like in the code below.The code doesn't work because somewhere down the line the code depends on the nodejs crypto module to run this function:
The function doesn't return the correct type though.
What is the expected behavior?
The code is supposed to prompt me for a microsoft login and when that is done, the bot should join the microsoft server I setup on my pc that is open on port 25565
What do you see instead?
Additional information
Mineflayer is a library that can be used to make bots for the game Minecraft. A link to Mineflayers repo can be found here: https://github.com/PrismarineJS/mineflayer