@secrecy/lib 1.30.0-feat-rename-file.1 → 1.30.0
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/lib/cache.js
CHANGED
|
@@ -4,7 +4,7 @@ export const dataCache = new Map();
|
|
|
4
4
|
export const nodesCache = new Map();
|
|
5
5
|
export const usersCache = new Map();
|
|
6
6
|
export const publicKeysCache = new Map();
|
|
7
|
-
export const
|
|
7
|
+
export const dataContentCache = new LRUCache({
|
|
8
8
|
max: 500,
|
|
9
9
|
maxSize: gigaToBytes(0.5),
|
|
10
10
|
sizeCalculation: (value) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
2
|
import ky from 'ky';
|
|
3
3
|
import { encryptName } from '../index.js';
|
|
4
|
-
import { nodesCache, dataCache,
|
|
4
|
+
import { nodesCache, dataCache, dataContentCache } from '../cache.js';
|
|
5
5
|
import { secretStreamKeygen } from '../crypto/data.js';
|
|
6
6
|
import { decryptCryptoBox, encryptCryptoBox } from '../crypto/index.js';
|
|
7
7
|
import { compress, decompress } from '../minify/index.js';
|
|
@@ -126,7 +126,7 @@ export class SecrecyCloudClient {
|
|
|
126
126
|
await byPart(p);
|
|
127
127
|
}));
|
|
128
128
|
await uploadEnded();
|
|
129
|
-
|
|
129
|
+
dataContentCache.set(uploadData.dataId, dataBuffer);
|
|
130
130
|
return uploadData.dataId;
|
|
131
131
|
}
|
|
132
132
|
async uploadDataInCloud({ data, name, nodeId, encryptProgress, uploadProgress, signal, }) {
|
|
@@ -271,7 +271,7 @@ export class SecrecyCloudClient {
|
|
|
271
271
|
return await apiNodeToExternalNodeFull(updateNode, this.#keys);
|
|
272
272
|
}
|
|
273
273
|
async dataContent({ dataId, onDownloadProgress, progressDecrypt, signal, }) {
|
|
274
|
-
const cached =
|
|
274
|
+
const cached = dataContentCache.get(dataId);
|
|
275
275
|
if (cached !== undefined) {
|
|
276
276
|
return cached;
|
|
277
277
|
}
|
|
@@ -348,7 +348,7 @@ export class SecrecyCloudClient {
|
|
|
348
348
|
throw `Can't find content for data ${dataId}`;
|
|
349
349
|
}
|
|
350
350
|
const data = await finalize(encryptedContent);
|
|
351
|
-
|
|
351
|
+
dataContentCache.set(dataId, data);
|
|
352
352
|
return data;
|
|
353
353
|
}
|
|
354
354
|
async deleteData({ dataId, nodeId, }) {
|
package/dist/types/cache.d.ts
CHANGED
|
@@ -10,4 +10,4 @@ export declare const usersCache: Map<string, {
|
|
|
10
10
|
isSearchable: boolean;
|
|
11
11
|
}>;
|
|
12
12
|
export declare const publicKeysCache: Map<string, string>;
|
|
13
|
-
export declare const
|
|
13
|
+
export declare const dataContentCache: LRUCache<string, Uint8Array, unknown>;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@secrecy/lib",
|
|
3
3
|
"author": "Anonymize <anonymize@gmail.com>",
|
|
4
4
|
"description": "Anonymize Secrecy Library",
|
|
5
|
-
"version": "1.30.0
|
|
5
|
+
"version": "1.30.0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "https://github.com/anonymize-org/lib.git"
|