@secrecy/lib 1.86.2 → 1.86.4-fix-md5.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.
Files changed (47) hide show
  1. package/dist/lib/base-client.js +6 -5
  2. package/dist/lib/cache.js +14 -5
  3. package/dist/lib/client/SecrecyCloudClient.js +4 -2
  4. package/dist/lib/client/SecrecyMailClient.js +12 -5
  5. package/dist/lib/client/data-link.js +6 -12
  6. package/dist/lib/client/helpers.js +21 -1
  7. package/dist/lib/client/index.js +6 -8
  8. package/dist/lib/client/upload.js +12 -14
  9. package/dist/lib/client.js +6 -10
  10. package/dist/lib/crypto/data.js +146 -91
  11. package/dist/lib/crypto/domain.js +1 -3
  12. package/dist/lib/crypto/helpers.js +23 -1
  13. package/dist/lib/crypto/index.js +2 -2
  14. package/dist/lib/error/client.js +7 -1
  15. package/dist/lib/react/index.js +69 -0
  16. package/dist/lib/transformer.js +3 -2
  17. package/dist/lib/utils/popup-tools.js +31 -13
  18. package/dist/lib/versioning.js +1 -1
  19. package/dist/lib/worker/generated/md5.js +2 -0
  20. package/dist/lib/worker/generated/sodium.js +2 -0
  21. package/dist/lib/worker/md5.js +2 -2
  22. package/dist/lib/worker/sodium.js +17 -15
  23. package/dist/types/base-client.d.ts +2 -0
  24. package/dist/types/cache.d.ts +7 -6
  25. package/dist/types/client/SecrecyMailClient.d.ts +23 -1
  26. package/dist/types/client/data-link.d.ts +4 -4
  27. package/dist/types/client/helpers.d.ts +12 -0
  28. package/dist/types/client/index.d.ts +4 -2
  29. package/dist/types/client/types/data.d.ts +2 -1
  30. package/dist/types/client.d.ts +67 -74
  31. package/dist/types/crypto/data.d.ts +11 -1
  32. package/dist/types/crypto/domain.d.ts +0 -1
  33. package/dist/types/crypto/helpers.d.ts +7 -0
  34. package/dist/types/crypto/index.d.ts +3 -3
  35. package/dist/types/error/client.d.ts +8 -0
  36. package/dist/types/error/index.d.ts +4 -0
  37. package/dist/types/react/index.d.ts +20 -0
  38. package/dist/types/sodium.d.ts +5 -0
  39. package/dist/types/utils/popup-tools.d.ts +4 -2
  40. package/dist/types/versioning.d.ts +1 -1
  41. package/dist/types/worker/generated/md5.d.ts +1 -0
  42. package/dist/types/worker/generated/sodium.d.ts +1 -0
  43. package/package.json +37 -13
  44. package/dist/lib/client/SecrecyDbClient.js +0 -3
  45. package/dist/lib/worker/workerCodes.js +0 -254
  46. package/dist/types/client/SecrecyDbClient.d.ts +0 -4
  47. package/dist/types/worker/workerCodes.d.ts +0 -2
@@ -8,6 +8,7 @@ export interface CreateTrpcClientOptions {
8
8
  session?: string | null | undefined;
9
9
  apiUrl?: string | null | undefined;
10
10
  onAccessDenied?: () => void | Promise<void> | null | undefined;
11
+ timeoutMs?: number | undefined;
11
12
  }
12
13
  export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => import("@trpc/client").TRPCClient<import("@trpc/server").TRPCBuiltRouter<{
13
14
  ctx: any;
@@ -67,6 +68,7 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => import
67
68
  hasDatabase: boolean;
68
69
  devsCount: bigint;
69
70
  usersCount: bigint;
71
+ } & {
70
72
  totalDataCount: bigint;
71
73
  totalDataSize: bigint;
72
74
  downloadBandwidth: bigint;
@@ -141,11 +143,12 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => import
141
143
  paidByApp?: boolean | undefined;
142
144
  userIds?: string[] | undefined;
143
145
  };
144
- output: {
146
+ output: ({
145
147
  lastReset: Date;
146
148
  hasDatabase: boolean;
147
149
  devsCount: bigint;
148
150
  usersCount: bigint;
151
+ } & {
149
152
  totalDataCount: bigint;
150
153
  totalDataSize: bigint;
151
154
  downloadBandwidth: bigint;
@@ -155,12 +158,11 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => import
155
158
  sentMailCount: bigint;
156
159
  sentMailDataCount: bigint;
157
160
  sentMailDataSize: bigint;
158
- type: "application";
159
- } | {
160
- type: "details";
161
+ }) | {
161
162
  lastReset: Date;
162
- details: {
163
+ details: ({
163
164
  userId: string;
165
+ } & {
164
166
  totalDataCount: bigint;
165
167
  totalDataSize: bigint;
166
168
  downloadBandwidth: bigint;
@@ -170,7 +172,7 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => import
170
172
  sentMailCount: bigint;
171
173
  sentMailDataCount: bigint;
172
174
  sentMailDataSize: bigint;
173
- }[];
175
+ })[];
174
176
  };
175
177
  meta: any;
176
178
  }>;
@@ -397,7 +399,7 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => import
397
399
  };
398
400
  output: ({
399
401
  id: string;
400
- md5: string;
402
+ md5: string | null;
401
403
  dataPart: number;
402
404
  dataKey: string;
403
405
  createdAt: Date;
@@ -1083,7 +1085,7 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => import
1083
1085
  size: bigint;
1084
1086
  prefix: string;
1085
1087
  sizeEncrypted: bigint | null;
1086
- md5: string;
1088
+ md5: string | null;
1087
1089
  md5Encrypted: string | null;
1088
1090
  mime: string | null;
1089
1091
  ext: string | null;
@@ -1105,7 +1107,7 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => import
1105
1107
  size: bigint;
1106
1108
  prefix: string;
1107
1109
  sizeEncrypted: bigint | null;
1108
- md5: string;
1110
+ md5: string | null;
1109
1111
  md5Encrypted: string | null;
1110
1112
  mime: string | null;
1111
1113
  ext: string | null;
@@ -1155,7 +1157,7 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => import
1155
1157
  size: bigint;
1156
1158
  prefix: string;
1157
1159
  sizeEncrypted: bigint | null;
1158
- md5: string;
1160
+ md5: string | null;
1159
1161
  md5Encrypted: string | null;
1160
1162
  mime: string | null;
1161
1163
  ext: string | null;
@@ -1181,7 +1183,7 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => import
1181
1183
  };
1182
1184
  output: {
1183
1185
  id: string;
1184
- md5: string;
1186
+ md5: string | null;
1185
1187
  size: bigint;
1186
1188
  sizeEncrypted: bigint | null;
1187
1189
  md5Encrypted: string | null;
@@ -1200,7 +1202,7 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => import
1200
1202
  maybeContent: Uint8Array<ArrayBufferLike> | null;
1201
1203
  } | {
1202
1204
  id: string;
1203
- md5: string;
1205
+ md5: string | null;
1204
1206
  size: bigint;
1205
1207
  sizeEncrypted: bigint | null;
1206
1208
  md5Encrypted: string | null;
@@ -1218,7 +1220,7 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => import
1218
1220
  maybeContent: Uint8Array<ArrayBufferLike> | null;
1219
1221
  } | {
1220
1222
  id: string;
1221
- md5: string;
1223
+ md5: string | null;
1222
1224
  size: bigint;
1223
1225
  sizeEncrypted: bigint | null;
1224
1226
  md5Encrypted: string | null;
@@ -1236,7 +1238,7 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => import
1236
1238
  }[];
1237
1239
  } | {
1238
1240
  id: string;
1239
- md5: string;
1241
+ md5: string | null;
1240
1242
  size: bigint;
1241
1243
  sizeEncrypted: bigint | null;
1242
1244
  md5Encrypted: string | null;
@@ -1259,7 +1261,7 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => import
1259
1261
  };
1260
1262
  output: ({
1261
1263
  id: string;
1262
- md5: string;
1264
+ md5: string | null;
1263
1265
  size: bigint;
1264
1266
  sizeEncrypted: bigint | null;
1265
1267
  md5Encrypted: string | null;
@@ -1278,7 +1280,7 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => import
1278
1280
  maybeContent: Uint8Array<ArrayBufferLike> | null;
1279
1281
  } | {
1280
1282
  id: string;
1281
- md5: string;
1283
+ md5: string | null;
1282
1284
  size: bigint;
1283
1285
  sizeEncrypted: bigint | null;
1284
1286
  md5Encrypted: string | null;
@@ -1296,7 +1298,7 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => import
1296
1298
  maybeContent: Uint8Array<ArrayBufferLike> | null;
1297
1299
  } | {
1298
1300
  id: string;
1299
- md5: string;
1301
+ md5: string | null;
1300
1302
  size: bigint;
1301
1303
  sizeEncrypted: bigint | null;
1302
1304
  md5Encrypted: string | null;
@@ -1314,7 +1316,7 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => import
1314
1316
  }[];
1315
1317
  } | {
1316
1318
  id: string;
1317
- md5: string;
1319
+ md5: string | null;
1318
1320
  size: bigint;
1319
1321
  sizeEncrypted: bigint | null;
1320
1322
  md5Encrypted: string | null;
@@ -1524,7 +1526,7 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => import
1524
1526
  size: bigint;
1525
1527
  prefix: string;
1526
1528
  sizeEncrypted: bigint | null;
1527
- md5: string;
1529
+ md5: string | null;
1528
1530
  md5Encrypted: string | null;
1529
1531
  mime: string | null;
1530
1532
  ext: string | null;
@@ -1546,7 +1548,7 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => import
1546
1548
  size: bigint;
1547
1549
  prefix: string;
1548
1550
  sizeEncrypted: bigint | null;
1549
- md5: string;
1551
+ md5: string | null;
1550
1552
  md5Encrypted: string | null;
1551
1553
  mime: string | null;
1552
1554
  ext: string | null;
@@ -1681,7 +1683,6 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => import
1681
1683
  uploadData: import("@trpc/server").TRPCMutationProcedure<{
1682
1684
  input: {
1683
1685
  size: bigint;
1684
- md5: string;
1685
1686
  sizeEncrypted: bigint;
1686
1687
  md5Encrypted: string;
1687
1688
  type: "encrypted";
@@ -1728,7 +1729,6 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => import
1728
1729
  fromIdentityPubKey?: string | null | undefined;
1729
1730
  appId?: string | null | undefined;
1730
1731
  size: bigint;
1731
- md5: string;
1732
1732
  sizeEncrypted: bigint;
1733
1733
  md5Encrypted: string;
1734
1734
  type: "encrypted";
@@ -1773,7 +1773,6 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => import
1773
1773
  uploadLiteData: import("@trpc/server").TRPCMutationProcedure<{
1774
1774
  input: {
1775
1775
  size: bigint;
1776
- md5: string;
1777
1776
  sizeEncrypted: bigint;
1778
1777
  md5Encrypted: string;
1779
1778
  type: "encrypted";
@@ -2139,7 +2138,7 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => import
2139
2138
  size: bigint;
2140
2139
  prefix: string;
2141
2140
  sizeEncrypted: bigint | null;
2142
- md5: string;
2141
+ md5: string | null;
2143
2142
  md5Encrypted: string | null;
2144
2143
  mime: string | null;
2145
2144
  ext: string | null;
@@ -2161,7 +2160,7 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => import
2161
2160
  size: bigint;
2162
2161
  prefix: string;
2163
2162
  sizeEncrypted: bigint | null;
2164
- md5: string;
2163
+ md5: string | null;
2165
2164
  md5Encrypted: string | null;
2166
2165
  mime: string | null;
2167
2166
  ext: string | null;
@@ -2610,7 +2609,7 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => import
2610
2609
  size: bigint;
2611
2610
  prefix: string;
2612
2611
  sizeEncrypted: bigint | null;
2613
- md5: string;
2612
+ md5: string | null;
2614
2613
  md5Encrypted: string | null;
2615
2614
  mime: string | null;
2616
2615
  ext: string | null;
@@ -2632,7 +2631,7 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => import
2632
2631
  size: bigint;
2633
2632
  prefix: string;
2634
2633
  sizeEncrypted: bigint | null;
2635
- md5: string;
2634
+ md5: string | null;
2636
2635
  md5Encrypted: string | null;
2637
2636
  mime: string | null;
2638
2637
  ext: string | null;
@@ -2829,7 +2828,7 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => import
2829
2828
  size: bigint;
2830
2829
  prefix: string;
2831
2830
  sizeEncrypted: bigint | null;
2832
- md5: string;
2831
+ md5: string | null;
2833
2832
  md5Encrypted: string | null;
2834
2833
  mime: string | null;
2835
2834
  ext: string | null;
@@ -2851,7 +2850,7 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => import
2851
2850
  size: bigint;
2852
2851
  prefix: string;
2853
2852
  sizeEncrypted: bigint | null;
2854
- md5: string;
2853
+ md5: string | null;
2855
2854
  md5Encrypted: string | null;
2856
2855
  mime: string | null;
2857
2856
  ext: string | null;
@@ -3389,7 +3388,7 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => import
3389
3388
  size: bigint;
3390
3389
  prefix: string;
3391
3390
  sizeEncrypted: bigint | null;
3392
- md5: string;
3391
+ md5: string | null;
3393
3392
  md5Encrypted: string | null;
3394
3393
  mime: string | null;
3395
3394
  ext: string | null;
@@ -3411,7 +3410,7 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => import
3411
3410
  size: bigint;
3412
3411
  prefix: string;
3413
3412
  sizeEncrypted: bigint | null;
3414
- md5: string;
3413
+ md5: string | null;
3415
3414
  md5Encrypted: string | null;
3416
3415
  mime: string | null;
3417
3416
  ext: string | null;
@@ -5308,6 +5307,7 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => import
5308
5307
  metrics: {
5309
5308
  lastReset: Date;
5310
5309
  membersCount: bigint;
5310
+ } & {
5311
5311
  totalDataCount: bigint;
5312
5312
  totalDataSize: bigint;
5313
5313
  downloadBandwidth: bigint;
@@ -5345,9 +5345,10 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => import
5345
5345
  paidByApp?: boolean | undefined;
5346
5346
  userIds?: string[] | undefined;
5347
5347
  };
5348
- output: {
5348
+ output: ({
5349
5349
  lastReset: Date;
5350
5350
  membersCount: bigint;
5351
+ } & {
5351
5352
  totalDataCount: bigint;
5352
5353
  totalDataSize: bigint;
5353
5354
  downloadBandwidth: bigint;
@@ -5357,9 +5358,7 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => import
5357
5358
  sentMailCount: bigint;
5358
5359
  sentMailDataCount: bigint;
5359
5360
  sentMailDataSize: bigint;
5360
- type: "organization";
5361
- } | {
5362
- type: "details";
5361
+ }) | {
5363
5362
  lastReset: Date;
5364
5363
  details: {
5365
5364
  totalDataCount: bigint;
@@ -5371,8 +5370,6 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => import
5371
5370
  sentMailCount: bigint;
5372
5371
  sentMailDataCount: bigint;
5373
5372
  sentMailDataSize: bigint;
5374
- userId?: string | undefined;
5375
- appId?: string | undefined;
5376
5373
  }[];
5377
5374
  };
5378
5375
  meta: any;
@@ -6778,6 +6775,7 @@ export declare const getTrpcGuestClient: ({ url }?: {
6778
6775
  hasDatabase: boolean;
6779
6776
  devsCount: bigint;
6780
6777
  usersCount: bigint;
6778
+ } & {
6781
6779
  totalDataCount: bigint;
6782
6780
  totalDataSize: bigint;
6783
6781
  downloadBandwidth: bigint;
@@ -6852,11 +6850,12 @@ export declare const getTrpcGuestClient: ({ url }?: {
6852
6850
  paidByApp?: boolean | undefined;
6853
6851
  userIds?: string[] | undefined;
6854
6852
  };
6855
- output: {
6853
+ output: ({
6856
6854
  lastReset: Date;
6857
6855
  hasDatabase: boolean;
6858
6856
  devsCount: bigint;
6859
6857
  usersCount: bigint;
6858
+ } & {
6860
6859
  totalDataCount: bigint;
6861
6860
  totalDataSize: bigint;
6862
6861
  downloadBandwidth: bigint;
@@ -6866,12 +6865,11 @@ export declare const getTrpcGuestClient: ({ url }?: {
6866
6865
  sentMailCount: bigint;
6867
6866
  sentMailDataCount: bigint;
6868
6867
  sentMailDataSize: bigint;
6869
- type: "application";
6870
- } | {
6871
- type: "details";
6868
+ }) | {
6872
6869
  lastReset: Date;
6873
- details: {
6870
+ details: ({
6874
6871
  userId: string;
6872
+ } & {
6875
6873
  totalDataCount: bigint;
6876
6874
  totalDataSize: bigint;
6877
6875
  downloadBandwidth: bigint;
@@ -6881,7 +6879,7 @@ export declare const getTrpcGuestClient: ({ url }?: {
6881
6879
  sentMailCount: bigint;
6882
6880
  sentMailDataCount: bigint;
6883
6881
  sentMailDataSize: bigint;
6884
- }[];
6882
+ })[];
6885
6883
  };
6886
6884
  meta: any;
6887
6885
  }>;
@@ -7108,7 +7106,7 @@ export declare const getTrpcGuestClient: ({ url }?: {
7108
7106
  };
7109
7107
  output: ({
7110
7108
  id: string;
7111
- md5: string;
7109
+ md5: string | null;
7112
7110
  dataPart: number;
7113
7111
  dataKey: string;
7114
7112
  createdAt: Date;
@@ -7794,7 +7792,7 @@ export declare const getTrpcGuestClient: ({ url }?: {
7794
7792
  size: bigint;
7795
7793
  prefix: string;
7796
7794
  sizeEncrypted: bigint | null;
7797
- md5: string;
7795
+ md5: string | null;
7798
7796
  md5Encrypted: string | null;
7799
7797
  mime: string | null;
7800
7798
  ext: string | null;
@@ -7816,7 +7814,7 @@ export declare const getTrpcGuestClient: ({ url }?: {
7816
7814
  size: bigint;
7817
7815
  prefix: string;
7818
7816
  sizeEncrypted: bigint | null;
7819
- md5: string;
7817
+ md5: string | null;
7820
7818
  md5Encrypted: string | null;
7821
7819
  mime: string | null;
7822
7820
  ext: string | null;
@@ -7866,7 +7864,7 @@ export declare const getTrpcGuestClient: ({ url }?: {
7866
7864
  size: bigint;
7867
7865
  prefix: string;
7868
7866
  sizeEncrypted: bigint | null;
7869
- md5: string;
7867
+ md5: string | null;
7870
7868
  md5Encrypted: string | null;
7871
7869
  mime: string | null;
7872
7870
  ext: string | null;
@@ -7892,7 +7890,7 @@ export declare const getTrpcGuestClient: ({ url }?: {
7892
7890
  };
7893
7891
  output: {
7894
7892
  id: string;
7895
- md5: string;
7893
+ md5: string | null;
7896
7894
  size: bigint;
7897
7895
  sizeEncrypted: bigint | null;
7898
7896
  md5Encrypted: string | null;
@@ -7911,7 +7909,7 @@ export declare const getTrpcGuestClient: ({ url }?: {
7911
7909
  maybeContent: Uint8Array<ArrayBufferLike> | null;
7912
7910
  } | {
7913
7911
  id: string;
7914
- md5: string;
7912
+ md5: string | null;
7915
7913
  size: bigint;
7916
7914
  sizeEncrypted: bigint | null;
7917
7915
  md5Encrypted: string | null;
@@ -7929,7 +7927,7 @@ export declare const getTrpcGuestClient: ({ url }?: {
7929
7927
  maybeContent: Uint8Array<ArrayBufferLike> | null;
7930
7928
  } | {
7931
7929
  id: string;
7932
- md5: string;
7930
+ md5: string | null;
7933
7931
  size: bigint;
7934
7932
  sizeEncrypted: bigint | null;
7935
7933
  md5Encrypted: string | null;
@@ -7947,7 +7945,7 @@ export declare const getTrpcGuestClient: ({ url }?: {
7947
7945
  }[];
7948
7946
  } | {
7949
7947
  id: string;
7950
- md5: string;
7948
+ md5: string | null;
7951
7949
  size: bigint;
7952
7950
  sizeEncrypted: bigint | null;
7953
7951
  md5Encrypted: string | null;
@@ -7970,7 +7968,7 @@ export declare const getTrpcGuestClient: ({ url }?: {
7970
7968
  };
7971
7969
  output: ({
7972
7970
  id: string;
7973
- md5: string;
7971
+ md5: string | null;
7974
7972
  size: bigint;
7975
7973
  sizeEncrypted: bigint | null;
7976
7974
  md5Encrypted: string | null;
@@ -7989,7 +7987,7 @@ export declare const getTrpcGuestClient: ({ url }?: {
7989
7987
  maybeContent: Uint8Array<ArrayBufferLike> | null;
7990
7988
  } | {
7991
7989
  id: string;
7992
- md5: string;
7990
+ md5: string | null;
7993
7991
  size: bigint;
7994
7992
  sizeEncrypted: bigint | null;
7995
7993
  md5Encrypted: string | null;
@@ -8007,7 +8005,7 @@ export declare const getTrpcGuestClient: ({ url }?: {
8007
8005
  maybeContent: Uint8Array<ArrayBufferLike> | null;
8008
8006
  } | {
8009
8007
  id: string;
8010
- md5: string;
8008
+ md5: string | null;
8011
8009
  size: bigint;
8012
8010
  sizeEncrypted: bigint | null;
8013
8011
  md5Encrypted: string | null;
@@ -8025,7 +8023,7 @@ export declare const getTrpcGuestClient: ({ url }?: {
8025
8023
  }[];
8026
8024
  } | {
8027
8025
  id: string;
8028
- md5: string;
8026
+ md5: string | null;
8029
8027
  size: bigint;
8030
8028
  sizeEncrypted: bigint | null;
8031
8029
  md5Encrypted: string | null;
@@ -8235,7 +8233,7 @@ export declare const getTrpcGuestClient: ({ url }?: {
8235
8233
  size: bigint;
8236
8234
  prefix: string;
8237
8235
  sizeEncrypted: bigint | null;
8238
- md5: string;
8236
+ md5: string | null;
8239
8237
  md5Encrypted: string | null;
8240
8238
  mime: string | null;
8241
8239
  ext: string | null;
@@ -8257,7 +8255,7 @@ export declare const getTrpcGuestClient: ({ url }?: {
8257
8255
  size: bigint;
8258
8256
  prefix: string;
8259
8257
  sizeEncrypted: bigint | null;
8260
- md5: string;
8258
+ md5: string | null;
8261
8259
  md5Encrypted: string | null;
8262
8260
  mime: string | null;
8263
8261
  ext: string | null;
@@ -8392,7 +8390,6 @@ export declare const getTrpcGuestClient: ({ url }?: {
8392
8390
  uploadData: import("@trpc/server").TRPCMutationProcedure<{
8393
8391
  input: {
8394
8392
  size: bigint;
8395
- md5: string;
8396
8393
  sizeEncrypted: bigint;
8397
8394
  md5Encrypted: string;
8398
8395
  type: "encrypted";
@@ -8439,7 +8436,6 @@ export declare const getTrpcGuestClient: ({ url }?: {
8439
8436
  fromIdentityPubKey?: string | null | undefined;
8440
8437
  appId?: string | null | undefined;
8441
8438
  size: bigint;
8442
- md5: string;
8443
8439
  sizeEncrypted: bigint;
8444
8440
  md5Encrypted: string;
8445
8441
  type: "encrypted";
@@ -8484,7 +8480,6 @@ export declare const getTrpcGuestClient: ({ url }?: {
8484
8480
  uploadLiteData: import("@trpc/server").TRPCMutationProcedure<{
8485
8481
  input: {
8486
8482
  size: bigint;
8487
- md5: string;
8488
8483
  sizeEncrypted: bigint;
8489
8484
  md5Encrypted: string;
8490
8485
  type: "encrypted";
@@ -8850,7 +8845,7 @@ export declare const getTrpcGuestClient: ({ url }?: {
8850
8845
  size: bigint;
8851
8846
  prefix: string;
8852
8847
  sizeEncrypted: bigint | null;
8853
- md5: string;
8848
+ md5: string | null;
8854
8849
  md5Encrypted: string | null;
8855
8850
  mime: string | null;
8856
8851
  ext: string | null;
@@ -8872,7 +8867,7 @@ export declare const getTrpcGuestClient: ({ url }?: {
8872
8867
  size: bigint;
8873
8868
  prefix: string;
8874
8869
  sizeEncrypted: bigint | null;
8875
- md5: string;
8870
+ md5: string | null;
8876
8871
  md5Encrypted: string | null;
8877
8872
  mime: string | null;
8878
8873
  ext: string | null;
@@ -9321,7 +9316,7 @@ export declare const getTrpcGuestClient: ({ url }?: {
9321
9316
  size: bigint;
9322
9317
  prefix: string;
9323
9318
  sizeEncrypted: bigint | null;
9324
- md5: string;
9319
+ md5: string | null;
9325
9320
  md5Encrypted: string | null;
9326
9321
  mime: string | null;
9327
9322
  ext: string | null;
@@ -9343,7 +9338,7 @@ export declare const getTrpcGuestClient: ({ url }?: {
9343
9338
  size: bigint;
9344
9339
  prefix: string;
9345
9340
  sizeEncrypted: bigint | null;
9346
- md5: string;
9341
+ md5: string | null;
9347
9342
  md5Encrypted: string | null;
9348
9343
  mime: string | null;
9349
9344
  ext: string | null;
@@ -9540,7 +9535,7 @@ export declare const getTrpcGuestClient: ({ url }?: {
9540
9535
  size: bigint;
9541
9536
  prefix: string;
9542
9537
  sizeEncrypted: bigint | null;
9543
- md5: string;
9538
+ md5: string | null;
9544
9539
  md5Encrypted: string | null;
9545
9540
  mime: string | null;
9546
9541
  ext: string | null;
@@ -9562,7 +9557,7 @@ export declare const getTrpcGuestClient: ({ url }?: {
9562
9557
  size: bigint;
9563
9558
  prefix: string;
9564
9559
  sizeEncrypted: bigint | null;
9565
- md5: string;
9560
+ md5: string | null;
9566
9561
  md5Encrypted: string | null;
9567
9562
  mime: string | null;
9568
9563
  ext: string | null;
@@ -10100,7 +10095,7 @@ export declare const getTrpcGuestClient: ({ url }?: {
10100
10095
  size: bigint;
10101
10096
  prefix: string;
10102
10097
  sizeEncrypted: bigint | null;
10103
- md5: string;
10098
+ md5: string | null;
10104
10099
  md5Encrypted: string | null;
10105
10100
  mime: string | null;
10106
10101
  ext: string | null;
@@ -10122,7 +10117,7 @@ export declare const getTrpcGuestClient: ({ url }?: {
10122
10117
  size: bigint;
10123
10118
  prefix: string;
10124
10119
  sizeEncrypted: bigint | null;
10125
- md5: string;
10120
+ md5: string | null;
10126
10121
  md5Encrypted: string | null;
10127
10122
  mime: string | null;
10128
10123
  ext: string | null;
@@ -12019,6 +12014,7 @@ export declare const getTrpcGuestClient: ({ url }?: {
12019
12014
  metrics: {
12020
12015
  lastReset: Date;
12021
12016
  membersCount: bigint;
12017
+ } & {
12022
12018
  totalDataCount: bigint;
12023
12019
  totalDataSize: bigint;
12024
12020
  downloadBandwidth: bigint;
@@ -12056,9 +12052,10 @@ export declare const getTrpcGuestClient: ({ url }?: {
12056
12052
  paidByApp?: boolean | undefined;
12057
12053
  userIds?: string[] | undefined;
12058
12054
  };
12059
- output: {
12055
+ output: ({
12060
12056
  lastReset: Date;
12061
12057
  membersCount: bigint;
12058
+ } & {
12062
12059
  totalDataCount: bigint;
12063
12060
  totalDataSize: bigint;
12064
12061
  downloadBandwidth: bigint;
@@ -12068,9 +12065,7 @@ export declare const getTrpcGuestClient: ({ url }?: {
12068
12065
  sentMailCount: bigint;
12069
12066
  sentMailDataCount: bigint;
12070
12067
  sentMailDataSize: bigint;
12071
- type: "organization";
12072
- } | {
12073
- type: "details";
12068
+ }) | {
12074
12069
  lastReset: Date;
12075
12070
  details: {
12076
12071
  totalDataCount: bigint;
@@ -12082,8 +12077,6 @@ export declare const getTrpcGuestClient: ({ url }?: {
12082
12077
  sentMailCount: bigint;
12083
12078
  sentMailDataCount: bigint;
12084
12079
  sentMailDataSize: bigint;
12085
- userId?: string | undefined;
12086
- appId?: string | undefined;
12087
12080
  }[];
12088
12081
  };
12089
12082
  meta: any;
@@ -1,6 +1,6 @@
1
1
  export interface EncryptedFile {
2
2
  data: Uint8Array<ArrayBuffer>;
3
- md5: string;
3
+ /** md5 of the ciphertext. No digest of the plaintext is ever computed. */
4
4
  md5Encrypted: string;
5
5
  }
6
6
  export declare function secretStreamKeygen(): Uint8Array;
@@ -10,5 +10,15 @@ export interface SecretStreamProgress {
10
10
  total: number;
11
11
  current: number;
12
12
  }
13
+ /**
14
+ * Encrypt `data` as a secretstream: the header followed by one authenticated
15
+ * chunk per CHUNK_SIZE bytes of plaintext. The last chunk (an empty one for
16
+ * empty data) is always tagged `TAG_FINAL` so that truncation is detected.
17
+ */
13
18
  export declare function encryptSecretStream(key: Uint8Array, data: Uint8Array<ArrayBuffer>, progress?: (progress: SecretStreamProgress) => Promise<void>, signal?: AbortSignal): Promise<EncryptedFile>;
19
+ /**
20
+ * Decrypt a secretstream produced by `encryptSecretStream`. Throws if any
21
+ * chunk fails authentication, if data follows the `TAG_FINAL` chunk, or if the
22
+ * stream ends without it (truncation).
23
+ */
14
24
  export declare function decryptSecretStream(key: Uint8Array, data: Uint8Array<ArrayBuffer>, progress?: (progress: SecretStreamProgress) => Promise<void>, signal?: AbortSignal): Promise<Uint8Array<ArrayBuffer>>;
@@ -19,7 +19,6 @@ export declare function encryptDataAndKey({ data, currentIdentity, keyPairs, pro
19
19
  encryptedDataKey?: Uint8Array<ArrayBufferLike>;
20
20
  encryptedData: Uint8Array<ArrayBuffer>;
21
21
  dataKey: Uint8Array<ArrayBufferLike>;
22
- md5Data: string;
23
22
  md5Encrypted: string;
24
23
  }>;
25
24
  export declare function buildBytesFromApiData({ dataContent, totalBytes, progressParts, onDownloadProgress, signal, }: {
@@ -1,5 +1,12 @@
1
1
  export declare function generatePassword(): string;
2
2
  export declare function derivePassword(password: string, salt: Uint8Array<ArrayBufferLike>): string;
3
+ /**
4
+ * Wrap a data key under a password, with a random salt:
5
+ * `version (1 byte) || salt || nonce || secretbox(key)`.
6
+ */
7
+ export declare function encryptKeyWithPassword(key: Uint8Array, password: string): Uint8Array;
8
+ /** Unwrap a data key produced by `encryptKeyWithPassword`. */
9
+ export declare function decryptKeyWithPassword(wrapped: Uint8Array, password: string): Uint8Array;
3
10
  export declare function encryptName(name: string, nameKey: string): Promise<string>;
4
11
  export declare function generateAndEncryptNameAndKey(args: {
5
12
  name: string;
@@ -1,9 +1,9 @@
1
- import { sodium } from '../sodium.js';
1
+ import { type StringKeyPair } from '../sodium.js';
2
2
  export declare function encryptCryptoBox(data: Uint8Array, publicKeyBob: string, privateKeyAlice: string): Uint8Array;
3
- export declare function generateCryptoBoxKeyPair(): sodium.StringKeyPair;
3
+ export declare function generateCryptoBoxKeyPair(): StringKeyPair;
4
4
  export declare function decryptCryptoBox(data: Uint8Array, publicKeyAlice: string, privateKeyBob: string): Uint8Array;
5
5
  export declare function generateSecretBoxKey(): string;
6
6
  export declare function encryptSecretBox(data: Uint8Array, key: string): Uint8Array;
7
7
  export declare function decryptSecretBox(data: Uint8Array, key: string): Uint8Array;
8
8
  export declare function encryptAnonymous(data: Uint8Array, receiverPublicKey: string): Uint8Array;
9
- export declare function decryptAnonymous(data: Uint8Array, { privateKey, publicKey }: Omit<sodium.StringKeyPair, 'keyType'>): Uint8Array;
9
+ export declare function decryptAnonymous(data: Uint8Array, { privateKey, publicKey }: Omit<StringKeyPair, 'keyType'>): Uint8Array;