@dignetwork/dig-sdk 0.0.1-alpha.11 → 0.0.1-alpha.110

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.
Files changed (75) hide show
  1. package/dist/DataIntegrityTree/DataIntegrityTree.d.ts +10 -2
  2. package/dist/DataIntegrityTree/DataIntegrityTree.d.ts.map +1 -1
  3. package/dist/DataIntegrityTree/DataIntegrityTree.js +100 -15
  4. package/dist/DigNetwork/ContentServer.d.ts +10 -5
  5. package/dist/DigNetwork/ContentServer.d.ts.map +1 -1
  6. package/dist/DigNetwork/ContentServer.js +90 -24
  7. package/dist/DigNetwork/DigNetwork.d.ts +3 -9
  8. package/dist/DigNetwork/DigNetwork.d.ts.map +1 -1
  9. package/dist/DigNetwork/DigNetwork.js +98 -189
  10. package/dist/DigNetwork/DigPeer.d.ts +8 -3
  11. package/dist/DigNetwork/DigPeer.d.ts.map +1 -1
  12. package/dist/DigNetwork/DigPeer.js +68 -114
  13. package/dist/DigNetwork/IncentiveServer.d.ts.map +1 -1
  14. package/dist/DigNetwork/IncentiveServer.js +6 -5
  15. package/dist/DigNetwork/PropagationServer.d.ts +73 -33
  16. package/dist/DigNetwork/PropagationServer.d.ts.map +1 -1
  17. package/dist/DigNetwork/PropagationServer.js +545 -360
  18. package/dist/blockchain/DataStore.d.ts +18 -7
  19. package/dist/blockchain/DataStore.d.ts.map +1 -1
  20. package/dist/blockchain/DataStore.js +98 -134
  21. package/dist/blockchain/DataStoreSerializer.d.ts +1 -1
  22. package/dist/blockchain/DataStoreSerializer.d.ts.map +1 -1
  23. package/dist/blockchain/FullNodePeer.d.ts +2 -1
  24. package/dist/blockchain/FullNodePeer.d.ts.map +1 -1
  25. package/dist/blockchain/FullNodePeer.js +39 -14
  26. package/dist/blockchain/ServerCoin.d.ts +13 -5
  27. package/dist/blockchain/ServerCoin.d.ts.map +1 -1
  28. package/dist/blockchain/ServerCoin.js +88 -25
  29. package/dist/blockchain/StoreInfoCacheUpdater.d.ts +14 -0
  30. package/dist/blockchain/StoreInfoCacheUpdater.d.ts.map +1 -0
  31. package/dist/blockchain/StoreInfoCacheUpdater.js +157 -0
  32. package/dist/blockchain/Wallet.d.ts +2 -2
  33. package/dist/blockchain/Wallet.d.ts.map +1 -1
  34. package/dist/blockchain/Wallet.js +51 -18
  35. package/dist/blockchain/coins.d.ts +1 -1
  36. package/dist/blockchain/coins.d.ts.map +1 -1
  37. package/dist/blockchain/coins.js +5 -4
  38. package/dist/types.d.ts +2 -0
  39. package/dist/types.d.ts.map +1 -1
  40. package/dist/utils/ContentScanner.d.ts +63 -0
  41. package/dist/utils/ContentScanner.d.ts.map +1 -0
  42. package/dist/utils/ContentScanner.js +175 -0
  43. package/dist/utils/Environment.d.ts +18 -0
  44. package/dist/utils/Environment.d.ts.map +1 -0
  45. package/dist/utils/Environment.js +85 -0
  46. package/dist/utils/FileTransfer.d.ts +47 -0
  47. package/dist/utils/FileTransfer.d.ts.map +1 -0
  48. package/dist/utils/FileTransfer.js +209 -0
  49. package/dist/utils/NconfManager.js +2 -1
  50. package/dist/utils/StoreArchiveManager.d.ts +45 -0
  51. package/dist/utils/StoreArchiveManager.d.ts.map +1 -0
  52. package/dist/utils/StoreArchiveManager.js +153 -0
  53. package/dist/utils/config.d.ts +4 -3
  54. package/dist/utils/config.d.ts.map +1 -1
  55. package/dist/utils/config.js +12 -7
  56. package/dist/utils/directoryUtils.d.ts +0 -6
  57. package/dist/utils/directoryUtils.d.ts.map +1 -1
  58. package/dist/utils/directoryUtils.js +35 -26
  59. package/dist/utils/index.d.ts +2 -1
  60. package/dist/utils/index.d.ts.map +1 -1
  61. package/dist/utils/index.js +2 -1
  62. package/dist/utils/merkle.d.ts +2 -0
  63. package/dist/utils/merkle.d.ts.map +1 -0
  64. package/dist/utils/merkle.js +28 -0
  65. package/dist/utils/network.d.ts +1 -0
  66. package/dist/utils/network.d.ts.map +1 -1
  67. package/dist/utils/network.js +38 -11
  68. package/dist/utils/promiseUtils.d.ts +17 -0
  69. package/dist/utils/promiseUtils.d.ts.map +1 -0
  70. package/dist/utils/promiseUtils.js +38 -0
  71. package/dist/utils/ssl.js +2 -2
  72. package/package.json +15 -5
  73. package/dist/utils/deltaUtils.d.ts +0 -2
  74. package/dist/utils/deltaUtils.d.ts.map +0 -1
  75. package/dist/utils/deltaUtils.js +0 -83
@@ -78,6 +78,9 @@ declare class DataIntegrityTree {
78
78
  * @returns The serialized Merkle tree.
79
79
  */
80
80
  serialize(rootHash?: string | null): object;
81
+ static getRootOfForeignTree(treeData: {
82
+ leaves: string[];
83
+ }): string;
81
84
  /**
82
85
  * Deserialize a JSON object to a Merkle tree.
83
86
  * @param rootHash - The root hash of the tree.
@@ -106,7 +109,7 @@ declare class DataIntegrityTree {
106
109
  * @param rootHash - The root hash of the tree. Defaults to the latest root hash.
107
110
  * @returns The readable stream for the file.
108
111
  */
109
- getValueStream(hexKey: string, rootHash?: string | null): Readable;
112
+ getValueStream(hexKey: string, rootHash?: string | null, byteOffset?: number | null, length?: number | null): Readable;
110
113
  /**
111
114
  * Delete all leaves from the Merkle tree.
112
115
  */
@@ -152,9 +155,14 @@ declare class DataIntegrityTree {
152
155
  * @param sha256 - The SHA-256 hash of the file.
153
156
  * @param serializedTree - The foreign serialized Merkle tree.
154
157
  * @param expectedRootHash - The expected root hash of the Merkle tree.
158
+ * @param dataDir - The directory where the data is stored.
159
+ * @param verifiedSha256 - A boolean indicating if the SHA-256 hash has already been verified.
155
160
  * @returns A boolean indicating if the SHA-256 is present in the foreign tree and the root hash matches.
156
161
  */
157
- static validateKeyIntegrityWithForeignTree(key: string, sha256: string, serializedTree: object, expectedRootHash: string): boolean;
162
+ static validateKeyIntegrityWithForeignTree(hexkey: string, sha256: string, serializedTree: object, expectedRootHash: string, dataDir: string, verifiedSha256?: boolean): Promise<boolean>;
163
+ private static verifyFileHash;
164
+ private static deserializeAndVerifyTree;
165
+ private static checkHashInTree;
158
166
  }
159
167
  export { DataIntegrityTree };
160
168
  //# sourceMappingURL=DataIntegrityTree.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DataIntegrityTree.d.ts","sourceRoot":"","sources":["../../src/DataIntegrityTree/DataIntegrityTree.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAuClC,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAGlB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;GAEG;AACH,cAAM,iBAAiB;IACrB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,OAAO,CAAS;IACjB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC5D,OAAO,CAAC,IAAI,CAAa;gBAEb,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,wBAA6B;WAiDrD,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,wBAAwB,GAAG,iBAAiB;IAIzF;;;OAGG;IACH,OAAO,CAAC,aAAa;IAQrB;;;OAGG;IACH,OAAO,CAAC,eAAe;IAUvB;;;;OAIG;IACH,OAAO,CAAC,kBAAkB;IAa1B;;;;OAIG;YACW,WAAW;IAazB;;;;;OAKG;IACG,SAAS,CAAC,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA+EjE;;;OAGG;IACH,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAW5B;;;;OAIG;IACH,QAAQ,CAAC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IACH,WAAW,CAAC,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO;IA4B5D;;;;;OAKG;IACH,WAAW,CACT,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GAChB;QAAE,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE;IA+B/D;;;;;OAKG;IACG,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAyD5E;;;;;;;;;;;OAWG;WACU,mCAAmC,CAC9C,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,MAAM,EACtB,gBAAgB,EAAE,MAAM,EACxB,OAAO,EAAE,MAAM,EACf,cAAc,GAAE,OAAe,GAC9B,OAAO,CAAC,OAAO,CAAC;mBAgCE,cAAc;IA8CnC,OAAO,CAAC,MAAM,CAAC,wBAAwB;IAkCvC,OAAO,CAAC,MAAM,CAAC,eAAe;CAgB/B;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
@@ -94,8 +94,7 @@ class DataIntegrityTree {
94
94
  }
95
95
  this.files = new Map();
96
96
  if (options.rootHash) {
97
- const manifest = this._loadManifest();
98
- if (manifest.includes(options.rootHash)) {
97
+ if (fs.existsSync(path.join(this.storeDir, `${options.rootHash}.dat`))) {
99
98
  this.tree = this.deserializeTree(options.rootHash);
100
99
  }
101
100
  else {
@@ -111,7 +110,10 @@ class DataIntegrityTree {
111
110
  }
112
111
  }
113
112
  static from(storeId, options) {
114
- return new DataIntegrityTree(storeId, { ...options, disableInitialize: true });
113
+ return new DataIntegrityTree(storeId, {
114
+ ...options,
115
+ disableInitialize: true,
116
+ });
115
117
  }
116
118
  /**
117
119
  * Load the manifest file.
@@ -132,7 +134,10 @@ class DataIntegrityTree {
132
134
  const manifest = this._loadManifest();
133
135
  if (manifest.length > 0) {
134
136
  const latestRootHash = manifest[manifest.length - 1];
135
- return this.deserializeTree(latestRootHash);
137
+ if (latestRootHash && isHexString(latestRootHash)) {
138
+ return this.deserializeTree(latestRootHash);
139
+ }
140
+ return new merkletreejs_1.MerkleTree([], crypto_js_1.SHA256, { sortPairs: true });
136
141
  }
137
142
  else {
138
143
  return new merkletreejs_1.MerkleTree([], crypto_js_1.SHA256, { sortPairs: true });
@@ -220,14 +225,19 @@ class DataIntegrityTree {
220
225
  hash: combinedHash,
221
226
  sha256: sha256,
222
227
  });
228
+ await new Promise((resolve) => setTimeout(resolve, 100));
223
229
  this._rebuildTree();
230
+ await new Promise((resolve) => setTimeout(resolve, 100));
224
231
  resolve();
225
232
  }
226
233
  catch (err) {
227
234
  reject(err);
228
235
  }
236
+ tempWriteStream.end();
237
+ finalWriteStream.end();
229
238
  });
230
239
  tempWriteStream.on("error", (err) => {
240
+ tempWriteStream.end();
231
241
  reject(err);
232
242
  });
233
243
  readStream.on("error", (err) => {
@@ -305,6 +315,11 @@ class DataIntegrityTree {
305
315
  files: Object.fromEntries(this.files),
306
316
  };
307
317
  }
318
+ static getRootOfForeignTree(treeData) {
319
+ const leaves = treeData.leaves.map((leaf) => Buffer.from(leaf, "hex"));
320
+ const tree = new merkletreejs_1.MerkleTree(leaves, crypto_js_1.SHA256, { sortPairs: true });
321
+ return tree.getRoot().toString("hex");
322
+ }
308
323
  /**
309
324
  * Deserialize a JSON object to a Merkle tree.
310
325
  * @param rootHash - The root hash of the tree.
@@ -337,7 +352,9 @@ class DataIntegrityTree {
337
352
  ? fs.readFileSync(manifestPath, "utf-8").trim().split("\n")
338
353
  : [];
339
354
  // Check if the last entry is the same as the rootHash to avoid duplicates
340
- const latestRootHash = manifestContent.length > 0 ? manifestContent[manifestContent.length - 1] : null;
355
+ const latestRootHash = manifestContent.length > 0
356
+ ? manifestContent[manifestContent.length - 1]
357
+ : null;
341
358
  if (latestRootHash !== rootHash) {
342
359
  // Append the new rootHash if it is not the same as the last one
343
360
  fs.appendFileSync(manifestPath, `${rootHash}\n`);
@@ -413,7 +430,7 @@ class DataIntegrityTree {
413
430
  * @param rootHash - The root hash of the tree. Defaults to the latest root hash.
414
431
  * @returns The readable stream for the file.
415
432
  */
416
- getValueStream(hexKey, rootHash = null) {
433
+ getValueStream(hexKey, rootHash = null, byteOffset = null, length = null) {
417
434
  if (!isHexString(hexKey)) {
418
435
  throw new Error("key must be a valid hex string");
419
436
  }
@@ -436,8 +453,22 @@ class DataIntegrityTree {
436
453
  if (!fs.existsSync(filePath)) {
437
454
  throw new Error(`File at path ${filePath} does not exist`);
438
455
  }
439
- // Create a read stream and pipe it through a decompression stream using the same algorithm (gzip)
440
- const readStream = fs.createReadStream(filePath);
456
+ const fileSize = fs.statSync(filePath).size;
457
+ // Validate offset and length
458
+ if (byteOffset !== null && length !== null) {
459
+ if (byteOffset + length > fileSize) {
460
+ throw new Error(`Offset (${byteOffset}) and length (${length}) exceed the file size (${fileSize}).`);
461
+ }
462
+ }
463
+ // Create the read stream with optional byte range
464
+ const options = {};
465
+ if (byteOffset !== null) {
466
+ options.start = byteOffset;
467
+ }
468
+ if (length !== null && byteOffset !== null) {
469
+ options.end = byteOffset + length - 1; // `end` is inclusive, hence `byteOffset + length - 1`
470
+ }
471
+ const readStream = fs.createReadStream(filePath, options);
441
472
  const decompressStream = zlib.createGunzip();
442
473
  // Return the combined stream as a generic Readable stream
443
474
  return readStream.pipe(decompressStream);
@@ -579,14 +610,13 @@ class DataIntegrityTree {
579
610
  decompressStream.on("end", () => {
580
611
  const uncompressedSha256 = hash.digest("hex");
581
612
  const isValid = uncompressedSha256 === sha256;
582
- console.log(`SHA-256 of uncompressed file: ${uncompressedSha256}`);
583
613
  if (!isValid) {
584
614
  return resolve(false);
585
615
  }
586
616
  const tree = this.deserializeTree(rootHash);
587
617
  const combinedHash = crypto
588
618
  .createHash("sha256")
589
- .update(`${toHex(sha256)}/${sha256}`)
619
+ .update(sha256)
590
620
  .digest("hex");
591
621
  const leaf = Buffer.from(combinedHash, "hex");
592
622
  const isInTree = tree.getLeafIndex(leaf) !== -1;
@@ -608,10 +638,12 @@ class DataIntegrityTree {
608
638
  * @param sha256 - The SHA-256 hash of the file.
609
639
  * @param serializedTree - The foreign serialized Merkle tree.
610
640
  * @param expectedRootHash - The expected root hash of the Merkle tree.
641
+ * @param dataDir - The directory where the data is stored.
642
+ * @param verifiedSha256 - A boolean indicating if the SHA-256 hash has already been verified.
611
643
  * @returns A boolean indicating if the SHA-256 is present in the foreign tree and the root hash matches.
612
644
  */
613
- static validateKeyIntegrityWithForeignTree(key, sha256, serializedTree, expectedRootHash) {
614
- if (!isHexString(key)) {
645
+ static async validateKeyIntegrityWithForeignTree(hexkey, sha256, serializedTree, expectedRootHash, dataDir, verifiedSha256 = false) {
646
+ if (!isHexString(hexkey)) {
615
647
  throw new Error("key must be a valid hex string");
616
648
  }
617
649
  if (!isHexString(sha256)) {
@@ -620,6 +652,56 @@ class DataIntegrityTree {
620
652
  if (!isHexString(expectedRootHash)) {
621
653
  throw new Error("expectedRootHash must be a valid hex string");
622
654
  }
655
+ if (!verifiedSha256) {
656
+ // Verify the file's SHA-256 hash
657
+ const isFileValid = await this.verifyFileHash(sha256, dataDir);
658
+ if (!isFileValid) {
659
+ return false;
660
+ }
661
+ }
662
+ // Deserialize and verify the tree
663
+ const tree = this.deserializeAndVerifyTree(serializedTree, expectedRootHash);
664
+ if (!tree) {
665
+ return false;
666
+ }
667
+ // Check if the combined hash exists in the foreign tree's leaves
668
+ const isInTree = this.checkHashInTree(tree, hexkey, sha256);
669
+ return isInTree;
670
+ }
671
+ // Function to verify the file's SHA-256 hash
672
+ static async verifyFileHash(sha256, dataDir) {
673
+ const filePath = path.join(dataDir, sha256.match(/.{1,2}/g).join("/"));
674
+ // Check if the file exists
675
+ if (!fs.existsSync(filePath)) {
676
+ throw new Error(`File at path ${filePath} does not exist`);
677
+ }
678
+ const compressedReadStream = fs.createReadStream(filePath);
679
+ const decompressStream = zlib.createGunzip();
680
+ const hash = crypto.createHash("sha256");
681
+ // Process file decompression and hash comparison
682
+ return new Promise((resolve, reject) => {
683
+ compressedReadStream.pipe(decompressStream);
684
+ decompressStream.on("data", (chunk) => {
685
+ hash.update(chunk);
686
+ });
687
+ decompressStream.on("end", () => {
688
+ const uncompressedSha256 = hash.digest("hex");
689
+ if (uncompressedSha256 !== sha256) {
690
+ console.warn(`File hash mismatch. Expected: ${sha256}, got: ${uncompressedSha256}`);
691
+ return resolve(false);
692
+ }
693
+ resolve(true);
694
+ });
695
+ decompressStream.on("error", (err) => {
696
+ reject(err);
697
+ });
698
+ compressedReadStream.on("error", (err) => {
699
+ reject(err);
700
+ });
701
+ });
702
+ }
703
+ // Function to deserialize and verify the tree
704
+ static deserializeAndVerifyTree(serializedTree, expectedRootHash) {
623
705
  // Deserialize the foreign tree
624
706
  const leaves = serializedTree.leaves.map((leaf) => Buffer.from(leaf, "hex"));
625
707
  const tree = new merkletreejs_1.MerkleTree(leaves, crypto_js_1.SHA256, { sortPairs: true });
@@ -627,7 +709,7 @@ class DataIntegrityTree {
627
709
  const treeRootHash = tree.getRoot().toString("hex");
628
710
  if (treeRootHash !== expectedRootHash) {
629
711
  console.warn(`Expected root hash ${expectedRootHash}, but got ${treeRootHash}`);
630
- return false;
712
+ return null;
631
713
  }
632
714
  // Rebuild the files map from the serialized tree
633
715
  // @ts-ignore
@@ -635,10 +717,13 @@ class DataIntegrityTree {
635
717
  key,
636
718
  { hash: value.hash, sha256: value.sha256 },
637
719
  ]));
638
- // Check if the SHA-256 exists in the foreign tree's files
720
+ return tree;
721
+ }
722
+ // Function to check if the combined hash exists in the tree
723
+ static checkHashInTree(tree, hexkey, sha256) {
639
724
  const combinedHash = crypto
640
725
  .createHash("sha256")
641
- .update(`${toHex(key)}/${sha256}`)
726
+ .update(`${hexkey}/${sha256}`)
642
727
  .digest("hex");
643
728
  const leaf = Buffer.from(combinedHash, "hex");
644
729
  const isInTree = tree.getLeafIndex(leaf) !== -1;
@@ -3,23 +3,28 @@ import { Readable } from "stream";
3
3
  export declare class ContentServer {
4
4
  private ipAddress;
5
5
  private storeId;
6
+ private static certPath;
7
+ private static keyPath;
6
8
  private static readonly port;
7
9
  constructor(ipAddress: string, storeId: string);
8
10
  getKey(key: string, rootHash: string, challengeHex?: string): Promise<string>;
9
- getPaymentAddress(): Promise<string>;
11
+ getPaymentAddress(): Promise<string | null>;
10
12
  getWellKnown(): Promise<any>;
11
13
  getKnownStores(): Promise<any>;
12
14
  getStoresIndex(): Promise<any>;
13
- getKeysIndex(): Promise<any>;
14
- headKey(key: string): Promise<{
15
+ getKeysIndex(rootHash?: string): Promise<any>;
16
+ headKey(key: string, rootHash?: string): Promise<{
15
17
  success: boolean;
16
18
  headers?: http.IncomingHttpHeaders;
17
19
  }>;
18
- headStore(): Promise<{
20
+ headStore(options?: {
21
+ hasRootHash: string;
22
+ }): Promise<{
19
23
  success: boolean;
20
24
  headers?: http.IncomingHttpHeaders;
21
25
  }>;
22
- streamKey(key: string): Promise<Readable>;
26
+ hasRootHash(rootHash: string): Promise<boolean>;
27
+ streamKey(key: string, rootHash?: string): Promise<Readable>;
23
28
  private head;
24
29
  private fetchJson;
25
30
  private fetchWithRetries;
@@ -1 +1 @@
1
- {"version":3,"file":"ContentServer.d.ts","sourceRoot":"","sources":["../../src/DigNetwork/ContentServer.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAGlC,qBAAa,aAAa;IACxB,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAM;gBAEtB,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;IAMjC,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,CAAC,EA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L,iBAAiB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAe3C,YAAY,IAAI,OAAO,CAAC,GAAG,CAAC;IAM5B,cAAc,IAAI,OAAO,CAAC,GAAG,CAAC;IAM9B,cAAc,IAAI,OAAO,CAAC,GAAG,CAAC;IAM9B,YAAY,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAY7C,OAAO,CAClB,GAAG,EAAE,MAAM,EACX,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,OAAO,CAAC,EAAE,IAAI,CAAC,mBAAmB,CAAA;KAAE,CAAC;IAYvD,SAAS,CAAC,OAAO,CAAC,EAAE;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC;QACjE,OAAO,EAAE,OAAO,CAAC;QACjB,OAAO,CAAC,EAAE,IAAI,CAAC,mBAAmB,CAAC;KACpC,CAAC;IAUW,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAUrD,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;YAgDrD,IAAI;YA0EJ,SAAS;YAMT,gBAAgB;YAiChB,KAAK;CA6GpB"}
@@ -4,17 +4,25 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.ContentServer = void 0;
7
+ const fs_1 = __importDefault(require("fs"));
7
8
  const http_1 = __importDefault(require("http"));
8
9
  const url_1 = require("url");
10
+ const ssl_1 = require("../utils/ssl");
11
+ const network_1 = require("../utils/network");
9
12
  class ContentServer {
10
13
  constructor(ipAddress, storeId) {
11
14
  this.ipAddress = ipAddress;
12
15
  this.storeId = storeId;
16
+ if (!ContentServer.certPath || !ContentServer.keyPath) {
17
+ const { certPath, keyPath } = (0, ssl_1.getOrCreateSSLCerts)();
18
+ ContentServer.certPath = certPath;
19
+ ContentServer.keyPath = keyPath;
20
+ }
13
21
  }
14
22
  // Method to get the content of a specified key from the peer, with optional challenge query
15
23
  async getKey(key, rootHash, challengeHex) {
16
24
  // Construct the base URL
17
- let url = `http://${this.ipAddress}/chia.${this.storeId}.${rootHash}/${key}`;
25
+ let url = `https://${(0, network_1.formatHost)(this.ipAddress)}:${ContentServer.port}/chia.${this.storeId}.${rootHash}/${key}`;
18
26
  // If a challenge is provided, append it as a query parameter
19
27
  if (challengeHex) {
20
28
  url += `?challenge=${challengeHex}`;
@@ -30,43 +38,66 @@ class ContentServer {
30
38
  }
31
39
  catch (error) {
32
40
  console.error(`Failed to fetch payment address from ${this.ipAddress}: ${error.message}`);
33
- throw new Error(`Failed to fetch payment address: ${error.message}`);
41
+ return null;
34
42
  }
35
43
  }
36
44
  // Method to get the .well-known information
37
45
  async getWellKnown() {
38
- const url = `http://${this.ipAddress}/.well-known`;
46
+ const url = `https://${(0, network_1.formatHost)(this.ipAddress)}:${ContentServer.port}/.well-known`;
39
47
  return this.fetchJson(url);
40
48
  }
41
49
  // Method to get the list of known stores
42
50
  async getKnownStores() {
43
- const url = `http://${this.ipAddress}/.well-known/stores`;
51
+ const url = `https://${(0, network_1.formatHost)(this.ipAddress)}:${ContentServer.port}/.well-known/stores`;
44
52
  return this.fetchJson(url);
45
53
  }
46
54
  // Method to get the index of all stores
47
55
  async getStoresIndex() {
48
- const url = `http://${this.ipAddress}/`;
56
+ const url = `https://${(0, network_1.formatHost)(this.ipAddress)}:${ContentServer.port}/`;
49
57
  return this.fetchJson(url);
50
58
  }
51
59
  // Method to get the index of keys in a store
52
- async getKeysIndex() {
53
- const url = `http://${this.ipAddress}/${this.storeId}`;
60
+ async getKeysIndex(rootHash) {
61
+ let udi = `chia.${this.storeId}`;
62
+ if (rootHash) {
63
+ udi += `.${rootHash}`;
64
+ }
65
+ const url = `https://${(0, network_1.formatHost)(this.ipAddress)}:${ContentServer.port}/${udi}`;
54
66
  return this.fetchJson(url);
55
67
  }
56
68
  // Method to check if a specific key exists (HEAD request)
57
- async headKey(key) {
58
- const url = `http://${this.ipAddress}/${this.storeId}/${key}`;
59
- return this.head(url); // Return the object from head method
69
+ async headKey(key, rootHash) {
70
+ let udi = `chia.${this.storeId}`;
71
+ if (rootHash) {
72
+ udi += `.${rootHash}`;
73
+ }
74
+ const url = `https://${(0, network_1.formatHost)(this.ipAddress)}:${ContentServer.port}/${udi}/${key}`;
75
+ return this.head(url);
60
76
  }
61
77
  // Method to check if a specific store exists (HEAD request)
62
- async headStore() {
63
- const url = `http://${this.ipAddress}/${this.storeId}`;
64
- console.log({ url });
65
- return this.head(url); // Return the object from head method
78
+ async headStore(options) {
79
+ let url = `https://${(0, network_1.formatHost)(this.ipAddress)}:${ContentServer.port}/chia.${this.storeId}`;
80
+ if (options?.hasRootHash) {
81
+ url += `?hasRootHash=${options.hasRootHash}`;
82
+ }
83
+ return this.head(url);
84
+ }
85
+ async hasRootHash(rootHash) {
86
+ const { success, headers } = await this.headStore({
87
+ hasRootHash: rootHash,
88
+ });
89
+ if (success) {
90
+ return headers?.["x-has-root-hash"] === "true";
91
+ }
92
+ return false;
66
93
  }
67
- streamKey(key) {
94
+ streamKey(key, rootHash) {
95
+ let udi = `chia.${this.storeId}`;
96
+ if (rootHash) {
97
+ udi += `.${rootHash}`;
98
+ }
68
99
  return new Promise((resolve, reject) => {
69
- const url = `http://${this.ipAddress}/${this.storeId}/${key}`;
100
+ const url = `https://${(0, network_1.formatHost)(this.ipAddress)}:${ContentServer.port}/${udi}/${key}`;
70
101
  const urlObj = new url_1.URL(url);
71
102
  const requestOptions = {
72
103
  hostname: urlObj.hostname,
@@ -93,7 +124,7 @@ class ContentServer {
93
124
  }
94
125
  });
95
126
  request.on("error", (error) => {
96
- console.error(`Request error for ${url}:`, error);
127
+ console.error(`GET Request error for ${url}:`, error);
97
128
  reject(error);
98
129
  });
99
130
  request.end();
@@ -111,6 +142,9 @@ class ContentServer {
111
142
  (urlObj.protocol === "http:" ? 80 : ContentServer.port),
112
143
  path: urlObj.pathname + urlObj.search,
113
144
  method: "HEAD",
145
+ key: fs_1.default.readFileSync(ContentServer.keyPath),
146
+ cert: fs_1.default.readFileSync(ContentServer.certPath),
147
+ rejectUnauthorized: false,
114
148
  };
115
149
  const request = http_1.default.request(requestOptions, (response) => {
116
150
  const { statusCode, headers } = response;
@@ -149,7 +183,7 @@ class ContentServer {
149
183
  }
150
184
  });
151
185
  request.on("error", (error) => {
152
- console.error(`Request error for ${url}:`, error);
186
+ console.error(`HEAD ${url}:`, error.message);
153
187
  reject({ success: false });
154
188
  });
155
189
  request.end();
@@ -168,7 +202,7 @@ class ContentServer {
168
202
  // Helper method to fetch content with retries and redirection handling
169
203
  async fetchWithRetries(url) {
170
204
  let attempt = 0;
171
- const maxRetries = 5;
205
+ const maxRetries = 1;
172
206
  const initialDelay = 2000; // 2 seconds
173
207
  const maxDelay = 10000; // 10 seconds
174
208
  const delayMultiplier = 1.5;
@@ -192,23 +226,48 @@ class ContentServer {
192
226
  }
193
227
  throw new Error(`Failed to retrieve data from ${url} after ${maxRetries} attempts.`);
194
228
  }
195
- // Core method to fetch content from a URL
229
+ // Core method to fetch content from a URL with a 5-second inactivity timeout
196
230
  async fetch(url, maxRedirects = 5) {
197
231
  return new Promise((resolve, reject) => {
198
232
  const urlObj = new url_1.URL(url);
233
+ const timeoutDuration = 5000; // 5 seconds
234
+ let timeout = null; // Initialize timeout
199
235
  const requestOptions = {
200
236
  hostname: urlObj.hostname,
201
237
  port: urlObj.port || ContentServer.port,
202
238
  path: urlObj.pathname + urlObj.search, // Include query params
203
239
  method: "GET",
240
+ key: fs_1.default.readFileSync(ContentServer.keyPath),
241
+ cert: fs_1.default.readFileSync(ContentServer.certPath),
242
+ rejectUnauthorized: false,
204
243
  };
205
244
  const request = http_1.default.request(requestOptions, (response) => {
206
245
  let data = "";
246
+ // Set timeout for inactivity
247
+ timeout = setTimeout(() => {
248
+ console.error(`Request timeout: No data received for ${timeoutDuration / 1000} seconds.`);
249
+ request.destroy(); // Use destroy instead of abort
250
+ reject(new Error(`Request timed out after ${timeoutDuration / 1000} seconds of inactivity`));
251
+ }, timeoutDuration);
252
+ const resetTimeout = () => {
253
+ if (timeout) {
254
+ clearTimeout(timeout);
255
+ }
256
+ timeout = setTimeout(() => {
257
+ console.error(`Request timeout: No data received for ${timeoutDuration / 1000} seconds.`);
258
+ request.destroy(); // Use destroy instead of abort
259
+ reject(new Error(`Request timed out after ${timeoutDuration / 1000} seconds of inactivity`));
260
+ }, timeoutDuration);
261
+ };
207
262
  if (response.statusCode === 200) {
208
263
  response.on("data", (chunk) => {
209
264
  data += chunk;
265
+ resetTimeout(); // Reset the timeout every time data is received
210
266
  });
211
267
  response.on("end", () => {
268
+ if (timeout) {
269
+ clearTimeout(timeout);
270
+ }
212
271
  resolve(data);
213
272
  });
214
273
  }
@@ -217,8 +276,9 @@ class ContentServer {
217
276
  // Handle redirects
218
277
  if (maxRedirects > 0) {
219
278
  const redirectUrl = new url_1.URL(response.headers.location, url); // Resolve relative URLs based on the original URL
220
- // Recursively follow the redirect, passing the same query params
221
- // console.log(`Redirecting to: ${redirectUrl.toString()}`);
279
+ if (timeout) {
280
+ clearTimeout(timeout);
281
+ }
222
282
  this.fetch(redirectUrl.toString(), maxRedirects - 1)
223
283
  .then(resolve)
224
284
  .catch(reject);
@@ -228,11 +288,17 @@ class ContentServer {
228
288
  }
229
289
  }
230
290
  else {
291
+ if (timeout) {
292
+ clearTimeout(timeout);
293
+ }
231
294
  reject(new Error(`Failed to retrieve data from ${url}. Status code: ${response.statusCode}`));
232
295
  }
233
296
  });
234
297
  request.on("error", (error) => {
235
- console.error(`Request error for ${url}:`, error);
298
+ if (timeout) {
299
+ clearTimeout(timeout);
300
+ }
301
+ console.error(`GET ${url}:`, error.message);
236
302
  reject(error);
237
303
  });
238
304
  request.end();
@@ -240,4 +306,4 @@ class ContentServer {
240
306
  }
241
307
  }
242
308
  exports.ContentServer = ContentServer;
243
- ContentServer.port = 80;
309
+ ContentServer.port = 4161;
@@ -5,16 +5,10 @@ export declare class DigNetwork {
5
5
  private storeDir;
6
6
  private peerBlacklist;
7
7
  constructor(storeId: string);
8
- private uploadPreflight;
9
- uploadStoreHead(digPeer: DigPeer): Promise<void>;
10
- uploadStore(digPeer: DigPeer): Promise<void>;
11
8
  static subscribeToStore(storeId: string): Promise<void>;
9
+ static findPeerWithStoreKey(storeId: string, rootHash: string, key?: string, intialBlackList?: string[]): Promise<DigPeer | null>;
12
10
  static unsubscribeFromStore(storeId: string): void;
13
- downloadFiles(forceDownload?: boolean, renderProgressBar?: boolean, skipData?: boolean): Promise<void>;
14
- private fetchAvailablePeers;
15
- private downloadHeightFile;
16
- private downloadManifestFile;
17
- private downloadFileFromPeers;
18
- private runProgressBar;
11
+ syncStoreFromPeers(maxRootsToProcess?: number): Promise<void>;
12
+ fetchAvailablePeers(): Promise<DigPeer[]>;
19
13
  }
20
14
  //# sourceMappingURL=DigNetwork.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DigNetwork.d.ts","sourceRoot":"","sources":["../../src/DigNetwork/DigNetwork.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,qBAAa,UAAU;IACrB,OAAO,CAAC,SAAS,CAAY;IAC7B,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,aAAa,CAA2B;gBAEpC,OAAO,EAAE,MAAM;YAOb,eAAe;IA8ChB,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAsDhD,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;WA6BrC,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;WAQtD,oBAAoB,CAAC,OAAO,E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