Open Nexus-00 opened 3 weeks ago
See https://github.com/denoland/deno/issues/20397 and the related PR on Prismarine's side: https://github.com/PrismarineJS/node-minecraft-protocol/pull/1292
I believe this is not a problem on Deno's side (unless they intend to double down on the security side of things for 100% Node compatibility); node-minecraft-protocol
isn't properly following the related RFC
Also facing the same issue, tried changing Deno versions, Mineflayer versions. Unsure on how some people apparently managed to get this working.
import { BaseModule } from "../ModuleTypes.ts";
import { Bot, BotEvents, BotOptions, createBot } from "npm:mineflayer";
import { config } from "../main.ts";
import * as log from "@std/log";
type BotEventListeners = {
[K in keyof BotEvents]?: (...args: Parameters<BotEvents[K]>) => void;
};
export interface MinecraftModule extends BaseModule, BotEventListeners {
getBot(): Bot | undefined;
}
let options: Partial<BotOptions>,
instance: Bot | undefined;
export const MinecraftModule: MinecraftModule = {
name: "Minecraft Module",
init: () => {
options = config.get("mineflayer");
instance = createBot(options as BotOptions);
},
getBot: () => {
return instance;
},
login: () => {
log.info(
`Logged onto ${options.host || "unknown"} as ${
instance?.username || "N/A"
}!`,
);
},
};
Error:
error: Uncaught (in promise) Error: ASN.1 error: PEM error: PEM Base64 error: invalid Base64 encoding
at Object.publicEncrypt (ext:deno_node/internal/crypto/cipher.ts:221:10)
at sendEncryptionKeyResponse (file:///C:/Users/spook/AppData/Local/deno/npm/registry.npmjs.org/minecraft-protocol/1.50.0/src/client/encrypt.js:49:52)
at onJoinServerResponse (file:///C:/Users/spook/AppData/Local/deno/npm/registry.npmjs.org/minecraft-protocol/1.50.0/src/client/encrypt.js:36:11)
at file:///C:/Users/spook/AppData/Local/deno/npm/registry.npmjs.org/yggdrasil/1.7.0/src/utils.js:73:15
at Object.runMicrotasks (ext:core/01_core.js:672:26)
at processTicksAndRejections (ext:deno_node/_next_tick.ts:59:10)
at runNextTicks (ext:deno_node/_next_tick.ts:76:3)
at eventLoopTick (ext:core/01_core.js:182:21)
Version: Deno 2.0.3 Hello.
I am interested in using Deno to build a Minecraft player bot. I used the minelayer package and the Deno runtime. I wrote simple code that should log in to the player using Microsoft authentication. I am using Deno running on aarch64 Linux. I am also running mineflayer version 4.23.0.
I am currently attempting to run this code:
After authenticating with a Microsoft account. I get this strange error:
This code works as intended using the latest version of node js, which is 23.0.0-1. Steps to reproduce: