pairnet 0.2.3 → 0.2.5

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/index.js CHANGED
@@ -405,12 +405,12 @@ module.exports = {
405
405
  disconnect: api.disconnect
406
406
  });
407
407
 
408
- // This is where the read stream should be attached to
409
- await onConnect(protocolPeer);
410
-
411
408
  socket.on("close", () => {
412
409
  onDisconnect?.(protocolPeer);
413
410
  });
411
+
412
+ // This is where the read stream should be attached to
413
+ await onConnect(protocolPeer);
414
414
  }
415
415
 
416
416
  server.on("secureConnection", async (socket) => {
@@ -9,9 +9,9 @@ const decodeCBOR = require("@promistream/decode-cbor");
9
9
  const map = require("@promistream/map");
10
10
  const simpleSink = require("@promistream/simple-sink");
11
11
  const NoValue = require("@promistream/no-value");
12
- const createDebugStream = require("@promistream/debug");
12
+ // const createDebugStream = require("@promistream/debug");
13
13
 
14
- const objid = require("@joepie91/objid");
14
+ // const objid = require("@joepie91/objid");
15
15
 
16
16
  const createSender = require("../sender");
17
17
  const createReplyTracker = require("../reply-tracker");
@@ -29,7 +29,7 @@ module.exports = async function createFileStorage(folder) {
29
29
  },
30
30
  get: async function (key) {
31
31
  try {
32
- return await fs.readFile(path.join(folder, safeName(key)));
32
+ return cbor.decode(await fs.readFile(path.join(folder, safeName(key))));
33
33
  } catch (error) {
34
34
  if (error.code === "ENOENT") {
35
35
  return NotSet;
package/notes.txt CHANGED
@@ -7,3 +7,4 @@
7
7
 
8
8
  TODO:
9
9
  - Implement re-pairing with wrapped tokens for eg. when a system's IP has changed
10
+ - Verify that only roles can be taken for which the relevant protocol handlers are specified
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pairnet",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "keywords": [],