baltica 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -37,10 +37,10 @@ class BridgePlayer extends libs_1.Emitter {
37
37
  }
38
38
  handlePacket(rawBuffer, clientBound) {
39
39
  let buffer = rawBuffer;
40
- const id = (0, protocol_1.getPacketId)(buffer);
40
+ const id = (0, protocol_1.getPacketId)(rawBuffer);
41
41
  const PacketClass = protocol_1.Packets[id];
42
42
  const event = PacketClass
43
- ? `${clientBound ? "server" : "client"}Bound-${PacketClass.name}`
43
+ ? `${clientBound ? "client" : "server"}Bound-${PacketClass.name}`
44
44
  : "Unknown";
45
45
  if (this.hasListeners(event) &&
46
46
  event !== "Unknown") {
@@ -12,6 +12,10 @@ declare function createOfflineSession(client: Client): Promise<void>;
12
12
  declare function authenticate(client: Client): Promise<void>;
13
13
  declare function setupClientProfile(client: Client, profile: Profile, accessToken: string[]): void;
14
14
  declare const decodeLoginJWT: (tokens: LoginTokens, version: keyof typeof ProtocolList) => Promise<{
15
+ key: null;
16
+ data: null;
17
+ skin: null;
18
+ } | {
15
19
  key: string;
16
20
  data: {};
17
21
  skin: jose.JWTPayload;
package/dist/libs/auth.js CHANGED
@@ -209,6 +209,10 @@ const decodeLoginJWT = async (tokens, version) => {
209
209
  const payload = JSON.parse(identity);
210
210
  let ClientUserChain = [];
211
211
  if ((0, __1.versionHigherThan)(version, "1.21.80")) {
212
+ if (!payload.Certificate) {
213
+ raknet_1.Logger.error("No certificate found in identity, possible version mismatch!");
214
+ return { key: null, data: null, skin: null };
215
+ }
212
216
  const parsed = JSON.parse(payload.Certificate);
213
217
  ClientUserChain = parsed.chain;
214
218
  }
@@ -134,6 +134,9 @@ class Player extends libs_1.Emitter {
134
134
  this.on("LoginPacket", async (packet) => {
135
135
  // TODO! Verify JWT.
136
136
  const { key, data, skin } = await (0, libs_1.decodeLoginJWT)(packet.tokens, types_1.CurrentVersionConst);
137
+ if (data === null) {
138
+ return;
139
+ }
137
140
  const extraData = data.extraData;
138
141
  this.username = extraData.displayName;
139
142
  this.loginPayload = skin;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "baltica",
3
3
  "description": "A MCBE Utility Library",
4
- "version": "0.1.1",
4
+ "version": "0.1.2",
5
5
  "minecraft": "1.21.93",
6
6
  "type": "commonjs",
7
7
  "main": "dist/index.js",