forkoff 1.0.17 → 1.0.19
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.
- package/LICENSE +11 -7
- package/README.md +77 -118
- package/dist/approval.d.ts +1 -0
- package/dist/approval.js +9 -0
- package/dist/config.d.ts +3 -0
- package/dist/config.js +62 -16
- package/dist/crypto/e2eeManager.d.ts +49 -52
- package/dist/crypto/e2eeManager.js +256 -181
- package/dist/crypto/encryption.d.ts +8 -10
- package/dist/crypto/encryption.js +29 -94
- package/dist/crypto/index.d.ts +10 -0
- package/dist/crypto/index.js +22 -0
- package/dist/crypto/keyExchange.d.ts +6 -20
- package/dist/crypto/keyExchange.js +18 -110
- package/dist/crypto/keyGeneration.d.ts +2 -13
- package/dist/crypto/keyGeneration.js +14 -88
- package/dist/crypto/keyStorage.d.ts +32 -5
- package/dist/crypto/keyStorage.js +152 -8
- package/dist/crypto/sessionPersistence.d.ts +7 -13
- package/dist/crypto/sessionPersistence.js +108 -33
- package/dist/crypto/types.d.ts +24 -3
- package/dist/crypto/types.js +2 -1
- package/dist/crypto/websocketE2EE.d.ts +6 -17
- package/dist/crypto/websocketE2EE.js +21 -38
- package/dist/index.js +203 -280
- package/dist/integration.d.ts +0 -1
- package/dist/integration.js +2 -4
- package/dist/logger.d.ts +15 -0
- package/dist/logger.js +209 -1
- package/dist/server.d.ts +30 -0
- package/dist/server.js +162 -0
- package/dist/startup.js +15 -6
- package/dist/terminal.d.ts +1 -0
- package/dist/terminal.js +94 -1
- package/dist/tools/claude-process.d.ts +8 -0
- package/dist/tools/claude-process.js +199 -26
- package/dist/tools/claude-sessions.d.ts +1 -0
- package/dist/tools/claude-sessions.js +36 -10
- package/dist/tools/detector.js +11 -3
- package/dist/tools/permission-hook.js +94 -27
- package/dist/tools/permission-ipc.d.ts +1 -0
- package/dist/tools/permission-ipc.js +61 -14
- package/dist/transcript-streamer.d.ts +1 -0
- package/dist/transcript-streamer.js +18 -4
- package/dist/usage-tracker.d.ts +45 -0
- package/dist/usage-tracker.js +243 -0
- package/dist/websocket.d.ts +43 -12
- package/dist/websocket.js +418 -214
- package/package.json +5 -4
- package/dist/__tests__/cli-commands.test.d.ts +0 -6
- package/dist/__tests__/cli-commands.test.d.ts.map +0 -1
- package/dist/__tests__/cli-commands.test.js +0 -213
- package/dist/__tests__/cli-commands.test.js.map +0 -1
- package/dist/__tests__/crypto/e2e-integration.test.d.ts +0 -17
- package/dist/__tests__/crypto/e2e-integration.test.d.ts.map +0 -1
- package/dist/__tests__/crypto/e2e-integration.test.js +0 -338
- package/dist/__tests__/crypto/e2e-integration.test.js.map +0 -1
- package/dist/__tests__/crypto/e2eeManager.test.d.ts +0 -2
- package/dist/__tests__/crypto/e2eeManager.test.d.ts.map +0 -1
- package/dist/__tests__/crypto/e2eeManager.test.js +0 -242
- package/dist/__tests__/crypto/e2eeManager.test.js.map +0 -1
- package/dist/__tests__/crypto/encryption.test.d.ts +0 -2
- package/dist/__tests__/crypto/encryption.test.d.ts.map +0 -1
- package/dist/__tests__/crypto/encryption.test.js +0 -116
- package/dist/__tests__/crypto/encryption.test.js.map +0 -1
- package/dist/__tests__/crypto/keyExchange.test.d.ts +0 -2
- package/dist/__tests__/crypto/keyExchange.test.d.ts.map +0 -1
- package/dist/__tests__/crypto/keyExchange.test.js +0 -84
- package/dist/__tests__/crypto/keyExchange.test.js.map +0 -1
- package/dist/__tests__/crypto/keyGeneration.test.d.ts +0 -2
- package/dist/__tests__/crypto/keyGeneration.test.d.ts.map +0 -1
- package/dist/__tests__/crypto/keyGeneration.test.js +0 -61
- package/dist/__tests__/crypto/keyGeneration.test.js.map +0 -1
- package/dist/__tests__/crypto/keyStorage.test.d.ts +0 -2
- package/dist/__tests__/crypto/keyStorage.test.d.ts.map +0 -1
- package/dist/__tests__/crypto/keyStorage.test.js +0 -133
- package/dist/__tests__/crypto/keyStorage.test.js.map +0 -1
- package/dist/__tests__/crypto/websocketIntegration.test.d.ts +0 -2
- package/dist/__tests__/crypto/websocketIntegration.test.d.ts.map +0 -1
- package/dist/__tests__/crypto/websocketIntegration.test.js +0 -259
- package/dist/__tests__/crypto/websocketIntegration.test.js.map +0 -1
- package/dist/__tests__/startup.test.d.ts +0 -11
- package/dist/__tests__/startup.test.d.ts.map +0 -1
- package/dist/__tests__/startup.test.js +0 -241
- package/dist/__tests__/startup.test.js.map +0 -1
- package/dist/__tests__/tools/claude-process.test.d.ts +0 -8
- package/dist/__tests__/tools/claude-process.test.d.ts.map +0 -1
- package/dist/__tests__/tools/claude-process.test.js +0 -430
- package/dist/__tests__/tools/claude-process.test.js.map +0 -1
- package/dist/__tests__/tools/permission-hook.test.d.ts +0 -17
- package/dist/__tests__/tools/permission-hook.test.d.ts.map +0 -1
- package/dist/__tests__/tools/permission-hook.test.js +0 -616
- package/dist/__tests__/tools/permission-hook.test.js.map +0 -1
- package/dist/__tests__/tools/permission-ipc.test.d.ts +0 -11
- package/dist/__tests__/tools/permission-ipc.test.d.ts.map +0 -1
- package/dist/__tests__/tools/permission-ipc.test.js +0 -612
- package/dist/__tests__/tools/permission-ipc.test.js.map +0 -1
- package/dist/__tests__/websocket.test.d.ts +0 -13
- package/dist/__tests__/websocket.test.d.ts.map +0 -1
- package/dist/__tests__/websocket.test.js +0 -204
- package/dist/__tests__/websocket.test.js.map +0 -1
- package/dist/api.d.ts +0 -44
- package/dist/api.d.ts.map +0 -1
- package/dist/api.js +0 -76
- package/dist/api.js.map +0 -1
- package/dist/approval.d.ts.map +0 -1
- package/dist/approval.js.map +0 -1
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js.map +0 -1
- package/dist/crypto/e2eeManager.d.ts.map +0 -1
- package/dist/crypto/e2eeManager.js.map +0 -1
- package/dist/crypto/encryption.d.ts.map +0 -1
- package/dist/crypto/encryption.js.map +0 -1
- package/dist/crypto/keyExchange.d.ts.map +0 -1
- package/dist/crypto/keyExchange.js.map +0 -1
- package/dist/crypto/keyGeneration.d.ts.map +0 -1
- package/dist/crypto/keyGeneration.js.map +0 -1
- package/dist/crypto/keyStorage.d.ts.map +0 -1
- package/dist/crypto/keyStorage.js.map +0 -1
- package/dist/crypto/sessionPersistence.d.ts.map +0 -1
- package/dist/crypto/sessionPersistence.js.map +0 -1
- package/dist/crypto/types.d.ts.map +0 -1
- package/dist/crypto/types.js.map +0 -1
- package/dist/crypto/websocketE2EE.d.ts.map +0 -1
- package/dist/crypto/websocketE2EE.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/integration.d.ts.map +0 -1
- package/dist/integration.js.map +0 -1
- package/dist/logger.d.ts.map +0 -1
- package/dist/logger.js.map +0 -1
- package/dist/startup.d.ts.map +0 -1
- package/dist/startup.js.map +0 -1
- package/dist/terminal.d.ts.map +0 -1
- package/dist/terminal.js.map +0 -1
- package/dist/tools/__tests__/claude-sessions.test.d.ts +0 -2
- package/dist/tools/__tests__/claude-sessions.test.d.ts.map +0 -1
- package/dist/tools/__tests__/claude-sessions.test.js +0 -306
- package/dist/tools/__tests__/claude-sessions.test.js.map +0 -1
- package/dist/tools/claude-hooks.d.ts.map +0 -1
- package/dist/tools/claude-hooks.js.map +0 -1
- package/dist/tools/claude-process.d.ts.map +0 -1
- package/dist/tools/claude-process.js.map +0 -1
- package/dist/tools/claude-sessions.d.ts.map +0 -1
- package/dist/tools/claude-sessions.js.map +0 -1
- package/dist/tools/detector.d.ts.map +0 -1
- package/dist/tools/detector.js.map +0 -1
- package/dist/tools/index.d.ts.map +0 -1
- package/dist/tools/index.js.map +0 -1
- package/dist/tools/permission-hook.d.ts.map +0 -1
- package/dist/tools/permission-hook.js.map +0 -1
- package/dist/tools/permission-ipc.d.ts.map +0 -1
- package/dist/tools/permission-ipc.js.map +0 -1
- package/dist/transcript-streamer.d.ts.map +0 -1
- package/dist/transcript-streamer.js.map +0 -1
- package/dist/websocket.d.ts.map +0 -1
- package/dist/websocket.js.map +0 -1
- package/jest.config.js +0 -18
|
@@ -4,8 +4,9 @@ exports.WebSocketE2EEIntegration = void 0;
|
|
|
4
4
|
exports.createE2EEWebSocketClient = createE2EEWebSocketClient;
|
|
5
5
|
const e2eeManager_1 = require("./e2eeManager");
|
|
6
6
|
/**
|
|
7
|
-
* WebSocket E2EE Integration
|
|
8
|
-
*
|
|
7
|
+
* WebSocket E2EE Integration (legacy wrapper)
|
|
8
|
+
* E2EE is now wired directly into WebSocketClient.
|
|
9
|
+
* This class remains for backward compatibility.
|
|
9
10
|
*/
|
|
10
11
|
class WebSocketE2EEIntegration {
|
|
11
12
|
constructor(wsClient) {
|
|
@@ -16,42 +17,37 @@ class WebSocketE2EEIntegration {
|
|
|
16
17
|
/**
|
|
17
18
|
* Initializes E2EE and sets up event handlers
|
|
18
19
|
*/
|
|
19
|
-
async initialize(deviceId
|
|
20
|
-
this.e2eeManager = new e2eeManager_1.E2EEManager(deviceId
|
|
20
|
+
async initialize(deviceId) {
|
|
21
|
+
this.e2eeManager = new e2eeManager_1.E2EEManager(deviceId);
|
|
21
22
|
await this.e2eeManager.initialize();
|
|
22
23
|
this.setupEventHandlers();
|
|
23
24
|
this.enabled = true;
|
|
24
25
|
}
|
|
25
|
-
/**
|
|
26
|
-
* Sets up WebSocket event handlers for E2EE
|
|
27
|
-
*/
|
|
28
26
|
setupEventHandlers() {
|
|
29
27
|
if (!this.e2eeManager)
|
|
30
28
|
return;
|
|
31
29
|
// Handle incoming key exchange init
|
|
32
|
-
this.wsClient.on('encrypted_key_exchange_init',
|
|
30
|
+
this.wsClient.on('encrypted_key_exchange_init', (data) => {
|
|
33
31
|
if (!this.e2eeManager)
|
|
34
32
|
return;
|
|
35
33
|
try {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
// Emit ack back to sender
|
|
39
|
-
this.emitKeyExchangeAck(data.senderDeviceId, ackPayload.ephemeralPublicKey);
|
|
34
|
+
const ack = this.e2eeManager.handleKeyExchangeInit(data);
|
|
35
|
+
this.emitKeyExchangeAck(data.senderDeviceId, ack.ephemeralPublicKey);
|
|
40
36
|
}
|
|
41
37
|
catch (error) {
|
|
42
|
-
console.error('[E2EE]
|
|
38
|
+
console.error('[E2EE] Key exchange init failed');
|
|
43
39
|
}
|
|
44
40
|
});
|
|
45
41
|
// Handle incoming key exchange ack
|
|
46
|
-
this.wsClient.on('encrypted_key_exchange_ack',
|
|
42
|
+
this.wsClient.on('encrypted_key_exchange_ack', (data) => {
|
|
47
43
|
if (!this.e2eeManager)
|
|
48
44
|
return;
|
|
49
45
|
try {
|
|
50
|
-
|
|
51
|
-
|
|
46
|
+
this.e2eeManager.handleKeyExchangeAck(data);
|
|
47
|
+
// Key exchange completed
|
|
52
48
|
}
|
|
53
49
|
catch (error) {
|
|
54
|
-
console.error('[E2EE]
|
|
50
|
+
console.error('[E2EE] Key exchange ack failed');
|
|
55
51
|
}
|
|
56
52
|
});
|
|
57
53
|
// Handle incoming encrypted messages
|
|
@@ -60,27 +56,25 @@ class WebSocketE2EEIntegration {
|
|
|
60
56
|
return;
|
|
61
57
|
try {
|
|
62
58
|
const plaintext = this.e2eeManager.decryptMessage(data, data.senderDeviceId);
|
|
63
|
-
// Emit decrypted message as a regular user_message event
|
|
64
59
|
this.wsClient.emit('decrypted_message', {
|
|
65
60
|
...data,
|
|
66
61
|
decryptedContent: plaintext,
|
|
67
62
|
});
|
|
68
63
|
}
|
|
69
64
|
catch (error) {
|
|
70
|
-
console.error('[E2EE] Failed to decrypt message
|
|
65
|
+
console.error('[E2EE] Failed to decrypt message — dropped');
|
|
71
66
|
}
|
|
72
67
|
});
|
|
73
68
|
}
|
|
74
69
|
/**
|
|
75
70
|
* Initiates key exchange with a target device
|
|
76
71
|
*/
|
|
77
|
-
|
|
72
|
+
initiateKeyExchange(targetDeviceId) {
|
|
78
73
|
if (!this.e2eeManager) {
|
|
79
74
|
throw new Error('E2EE not initialized');
|
|
80
75
|
}
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
this.emitKeyExchangeInit(targetDeviceId, initPayload.ephemeralPublicKey);
|
|
76
|
+
const init = this.e2eeManager.createKeyExchangeInit(targetDeviceId);
|
|
77
|
+
this.emitKeyExchangeInit(targetDeviceId, init.ephemeralPublicKey);
|
|
84
78
|
}
|
|
85
79
|
/**
|
|
86
80
|
* Encrypts and sends a message to a target device
|
|
@@ -93,39 +87,28 @@ class WebSocketE2EEIntegration {
|
|
|
93
87
|
throw new Error(`No E2EE session with ${targetDeviceId}. Must complete key exchange first.`);
|
|
94
88
|
}
|
|
95
89
|
const encryptedMessage = this.e2eeManager.encryptMessage(plaintext, targetDeviceId, sessionId);
|
|
96
|
-
// Emit encrypted message via WebSocket
|
|
97
90
|
this.emitEncryptedMessage(encryptedMessage);
|
|
98
91
|
}
|
|
99
|
-
/**
|
|
100
|
-
* Checks if E2EE session exists for a device
|
|
101
|
-
*/
|
|
102
92
|
hasSession(deviceId) {
|
|
103
93
|
return this.e2eeManager?.hasSessionKey(deviceId) ?? false;
|
|
104
94
|
}
|
|
105
|
-
/**
|
|
106
|
-
* Checks if E2EE is enabled
|
|
107
|
-
*/
|
|
108
95
|
isEnabled() {
|
|
109
96
|
return this.enabled && this.e2eeManager !== null;
|
|
110
97
|
}
|
|
111
|
-
/**
|
|
112
|
-
* Cleans up E2EE sessions
|
|
113
|
-
*/
|
|
114
98
|
cleanup() {
|
|
115
99
|
this.e2eeManager?.cleanup();
|
|
116
100
|
}
|
|
117
|
-
// Private WebSocket emit methods
|
|
118
101
|
emitKeyExchangeInit(recipientDeviceId, ephemeralPublicKey) {
|
|
119
102
|
this.wsClient.emitKeyExchangeInit({
|
|
120
103
|
recipientDeviceId,
|
|
121
|
-
senderDeviceId: this.e2eeManager?.
|
|
104
|
+
senderDeviceId: this.e2eeManager?.deviceId || '',
|
|
122
105
|
ephemeralPublicKey,
|
|
123
106
|
});
|
|
124
107
|
}
|
|
125
108
|
emitKeyExchangeAck(recipientDeviceId, ephemeralPublicKey) {
|
|
126
109
|
this.wsClient.emitKeyExchangeAck({
|
|
127
110
|
recipientDeviceId,
|
|
128
|
-
senderDeviceId: this.e2eeManager?.
|
|
111
|
+
senderDeviceId: this.e2eeManager?.deviceId || '',
|
|
129
112
|
ephemeralPublicKey,
|
|
130
113
|
});
|
|
131
114
|
}
|
|
@@ -137,8 +120,8 @@ exports.WebSocketE2EEIntegration = WebSocketE2EEIntegration;
|
|
|
137
120
|
/**
|
|
138
121
|
* Factory function to create E2EE-enabled WebSocket client
|
|
139
122
|
*/
|
|
140
|
-
function createE2EEWebSocketClient(wsClient, deviceId
|
|
123
|
+
function createE2EEWebSocketClient(wsClient, deviceId) {
|
|
141
124
|
const integration = new WebSocketE2EEIntegration(wsClient);
|
|
142
|
-
return integration.initialize(deviceId
|
|
125
|
+
return integration.initialize(deviceId).then(() => integration);
|
|
143
126
|
}
|
|
144
127
|
//# sourceMappingURL=websocketE2EE.js.map
|