@honeybbq/teamspeak-client 0.3.1 → 1.0.0-beta.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 (148) hide show
  1. package/README.md +322 -60
  2. package/dist/abort.d.ts +5 -0
  3. package/dist/abort.d.ts.map +1 -0
  4. package/dist/address.d.ts +8 -0
  5. package/dist/address.d.ts.map +1 -1
  6. package/dist/api/voice.d.ts +24 -0
  7. package/dist/api/voice.d.ts.map +1 -0
  8. package/dist/capabilities.d.ts +62 -0
  9. package/dist/capabilities.d.ts.map +1 -0
  10. package/dist/client.d.ts +172 -39
  11. package/dist/client.d.ts.map +1 -1
  12. package/dist/commands.d.ts +45 -27
  13. package/dist/commands.d.ts.map +1 -1
  14. package/dist/crypto/crypt.d.ts +19 -4
  15. package/dist/crypto/crypt.d.ts.map +1 -1
  16. package/dist/crypto/identity.d.ts +87 -8
  17. package/dist/crypto/identity.d.ts.map +1 -1
  18. package/dist/crypto/index.d.ts +2 -1
  19. package/dist/crypto/index.d.ts.map +1 -1
  20. package/dist/diagnostics.d.ts +45 -0
  21. package/dist/diagnostics.d.ts.map +1 -0
  22. package/dist/discovery/resolver.d.ts +21 -3
  23. package/dist/discovery/resolver.d.ts.map +1 -1
  24. package/dist/errors.d.ts +70 -16
  25. package/dist/errors.d.ts.map +1 -1
  26. package/dist/events.d.ts +4 -5
  27. package/dist/events.d.ts.map +1 -1
  28. package/dist/handshake/crypt-handshake.d.ts +1 -0
  29. package/dist/handshake/crypt-handshake.d.ts.map +1 -1
  30. package/dist/handshake/crypt-init2.d.ts.map +1 -1
  31. package/dist/handshake/license.d.ts +7 -0
  32. package/dist/handshake/license.d.ts.map +1 -1
  33. package/dist/handshake.d.ts +14 -5
  34. package/dist/handshake.d.ts.map +1 -1
  35. package/dist/helpers.d.ts +0 -8
  36. package/dist/helpers.d.ts.map +1 -1
  37. package/dist/index.d.ts +20 -6
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/index.js +3967 -0
  40. package/dist/index.js.map +1 -0
  41. package/dist/notifications.d.ts +7 -15
  42. package/dist/notifications.d.ts.map +1 -1
  43. package/dist/reconnect.d.ts +69 -0
  44. package/dist/reconnect.d.ts.map +1 -0
  45. package/dist/throttle.d.ts +9 -0
  46. package/dist/throttle.d.ts.map +1 -1
  47. package/dist/transfer.d.ts +27 -25
  48. package/dist/transfer.d.ts.map +1 -1
  49. package/dist/transport/handler.d.ts +37 -5
  50. package/dist/transport/handler.d.ts.map +1 -1
  51. package/dist/transport/quicklz.d.ts +19 -0
  52. package/dist/transport/quicklz.d.ts.map +1 -1
  53. package/dist/types.d.ts +277 -97
  54. package/dist/types.d.ts.map +1 -1
  55. package/package.json +21 -56
  56. package/src/abort.ts +24 -0
  57. package/src/address.ts +74 -0
  58. package/src/api/voice.ts +61 -0
  59. package/src/capabilities.ts +92 -0
  60. package/src/client.ts +1392 -0
  61. package/src/commands.ts +193 -0
  62. package/src/crypto/crypt-ops.ts +6 -0
  63. package/src/crypto/crypt.ts +274 -0
  64. package/src/crypto/eax.ts +152 -0
  65. package/src/crypto/identity.ts +484 -0
  66. package/src/crypto/index.ts +21 -0
  67. package/src/crypto/primitives.ts +141 -0
  68. package/src/diagnostics.ts +58 -0
  69. package/src/discovery/index.ts +1 -0
  70. package/src/discovery/resolver.ts +272 -0
  71. package/src/errors.ts +156 -0
  72. package/src/events.ts +28 -0
  73. package/src/handshake/crypt-handshake.ts +135 -0
  74. package/src/handshake/crypt-init2.ts +48 -0
  75. package/src/handshake/index.ts +3 -0
  76. package/src/handshake/license.test.ts +49 -0
  77. package/src/handshake/license.ts +208 -0
  78. package/src/handshake.ts +136 -0
  79. package/src/helpers.ts +10 -0
  80. package/src/index.ts +74 -0
  81. package/src/notifications.ts +136 -0
  82. package/src/reconnect.ts +141 -0
  83. package/src/throttle.ts +92 -0
  84. package/src/transfer.ts +127 -0
  85. package/src/transport/generation-window.ts +77 -0
  86. package/src/transport/handler.ts +914 -0
  87. package/src/transport/index.ts +14 -0
  88. package/src/transport/packet.ts +69 -0
  89. package/src/transport/quicklz.ts +209 -0
  90. package/src/types.ts +349 -0
  91. package/dist/address-BR-5unVo.cjs +0 -2
  92. package/dist/address-BR-5unVo.cjs.map +0 -1
  93. package/dist/address-BfmovVpp.js +0 -65
  94. package/dist/address-BfmovVpp.js.map +0 -1
  95. package/dist/api.d.ts +0 -17
  96. package/dist/api.d.ts.map +0 -1
  97. package/dist/command/command.d.ts +0 -12
  98. package/dist/command/command.d.ts.map +0 -1
  99. package/dist/command/index.cjs +0 -1
  100. package/dist/command/index.d.ts +0 -4
  101. package/dist/command/index.d.ts.map +0 -1
  102. package/dist/command/index.mjs +0 -3
  103. package/dist/command/parser.d.ts +0 -3
  104. package/dist/command/parser.d.ts.map +0 -1
  105. package/dist/command-BLe-C2L2.js +0 -74
  106. package/dist/command-BLe-C2L2.js.map +0 -1
  107. package/dist/command-DAK4pUBP.cjs +0 -4
  108. package/dist/command-DAK4pUBP.cjs.map +0 -1
  109. package/dist/crypt-handshake-CQkQreLx.cjs +0 -2
  110. package/dist/crypt-handshake-CQkQreLx.cjs.map +0 -1
  111. package/dist/crypt-handshake-DziOY4Lq.js +0 -55
  112. package/dist/crypt-handshake-DziOY4Lq.js.map +0 -1
  113. package/dist/crypt-init2-D70ha4LB.js +0 -158
  114. package/dist/crypt-init2-D70ha4LB.js.map +0 -1
  115. package/dist/crypt-init2-DparLekm.cjs +0 -2
  116. package/dist/crypt-init2-DparLekm.cjs.map +0 -1
  117. package/dist/crypto/index.cjs +0 -1
  118. package/dist/crypto/index.mjs +0 -3
  119. package/dist/crypto-Bg02m4ZE.js +0 -165
  120. package/dist/crypto-Bg02m4ZE.js.map +0 -1
  121. package/dist/crypto-CDlweUL3.cjs +0 -2
  122. package/dist/crypto-CDlweUL3.cjs.map +0 -1
  123. package/dist/discovery/index.cjs +0 -1
  124. package/dist/discovery/index.mjs +0 -2
  125. package/dist/handler-DI_abe9c.js +0 -483
  126. package/dist/handler-DI_abe9c.js.map +0 -1
  127. package/dist/handler-DuwoO5RC.cjs +0 -2
  128. package/dist/handler-DuwoO5RC.cjs.map +0 -1
  129. package/dist/handshake/index.cjs +0 -1
  130. package/dist/handshake/index.mjs +0 -3
  131. package/dist/index.cjs +0 -4
  132. package/dist/index.cjs.map +0 -1
  133. package/dist/index.mjs +0 -827
  134. package/dist/index.mjs.map +0 -1
  135. package/dist/parser-CL33R9tr.cjs +0 -2
  136. package/dist/parser-CL33R9tr.cjs.map +0 -1
  137. package/dist/parser-DZMv3Jm-.js +0 -33
  138. package/dist/parser-DZMv3Jm-.js.map +0 -1
  139. package/dist/primitives-cNNAeFCo.cjs +0 -2
  140. package/dist/primitives-cNNAeFCo.cjs.map +0 -1
  141. package/dist/primitives-xIr6Tjk4.js +0 -1457
  142. package/dist/primitives-xIr6Tjk4.js.map +0 -1
  143. package/dist/resolver-6B8dI9gr.js +0 -141
  144. package/dist/resolver-6B8dI9gr.js.map +0 -1
  145. package/dist/resolver-DCcmyWSK.cjs +0 -4
  146. package/dist/resolver-DCcmyWSK.cjs.map +0 -1
  147. package/dist/transport/index.cjs +0 -1
  148. package/dist/transport/index.mjs +0 -2
package/dist/errors.d.ts CHANGED
@@ -1,34 +1,88 @@
1
- export declare class TeamspeakError extends Error {
2
- constructor(message: string, options?: ErrorOptions);
3
- }
4
- export declare class ServerError extends TeamspeakError {
5
- readonly id: string;
6
- readonly serverMessage: string;
7
- constructor(id: string, serverMessage: string);
8
- }
9
- export declare class CommandTimeoutError extends TeamspeakError {
10
- readonly command: string;
11
- constructor(command: string);
12
- }
1
+ import { TeamspeakError } from "@honeybbq/teamspeak-core";
2
+ /** `connect()` was called on a client that is connecting or connected. */
13
3
  export declare class AlreadyConnectedError extends TeamspeakError {
4
+ /** {@inheritDoc TeamspeakError.kind} */
5
+ static readonly kind: string;
14
6
  constructor();
15
7
  }
8
+ /**
9
+ * The address a client was given cannot be connected to: no host, a host with
10
+ * characters no host name or IP address has, or a port outside 1–65535.
11
+ * `connect()` rejects with it before it starts, and the client stays
12
+ * disconnected. A name that does not resolve is not this: that fails with a
13
+ * TeamspeakError whose `cause` is the lookup's error, since DNS failures are
14
+ * often transient.
15
+ */
16
+ export declare class InvalidAddressError extends TeamspeakError {
17
+ /** {@inheritDoc TeamspeakError.kind} */
18
+ static readonly kind: string;
19
+ /** The address as given. */
20
+ readonly address: string;
21
+ constructor(address: string, reason: string);
22
+ }
23
+ /**
24
+ * A packet failed authentication: it was corrupted, or not from the server.
25
+ * Internal: the packet is dropped, and this never reaches a caller.
26
+ */
16
27
  export declare class EAXTagMismatchError extends TeamspeakError {
28
+ /** {@inheritDoc TeamspeakError.kind} */
29
+ static readonly kind: string;
17
30
  constructor();
18
31
  }
32
+ /**
33
+ * An unencrypted packet failed its integrity check. Internal: the packet is
34
+ * dropped, and this never reaches a caller.
35
+ */
19
36
  export declare class FakeSignatureMismatchError extends TeamspeakError {
37
+ /** {@inheritDoc TeamspeakError.kind} */
38
+ static readonly kind: string;
20
39
  constructor();
21
40
  }
41
+ /** A file transfer connection failed: it could not be opened, or broke during the transfer. */
22
42
  export declare class FileTransferError extends TeamspeakError {
43
+ /** {@inheritDoc TeamspeakError.kind} */
44
+ static readonly kind: string;
23
45
  constructor(message: string, options?: ErrorOptions);
24
46
  }
25
- export declare class FileTransferTimeoutError extends TeamspeakError {
26
- constructor();
27
- }
47
+ /**
48
+ * The handshake failed on what the server sent: a malformed or out-of-range
49
+ * Init1 step, public key, license or proof. `connect()` rejects with it, the
50
+ * underlying failure as its `cause`.
51
+ */
28
52
  export declare class CryptoInitError extends TeamspeakError {
53
+ /** {@inheritDoc TeamspeakError.kind} */
54
+ static readonly kind: string;
29
55
  constructor(message: string, options?: ErrorOptions);
30
56
  }
57
+ /** An identity string `parseIdentity()` cannot read. */
31
58
  export declare class InvalidIdentityError extends TeamspeakError {
32
- constructor(message?: string);
59
+ /** {@inheritDoc TeamspeakError.kind} */
60
+ static readonly kind: string;
61
+ constructor(message?: string, options?: ErrorOptions);
62
+ }
63
+ /**
64
+ * The server stopped answering: nothing arrived, or a packet went
65
+ * unacknowledged, for a minute.
66
+ */
67
+ export declare class ConnectionTimeoutError extends TeamspeakError {
68
+ /** {@inheritDoc TeamspeakError.kind} */
69
+ static readonly kind: string;
70
+ constructor();
71
+ }
72
+ /**
73
+ * The server ended this client's session: a kick, a ban, or the server
74
+ * stopping. The default reconnect policy retries a server that stopped, but
75
+ * not a kick or a ban.
76
+ */
77
+ export declare class RemovedError extends TeamspeakError {
78
+ /** {@inheritDoc TeamspeakError.kind} */
79
+ static readonly kind: string;
80
+ /** Why: `Reason.KickServer`, `KickServerBan`, `ServerStop` or `ServerShutdown`. */
81
+ readonly reason: number;
82
+ /** The reason the server or the invoker gave, if any. */
83
+ readonly reasonMessage: string;
84
+ /** Who removed the client, for a kick or a ban. */
85
+ readonly invokerName: string;
86
+ constructor(reason: number, reasonMessage: string, invokerName: string);
33
87
  }
34
88
  //# sourceMappingURL=errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,cAAe,SAAQ,KAAK;IACvC,YAAY,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,EAGlD;CACF;AAED,qBAAa,WAAY,SAAQ,cAAc;IAC7C,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAE/B,YAAY,EAAE,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAK5C;CACF;AAED,qBAAa,mBAAoB,SAAQ,cAAc;IACrD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB,YAAY,OAAO,EAAE,MAAM,EAI1B;CACF;AAED,qBAAa,qBAAsB,SAAQ,cAAc;IACvD,cAGC;CACF;AAED,qBAAa,mBAAoB,SAAQ,cAAc;IACrD,cAGC;CACF;AAED,qBAAa,0BAA2B,S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AAE,YAAY,EAGlD;CACF;AAED;;;;GAIG;AACH,qBAAa,eAAgB,SAAQ,cAAc;IACjD,wCAAwC;IACxC,gBAAyB,IAAI,EAAE,MAAM,CAAqB;IAE1D,YAAY,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,EAGlD;CACF;AAED,wDAAwD;AACxD,qBAAa,oBAAqB,SAAQ,cAAc;IACtD,wCAAwC;IACxC,gBAAyB,IAAI,EAAE,MAAM,CAA0B;IAE/D,YAAY,OAAO,SAA4B,EAAE,OAAO,CAAC,EAAE,YAAY,EAGtE;CACF;AAED;;;GAGG;AACH,qBAAa,sBAAuB,SAAQ,cAAc;IACxD,wCAAwC;IACxC,gBAAyB,IAAI,EAAE,MAAM,CAA4B;IAEjE,cAGC;CACF;AAED;;;;GAIG;AACH,qBAAa,YAAa,SAAQ,cAAc;IAC9C,wCAAwC;IACxC,gBAAyB,IAAI,EAAE,MAAM,CAAkB;IAEvD,mFAAmF;IACnF,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,yDAAyD;IACzD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,mDAAmD;IACnD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAE7B,YAAY,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EASrE;CACF"}
package/dist/events.d.ts CHANGED
@@ -1,10 +1,9 @@
1
- import type { EventMap, CommandMiddleware, EventMiddleware } from "./types.js";
2
- type EventHandler<K extends keyof EventMap> = EventMap[K] extends void ? () => void : (payload: EventMap[K]) => void;
3
- export type { EventHandler };
1
+ import type { EventMiddleware, ServerEvent } from "./types.js";
2
+ import type { CommandExecutor, CommandMiddleware } from "@honeybbq/teamspeak-core";
4
3
  /**
5
4
  * Compose a chain of middlewares around a base handler.
6
5
  * Rightmost middleware wraps the base first.
7
6
  */
8
- export declare function buildCommandChain(middlewares: CommandMiddleware[], base: (cmd: string) => Promise<void>): (cmd: string) => Promise<void>;
9
- export declare function buildEventChain(middlewares: EventMiddleware[], base: (evt: EventMap[keyof EventMap]) => void): (evt: EventMap[keyof EventMap]) => void;
7
+ export declare function buildCommandChain(middlewares: readonly CommandMiddleware[], base: CommandExecutor["send"]): CommandExecutor["send"];
8
+ export declare function buildEventChain(middlewares: EventMiddleware[], base: (event: ServerEvent) => void): (event: ServerEvent) => void;
10
9
  //# sourceMappingURL=events.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE/E,KAAK,YAAY,CAAC,CAAC,SAAS,MAAM,QAAQ,IAAI,QAAQ,CAAC,CAAC,CAAC,SAAS,IAAI,GAClE,MAAM,IAAI,GACV,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;AAEnC,YAAY,EAAE,YAAY,EAAE,CAAC;AAE7B;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,iBAAiB,EAAE,EAChC,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,GACnC,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAMhC;AAED,wBAAgB,eAAe,CAC7B,WAAW,EAAE,eAAe,EAAE,EAC9B,IAAI,EAAE,CAAC,GAAG,EAAE,QAAQ,CAAC,MAAM,QAAQ,CAAC,KAAK,IAAI,GAC5C,CAAC,GAAG,EAAE,QAAQ,CAAC,MAAM,QAAQ,CAAC,KAAK,IAAI,CAMzC"}
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAEnF;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,SAAS,iBAAiB,EAAE,EACzC,IAAI,EAAE,eAAe,CAAC,MAAM,CAAC,GAC5B,eAAe,CAAC,MAAM,CAAC,CAMzB;AAED,wBAAgB,eAAe,CAC7B,WAAW,EAAE,eAAe,EAAE,EAC9B,IAAI,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,GACjC,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAM9B"}
@@ -3,6 +3,7 @@ export declare const INIT_VERSION = 1566914096;
3
3
  /**
4
4
  * Handle the TS3INIT1 handshake steps.
5
5
  * Returns the response bytes to send, or null if nothing should be sent.
6
+ * Throws a CryptoInitError for a step that cannot be answered.
6
7
  */
7
8
  export declare function processInit1(crypt: Crypt, data: Uint8Array | null): Uint8Array | null;
8
9
  //# sourceMappingURL=crypt-handshake.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"crypt-handshake.d.ts","sourceRoot":"","sources":["../../src/handshake/crypt-handshake.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAEhD,eAAO,MAAM,YAAY,aAAa,CAAC;AAMvC;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,GAAG,IAAI,GAAG,UAAU,GAAG,IAAI,CAiBrF"}
1
+ {"version":3,"file":"crypt-handshake.d.ts","sourceRoot":"","sources":["../../src/handshake/crypt-handshake.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAGhD,eAAO,MAAM,YAAY,aAAa,CAAC;AAYvC;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,GAAG,IAAI,GAAG,UAAU,GAAG,IAAI,CAkBrF"}
@@ -1 +1 @@
1
- {"version":3,"file":"crypt-init2.d.ts","sourceRoot":"","sources":["../../src/handshake/crypt-init2.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAKhD;;;GAGG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,UAAU,GACrB,IAAI,CAqBN"}
1
+ {"version":3,"file":"crypt-init2.d.ts","sourceRoot":"","sources":["../../src/handshake/crypt-init2.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAMhD;;;GAGG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,UAAU,GACrB,IAAI,CA6BN"}
@@ -23,6 +23,13 @@ export declare class LicenseChain {
23
23
  */
24
24
  deriveKey(): Uint8Array<ArrayBuffer>;
25
25
  }
26
+ /**
27
+ * The most blocks a license chain may have. Real chains have two or three —
28
+ * root-issued intermediate, server, ephemeral — and every block costs a
29
+ * point multiplication to derive, so a server's chain of thousands would hold
30
+ * the event loop for seconds.
31
+ */
32
+ export declare const MAX_LICENSE_BLOCKS = 8;
26
33
  export declare function parseLicenses(data: Uint8Array): LicenseChain;
27
34
  export {};
28
35
  //# sourceMappingURL=license.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"license.d.ts","sourceRoot":"","sources":["../../src/handshake/license.ts"],"names":[],"mappings":"AAUA,mBAAW,gBAAgB;IACzB,YAAY,IAAI;IAChB,MAAM,IAAI;IACV,SAAS,IAAI;IACb,SAAS,KAAK;CACf;AAED,UAAU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AEpC,wBAAgB,aAAa,CAAC,IAAI,EAAE,UAAU,GAAG,YAAY,CAiB5D"}
@@ -1,9 +1,18 @@
1
- import type { Client } from "./client.js";
1
+ import type { ClientInternals } from "./client.js";
2
2
  /** Handle the `clientinitiv` message (P-256 based crypto path). */
3
- export declare function handleHandshakeInitIV(client: Client, params: Record<string, string>): void;
3
+ export declare function handleHandshakeInitIV(client: ClientInternals, params: Record<string, string>): void;
4
4
  /** Handle the `initivexpand2` message (Ed25519 / TS3 crypto path). */
5
- export declare function handleHandshakeExpand2(client: Client, params: Record<string, string>): void;
5
+ export declare function handleHandshakeExpand2(client: ClientInternals, params: Record<string, string>): void;
6
6
  /** Handle `initserver` — marks the client as connected. */
7
- export declare function handleInitServer(client: Client, params: Record<string, string>): void;
8
- export declare function sendClientInit(client: Client): void;
7
+ export declare function handleInitServer(client: ClientInternals, params: Record<string, string>): void;
8
+ /**
9
+ * Encode a password field for the command protocol.
10
+ *
11
+ * TeamSpeak expects password fields as base64(sha1(password)) — server and
12
+ * channel passwords during the handshake, the `clientmove` channel password,
13
+ * and the `cpw` field of the file transfer commands. Sending the plain text
14
+ * instead makes the server reject correct passwords with error 781.
15
+ */
16
+ export declare function prepareClientPassword(password: string): string;
17
+ export declare function sendClientInit(client: ClientInternals): void;
9
18
  //# sourceMappingURL=handshake.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"handshake.d.ts","sourceRoot":"","sources":["../src/handshake.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,mEAAmE;AACnE,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAQ1F;AAED,sEAAsE;AACtE,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAY3F;AAED,2DAA2D;AAC3D,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAoBrF;AA8BD,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAGnD"}
1
+ {"version":3,"file":"handshake.d.ts","sourceRoot":"","sources":["../src/handshake.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,mEAAmE;AACnE,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,eAAe,EACvB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC7B,IAAI,CAQN;AAED,sEAAsE;AACtE,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,eAAe,EACvB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC7B,IAAI,CAYN;AAED,2DAA2D;AAC3D,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CA0B9F;AAwBD;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAG9D;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI,CAG5D"}
package/dist/helpers.d.ts CHANGED
@@ -1,14 +1,6 @@
1
- export declare function parseUint64(s: string): bigint;
2
- export declare function parseUint16(s: string): number;
3
- export declare function parseInt10(s: string): number;
4
1
  /**
5
2
  * Reports whether `actual` equals `expected` or equals `expected` followed by
6
3
  * only digits — the pattern TeamSpeak uses when a nickname is already taken.
7
4
  */
8
5
  export declare function isAutoNicknameMatch(expected: string, actual: string): boolean;
9
- /**
10
- * Expand a pipe-separated multi-row TS3 command line into individual rows,
11
- * each prefixed with the command name.
12
- */
13
- export declare function splitCommandRows(line: string): string[];
14
6
  //# sourceMappingURL=helpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAO7C;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAI7C;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAG5C;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAK7E;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAuCvD"}
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAK7E"}
package/dist/index.d.ts CHANGED
@@ -1,9 +1,23 @@
1
+ /**
2
+ * A clean-room TeamSpeak client: it connects over the voice protocol, the way
3
+ * the TeamSpeak application does.
4
+ *
5
+ * Everything in `@honeybbq/teamspeak-core` — the typed commands, ids, errors —
6
+ * is re-exported here, so this is the only package a voice client needs.
7
+ */
8
+ export * from "@honeybbq/teamspeak-core";
1
9
  export { Client, ClientStatus } from "./client.js";
2
- export type { ClientState } from "./client.js";
3
- export type { TextMessage, ClientMovedEvent, ClientLeftViewEvent, ClientInfo, ChannelInfo, PokeEvent, VoiceData, FileUploadInfo, FileDownloadInfo, FileTransferStatusInfo, EventMap, CommandMiddleware, EventMiddleware, Logger, AddrResolver, ClientOptions, ResolvedAddr, EscapedString, } from "./types.js";
4
- export { noopLogger, consoleLogger } from "./types.js";
5
- export { TeamspeakError, ServerError, CommandTimeoutError, AlreadyConnectedError, EAXTagMismatchError, FakeSignatureMismatchError, FileTransferError, FileTransferTimeoutError, CryptoInitError, InvalidIdentityError, } from "./errors.js";
6
- export { sendTextMessage, clientMove, poke, getClientInfo, listChannels, listClients, fileTransferDeleteFile, } from "./api.js";
10
+ export type { TextMessageEvent, ClientMovedEvent, ClientLeaveEvent, KickedEvent, NotificationEvent, ClientEnterEvent, PokeEvent, VoiceDataEvent, EventMap, EventMiddleware, Listener, ServerEvent, ServerEventName, Unsubscribe, AddrResolver, ClientOptions, ResolvedAddr, DatagramSocket, SocketFactory, FileTransferSocketFactory, } from "./types.js";
11
+ export { AlreadyConnectedError, FileTransferError, CryptoInitError, InvalidAddressError, InvalidIdentityError, RemovedError, ConnectionTimeoutError, } from "./errors.js";
12
+ export * from "./api/voice.js";
7
13
  export { dialFileTransfer, uploadFileData, downloadFileData } from "./transfer.js";
8
- export { Identity, identityFromString, generateIdentity, getUidFromPublicKey, } from "./crypto/index.js";
14
+ export type { FileTransferOptions } from "./transfer.js";
15
+ export { unknownServerCapabilities } from "./capabilities.js";
16
+ export type { ServerCapabilities, ServerFamily } from "./capabilities.js";
17
+ export { commandChannel, packetChannel } from "./diagnostics.js";
18
+ export type { CommandTrace, PacketTrace } from "./diagnostics.js";
19
+ export { backoffDelay, defaultShouldRetry, defaultBackoffPolicy } from "./reconnect.js";
20
+ export type { ReconnectOptions, BackoffPolicy } from "./reconnect.js";
21
+ export { Identity, parseIdentity, generateIdentity, generateIdentitySync, uidFromPublicKey, } from "./crypto/index.js";
22
+ export type { UIDAlgorithm } from "./crypto/index.js";
9
23
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACnD,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/C,YAAY,EACV,WAAW,EACX,gBAAgB,EAChB,mBAAmB,EACnB,UAAU,EACV,WAAW,EACX,SAAS,EACT,SAAS,EACT,cAAc,EACd,gBAAgB,EAChB,sBAAsB,EACtB,QAAQ,EACR,iBAAiB,EACjB,eAAe,EACf,MAAM,EACN,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,aAAa,GACd,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGvD,OAAO,EACL,cAAc,EACd,WAAW,EACX,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,0BAA0B,EAC1B,iBAAiB,EACjB,wBAAwB,EACxB,eAAe,EACf,oBAAoB,GACrB,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,eAAe,EACf,UAAU,EACV,IAAI,EACJ,aAAa,EACb,YAAY,EACZ,WAAW,EACX,sBAAsB,GACvB,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAGnF,OAAO,EACL,QAAQ,EACR,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,0BAA0B,CAAC;AAGzC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEnD,YAAY,EACV,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,SAAS,EACT,cAAc,EACd,QAAQ,EACR,eAAe,EACf,QAAQ,EACR,WAAW,EACX,eAAe,EACf,WAAW,EACX,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,cAAc,EACd,aAAa,EACb,yBAAyB,GAC1B,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,eAAe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