hackchat-engine 1.1.24 → 1.1.26

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 (2) hide show
  1. package/Client.js +19 -7
  2. package/package.json +1 -1
package/Client.js CHANGED
@@ -138,9 +138,10 @@ class Client extends EventEmitter {
138
138
  * @param {string} name Name to join with
139
139
  * @param {string} password Optional password to create trip code
140
140
  * @param {string} channel Channel to join
141
+ * @param {string|boolean} color Optional hex color for initial join
141
142
  * @returns {void}
142
143
  */
143
- join(name = false, password = '', channel = false) {
144
+ join(name = false, password = '', channel = false, color = false) {
144
145
  try {
145
146
  if (!name || typeof name !== 'string') {
146
147
  throw new Error(Errors.INVALID_NAME);
@@ -150,12 +151,18 @@ class Client extends EventEmitter {
150
151
  throw new Error(Errors.INVALID_CHANNEL);
151
152
  }
152
153
 
153
- this.ws.send({
154
+ const payload = {
154
155
  cmd: OPCodes.JOIN,
155
156
  nick: name,
156
157
  pass: password,
157
158
  channel,
158
- });
159
+ };
160
+
161
+ if (color) {
162
+ payload.color = color;
163
+ }
164
+
165
+ this.ws.send(payload);
159
166
  } catch (e) {
160
167
  this.destroy();
161
168
  this.emit(Events.ERROR, `[client] Error joining channel: ${e}`);
@@ -368,15 +375,20 @@ class Client extends EventEmitter {
368
375
  }
369
376
 
370
377
  /**
371
- * Sends a Solana signature and the signed message back to the server for verification
372
- * @param {string} signature The base64 or hex encoded signature from the client's wallet
373
- * @param {string} signedMessage The original human-readable message that was signed
378
+ * Sends a Solana signature request to the server for authentication
379
+ * @param {string} wallet The name of the wallet provider (e.g., 'Phantom')
380
+ * @param {string} address The public key of the connecting wallet
381
+ * @param {string} [domain] The domain requesting the signature. Optional / autodetected
374
382
  */
375
- requestSiw(wallet, address) {
383
+ requestSiw(wallet, address, domain) {
384
+ const requestDomain = domain
385
+ || (typeof window !== 'undefined' && window.location ? window.location.host : 'hack.chat');
386
+
376
387
  this.ws.send({
377
388
  cmd: OPCodes.REQUEST_SIW,
378
389
  wallet,
379
390
  address,
391
+ domain: requestDomain,
380
392
  });
381
393
  }
382
394
 
package/package.json CHANGED
@@ -59,5 +59,5 @@
59
59
  "lintfix": "eslint --fix --ignore-path .gitignore .",
60
60
  "test": "echo \"Error: no test specified\" && exit 1"
61
61
  },
62
- "version": "1.1.24"
62
+ "version": "1.1.26"
63
63
  }