@secrecy/lib 1.48.0 → 1.49.0-feat-report-data.1

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.
@@ -549,4 +549,20 @@ export class SecrecyCloudClient {
549
549
  : [],
550
550
  };
551
551
  };
552
+ async reportData({ id, reasons, }) {
553
+ const [data, secrecy] = await Promise.all([
554
+ this.#apiClient.cloud.dataById.query({ id }),
555
+ this.#apiClient.misc.publicKey.query(),
556
+ ]);
557
+ if (!data.access.key) {
558
+ throw new Error('Unable to retreive data key!');
559
+ }
560
+ const decryptedDataKey = decryptCryptoBox(sodium.from_hex(data.access.key), this.#keys.publicKey, this.#keys.privateKey);
561
+ const encryptedDataKey = sodium.to_hex(encryptCryptoBox(decryptedDataKey, secrecy.publicKey, this.#keys.privateKey));
562
+ return this.#apiClient.cloud.reportData.mutate({
563
+ id,
564
+ reasons,
565
+ encryptedDataKey,
566
+ });
567
+ }
552
568
  }
@@ -1,6 +1,6 @@
1
1
  import type { ProgressCallback, SecrecyClient } from '../index.js';
2
2
  import type { DataMetadata, KeyPair, Node, NodeFull, NodeType, Rights } from './types/index.js';
3
- import { type ApiClient } from '../client.js';
3
+ import { type RouterInputs, type ApiClient, type RouterOutputs } from '../client.js';
4
4
  import { type DownloadProgress } from '../types.js';
5
5
  export declare class SecrecyCloudClient {
6
6
  #private;
@@ -94,4 +94,5 @@ export declare class SecrecyCloudClient {
94
94
  nodeId?: string;
95
95
  }): Promise<NodeFull>;
96
96
  private readonly perNode;
97
+ reportData({ id, reasons, }: Omit<RouterInputs['cloud']['reportData'], 'encryptedDataKey'>): Promise<RouterOutputs['cloud']['reportData']>;
97
98
  }
@@ -918,6 +918,256 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
918
918
  };
919
919
  };
920
920
  admin: {
921
+ report: {
922
+ data: {
923
+ query: import("@trpc/client").Resolver<import("@trpc/server").BuildProcedure<"query", {
924
+ _config: import("@trpc/server").RootConfig<{
925
+ ctx: {};
926
+ meta: object;
927
+ errorShape: {
928
+ message: string;
929
+ code: import("@trpc/server/rpc").TRPC_ERROR_CODE_NUMBER;
930
+ data: _trpc_server_dist_error_formatter.DefaultErrorData;
931
+ } | {
932
+ data: {
933
+ zodError: import("zod").typeToFlattenedError<any, string> | null;
934
+ code: import("@trpc/server/rpc").TRPC_ERROR_CODE_KEY;
935
+ httpStatus: number;
936
+ path?: string;
937
+ stack?: string;
938
+ };
939
+ message: string;
940
+ code: import("@trpc/server/rpc").TRPC_ERROR_CODE_NUMBER;
941
+ };
942
+ transformer: typeof superjson;
943
+ }>;
944
+ _meta: object;
945
+ _ctx_out: {};
946
+ _input_in: {
947
+ orderBy: "DATE_ASC" | "DATE_DESC";
948
+ state: ("PENDING" | "TRACKED" | "REJECTED")[];
949
+ id?: string | undefined;
950
+ md5?: string | undefined;
951
+ };
952
+ _input_out: {
953
+ orderBy: "DATE_ASC" | "DATE_DESC";
954
+ state: ("PENDING" | "TRACKED" | "REJECTED")[];
955
+ id?: string | undefined;
956
+ md5?: string | undefined;
957
+ };
958
+ _output_in: ({
959
+ dataPart: number;
960
+ id: string;
961
+ createdAt: Date;
962
+ md5: string;
963
+ dataKey: string;
964
+ snapshot: string | number | boolean | Record<string, string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null> | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
965
+ trackedSince: Date | null;
966
+ rejectedSince: Date | null;
967
+ isDataSaved: boolean;
968
+ isReadBlocked: boolean;
969
+ isAddBlocked: boolean;
970
+ isDeleteBlocked: boolean;
971
+ } & {
972
+ reportedBy: {
973
+ id: string;
974
+ userId: string;
975
+ reasons: "data_leak"[];
976
+ reportedDataId: string;
977
+ } & {
978
+ user: {
979
+ id: string;
980
+ phones: string[];
981
+ emails: string[];
982
+ ips: string[];
983
+ userAgents: string[];
984
+ fingerprints: string[];
985
+ geos: (string | number | boolean | Record<string, string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null> | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[];
986
+ };
987
+ };
988
+ events: {
989
+ id: string;
990
+ userId: string;
991
+ type: "delete" | "add" | "read";
992
+ date: Date;
993
+ reportedDataId: string;
994
+ } & {
995
+ user: {
996
+ id: string;
997
+ phones: string[];
998
+ emails: string[];
999
+ ips: string[];
1000
+ userAgents: string[];
1001
+ fingerprints: string[];
1002
+ geos: (string | number | boolean | Record<string, string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null> | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[];
1003
+ };
1004
+ };
1005
+ })[];
1006
+ _output_out: ({
1007
+ dataPart: number;
1008
+ id: string;
1009
+ createdAt: Date;
1010
+ md5: string;
1011
+ dataKey: string;
1012
+ snapshot: string | number | boolean | Record<string, string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null> | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
1013
+ trackedSince: Date | null;
1014
+ rejectedSince: Date | null;
1015
+ isDataSaved: boolean;
1016
+ isReadBlocked: boolean;
1017
+ isAddBlocked: boolean;
1018
+ isDeleteBlocked: boolean;
1019
+ } & {
1020
+ reportedBy: {
1021
+ id: string;
1022
+ userId: string;
1023
+ reasons: "data_leak"[];
1024
+ reportedDataId: string;
1025
+ } & {
1026
+ user: {
1027
+ id: string;
1028
+ phones: string[];
1029
+ emails: string[];
1030
+ ips: string[];
1031
+ userAgents: string[];
1032
+ fingerprints: string[];
1033
+ geos: (string | number | boolean | Record<string, string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null> | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[];
1034
+ };
1035
+ };
1036
+ events: {
1037
+ id: string;
1038
+ userId: string;
1039
+ type: "delete" | "add" | "read";
1040
+ date: Date;
1041
+ reportedDataId: string;
1042
+ } & {
1043
+ user: {
1044
+ id: string;
1045
+ phones: string[];
1046
+ emails: string[];
1047
+ ips: string[];
1048
+ userAgents: string[];
1049
+ fingerprints: string[];
1050
+ geos: (string | number | boolean | Record<string, string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null> | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[];
1051
+ };
1052
+ };
1053
+ })[];
1054
+ }, unknown>>;
1055
+ };
1056
+ reject: {
1057
+ mutate: import("@trpc/client").Resolver<import("@trpc/server").BuildProcedure<"mutation", {
1058
+ _config: import("@trpc/server").RootConfig<{
1059
+ ctx: {};
1060
+ meta: object;
1061
+ errorShape: {
1062
+ message: string;
1063
+ code: import("@trpc/server/rpc").TRPC_ERROR_CODE_NUMBER;
1064
+ data: _trpc_server_dist_error_formatter.DefaultErrorData;
1065
+ } | {
1066
+ data: {
1067
+ zodError: import("zod").typeToFlattenedError<any, string> | null;
1068
+ code: import("@trpc/server/rpc").TRPC_ERROR_CODE_KEY;
1069
+ httpStatus: number;
1070
+ path?: string;
1071
+ stack?: string;
1072
+ };
1073
+ message: string;
1074
+ code: import("@trpc/server/rpc").TRPC_ERROR_CODE_NUMBER;
1075
+ };
1076
+ transformer: typeof superjson;
1077
+ }>;
1078
+ _meta: object;
1079
+ _ctx_out: {};
1080
+ _input_in: {
1081
+ id: string;
1082
+ };
1083
+ _input_out: {
1084
+ id: string;
1085
+ };
1086
+ _output_in: {
1087
+ isRejected: boolean;
1088
+ };
1089
+ _output_out: {
1090
+ isRejected: boolean;
1091
+ };
1092
+ }, unknown>>;
1093
+ };
1094
+ track: {
1095
+ mutate: import("@trpc/client").Resolver<import("@trpc/server").BuildProcedure<"mutation", {
1096
+ _config: import("@trpc/server").RootConfig<{
1097
+ ctx: {};
1098
+ meta: object;
1099
+ errorShape: {
1100
+ message: string;
1101
+ code: import("@trpc/server/rpc").TRPC_ERROR_CODE_NUMBER;
1102
+ data: _trpc_server_dist_error_formatter.DefaultErrorData;
1103
+ } | {
1104
+ data: {
1105
+ zodError: import("zod").typeToFlattenedError<any, string> | null;
1106
+ code: import("@trpc/server/rpc").TRPC_ERROR_CODE_KEY;
1107
+ httpStatus: number;
1108
+ path?: string;
1109
+ stack?: string;
1110
+ };
1111
+ message: string;
1112
+ code: import("@trpc/server/rpc").TRPC_ERROR_CODE_NUMBER;
1113
+ };
1114
+ transformer: typeof superjson;
1115
+ }>;
1116
+ _meta: object;
1117
+ _ctx_out: {};
1118
+ _input_in: {
1119
+ id: string;
1120
+ };
1121
+ _input_out: {
1122
+ id: string;
1123
+ };
1124
+ _output_in: {
1125
+ isTracked: boolean;
1126
+ };
1127
+ _output_out: {
1128
+ isTracked: boolean;
1129
+ };
1130
+ }, unknown>>;
1131
+ };
1132
+ untrack: {
1133
+ mutate: import("@trpc/client").Resolver<import("@trpc/server").BuildProcedure<"mutation", {
1134
+ _config: import("@trpc/server").RootConfig<{
1135
+ ctx: {};
1136
+ meta: object;
1137
+ errorShape: {
1138
+ message: string;
1139
+ code: import("@trpc/server/rpc").TRPC_ERROR_CODE_NUMBER;
1140
+ data: _trpc_server_dist_error_formatter.DefaultErrorData;
1141
+ } | {
1142
+ data: {
1143
+ zodError: import("zod").typeToFlattenedError<any, string> | null;
1144
+ code: import("@trpc/server/rpc").TRPC_ERROR_CODE_KEY;
1145
+ httpStatus: number;
1146
+ path?: string;
1147
+ stack?: string;
1148
+ };
1149
+ message: string;
1150
+ code: import("@trpc/server/rpc").TRPC_ERROR_CODE_NUMBER;
1151
+ };
1152
+ transformer: typeof superjson;
1153
+ }>;
1154
+ _meta: object;
1155
+ _ctx_out: {};
1156
+ _input_in: {
1157
+ id: string;
1158
+ };
1159
+ _input_out: {
1160
+ id: string;
1161
+ };
1162
+ _output_in: {
1163
+ isUntracked: boolean;
1164
+ };
1165
+ _output_out: {
1166
+ isUntracked: boolean;
1167
+ };
1168
+ }, unknown>>;
1169
+ };
1170
+ };
921
1171
  user: {
922
1172
  deleteById: {
923
1173
  mutate: import("@trpc/client").Resolver<import("@trpc/server").BuildProcedure<"mutation", {
@@ -3226,6 +3476,48 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
3226
3476
  };
3227
3477
  }, unknown>>;
3228
3478
  };
3479
+ reportData: {
3480
+ mutate: import("@trpc/client").Resolver<import("@trpc/server").BuildProcedure<"mutation", {
3481
+ _config: import("@trpc/server").RootConfig<{
3482
+ ctx: {};
3483
+ meta: object;
3484
+ errorShape: {
3485
+ message: string;
3486
+ code: import("@trpc/server/rpc").TRPC_ERROR_CODE_NUMBER;
3487
+ data: _trpc_server_dist_error_formatter.DefaultErrorData;
3488
+ } | {
3489
+ data: {
3490
+ zodError: import("zod").typeToFlattenedError<any, string> | null;
3491
+ code: import("@trpc/server/rpc").TRPC_ERROR_CODE_KEY;
3492
+ httpStatus: number;
3493
+ path?: string;
3494
+ stack?: string;
3495
+ };
3496
+ message: string;
3497
+ code: import("@trpc/server/rpc").TRPC_ERROR_CODE_NUMBER;
3498
+ };
3499
+ transformer: typeof superjson;
3500
+ }>;
3501
+ _meta: object;
3502
+ _ctx_out: {};
3503
+ _input_in: {
3504
+ id: string;
3505
+ reasons: "data_leak"[];
3506
+ encryptedDataKey: string;
3507
+ };
3508
+ _input_out: {
3509
+ id: string;
3510
+ reasons: "data_leak"[];
3511
+ encryptedDataKey: string;
3512
+ };
3513
+ _output_in: {
3514
+ isReported: boolean;
3515
+ };
3516
+ _output_out: {
3517
+ isReported: boolean;
3518
+ };
3519
+ }, unknown>>;
3520
+ };
3229
3521
  createFolder: {
3230
3522
  mutate: import("@trpc/client").Resolver<import("@trpc/server").BuildProcedure<"mutation", {
3231
3523
  _config: import("@trpc/server").RootConfig<{
@@ -11054,6 +11346,40 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
11054
11346
  };
11055
11347
  }, unknown>>;
11056
11348
  };
11349
+ publicKey: {
11350
+ query: import("@trpc/client").Resolver<import("@trpc/server").BuildProcedure<"query", {
11351
+ _config: import("@trpc/server").RootConfig<{
11352
+ ctx: {};
11353
+ meta: object;
11354
+ errorShape: {
11355
+ message: string;
11356
+ code: import("@trpc/server/rpc").TRPC_ERROR_CODE_NUMBER;
11357
+ data: _trpc_server_dist_error_formatter.DefaultErrorData;
11358
+ } | {
11359
+ data: {
11360
+ zodError: import("zod").typeToFlattenedError<any, string> | null;
11361
+ code: import("@trpc/server/rpc").TRPC_ERROR_CODE_KEY;
11362
+ httpStatus: number;
11363
+ path?: string;
11364
+ stack?: string;
11365
+ };
11366
+ message: string;
11367
+ code: import("@trpc/server/rpc").TRPC_ERROR_CODE_NUMBER;
11368
+ };
11369
+ transformer: typeof superjson;
11370
+ }>;
11371
+ _meta: object;
11372
+ _ctx_out: {};
11373
+ _input_in: {} | undefined;
11374
+ _input_out: {} | undefined;
11375
+ _output_in: {
11376
+ publicKey: string;
11377
+ };
11378
+ _output_out: {
11379
+ publicKey: string;
11380
+ };
11381
+ }, unknown>>;
11382
+ };
11057
11383
  };
11058
11384
  plan: {
11059
11385
  all: {
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.48.0",
5
+ "version": "1.49.0-feat-report-data.1",
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-fix-fix-mistakes.6",
77
+ "@secrecy/trpc-api-types": "1.33.0-feat-report-data-content.5",
78
78
  "@trpc/client": "10.45.2",
79
79
  "@trpc/server": "10.45.2",
80
80
  "@types/libsodium-wrappers-sumo": "^0.7.8",