@internxt/sdk 1.17.7 → 1.17.8

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.
@@ -21,14 +21,15 @@ async function downloadFile(fileId, bucketId, mnemonic, network, crypto, toBinar
21
21
  throw new errors_1.DownloadInvalidMnemonicError();
22
22
  }
23
23
  }
24
- const { index, shards, version, size } = await network.getDownloadLinks(bucketId, fileId, opts?.token);
24
+ const fileInfo = await network.getDownloadLinks(bucketId, fileId, opts?.token);
25
+ const { index, shards, version, size } = fileInfo;
25
26
  if (!version || version === 1) {
26
27
  throw new FileVersionOneError();
27
28
  }
28
29
  iv = toBinaryData(index, types_1.BinaryDataEncoding.HEX).slice(0, 16);
29
30
  key = await crypto.generateFileKey(mnemonic, bucketId, toBinaryData(index, types_1.BinaryDataEncoding.HEX));
30
31
  const downloadables = shards.sort((sA, sB) => sA.index - sB.index);
31
- await downloadFile(downloadables, size);
32
+ await downloadFile(downloadables, fileInfo);
32
33
  await decryptFile(crypto.algorithm.type, key, iv, size);
33
34
  }
34
35
  catch (err) {
@@ -45,6 +45,10 @@ export interface GetDownloadLinksResponse {
45
45
  shards: DownloadableShard[];
46
46
  version?: number;
47
47
  size: number;
48
+ hmac?: {
49
+ value: string;
50
+ type: 'sha512';
51
+ };
48
52
  }
49
53
  export interface NetworkRequestConfig {
50
54
  client: HttpClient;
@@ -74,7 +78,7 @@ export type UploadFileMultipartFunction = (urls: string[]) => Promise<{
74
78
  ETag: string;
75
79
  }[];
76
80
  }>;
77
- export type DownloadFileFunction = (downloadables: DownloadableShard[], fileSize: number) => Promise<void>;
81
+ export type DownloadFileFunction = (downloadables: DownloadableShard[], fileInfo: GetDownloadLinksResponse) => Promise<void>;
78
82
  export type BinaryData = {
79
83
  slice: (from: number, to: number) => BinaryData;
80
84
  toString(encoding: 'hex'): string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@internxt/sdk",
3
3
  "author": "Internxt <hello@internxt.com>",
4
- "version": "1.17.7",
4
+ "version": "1.17.8",
5
5
  "description": "An sdk for interacting with Internxt's services",
6
6
  "repository": {
7
7
  "type": "git",