@secrecy/lib 1.49.0-feat-report-data.1 → 1.49.0-feat-report-data.2
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.
|
@@ -9,7 +9,7 @@ import { sodium } from '../sodium.js';
|
|
|
9
9
|
import { enumerate, chunks, concatenate } from '../utils/array.js';
|
|
10
10
|
import { md5 } from '../worker/md5.js';
|
|
11
11
|
import { decrypt, encrypt } from '../worker/sodium.js';
|
|
12
|
-
import { apiDataToExternal } from './convert/data.js';
|
|
12
|
+
import { apiDataToExternal, apiDataToInternal } from './convert/data.js';
|
|
13
13
|
import { apiNodeFullToInternalFull, apiNodeToExternal, apiNodeToExternalNodeFull, internalNodeFullToNodeFull, } from './convert/node.js';
|
|
14
14
|
import { promiseAllLimit } from '../utils/promise.js';
|
|
15
15
|
import { kiloToBytes } from '../utils.js';
|
|
@@ -550,15 +550,15 @@ export class SecrecyCloudClient {
|
|
|
550
550
|
};
|
|
551
551
|
};
|
|
552
552
|
async reportData({ id, reasons, }) {
|
|
553
|
-
const [
|
|
553
|
+
const [rawData, secrecy] = await Promise.all([
|
|
554
554
|
this.#apiClient.cloud.dataById.query({ id }),
|
|
555
555
|
this.#apiClient.misc.publicKey.query(),
|
|
556
556
|
]);
|
|
557
|
-
|
|
557
|
+
const data = apiDataToInternal(rawData, this.#keys);
|
|
558
|
+
if (!data.key) {
|
|
558
559
|
throw new Error('Unable to retreive data key!');
|
|
559
560
|
}
|
|
560
|
-
const
|
|
561
|
-
const encryptedDataKey = sodium.to_hex(encryptCryptoBox(decryptedDataKey, secrecy.publicKey, this.#keys.privateKey));
|
|
561
|
+
const encryptedDataKey = sodium.to_hex(encryptCryptoBox(sodium.from_hex(data.key), secrecy.publicKey, this.#keys.privateKey));
|
|
562
562
|
return this.#apiClient.cloud.reportData.mutate({
|
|
563
563
|
id,
|
|
564
564
|
reasons,
|
package/dist/types/client.d.ts
CHANGED
|
@@ -3503,12 +3503,12 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
|
|
|
3503
3503
|
_input_in: {
|
|
3504
3504
|
id: string;
|
|
3505
3505
|
reasons: "data_leak"[];
|
|
3506
|
-
encryptedDataKey: string;
|
|
3506
|
+
encryptedDataKey: string | null;
|
|
3507
3507
|
};
|
|
3508
3508
|
_input_out: {
|
|
3509
3509
|
id: string;
|
|
3510
3510
|
reasons: "data_leak"[];
|
|
3511
|
-
encryptedDataKey: string;
|
|
3511
|
+
encryptedDataKey: string | null;
|
|
3512
3512
|
};
|
|
3513
3513
|
_output_in: {
|
|
3514
3514
|
isReported: boolean;
|
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.49.0-feat-report-data.
|
|
5
|
+
"version": "1.49.0-feat-report-data.2",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "https://github.com/anonymize-org/lib.git"
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"typescript": "^5.6.2"
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
|
-
"@secrecy/trpc-api-types": "1.33.0-feat-report-data-content.
|
|
77
|
+
"@secrecy/trpc-api-types": "1.33.0-feat-report-data-content.6",
|
|
78
78
|
"@trpc/client": "10.45.2",
|
|
79
79
|
"@trpc/server": "10.45.2",
|
|
80
80
|
"@types/libsodium-wrappers-sumo": "^0.7.8",
|