wse-client 1.0.0

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 (95) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +222 -0
  3. package/dist/constants.d.ts +195 -0
  4. package/dist/constants.d.ts.map +1 -0
  5. package/dist/constants.js +285 -0
  6. package/dist/constants.js.map +1 -0
  7. package/dist/examples/ChatHandlers.d.ts +15 -0
  8. package/dist/examples/ChatHandlers.d.ts.map +1 -0
  9. package/dist/examples/ChatHandlers.js +20 -0
  10. package/dist/examples/ChatHandlers.js.map +1 -0
  11. package/dist/examples/IoTHandlers.d.ts +12 -0
  12. package/dist/examples/IoTHandlers.d.ts.map +1 -0
  13. package/dist/examples/IoTHandlers.js +15 -0
  14. package/dist/examples/IoTHandlers.js.map +1 -0
  15. package/dist/handlers/EventHandlers.d.ts +17 -0
  16. package/dist/handlers/EventHandlers.d.ts.map +1 -0
  17. package/dist/handlers/EventHandlers.js +20 -0
  18. package/dist/handlers/EventHandlers.js.map +1 -0
  19. package/dist/handlers/index.d.ts +14 -0
  20. package/dist/handlers/index.d.ts.map +1 -0
  21. package/dist/handlers/index.js +37 -0
  22. package/dist/handlers/index.js.map +1 -0
  23. package/dist/hooks/useWSE.d.ts +42 -0
  24. package/dist/hooks/useWSE.d.ts.map +1 -0
  25. package/dist/hooks/useWSE.js +1224 -0
  26. package/dist/hooks/useWSE.js.map +1 -0
  27. package/dist/index.d.ts +25 -0
  28. package/dist/index.d.ts.map +1 -0
  29. package/dist/index.js +48 -0
  30. package/dist/index.js.map +1 -0
  31. package/dist/protocols/compression.d.ts +17 -0
  32. package/dist/protocols/compression.d.ts.map +1 -0
  33. package/dist/protocols/compression.js +155 -0
  34. package/dist/protocols/compression.js.map +1 -0
  35. package/dist/protocols/transformer.d.ts +12 -0
  36. package/dist/protocols/transformer.d.ts.map +1 -0
  37. package/dist/protocols/transformer.js +76 -0
  38. package/dist/protocols/transformer.js.map +1 -0
  39. package/dist/services/AdaptiveQualityManager.d.ts +44 -0
  40. package/dist/services/AdaptiveQualityManager.d.ts.map +1 -0
  41. package/dist/services/AdaptiveQualityManager.js +114 -0
  42. package/dist/services/AdaptiveQualityManager.js.map +1 -0
  43. package/dist/services/ConnectionManager.d.ts +92 -0
  44. package/dist/services/ConnectionManager.d.ts.map +1 -0
  45. package/dist/services/ConnectionManager.js +852 -0
  46. package/dist/services/ConnectionManager.js.map +1 -0
  47. package/dist/services/ConnectionPool.d.ts +74 -0
  48. package/dist/services/ConnectionPool.d.ts.map +1 -0
  49. package/dist/services/ConnectionPool.js +430 -0
  50. package/dist/services/ConnectionPool.js.map +1 -0
  51. package/dist/services/EventSequencer.d.ts +30 -0
  52. package/dist/services/EventSequencer.d.ts.map +1 -0
  53. package/dist/services/EventSequencer.js +152 -0
  54. package/dist/services/EventSequencer.js.map +1 -0
  55. package/dist/services/MessageProcessor.d.ts +69 -0
  56. package/dist/services/MessageProcessor.d.ts.map +1 -0
  57. package/dist/services/MessageProcessor.js +1050 -0
  58. package/dist/services/MessageProcessor.js.map +1 -0
  59. package/dist/services/NetworkMonitor.d.ts +34 -0
  60. package/dist/services/NetworkMonitor.d.ts.map +1 -0
  61. package/dist/services/NetworkMonitor.js +143 -0
  62. package/dist/services/NetworkMonitor.js.map +1 -0
  63. package/dist/services/OfflineQueue.d.ts +25 -0
  64. package/dist/services/OfflineQueue.d.ts.map +1 -0
  65. package/dist/services/OfflineQueue.js +117 -0
  66. package/dist/services/OfflineQueue.js.map +1 -0
  67. package/dist/services/RateLimiter.d.ts +25 -0
  68. package/dist/services/RateLimiter.d.ts.map +1 -0
  69. package/dist/services/RateLimiter.js +85 -0
  70. package/dist/services/RateLimiter.js.map +1 -0
  71. package/dist/stores/useMessageQueueStore.d.ts +23 -0
  72. package/dist/stores/useMessageQueueStore.d.ts.map +1 -0
  73. package/dist/stores/useMessageQueueStore.js +188 -0
  74. package/dist/stores/useMessageQueueStore.js.map +1 -0
  75. package/dist/stores/useWSEStore.d.ts +54 -0
  76. package/dist/stores/useWSEStore.d.ts.map +1 -0
  77. package/dist/stores/useWSEStore.js +464 -0
  78. package/dist/stores/useWSEStore.js.map +1 -0
  79. package/dist/types.d.ts +403 -0
  80. package/dist/types.d.ts.map +1 -0
  81. package/dist/types.js +39 -0
  82. package/dist/types.js.map +1 -0
  83. package/dist/utils/circuitBreaker.d.ts +35 -0
  84. package/dist/utils/circuitBreaker.d.ts.map +1 -0
  85. package/dist/utils/circuitBreaker.js +145 -0
  86. package/dist/utils/circuitBreaker.js.map +1 -0
  87. package/dist/utils/logger.d.ts +46 -0
  88. package/dist/utils/logger.d.ts.map +1 -0
  89. package/dist/utils/logger.js +231 -0
  90. package/dist/utils/logger.js.map +1 -0
  91. package/dist/utils/security.d.ts +74 -0
  92. package/dist/utils/security.d.ts.map +1 -0
  93. package/dist/utils/security.js +383 -0
  94. package/dist/utils/security.js.map +1 -0
  95. package/package.json +63 -0
@@ -0,0 +1,383 @@
1
+ // =============================================================================
2
+ // WebSocket Event System - Security Manager
3
+ // =============================================================================
4
+ import { logger } from './logger';
5
+ // Check for Web Crypto API availability
6
+ if (typeof window !== 'undefined' && !window.crypto?.subtle) {
7
+ logger.warn('Web Crypto API not available. HTTPS required for crypto.subtle');
8
+ }
9
+ // Security error types
10
+ export class SecurityError extends Error {
11
+ constructor(message, code, details) {
12
+ super(message);
13
+ this.code = code;
14
+ this.details = details;
15
+ this.name = 'SecurityError';
16
+ }
17
+ }
18
+ // Nonce cache for replay attack prevention with size limits
19
+ class NonceCache {
20
+ constructor(maxAge = 300000) {
21
+ this.maxAge = maxAge;
22
+ this.cache = new Map();
23
+ this.maxSize = 10000;
24
+ this.cleanupInterval = setInterval(() => this.cleanup(), 60000);
25
+ }
26
+ add(nonce) {
27
+ this.cache.set(nonce, Date.now());
28
+ if (this.cache.size > this.maxSize * 1.2) {
29
+ this.cleanup();
30
+ }
31
+ }
32
+ has(nonce) {
33
+ return this.cache.has(nonce);
34
+ }
35
+ cleanup() {
36
+ const now = Date.now();
37
+ for (const [nonce, timestamp] of this.cache.entries()) {
38
+ if (now - timestamp > this.maxAge) {
39
+ this.cache.delete(nonce);
40
+ }
41
+ }
42
+ if (this.cache.size > this.maxSize) {
43
+ const sortedEntries = Array.from(this.cache.entries())
44
+ .sort((a, b) => a[1] - b[1]);
45
+ const toRemove = sortedEntries.slice(0, this.cache.size - this.maxSize);
46
+ toRemove.forEach(([nonce]) => this.cache.delete(nonce));
47
+ }
48
+ }
49
+ destroy() {
50
+ clearInterval(this.cleanupInterval);
51
+ this.cache.clear();
52
+ }
53
+ }
54
+ export class SecurityManager {
55
+ constructor() {
56
+ this.encryptionEnabled = false;
57
+ this.messageSigningEnabled = false;
58
+ this.encryptionKey = null;
59
+ this.signingKey = null;
60
+ this.keyRotationInterval = null;
61
+ this.lastKeyRotation = null;
62
+ this.keyRotationTimer = null;
63
+ this.keyRotationFailures = 0;
64
+ this.nonceCache = new NonceCache();
65
+ this.sessionKeyPair = null;
66
+ this.sharedSecret = null;
67
+ this.serverPublicKey = null;
68
+ this.usedIVs = new Set();
69
+ this.backendCompatibilityMode = false;
70
+ this.supportedAlgorithms = {
71
+ encryption: 'AES-GCM',
72
+ signing: 'HMAC-SHA256',
73
+ keyExchange: 'ECDH-P256'
74
+ };
75
+ }
76
+ async initialize(config) {
77
+ try {
78
+ this.encryptionEnabled = config.encryptionEnabled;
79
+ this.messageSigningEnabled = config.messageSigningEnabled;
80
+ this.keyRotationInterval = config.keyRotationInterval || 3600000;
81
+ this.backendCompatibilityMode = config.backendCompatibilityMode || false;
82
+ if (this.encryptionEnabled) {
83
+ await this.generateEncryptionKey();
84
+ logger.info('Encryption enabled for WebSocket messages with AES-GCM');
85
+ }
86
+ if (this.messageSigningEnabled) {
87
+ await this.generateSigningKey();
88
+ logger.info('Message signing enabled for WebSocket messages with HMAC-SHA256');
89
+ }
90
+ await this.generateKeyPair();
91
+ if (this.encryptionEnabled || this.messageSigningEnabled) {
92
+ this.scheduleKeyRotation();
93
+ }
94
+ }
95
+ catch (error) {
96
+ throw new SecurityError('Failed to initialize security manager', 'KEY_GENERATION_FAILED', error);
97
+ }
98
+ }
99
+ async generateEncryptionKey() {
100
+ try {
101
+ this.encryptionKey = await crypto.subtle.generateKey({ name: 'AES-GCM', length: 256 }, true, ['encrypt', 'decrypt']);
102
+ }
103
+ catch (error) {
104
+ throw new SecurityError('Failed to generate encryption key', 'KEY_GENERATION_FAILED', error);
105
+ }
106
+ }
107
+ async generateSigningKey() {
108
+ try {
109
+ this.signingKey = await crypto.subtle.generateKey({ name: 'HMAC', hash: 'SHA-256' }, true, ['sign', 'verify']);
110
+ }
111
+ catch (error) {
112
+ throw new SecurityError('Failed to generate signing key', 'KEY_GENERATION_FAILED', error);
113
+ }
114
+ }
115
+ async generateKeyPair() {
116
+ try {
117
+ this.sessionKeyPair = await crypto.subtle.generateKey({ name: 'ECDH', namedCurve: 'P-256' }, true, ['deriveKey', 'deriveBits']);
118
+ }
119
+ catch (error) {
120
+ throw new SecurityError('Failed to generate key pair', 'KEY_GENERATION_FAILED', error);
121
+ }
122
+ }
123
+ async getPublicKey() {
124
+ if (!this.sessionKeyPair)
125
+ return null;
126
+ try {
127
+ return await crypto.subtle.exportKey('jwk', this.sessionKeyPair.publicKey);
128
+ }
129
+ catch (error) {
130
+ logger.error('Failed to export public key:', error);
131
+ return null;
132
+ }
133
+ }
134
+ async setServerPublicKey(publicKeyJwk) {
135
+ try {
136
+ if (!publicKeyJwk.kty || publicKeyJwk.kty !== 'EC') {
137
+ throw new Error('Invalid key type for ECDH');
138
+ }
139
+ if (!publicKeyJwk.crv || publicKeyJwk.crv !== 'P-256') {
140
+ throw new Error('Invalid curve for ECDH');
141
+ }
142
+ this.serverPublicKey = await crypto.subtle.importKey('jwk', publicKeyJwk, { name: 'ECDH', namedCurve: 'P-256' }, false, []);
143
+ if (this.sessionKeyPair && this.serverPublicKey) {
144
+ await this.deriveSharedSecret();
145
+ }
146
+ }
147
+ catch (error) {
148
+ this.serverPublicKey = null;
149
+ throw new SecurityError('Failed to import server public key', 'KEY_EXCHANGE_FAILED', error);
150
+ }
151
+ }
152
+ async deriveSharedSecret() {
153
+ if (!this.sessionKeyPair || !this.serverPublicKey)
154
+ return;
155
+ try {
156
+ const sharedSecretBits = await crypto.subtle.deriveBits({ name: 'ECDH', public: this.serverPublicKey }, this.sessionKeyPair.privateKey, 256);
157
+ this.sharedSecret = await crypto.subtle.importKey('raw', sharedSecretBits, 'HKDF', false, ['deriveKey']);
158
+ this.encryptionKey = await crypto.subtle.deriveKey({
159
+ name: 'HKDF',
160
+ hash: 'SHA-256',
161
+ salt: new TextEncoder().encode('wse-encryption'),
162
+ info: new TextEncoder().encode('aes-gcm-key')
163
+ }, this.sharedSecret, { name: 'AES-GCM', length: 256 }, true, ['encrypt', 'decrypt']);
164
+ logger.info('Derived shared encryption key from ECDH exchange');
165
+ }
166
+ catch (error) {
167
+ throw new SecurityError('Failed to derive shared secret', 'KEY_EXCHANGE_FAILED', error);
168
+ }
169
+ }
170
+ async encryptMessage(data) {
171
+ if (!this.encryptionEnabled || !this.encryptionKey)
172
+ return null;
173
+ try {
174
+ const encoder = new TextEncoder();
175
+ const encoded = encoder.encode(data);
176
+ let iv;
177
+ let ivHex;
178
+ let attempts = 0;
179
+ do {
180
+ iv = crypto.getRandomValues(new Uint8Array(12));
181
+ ivHex = Array.from(iv).map(b => b.toString(16).padStart(2, '0')).join('');
182
+ attempts++;
183
+ if (attempts > 10) {
184
+ this.usedIVs.clear();
185
+ }
186
+ } while (this.usedIVs.has(ivHex) && attempts < 100);
187
+ this.usedIVs.add(ivHex);
188
+ if (this.usedIVs.size > 10000) {
189
+ this.usedIVs.clear();
190
+ }
191
+ const encrypted = await crypto.subtle.encrypt({ name: 'AES-GCM', iv: iv }, this.encryptionKey, encoded);
192
+ const combined = new Uint8Array(iv.length + encrypted.byteLength);
193
+ combined.set(iv, 0);
194
+ combined.set(new Uint8Array(encrypted), iv.length);
195
+ return combined.buffer;
196
+ }
197
+ catch (error) {
198
+ throw new SecurityError('Encryption failed', 'ENCRYPTION_FAILED', error);
199
+ }
200
+ }
201
+ async decryptMessage(data) {
202
+ if (!this.encryptionEnabled || !this.encryptionKey)
203
+ return null;
204
+ try {
205
+ const dataArray = new Uint8Array(data);
206
+ const iv = dataArray.slice(0, 12);
207
+ const encrypted = dataArray.slice(12);
208
+ const decrypted = await crypto.subtle.decrypt({ name: 'AES-GCM', iv: iv }, this.encryptionKey, encrypted);
209
+ return new TextDecoder().decode(decrypted);
210
+ }
211
+ catch (error) {
212
+ throw new SecurityError('Decryption failed', 'DECRYPTION_FAILED', error);
213
+ }
214
+ }
215
+ async encryptForTransport(data) {
216
+ const encrypted = await this.encryptMessage(data);
217
+ if (!encrypted) {
218
+ const encoded = new TextEncoder().encode(data);
219
+ return encoded.buffer.slice(encoded.byteOffset, encoded.byteOffset + encoded.byteLength);
220
+ }
221
+ const prefix = new TextEncoder().encode('E:');
222
+ const combined = new Uint8Array(prefix.length + encrypted.byteLength);
223
+ combined.set(prefix, 0);
224
+ combined.set(new Uint8Array(encrypted), prefix.length);
225
+ return combined.buffer;
226
+ }
227
+ async decryptFromTransport(data) {
228
+ const view = new Uint8Array(data);
229
+ if (view.length >= 2 && view[0] === 69 && view[1] === 58) {
230
+ return this.decryptMessage(data.slice(2));
231
+ }
232
+ return this.decryptMessage(data);
233
+ }
234
+ async signMessage(data) {
235
+ if (!this.messageSigningEnabled || !this.signingKey)
236
+ return null;
237
+ try {
238
+ const encoder = new TextEncoder();
239
+ const encoded = encoder.encode(JSON.stringify(data));
240
+ const signature = await crypto.subtle.sign('HMAC', this.signingKey, encoded);
241
+ return this.arrayBufferToBase64(signature);
242
+ }
243
+ catch (error) {
244
+ logger.error('Message signing failed:', error);
245
+ return null;
246
+ }
247
+ }
248
+ async verifySignature(data, signature) {
249
+ if (!this.messageSigningEnabled || !this.signingKey)
250
+ return true;
251
+ try {
252
+ const encoder = new TextEncoder();
253
+ const encoded = encoder.encode(JSON.stringify(data));
254
+ const signatureBuffer = this.base64ToArrayBuffer(signature);
255
+ return await crypto.subtle.verify('HMAC', this.signingKey, signatureBuffer, encoded);
256
+ }
257
+ catch (error) {
258
+ logger.error('Signature verification failed:', error);
259
+ return false;
260
+ }
261
+ }
262
+ async negotiateSecurity(serverCapabilities) {
263
+ try {
264
+ this.encryptionEnabled = this.encryptionEnabled && (serverCapabilities.encryption ?? false);
265
+ this.messageSigningEnabled = this.messageSigningEnabled && (serverCapabilities.signing ?? false);
266
+ if (serverCapabilities.publicKey && this.encryptionEnabled) {
267
+ await this.setServerPublicKey(serverCapabilities.publicKey);
268
+ }
269
+ const negotiated = {
270
+ encryption: this.encryptionEnabled,
271
+ signing: this.messageSigningEnabled,
272
+ keyExchange: !!serverCapabilities.publicKey,
273
+ algorithms: this.supportedAlgorithms
274
+ };
275
+ logger.info('Security negotiated:', negotiated);
276
+ return negotiated;
277
+ }
278
+ catch (error) {
279
+ throw new SecurityError('Security negotiation failed', 'NEGOTIATION_FAILED', error);
280
+ }
281
+ }
282
+ scheduleKeyRotation() {
283
+ if (!this.keyRotationInterval || this.keyRotationTimer)
284
+ return;
285
+ this.keyRotationTimer = setInterval(async () => {
286
+ try {
287
+ await this.rotateKeys();
288
+ this.keyRotationFailures = 0;
289
+ }
290
+ catch (error) {
291
+ logger.error('Key rotation failed:', error);
292
+ this.keyRotationFailures++;
293
+ if (this.keyRotationFailures >= 3) {
294
+ logger.error('Key rotation disabled after 3 consecutive failures');
295
+ if (this.keyRotationTimer) {
296
+ clearInterval(this.keyRotationTimer);
297
+ this.keyRotationTimer = null;
298
+ }
299
+ }
300
+ }
301
+ }, this.keyRotationInterval);
302
+ }
303
+ async rotateKeys() {
304
+ logger.info('Rotating cryptographic keys');
305
+ try {
306
+ if (this.encryptionEnabled) {
307
+ await this.generateEncryptionKey();
308
+ this.usedIVs.clear();
309
+ }
310
+ if (this.messageSigningEnabled) {
311
+ await this.generateSigningKey();
312
+ }
313
+ await this.generateKeyPair();
314
+ this.lastKeyRotation = Date.now();
315
+ logger.info('Keys rotated successfully');
316
+ }
317
+ catch (error) {
318
+ logger.error('Key rotation failed:', error);
319
+ throw error;
320
+ }
321
+ }
322
+ // ---------------------------------------------------------------------------
323
+ // Utilities
324
+ // ---------------------------------------------------------------------------
325
+ arrayBufferToBase64(buffer) {
326
+ const bytes = new Uint8Array(buffer);
327
+ let binary = '';
328
+ for (let i = 0; i < bytes.byteLength; i++) {
329
+ binary += String.fromCharCode(bytes[i]);
330
+ }
331
+ return btoa(binary);
332
+ }
333
+ base64ToArrayBuffer(base64) {
334
+ const binary = atob(base64);
335
+ const bytes = new Uint8Array(binary.length);
336
+ for (let i = 0; i < binary.length; i++) {
337
+ bytes[i] = binary.charCodeAt(i);
338
+ }
339
+ return bytes.buffer;
340
+ }
341
+ // ---------------------------------------------------------------------------
342
+ // Public API
343
+ // ---------------------------------------------------------------------------
344
+ isEncryptionEnabled() {
345
+ return this.encryptionEnabled;
346
+ }
347
+ isMessageSigningEnabled() {
348
+ return this.messageSigningEnabled;
349
+ }
350
+ getSecurityInfo() {
351
+ return {
352
+ encryptionEnabled: this.encryptionEnabled,
353
+ encryptionAlgorithm: this.encryptionEnabled ? 'AES-GCM-256' : null,
354
+ messageSigningEnabled: this.messageSigningEnabled,
355
+ signatureAlgorithm: this.messageSigningEnabled ? 'HMAC-SHA256' : null,
356
+ keyRotationInterval: this.keyRotationInterval,
357
+ lastKeyRotation: this.lastKeyRotation,
358
+ keyExchangeEnabled: !!this.sessionKeyPair,
359
+ backendCompatibilityMode: this.backendCompatibilityMode,
360
+ };
361
+ }
362
+ destroy() {
363
+ if (this.keyRotationTimer) {
364
+ clearInterval(this.keyRotationTimer);
365
+ this.keyRotationTimer = null;
366
+ }
367
+ this.nonceCache.destroy();
368
+ if (this.usedIVs) {
369
+ this.usedIVs.clear();
370
+ }
371
+ this.encryptionKey = null;
372
+ this.signingKey = null;
373
+ this.sessionKeyPair = null;
374
+ this.sharedSecret = null;
375
+ this.serverPublicKey = null;
376
+ this.encryptionEnabled = false;
377
+ this.messageSigningEnabled = false;
378
+ this.keyRotationFailures = 0;
379
+ logger.info('Security manager destroyed, all keys and caches cleared');
380
+ }
381
+ }
382
+ export const securityManager = new SecurityManager();
383
+ //# sourceMappingURL=security.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"security.js","sourceRoot":"","sources":["../../client/utils/security.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,4CAA4C;AAC5C,gFAAgF;AAEhF,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,wCAAwC;AACxC,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC;IAC5D,MAAM,CAAC,IAAI,CAAC,gEAAgE,CAAC,CAAC;AAChF,CAAC;AAED,uBAAuB;AACvB,MAAM,OAAO,aAAc,SAAQ,KAAK;IACtC,YACE,OAAe,EACC,IAEqD,EACrD,OAAa;QAE7B,KAAK,CAAC,OAAO,CAAC,CAAC;QALC,SAAI,GAAJ,IAAI,CAEiD;QACrD,YAAO,GAAP,OAAO,CAAM;QAG7B,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;IAC9B,CAAC;CACF;AAED,4DAA4D;AAC5D,MAAM,UAAU;IAKd,YAA6B,SAAiB,MAAM;QAAvB,WAAM,GAAN,MAAM,CAAiB;QAJnC,UAAK,GAAG,IAAI,GAAG,EAAkB,CAAC;QAElC,YAAO,GAAG,KAAK,CAAC;QAG/B,IAAI,CAAC,eAAe,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,KAAK,CAAC,CAAC;IAClE,CAAC;IAED,GAAG,CAAC,KAAa;QACf,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;QAElC,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,GAA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AAI,IAAI,CAAC,gBAAgB,EAAE,CAAC;YAC1B,aAAa,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;YACrC,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;QAC/B,CAAC;QACD,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;QAC1B,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACvB,CAAC;QACD,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;QAC1B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;QAC3B,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QACzB,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;QAC5B,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC;QAC/B,IAAI,CAAC,qBAAqB,GAAG,KAAK,CAAC;QACnC,IAAI,CAAC,mBAAmB,GAAG,CAAC,CAAC;QAE7B,MAAM,CAAC,IAAI,CAAC,yDAAyD,CAAC,CAAC;IACzE,CAAC;CACF;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,eAAe,EAAE,CAAC"}
package/package.json ADDED
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "wse-client",
3
+ "version": "1.0.0",
4
+ "description": "WSE (WebSocket Engine) React client. Type-safe hooks, auto-reconnect, offline queue, E2E encryption.",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js",
12
+ "default": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist/"
17
+ ],
18
+ "scripts": {
19
+ "build": "tsc",
20
+ "lint": "tsc --noEmit",
21
+ "prepublishOnly": "npm run build",
22
+ "test": "vitest"
23
+ },
24
+ "keywords": [
25
+ "websocket",
26
+ "react",
27
+ "hooks",
28
+ "real-time",
29
+ "events",
30
+ "pubsub",
31
+ "encryption",
32
+ "rust",
33
+ "zustand"
34
+ ],
35
+ "author": "silvermpx",
36
+ "license": "MIT",
37
+ "repository": {
38
+ "type": "git",
39
+ "url": "https://github.com/silvermpx/wse.git",
40
+ "directory": "client"
41
+ },
42
+ "homepage": "https://github.com/silvermpx/wse",
43
+ "bugs": {
44
+ "url": "https://github.com/silvermpx/wse/issues"
45
+ },
46
+ "dependencies": {
47
+ "@msgpack/msgpack": "^3.0.0",
48
+ "pako": "^2.1.0"
49
+ },
50
+ "peerDependencies": {
51
+ "react": ">=18",
52
+ "zustand": ">=4"
53
+ },
54
+ "devDependencies": {
55
+ "@types/node": "^25.3.0",
56
+ "@types/pako": "^2.0.4",
57
+ "@types/react": "^18.3.0",
58
+ "react": "^18.3.1",
59
+ "typescript": ">=5",
60
+ "vitest": "^2.0.0",
61
+ "zustand": "^4.5.0"
62
+ }
63
+ }