peer-term 1.1.3 → 1.1.4
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/package.json +1 -1
- package/src/index.js +16 -0
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -205,6 +205,20 @@ class Session {
|
|
|
205
205
|
logger.debug(`${prefix} ${msg}`);
|
|
206
206
|
}
|
|
207
207
|
|
|
208
|
+
async _sendSessionConfig() {
|
|
209
|
+
if (!this.sharedKey || !this.ws || this.ws.readyState !== WebSocket.OPEN) return;
|
|
210
|
+
|
|
211
|
+
const config = JSON.stringify({
|
|
212
|
+
type: 'session-config',
|
|
213
|
+
readonly: this.readOnly,
|
|
214
|
+
version: '1.1.3',
|
|
215
|
+
shell: this.shell,
|
|
216
|
+
startPath: this.startPath,
|
|
217
|
+
});
|
|
218
|
+
const payload = await encrypt(this.sharedKey, config);
|
|
219
|
+
this.ws.send(JSON.stringify({ type: 'data', payload }));
|
|
220
|
+
}
|
|
221
|
+
|
|
208
222
|
// ─── Start the session ──────────────────────────────────────────────
|
|
209
223
|
async start() {
|
|
210
224
|
for (let i = 0; i < RELAY_URLS.length; i++) {
|
|
@@ -284,6 +298,7 @@ class Session {
|
|
|
284
298
|
const peerPublicKey = await importPublicKey(msg.publicKey);
|
|
285
299
|
this.sharedKey = await deriveSharedKey(this.keyPair.privateKey, peerPublicKey);
|
|
286
300
|
this.log('Encrypted tunnel active');
|
|
301
|
+
await this._sendSessionConfig();
|
|
287
302
|
|
|
288
303
|
this.startHeartbeat();
|
|
289
304
|
|
|
@@ -712,6 +727,7 @@ class Session {
|
|
|
712
727
|
const peerPublicKey = await importPublicKey(msg.publicKey);
|
|
713
728
|
this.sharedKey = await deriveSharedKey(this.keyPair.privateKey, peerPublicKey);
|
|
714
729
|
this.log('Encrypted tunnel active');
|
|
730
|
+
await this._sendSessionConfig();
|
|
715
731
|
|
|
716
732
|
this.startHeartbeat();
|
|
717
733
|
|