PrismarineJS / node-minecraft-protocol

Parse and serialize minecraft packets, plus authentication and encryption.
https://prismarinejs.github.io/node-minecraft-protocol/
BSD 3-Clause "New" or "Revised" License
1.2k stars 241 forks source link

Chat Signing is Forced for Commands #1262

Closed WhoTho closed 6 months ago

WhoTho commented 7 months ago

When sending commands through client.chat, chat signing of command arguments is forced despite the client not having profile keys. This causes the "Can't sign message without profile keys, please set valid auth mode" error.

I don't know how chat signing works, but I assume it'll be as easy to fix as changing the signing line in signaturesForCommand to something like:

signatures.push({
  argumentName: fieldName,
  signature:
    client.profileKeys ?
    client.signMessage(signable, ts, salt, preview, acknowledgements) :
    Buffer.alloc(0)
})
frej4189 commented 7 months ago

Can be fixed by mirroring the normal chat message signing behaviour (e.g. providing no signature when profile keys are not set)

https://github.com/PrismarineJS/node-minecraft-protocol/blob/827b6cdb61eac9e1b737fa0a9fb8e81385a78d3d/src/client/chat.js#L403

extremeheat commented 6 months ago

@frej4189 Can you open a PR to fix or show suggested patch?

extremeheat commented 6 months ago

Should be fixed with #1277