@sanctumterra/raknet 1.4.4 → 1.4.5

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.
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,YAAY,EAWZ,QAAQ,EAIR,KAAK,KAAK,EAIV,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EACN,KAAK,aAAa,EAElB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAgB,KAAK,UAAU,EAAe,MAAM,YAAY,CAAC;AAGxE,qBAAa,MAAO,SAAQ,YAAY,CAAC,YAAY,CAAC;IACrD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAA2B;IAC7D,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAO;IAE1C,OAAO,EAAE,aAAa,CAAC;IAC9B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,QAAQ,CAAwB;IACxC,OAAO,CAAC,MAAM,CAAmB;IAC1B,IAAI,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,OAAO,CAAiB;IAChC,OAAO,CAAC,SAAS,CAAS;gBAEd,OAAO,GAAE,OAAO,CAAC,aAAa,CAAM;IAmBzC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IA6CxB,MAAM,IAAI,IAAI;IAYd,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,IAAI;IAuDhD,YAAY,CAAC,IAAI,EAAE,MAAM;IAwCzB,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,GAAE,QAA0B;IAI5D,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,GAAE,QAA0B;IAI/D,IAAI,IAAI,IAAI;IAQZ,IAAI,CAAC,IAAI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6 +100,8 @@ class Client extends shared_1.EventEmitter {
100
100
  request.mtu = reply.mtu;
101
101
  request.guid = this.options.guid;
102
102
  request.cookie = reply.cookie;
103
+ // Set to false since we don't support libcat encryption
104
+ request.clientSupportsecurity = false;
103
105
  this.send(request.serialize());
104
106
  break;
105
107
  }
@@ -2,7 +2,9 @@ import { BinaryStream } from "@serenityjs/binarystream";
2
2
  export declare class OpenConnectionReplyOne extends BinaryStream {
3
3
  guid: bigint;
4
4
  security: boolean;
5
+ hasCookie: boolean;
5
6
  cookie: number | null;
7
+ serverPublicKey: Buffer | null;
6
8
  mtu: number;
7
9
  serialize(): Buffer;
8
10
  deserialize(): OpenConnectionReplyOne;
@@ -1 +1 @@
1
- {"version":3,"file":"open-connection-reply-one.d.ts","sourceRoot":"","sources":["../../../../src/shared/proto/offline/open-connection-reply-one.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,YAAY,EAMZ,MAAM,0BAA0B,CAAC;AAIlC,qBAAa,sBAAuB,SAAQ,YAAY;IAChD,IAAI,EAAG,MAAM,CAAC;IACd,QAAQ,EAAG,OAAO,CAAC;IACnB,MAAM,EAAG,MAAM,GAAG,IAAI,CAAC;IACvB,GAAG,EAAG,MAAM,CAAC;IAEb,SAAS,IAAI,MAAM;IAYnB,WAAW,IAAI,sBAAsB;CAY5C"}
1
+ {"version":3,"file":"open-connection-reply-one.d.ts","sourceRoot":"","sources":["../../../../src/shared/proto/offline/open-connection-reply-one.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,YAAY,EAKZ,MAAM,0BAA0B,CAAC;AAIlC,qBAAa,sBAAuB,SAAQ,YAAY;IAChD,IAAI,EAAG,MAAM,CAAC;IACd,QAAQ,EAAG,OAAO,CAAC;IACnB,SAAS,EAAG,OAAO,CAAC;IACpB,MAAM,EAAG,MAAM,GAAG,IAAI,CAAC;IACvB,eAAe,EAAG,MAAM,GAAG,IAAI,CAAC;IAChC,GAAG,EAAG,MAAM,CAAC;IAEb,SAAS,IAAI,MAAM;IAYnB,WAAW,IAAI,sBAAsB;CAyB5C"}
@@ -7,7 +7,9 @@ const types_1 = require("../types");
7
7
  class OpenConnectionReplyOne extends binarystream_1.BinaryStream {
8
8
  guid;
9
9
  security;
10
+ hasCookie;
10
11
  cookie;
12
+ serverPublicKey;
11
13
  mtu;
12
14
  serialize() {
13
15
  binarystream_1.Uint8.write(this, enums_1.Packets.OpenConnectionReply1);
@@ -15,21 +17,33 @@ class OpenConnectionReplyOne extends binarystream_1.BinaryStream {
15
17
  binarystream_1.Int64.write(this, this.guid);
16
18
  binarystream_1.Bool.write(this, this.security);
17
19
  if (this.security && this.cookie != null) {
18
- binarystream_1.Int32.write(this, this.cookie);
20
+ this.writeUint32(this.cookie);
19
21
  }
20
- binarystream_1.Int16.write(this, this.mtu);
22
+ this.writeUint16(this.mtu);
21
23
  return this.getBuffer();
22
24
  }
23
25
  deserialize() {
24
26
  binarystream_1.Uint8.read(this);
25
27
  types_1.Magic.read(this);
26
- this.guid = binarystream_1.Int64.read(this);
28
+ this.guid = this.readInt64(binarystream_1.Endianness.Little);
27
29
  this.security = binarystream_1.Bool.read(this);
28
30
  this.cookie = null;
31
+ this.hasCookie = false;
32
+ this.serverPublicKey = null;
29
33
  if (this.security) {
30
- this.cookie = binarystream_1.Int32.read(this);
34
+ const remaining = this.buffer.byteLength - this.offset;
35
+ // Full security format: has_cookie (1) + cookie (4) + public_key (294) + mtu (2) = 301
36
+ if (remaining >= 1 + 4 + 294 + 2) {
37
+ this.hasCookie = binarystream_1.Bool.read(this);
38
+ this.cookie = this.readUint32();
39
+ this.serverPublicKey = this.read(294);
40
+ }
41
+ else if (remaining >= 4 + 2) {
42
+ // Simple security format: cookie (4) + mtu (2)
43
+ this.cookie = this.readUint32();
44
+ }
31
45
  }
32
- this.mtu = binarystream_1.Int16.read(this);
46
+ this.mtu = this.readUint16();
33
47
  return this;
34
48
  }
35
49
  }
@@ -5,6 +5,7 @@ export declare class OpenConnectionRequestTwo extends BinaryStream {
5
5
  mtu: number;
6
6
  guid: bigint;
7
7
  cookie: number | null;
8
+ clientSupportsecurity: boolean;
8
9
  serialize(): Buffer;
9
10
  deserialize(): OpenConnectionRequestTwo;
10
11
  }
@@ -1 +1 @@
1
- {"version":3,"file":"open-connection-request-two.d.ts","sourceRoot":"","sources":["../../../../src/shared/proto/offline/open-connection-request-two.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,YAAY,EAMZ,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,OAAO,EAAS,MAAM,UAAU,CAAC;AAE1C,qBAAa,wBAAyB,SAAQ,YAAY;IAClD,OAAO,EAAG,OAAO,CAAC;IAClB,GAAG,EAAG,MAAM,CAAC;IACb,IAAI,EAAG,MAAM,CAAC;IACd,MAAM,EAAG,MAAM,GAAG,IAAI,CAAC;IAEvB,SAAS,IAAI,MAAM;IAanB,WAAW,IAAI,wBAAwB;CAW9C"}
1
+ {"version":3,"file":"open-connection-request-two.d.ts","sourceRoot":"","sources":["../../../../src/shared/proto/offline/open-connection-request-two.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAsB,MAAM,0BAA0B,CAAC;AAE5E,OAAO,EAAE,OAAO,EAAS,MAAM,UAAU,CAAC;AAE1C,qBAAa,wBAAyB,SAAQ,YAAY;IAClD,OAAO,EAAG,OAAO,CAAC;IAClB,GAAG,EAAG,MAAM,CAAC;IACb,IAAI,EAAG,MAAM,CAAC;IACd,MAAM,EAAG,MAAM,GAAG,IAAI,CAAC;IACvB,qBAAqB,EAAG,OAAO,CAAC;IAEhC,SAAS,IAAI,MAAM;IAcnB,WAAW,IAAI,wBAAwB;CAc9C"}
@@ -9,26 +9,31 @@ class OpenConnectionRequestTwo extends binarystream_1.BinaryStream {
9
9
  mtu;
10
10
  guid;
11
11
  cookie;
12
+ clientSupportsecurity;
12
13
  serialize() {
13
14
  binarystream_1.Uint8.write(this, enums_1.Packets.OpenConnectionRequest2);
14
15
  types_1.Magic.write(this);
15
16
  if (this.cookie != null) {
16
- binarystream_1.Int32.write(this, this.cookie);
17
- binarystream_1.Bool.write(this, true); //Not sure about this (https://minecraft.wiki/w/RakNet#Open_Connection_Reply_2)
17
+ this.writeUint32(this.cookie);
18
+ // client_supports_security should be false if we don't support libcat encryption
19
+ binarystream_1.Bool.write(this, this.clientSupportsecurity ?? false);
18
20
  }
19
21
  types_1.Address.write(this, this.address);
20
- binarystream_1.Int16.write(this, this.mtu);
22
+ this.writeUint16(this.mtu);
21
23
  binarystream_1.Int64.write(this, this.guid);
22
24
  return this.getBuffer();
23
25
  }
24
26
  deserialize() {
25
27
  binarystream_1.Uint8.read(this);
26
28
  types_1.Magic.read(this);
27
- //TODO:If server uses security need to Deserialize cookie
28
- //But this implemntion doesnt seem to use cookies
29
- //https://minecraft.wiki/w/RakNet#Open_Connection_Request_2
29
+ // Check if there's enough data for cookie + clientSupportsecurity before address
30
+ // Cookie format: cookie (4) + clientSupportsecurity (1) = 5 bytes minimum before address
31
+ // We need to peek ahead to determine if security data is present
32
+ // For now, assume no security on deserialize (server-side typically doesn't need this)
33
+ this.cookie = null;
34
+ this.clientSupportsecurity = false;
30
35
  this.address = types_1.Address.read(this);
31
- this.mtu = binarystream_1.Int16.read(this);
36
+ this.mtu = this.readUint16();
32
37
  this.guid = binarystream_1.Int64.read(this);
33
38
  return this;
34
39
  }
@@ -2,7 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const client_1 = require("../client");
4
4
  const client = new client_1.Client({
5
- address: "donutsmp.net",
5
+ // address: "donutsmp.net",
6
+ // address: "127.0.0.1",
7
+ address: "geo.hivebedrock.network",
6
8
  });
7
9
  client.on("unconnectedPong", (packet) => {
8
10
  console.log(packet);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanctumterra/raknet",
3
- "version": "1.4.4",
3
+ "version": "1.4.5",
4
4
  "description": "",
5
5
 
6
6
  "types": "dist/index.d.ts",