@freesignal/protocol 0.7.6 → 0.7.7

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 CHANGED
@@ -83,6 +83,7 @@ export declare class FreeSignalNode {
83
83
  sendRelay(relayId: string | UserId, receiverId: string | UserId, data: Datagram): Promise<void>;
84
84
  sendPing(receiverId: string | UserId): Promise<void>;
85
85
  sendDiscover(receiverId: string | UserId, discoverId: string | UserId): Promise<void>;
86
+ packBootstrap(): Promise<Datagram>;
86
87
  sendBootstrap(receiverId: string | UserId): Promise<void>;
87
88
  protected decrypt(datagram: EncryptedDatagram | Datagram | Uint8Array): Promise<MessageEventData>;
88
89
  protected open(datagram: Datagram | EncryptedDatagram | Uint8Array): Promise<void>;
package/dist/node.js CHANGED
@@ -190,12 +190,17 @@ class FreeSignalNode {
190
190
  this.emitter.emit('send', yield this.encrypt(receiverId, types_1.Protocols.DISCOVER, (0, utils_1.encodeData)(message)));
191
191
  });
192
192
  }
193
+ packBootstrap() {
194
+ return __awaiter(this, void 0, void 0, function* () {
195
+ return new types_1.Datagram(types_1.Protocols.BOOTSTRAP, (0, utils_1.encodeData)(yield this.keyExchange.generateData()));
196
+ });
197
+ }
193
198
  sendBootstrap(receiverId) {
194
199
  return __awaiter(this, void 0, void 0, function* () {
195
200
  //console.debug("Sending Bootstrap");
196
- if (yield this.sessions.has(receiverId.toString()))
201
+ if (receiverId && (yield this.sessions.has(receiverId.toString())))
197
202
  throw new Error("Session exists");
198
- const datagram = new types_1.Datagram(types_1.Protocols.BOOTSTRAP, (0, utils_1.encodeData)(yield this.keyExchange.generateData()));
203
+ const datagram = yield this.packBootstrap();
199
204
  this.emitter.emit('send', { datagram, userId: types_1.UserId.from(receiverId) });
200
205
  });
201
206
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@freesignal/protocol",
3
- "version": "0.7.6",
3
+ "version": "0.7.7",
4
4
  "description": "Signal Protocol implementation in javascript",
5
5
  "license": "GPL-3.0-or-later",
6
6
  "author": "Christian Braghette",