@honeybbq/teamspeak-client 0.1.0 → 0.1.1

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.
Files changed (38) hide show
  1. package/dist/{crypt-init2-BIbQ7TN0.cjs → crypt-init2-C2oihZ7e.cjs} +2 -2
  2. package/dist/crypt-init2-C2oihZ7e.cjs.map +1 -0
  3. package/dist/{crypt-init2-C63eypta.js → crypt-init2-DWX7Tp-_.js} +36 -41
  4. package/dist/crypt-init2-DWX7Tp-_.js.map +1 -0
  5. package/dist/crypto/identity.d.ts.map +1 -1
  6. package/dist/crypto/index.cjs +1 -1
  7. package/dist/crypto/index.mjs +3 -3
  8. package/dist/crypto/primitives.d.ts +17 -2
  9. package/dist/crypto/primitives.d.ts.map +1 -1
  10. package/dist/{crypto-C3gBJkh2.cjs → crypto-2veVY1fC.cjs} +2 -2
  11. package/dist/{crypto-C3gBJkh2.cjs.map → crypto-2veVY1fC.cjs.map} +1 -1
  12. package/dist/{crypto-IGJlkTAl.js → crypto-VC7n6YJb.js} +12 -12
  13. package/dist/{crypto-IGJlkTAl.js.map → crypto-VC7n6YJb.js.map} +1 -1
  14. package/dist/{handler-C2vxlHYC.js → handler-C_JhqGTd.js} +2 -5
  15. package/dist/handler-C_JhqGTd.js.map +1 -0
  16. package/dist/{handler-DQteUMKT.cjs → handler-CqCD93f0.cjs} +2 -2
  17. package/dist/handler-CqCD93f0.cjs.map +1 -0
  18. package/dist/handshake/index.cjs +1 -1
  19. package/dist/handshake/index.mjs +1 -1
  20. package/dist/index.cjs +1 -1
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.mjs +72 -72
  23. package/dist/index.mjs.map +1 -1
  24. package/dist/{primitives-CmIK1O7L.js → primitives-BIAYfJ2Y.js} +12 -6
  25. package/dist/primitives-BIAYfJ2Y.js.map +1 -0
  26. package/dist/primitives-bj-ml31v.cjs +2 -0
  27. package/dist/primitives-bj-ml31v.cjs.map +1 -0
  28. package/dist/transport/handler.d.ts.map +1 -1
  29. package/dist/transport/index.cjs +1 -1
  30. package/dist/transport/index.mjs +1 -1
  31. package/package.json +4 -4
  32. package/dist/crypt-init2-BIbQ7TN0.cjs.map +0 -1
  33. package/dist/crypt-init2-C63eypta.js.map +0 -1
  34. package/dist/handler-C2vxlHYC.js.map +0 -1
  35. package/dist/handler-DQteUMKT.cjs.map +0 -1
  36. package/dist/primitives-BxtDMP7x.cjs +0 -2
  37. package/dist/primitives-BxtDMP7x.cjs.map +0 -1
  38. package/dist/primitives-CmIK1O7L.js.map +0 -1
package/dist/index.mjs CHANGED
@@ -1,16 +1,16 @@
1
1
  import { n as e, r as t, t as n } from "./types-CGKgXvpG.js";
2
- import { S as r, _ as i, b as a, c as o, d as s, g as c, h as l, i as u, l as d, m as f, n as ee, p, s as m, v as h, x as g, y as _ } from "./primitives-CmIK1O7L.js";
3
- import { t as v } from "./crypto-IGJlkTAl.js";
2
+ import { C as r, S as i, _ as a, b as o, d as s, g as c, h as l, l as u, o as d, p as f, r as p, u as m, v as ee, w as h, x as g, y as _ } from "./primitives-BIAYfJ2Y.js";
3
+ import { t as v } from "./crypto-VC7n6YJb.js";
4
4
  import { t as y } from "./resolver-DDZWomrF.js";
5
- import { a as b, t as x } from "./handler-C2vxlHYC.js";
5
+ import { a as b, t as x } from "./handler-C_JhqGTd.js";
6
6
  import { i as S, n as C, t as w } from "./command-caXc4h0n.js";
7
7
  import { n as T } from "./crypt-handshake-CHmvZ2qs.js";
8
- import { t as te } from "./crypt-init2-C63eypta.js";
9
- import { t as E } from "./parser-CJjP3LlO.js";
10
- import { createHash as D } from "node:crypto";
11
- import { createConnection as O } from "node:net";
8
+ import { t as E } from "./crypt-init2-DWX7Tp-_.js";
9
+ import { t as D } from "./parser-CJjP3LlO.js";
10
+ import { createHash as O } from "node:crypto";
11
+ import { createConnection as k } from "node:net";
12
12
  //#region src/commands.ts
13
- var k = class {
13
+ var A = class {
14
14
  #e = /* @__PURE__ */ new Map();
15
15
  #t = 0;
16
16
  #n = [];
@@ -50,25 +50,25 @@ var k = class {
50
50
  this.#e.clear(), this.#n = [], this.#r = !1, this.#t = 0;
51
51
  }
52
52
  };
53
- function A(e) {
54
- let t = e.id ?? "0", n = e.msg ?? "", r = e.return_code, i = null;
55
- t !== "0" && (i = new g(t, n));
56
- let a = null;
57
- if (r !== void 0 && r !== "") {
58
- let e = parseInt(r, 10);
59
- isNaN(e) || (a = e);
53
+ function j(e) {
54
+ let t = e.id ?? "0", n = e.msg ?? "", i = e.return_code, a = null;
55
+ t !== "0" && (a = new r(t, n));
56
+ let o = null;
57
+ if (i !== void 0 && i !== "") {
58
+ let e = parseInt(i, 10);
59
+ isNaN(e) || (o = e);
60
60
  }
61
61
  return {
62
- err: i,
63
- rc: a
62
+ err: a,
63
+ rc: o
64
64
  };
65
65
  }
66
- function j(e, t) {
66
+ function M(e, t) {
67
67
  return e.includes("return_code=") ? e : `${e} return_code=${t}`;
68
68
  }
69
69
  //#endregion
70
70
  //#region src/transfer.ts
71
- var M = class {
71
+ var N = class {
72
72
  #e = /* @__PURE__ */ new Map();
73
73
  #t = 0;
74
74
  register() {
@@ -89,34 +89,34 @@ var M = class {
89
89
  this.#e.clear(), this.#t = 0;
90
90
  }
91
91
  };
92
- function N(e, t, n) {
92
+ function P(e, t, n) {
93
93
  return new Promise((r, i) => {
94
- let a = O({
94
+ let a = k({
95
95
  host: e,
96
96
  port: t
97
97
  }, () => {
98
98
  a.write(n, (e) => {
99
- e ? (a.destroy(), i(new h(`failed to send transfer key: ${e.message}`))) : r(a);
99
+ e ? (a.destroy(), i(new o(`failed to send transfer key: ${e.message}`))) : r(a);
100
100
  });
101
101
  });
102
102
  a.setTimeout(1e4), a.once("error", i), a.once("timeout", () => {
103
- a.destroy(), i(new h("connection timeout"));
103
+ a.destroy(), i(new o("connection timeout"));
104
104
  });
105
105
  });
106
106
  }
107
- async function P(e, t, n) {
108
- let r = await N(e, t.port, t.fileTransferKey);
107
+ async function F(e, t, n) {
108
+ let r = await P(e, t.port, t.fileTransferKey);
109
109
  await new Promise((e, t) => {
110
110
  n.pipe(r), r.on("finish", e), r.on("error", t);
111
111
  });
112
112
  }
113
- async function F(e, t, n) {
114
- let r = await N(e, t.port, t.fileTransferKey);
113
+ async function I(e, t, n) {
114
+ let r = await P(e, t.port, t.fileTransferKey);
115
115
  await new Promise((e, t) => {
116
116
  r.pipe(n), n.on("finish", e), r.on("error", t), n.on("error", t);
117
117
  });
118
118
  }
119
- function I(e, t, n, r, i, a) {
119
+ function L(e, t, n, r, i, a) {
120
120
  let o = t.startsWith("/") ? t : `/${t}`;
121
121
  return w("ftinitupload", {
122
122
  cid: String(e),
@@ -128,7 +128,7 @@ function I(e, t, n, r, i, a) {
128
128
  resume: "0"
129
129
  });
130
130
  }
131
- function L(e, t, n, r) {
131
+ function R(e, t, n, r) {
132
132
  let i = t.startsWith("/") ? t : `/${t}`;
133
133
  return w("ftinitdownload", {
134
134
  cid: String(e),
@@ -140,28 +140,28 @@ function L(e, t, n, r) {
140
140
  }
141
141
  //#endregion
142
142
  //#region src/events.ts
143
- function R(e, t) {
143
+ function z(e, t) {
144
144
  let n = t;
145
145
  for (let t = e.length - 1; t >= 0; t--) n = e[t](n);
146
146
  return n;
147
147
  }
148
- function z(e, t) {
148
+ function B(e, t) {
149
149
  let n = t;
150
150
  for (let t = e.length - 1; t >= 0; t--) n = e[t](n);
151
151
  return n;
152
152
  }
153
153
  //#endregion
154
154
  //#region src/handshake.ts
155
- function B(e, t) {
155
+ function V(e, t) {
156
156
  let n = t.alpha ?? "", r = t.beta ?? "", i = t.omega ?? "";
157
157
  e.crypt.initCrypto(n, r, i), e.logger.info("crypto initialized (P-256 path), sending clientinit"), G(e);
158
158
  }
159
- function V(e, t) {
159
+ function H(e, t) {
160
160
  e.logger.info("received initivexpand2"), e.handler.receivedFinalInitAck();
161
- let n = t.l ?? "", r = t.omega ?? "", i = t.proof ?? "", a = t.beta ?? "", o = U(e, a);
162
- te(e.crypt, n, r, i, a, o), G(e);
161
+ let n = t.l ?? "", r = t.omega ?? "", i = t.proof ?? "", a = t.beta ?? "", o = te(e, a);
162
+ E(e.crypt, n, r, i, a, o), G(e);
163
163
  }
164
- function H(e, t) {
164
+ function U(e, t) {
165
165
  let n = t.aclid ?? t.clid ?? "", r = n ? parseInt(n, 10) : 0;
166
166
  r > 0 && (e.clid = r, e.handler.setClientID(r)), e.logger.info("connected to server", { selfId: e.clid }), e._markConnected(), setImmediate(() => {
167
167
  let t = w("clientupdate", {
@@ -171,20 +171,20 @@ function H(e, t) {
171
171
  e.sendCommandNoWait(t).catch(() => {});
172
172
  });
173
173
  }
174
- function U(e, t) {
175
- let [n, r] = ee(), i = Buffer.from(n).toString("base64"), a = W(e, n, t), o = C("clientek", [["ek", i], ["proof", a]]);
174
+ function te(e, t) {
175
+ let [n, r] = p(), i = Buffer.from(n).toString("base64"), a = W(e, n, t), o = C("clientek", [["ek", i], ["proof", a]]);
176
176
  return e.handler.sendPacket(b.Command, Buffer.from(o), 0), r;
177
177
  }
178
178
  function W(e, t, n) {
179
179
  let r = Buffer.from(n, "base64"), i = new Uint8Array(86);
180
180
  i.set(t.slice(0, 32)), i.set(r.slice(0, Math.min(54, r.length)), 32);
181
- let a = u(e.crypt.identity.privateKey, i);
181
+ let a = d(e.crypt.identity.privateKey, i);
182
182
  return Buffer.from(a).toString("base64");
183
183
  }
184
184
  function G(e) {
185
- let t = e.crypt.identity.publicKeyBase64(), n = D("sha256").update(t).digest().slice(0, 16).toString("base64"), r = C("clientinit", [
185
+ let t = e.crypt.identity.publicKeyBase64(), n = O("sha1").update(t).digest().toString("base64"), r = C("clientinit", [
186
186
  ["client_nickname", e.nickname],
187
- ["client_version", "3.5.3 [Build: 1587971024]"],
187
+ ["client_version", "3.?.? [Build: 5680278000]"],
188
188
  ["client_platform", "Windows"],
189
189
  ["client_input_hardware", "1"],
190
190
  ["client_output_hardware", "1"],
@@ -192,7 +192,7 @@ function G(e) {
192
192
  ["client_default_channel_password", ""],
193
193
  ["client_server_password", ""],
194
194
  ["client_meta_data", ""],
195
- ["client_version_sign", "Kvmj7qX6wJCPI5GVT71samfmhz/bvs7M+OTXWB/JWxdQbxDe17xda7dzUWLX7pjvdJTqZmbse1HBmTxThPKvAg=="],
195
+ ["client_version_sign", "DX5NIYLvfJEUjuIbCidnoeozxIDRRkpq3I9vVMBmE9L2qnekOoBzSenkzsg2lC9CMv8K5hkEzhr2TYUYSwUXCg=="],
196
196
  ["client_key_offset", String(e.crypt.identity.offset)],
197
197
  ["client_nickname_phonetic", ""],
198
198
  ["client_default_token", ""],
@@ -391,8 +391,8 @@ var ce = class e {
391
391
  #n;
392
392
  #r = n.Disconnected;
393
393
  #i = new ce();
394
- #a = new k();
395
- #o = new M();
394
+ #a = new A();
395
+ #o = new N();
396
396
  #s = /* @__PURE__ */ new Map();
397
397
  #c = [];
398
398
  #l = [];
@@ -415,7 +415,7 @@ var ce = class e {
415
415
  return this.#r;
416
416
  }
417
417
  async connect() {
418
- if (this.#r !== n.Disconnected) throw new p();
418
+ if (this.#r !== n.Disconnected) throw new l();
419
419
  this.#S(), this.#r = n.Connecting;
420
420
  let e = await this.#C();
421
421
  this.logger.info("connecting to server", { address: e }), await this.handler.connect(e);
@@ -442,13 +442,13 @@ var ce = class e {
442
442
  await this.execCommandWithResponse(e, t);
443
443
  }
444
444
  async execCommandWithResponse(e, t = 1e4) {
445
- let [n, r] = this.#a.register(), i = j(e, n);
445
+ let [n, r] = this.#a.register(), i = M(e, n);
446
446
  try {
447
447
  await this.#i.wait(), await this.#b(i);
448
448
  } catch (e) {
449
449
  throw this.#a.unregister(n), e;
450
450
  }
451
- let a = await Promise.race([r, new Promise((n, r) => setTimeout(() => r(new f(e)), t))]);
451
+ let a = await Promise.race([r, new Promise((n, r) => setTimeout(() => r(new c(e)), t))]);
452
452
  if (this.#a.unregister(n), a.err) throw a.err;
453
453
  return a.data;
454
454
  }
@@ -500,40 +500,40 @@ var ce = class e {
500
500
  this.handler.sendVoicePacket(e, t);
501
501
  }
502
502
  async fileTransferInitUpload(e, t, n, r, i = !1) {
503
- let [a, o] = this.#o.register(), s = I(e, t, n, r, a, i);
503
+ let [a, s] = this.#o.register(), c = L(e, t, n, r, a, i);
504
504
  try {
505
- await this.execCommand(s, 1e4);
505
+ await this.execCommand(c, 1e4);
506
506
  } catch (e) {
507
507
  throw this.#o.unregister(a), e;
508
508
  }
509
- let c = await Promise.race([o, new Promise((e, t) => setTimeout(() => t(new _()), 1e4))]);
510
- if (this.#o.unregister(a), "size" in c) throw new h("unexpected download response");
511
- if ("status" in c) {
512
- let e = c;
513
- throw new h(`${e.message} (status=${e.status})`);
509
+ let l = await Promise.race([s, new Promise((e, t) => setTimeout(() => t(new g()), 1e4))]);
510
+ if (this.#o.unregister(a), "size" in l) throw new o("unexpected download response");
511
+ if ("status" in l) {
512
+ let e = l;
513
+ throw new o(`${e.message} (status=${e.status})`);
514
514
  }
515
- return c;
515
+ return l;
516
516
  }
517
517
  async fileTransferInitDownload(e, t, n) {
518
- let [r, i] = this.#o.register(), a = L(e, t, n, r);
518
+ let [r, i] = this.#o.register(), a = R(e, t, n, r);
519
519
  try {
520
520
  await this.execCommand(a, 1e4);
521
521
  } catch (e) {
522
522
  throw this.#o.unregister(r), e;
523
523
  }
524
- let o = await Promise.race([i, new Promise((e, t) => setTimeout(() => t(new _()), 1e4))]);
525
- if (this.#o.unregister(r), "seekPosition" in o) throw new h("unexpected upload response");
526
- if ("status" in o) {
527
- let e = o;
528
- throw new h(`${e.message} (status=${e.status})`);
524
+ let s = await Promise.race([i, new Promise((e, t) => setTimeout(() => t(new g()), 1e4))]);
525
+ if (this.#o.unregister(r), "seekPosition" in s) throw new o("unexpected upload response");
526
+ if ("status" in s) {
527
+ let e = s;
528
+ throw new o(`${e.message} (status=${e.status})`);
529
529
  }
530
- return o;
530
+ return s;
531
531
  }
532
532
  uploadFileData(e, t, n) {
533
- return P(e, t, n);
533
+ return F(e, t, n);
534
534
  }
535
535
  downloadFileData(e, t, n) {
536
- return F(e, t, n);
536
+ return I(e, t, n);
537
537
  }
538
538
  _markConnected() {
539
539
  this.#r = n.Connected;
@@ -589,7 +589,7 @@ var ce = class e {
589
589
  }
590
590
  }
591
591
  #O(e) {
592
- let t = E(e);
592
+ let t = D(e);
593
593
  if (!(!t || !t.name)) {
594
594
  if (t.name.startsWith("notify")) {
595
595
  let e = Z(t, this.clid, this.#s, this.nickname);
@@ -598,13 +598,13 @@ var ce = class e {
598
598
  }
599
599
  switch (t.name) {
600
600
  case "clientinitiv":
601
- B(this, t.params);
601
+ V(this, t.params);
602
602
  break;
603
603
  case "initivexpand2":
604
- V(this, t.params);
604
+ H(this, t.params);
605
605
  break;
606
606
  case "initserver":
607
- H(this, t.params);
607
+ U(this, t.params);
608
608
  break;
609
609
  case "error":
610
610
  this.#k(t.params);
@@ -625,7 +625,7 @@ var ce = class e {
625
625
  }
626
626
  }
627
627
  #k(e) {
628
- let { err: t, rc: n } = A(e);
628
+ let { err: t, rc: n } = j(e);
629
629
  n === null ? this.#a.discardBuffer() : this.#a.resolve(n, t), (e.id ?? "0") === "3329" && setImmediate(() => this.disconnect().catch(() => {}));
630
630
  }
631
631
  #A(e, t) {
@@ -690,12 +690,12 @@ var ce = class e {
690
690
  for (let n of t) setImmediate(() => n(e ?? void 0));
691
691
  }
692
692
  #P() {
693
- return R(this.#v, async (e) => {
693
+ return z(this.#v, async (e) => {
694
694
  this.handler.sendPacket(b.Command, Buffer.from(e), 0);
695
695
  });
696
696
  }
697
697
  #F() {
698
- return z(this.#y, (e) => {
698
+ return B(this.#y, (e) => {
699
699
  typeof e == "object" && e && "invokerName" in e && "message" in e && "targetMode" in e ? this.#M("textMessage", e) : typeof e == "object" && e && "invokerName" in e && "message" in e && !("targetMode" in e) ? this.#M("poked", e) : typeof e == "object" && e && "id" in e && "uid" in e ? this.#M("clientEnter", e) : typeof e == "object" && e && "id" in e && "reasonID" in e && "targetChannelID" in e ? this.#M("clientMoved", e) : typeof e == "object" && e && "id" in e && "reasonID" in e && this.#M("clientLeave", e);
700
700
  });
701
701
  }
@@ -756,6 +756,6 @@ async function ge(e, t, n) {
756
756
  await e.execCommand(i, 1e4);
757
757
  }
758
758
  //#endregion
759
- export { p as AlreadyConnectedError, le as Client, n as ClientStatus, f as CommandTimeoutError, l as CryptoInitError, c as EAXTagMismatchError, i as FakeSignatureMismatchError, h as FileTransferError, _ as FileTransferTimeoutError, m as Identity, a as InvalidIdentityError, g as ServerError, r as TeamspeakError, de as clientMove, e as consoleLogger, N as dialFileTransfer, F as downloadFileData, ge as fileTransferDeleteFile, o as generateIdentity, pe as getClientInfo, d as getUidFromPublicKey, s as identityFromString, me as listChannels, he as listClients, t as noopLogger, fe as poke, ue as sendTextMessage, P as uploadFileData };
759
+ export { l as AlreadyConnectedError, le as Client, n as ClientStatus, c as CommandTimeoutError, a as CryptoInitError, ee as EAXTagMismatchError, _ as FakeSignatureMismatchError, o as FileTransferError, g as FileTransferTimeoutError, u as Identity, i as InvalidIdentityError, r as ServerError, h as TeamspeakError, de as clientMove, e as consoleLogger, P as dialFileTransfer, I as downloadFileData, ge as fileTransferDeleteFile, m as generateIdentity, pe as getClientInfo, s as getUidFromPublicKey, f as identityFromString, me as listChannels, he as listClients, t as noopLogger, fe as poke, ue as sendTextMessage, F as uploadFileData };
760
760
 
761
761
  //# sourceMappingURL=index.mjs.map