@freesignal/protocol 0.7.9 → 0.7.10
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/dist/node.d.ts +6 -3
- package/dist/node.js +7 -5
- package/package.json +1 -1
package/dist/node.d.ts
CHANGED
|
@@ -32,19 +32,22 @@ export declare class BootstrapRequest extends EventEmitter<'change', BootstrapRe
|
|
|
32
32
|
accept(): void;
|
|
33
33
|
deny(): void;
|
|
34
34
|
}
|
|
35
|
-
type NodeEventData = {
|
|
35
|
+
export type NodeEventData = {
|
|
36
36
|
session?: KeySession;
|
|
37
37
|
payload?: Uint8Array;
|
|
38
38
|
datagram?: Datagram;
|
|
39
39
|
request?: BootstrapRequest;
|
|
40
40
|
userId?: UserId;
|
|
41
41
|
};
|
|
42
|
-
type
|
|
42
|
+
export type HandshakeEventData = {
|
|
43
|
+
session: KeySession;
|
|
44
|
+
};
|
|
45
|
+
export type SendEventData = {
|
|
43
46
|
session?: KeySession;
|
|
44
47
|
datagram: Datagram;
|
|
45
48
|
userId: UserId;
|
|
46
49
|
};
|
|
47
|
-
type MessageEventData = {
|
|
50
|
+
export type MessageEventData = {
|
|
48
51
|
session: KeySession;
|
|
49
52
|
payload: Uint8Array;
|
|
50
53
|
};
|
package/dist/node.js
CHANGED
|
@@ -66,14 +66,16 @@ class BootstrapRequest extends easyemitter_ts_1.default {
|
|
|
66
66
|
return __classPrivateFieldGet(this, _BootstrapRequest_status, "f") === 'accepted' ? this.keyExchangeData : undefined;
|
|
67
67
|
}
|
|
68
68
|
accept() {
|
|
69
|
-
if (this.status === 'pending')
|
|
69
|
+
if (this.status === 'pending') {
|
|
70
70
|
__classPrivateFieldSet(this, _BootstrapRequest_status, 'accepted', "f");
|
|
71
|
-
|
|
71
|
+
this.emit('change', this);
|
|
72
|
+
}
|
|
72
73
|
}
|
|
73
74
|
deny() {
|
|
74
|
-
if (this.status === 'pending')
|
|
75
|
+
if (this.status === 'pending') {
|
|
75
76
|
__classPrivateFieldSet(this, _BootstrapRequest_status, 'denied', "f");
|
|
76
|
-
|
|
77
|
+
this.emit('change', this);
|
|
78
|
+
}
|
|
77
79
|
}
|
|
78
80
|
}
|
|
79
81
|
exports.BootstrapRequest = BootstrapRequest;
|
|
@@ -198,7 +200,7 @@ class FreeSignalNode {
|
|
|
198
200
|
sendBootstrap(receiverId) {
|
|
199
201
|
return __awaiter(this, void 0, void 0, function* () {
|
|
200
202
|
//console.debug("Sending Bootstrap");
|
|
201
|
-
if (
|
|
203
|
+
if (yield this.sessions.has(receiverId.toString()))
|
|
202
204
|
throw new Error("Session exists");
|
|
203
205
|
const datagram = yield this.packBootstrap();
|
|
204
206
|
this.emitter.emit('send', { datagram, userId: types_1.UserId.from(receiverId) });
|