@secrecy/lib 1.51.0-feat-improvements.1 → 1.51.0-feat-improvements.3
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.
|
@@ -71,7 +71,7 @@ export class SecrecyCloudClient {
|
|
|
71
71
|
percent: 0,
|
|
72
72
|
});
|
|
73
73
|
if (storageType === 'lite') {
|
|
74
|
-
const
|
|
74
|
+
const uploadDataArgs = encryptedDataKey && md5Encrypted
|
|
75
75
|
? {
|
|
76
76
|
type: 'encrypted',
|
|
77
77
|
content: Buffer.from(encryptedData),
|
|
@@ -86,18 +86,26 @@ export class SecrecyCloudClient {
|
|
|
86
86
|
content: Buffer.from(encryptedData),
|
|
87
87
|
md5: md5Data,
|
|
88
88
|
size: BigInt(dataBuffer.byteLength),
|
|
89
|
-
}
|
|
89
|
+
};
|
|
90
|
+
const uploadData = await this.#apiClient.cloud.uploadLiteData.mutate(uploadDataArgs, { signal });
|
|
90
91
|
await uploadProgress?.({
|
|
91
92
|
total: encryptedData.byteLength,
|
|
92
93
|
current: encryptedData.byteLength,
|
|
93
94
|
percent: 1,
|
|
94
95
|
});
|
|
96
|
+
dataContentCache.set(uploadData.id, {
|
|
97
|
+
id: uploadData.id,
|
|
98
|
+
storageType: 'lite',
|
|
99
|
+
size: uploadDataArgs.size,
|
|
100
|
+
sizeEncrypted: uploadDataArgs.sizeEncrypted ?? null,
|
|
101
|
+
data: dataBuffer,
|
|
102
|
+
});
|
|
95
103
|
return {
|
|
96
104
|
object: 'lite',
|
|
97
105
|
id: uploadData.id,
|
|
98
106
|
};
|
|
99
107
|
}
|
|
100
|
-
if (storageType === 's3') {
|
|
108
|
+
if (storageType === 's3' || storageType === 'cold') {
|
|
101
109
|
const uploadDataArgs = encryptedDataKey && md5Encrypted
|
|
102
110
|
? {
|
|
103
111
|
type: 'encrypted',
|
|
@@ -112,7 +120,12 @@ export class SecrecyCloudClient {
|
|
|
112
120
|
md5: md5Data,
|
|
113
121
|
size: BigInt(dataBuffer.byteLength),
|
|
114
122
|
};
|
|
115
|
-
const
|
|
123
|
+
const uploadDataCaller = storageType === 's3'
|
|
124
|
+
? this.#apiClient.cloud.uploadData
|
|
125
|
+
: this.#apiClient.cloud.uploadColdData;
|
|
126
|
+
const uploadData = await uploadDataCaller.mutate(uploadDataArgs, {
|
|
127
|
+
signal,
|
|
128
|
+
});
|
|
116
129
|
if (uploadData.parts.length === 0) {
|
|
117
130
|
if (uploadData.keyPair.pub !== this.#keys.publicKey) {
|
|
118
131
|
throw new Error('The public key does not match with cached key!');
|
|
@@ -122,8 +135,15 @@ export class SecrecyCloudClient {
|
|
|
122
135
|
current: encryptedData.byteLength,
|
|
123
136
|
percent: 1,
|
|
124
137
|
});
|
|
138
|
+
dataContentCache.set(uploadData.id, {
|
|
139
|
+
id: uploadData.id,
|
|
140
|
+
storageType: storageType,
|
|
141
|
+
size: uploadDataArgs.size,
|
|
142
|
+
sizeEncrypted: uploadDataArgs.sizeEncrypted ?? null,
|
|
143
|
+
data: dataBuffer,
|
|
144
|
+
});
|
|
125
145
|
return {
|
|
126
|
-
object:
|
|
146
|
+
object: storageType,
|
|
127
147
|
id: uploadData.id,
|
|
128
148
|
};
|
|
129
149
|
}
|
|
@@ -175,13 +195,14 @@ export class SecrecyCloudClient {
|
|
|
175
195
|
}));
|
|
176
196
|
dataContentCache.set(uploadData.id, {
|
|
177
197
|
id: uploadData.id,
|
|
178
|
-
storageType:
|
|
198
|
+
storageType: storageType,
|
|
179
199
|
size: uploadDataArgs.size,
|
|
200
|
+
sizeEncrypted: uploadDataArgs.sizeEncrypted ?? null,
|
|
180
201
|
data: dataBuffer,
|
|
181
202
|
});
|
|
182
203
|
return {
|
|
204
|
+
object: storageType,
|
|
183
205
|
id: uploadData.id,
|
|
184
|
-
object: 's3',
|
|
185
206
|
};
|
|
186
207
|
}
|
|
187
208
|
throw new Error(`The "${storageType}" is not implemented yet!`);
|
|
@@ -336,91 +357,16 @@ export class SecrecyCloudClient {
|
|
|
336
357
|
const dataContent = await this.#apiClient.cloud.dataContentById.query({
|
|
337
358
|
id: dataId,
|
|
338
359
|
});
|
|
360
|
+
const totalBytes = Number(dataContent.sizeEncrypted ?? dataContent.size);
|
|
339
361
|
const progressParts = {};
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
transferredBytes,
|
|
348
|
-
});
|
|
349
|
-
};
|
|
350
|
-
const encryptedContentFromParts = async (dataParts) => {
|
|
351
|
-
const parts = new Array();
|
|
352
|
-
const byPart = async (part) => {
|
|
353
|
-
const buf = new Uint8Array(await ky
|
|
354
|
-
.get(part.contentUrl, {
|
|
355
|
-
timeout: false,
|
|
356
|
-
onDownloadProgress: (pr) => {
|
|
357
|
-
onProgress(part.order, pr);
|
|
358
|
-
},
|
|
359
|
-
signal,
|
|
360
|
-
})
|
|
361
|
-
.arrayBuffer());
|
|
362
|
-
const md5Part = await md5(buf);
|
|
363
|
-
if (md5Part !== part.md5) {
|
|
364
|
-
throw new Error(`Invalid md5 for part ${part.order} of data ${dataId}`);
|
|
365
|
-
}
|
|
366
|
-
parts.push({
|
|
367
|
-
data: buf,
|
|
368
|
-
order: part.order,
|
|
369
|
-
});
|
|
370
|
-
};
|
|
371
|
-
await promiseAllLimit(3, dataParts.map((p) => async () => {
|
|
372
|
-
await byPart(p);
|
|
373
|
-
}));
|
|
374
|
-
return concatenate(...parts.sort((a, b) => a.order - b.order).map((p) => p.data));
|
|
375
|
-
};
|
|
376
|
-
const finalize = async (encryptedContent) => {
|
|
377
|
-
// const md5Encrypted = await firstValueFrom(md5(of(encryptedContent)));
|
|
378
|
-
const md5Encrypted = await md5(encryptedContent);
|
|
379
|
-
if (md5Encrypted !== dataContent.md5Encrypted) {
|
|
380
|
-
throw new Error(`Encrypted content does not match`);
|
|
381
|
-
}
|
|
382
|
-
const key = dataContent.key
|
|
383
|
-
? decryptCryptoBox(sodium.from_hex(dataContent.key), dataContent.type === 'received_mail'
|
|
384
|
-
? dataContent.senderPublicKey
|
|
385
|
-
: dataContent.type === 'cloud'
|
|
386
|
-
? dataContent.publicKey
|
|
387
|
-
: this.#keys.publicKey, this.#keys.privateKey)
|
|
388
|
-
: null;
|
|
389
|
-
const src = key
|
|
390
|
-
? await decrypt(key, encryptedContent, progressDecrypt, signal)
|
|
391
|
-
: encryptedContent;
|
|
392
|
-
// const md5Content = await firstValueFrom(md5(of(src)));
|
|
393
|
-
const md5Content = await md5(src);
|
|
394
|
-
if (md5Content !== dataContent.md5) {
|
|
395
|
-
throw new Error(`Content does not match`);
|
|
396
|
-
}
|
|
397
|
-
return decompress(src);
|
|
398
|
-
};
|
|
399
|
-
const encryptedContent = dataContent.type === 'lite'
|
|
400
|
-
? new Uint8Array(dataContent.content)
|
|
401
|
-
: dataContent.type === 'cloud'
|
|
402
|
-
? await encryptedContentFromParts(dataContent.parts)
|
|
403
|
-
: // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
404
|
-
dataContent.maybeContent !== null
|
|
405
|
-
? new Uint8Array(dataContent.maybeContent)
|
|
406
|
-
: dataContent.maybeParts !== null
|
|
407
|
-
? await encryptedContentFromParts(dataContent.maybeParts)
|
|
408
|
-
: null;
|
|
409
|
-
if (encryptedContent === null) {
|
|
410
|
-
throw `Can't find content for data ${dataId}`;
|
|
411
|
-
}
|
|
412
|
-
const data = await finalize(encryptedContent);
|
|
413
|
-
dataContentCache.set(dataId, {
|
|
414
|
-
id: dataId,
|
|
415
|
-
storageType: dataContent.storageType,
|
|
416
|
-
size: dataContent.totalSize,
|
|
417
|
-
data,
|
|
362
|
+
return this._handleDataContent({
|
|
363
|
+
dataContent,
|
|
364
|
+
progressParts,
|
|
365
|
+
progressDecrypt,
|
|
366
|
+
totalBytes,
|
|
367
|
+
onDownloadProgress,
|
|
368
|
+
signal,
|
|
418
369
|
});
|
|
419
|
-
return {
|
|
420
|
-
id: dataId,
|
|
421
|
-
storageType: dataContent.storageType,
|
|
422
|
-
data,
|
|
423
|
-
};
|
|
424
370
|
}
|
|
425
371
|
async dataContents({ dataIds, onDownloadProgress, progressDecrypt, signal, }) {
|
|
426
372
|
const cachedData = dataIds
|
|
@@ -435,7 +381,7 @@ export class SecrecyCloudClient {
|
|
|
435
381
|
const allDataContents = [
|
|
436
382
|
...missingContents.map((data) => ({
|
|
437
383
|
id: data.id,
|
|
438
|
-
size: data.
|
|
384
|
+
size: data.size,
|
|
439
385
|
storageType: data.storageType,
|
|
440
386
|
})),
|
|
441
387
|
...cachedData.map((data) => ({
|
|
@@ -446,106 +392,21 @@ export class SecrecyCloudClient {
|
|
|
446
392
|
];
|
|
447
393
|
const allDataContentsBytes = Number(allDataContents.reduce((curr, next) => curr + next.size, 0n));
|
|
448
394
|
const progressParts = {};
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
onDownloadProgress?.({
|
|
453
|
-
percent: transferredBytes / allDataContentsBytes,
|
|
395
|
+
return Promise.all(missingContents.map(async (missingContent) => {
|
|
396
|
+
return this._handleDataContent({
|
|
397
|
+
dataContent: missingContent,
|
|
454
398
|
totalBytes: allDataContentsBytes,
|
|
455
|
-
|
|
399
|
+
progressParts,
|
|
400
|
+
progressDecrypt,
|
|
401
|
+
onDownloadProgress,
|
|
402
|
+
signal,
|
|
456
403
|
});
|
|
457
|
-
};
|
|
458
|
-
const encryptedContentFromParts = async ({ dataId, dataParts, }) => {
|
|
459
|
-
const parts = {};
|
|
460
|
-
const byPart = async (part) => {
|
|
461
|
-
const buf = new Uint8Array(await ky
|
|
462
|
-
.get(part.contentUrl, {
|
|
463
|
-
timeout: false,
|
|
464
|
-
onDownloadProgress: (pr) => {
|
|
465
|
-
onProgress(dataId, part.order, pr);
|
|
466
|
-
},
|
|
467
|
-
signal,
|
|
468
|
-
})
|
|
469
|
-
.arrayBuffer());
|
|
470
|
-
const md5Part = await md5(buf);
|
|
471
|
-
if (md5Part !== part.md5) {
|
|
472
|
-
throw new Error(`Invalid md5 for part ${part.order} of data ${dataId}`);
|
|
473
|
-
}
|
|
474
|
-
if (typeof parts[dataId] === 'undefined') {
|
|
475
|
-
parts[dataId] = [
|
|
476
|
-
{
|
|
477
|
-
data: buf,
|
|
478
|
-
order: part.order,
|
|
479
|
-
},
|
|
480
|
-
];
|
|
481
|
-
}
|
|
482
|
-
else {
|
|
483
|
-
parts[dataId].push({
|
|
484
|
-
data: buf,
|
|
485
|
-
order: part.order,
|
|
486
|
-
});
|
|
487
|
-
}
|
|
488
|
-
};
|
|
489
|
-
await promiseAllLimit(3, dataParts.map((p) => async () => byPart(p)));
|
|
490
|
-
return concatenate(...parts[dataId].sort((a, b) => a.order - b.order).map((p) => p.data));
|
|
491
|
-
};
|
|
492
|
-
const finalize = async (dataContent, encryptedContent) => {
|
|
493
|
-
// const md5Encrypted = await firstValueFrom(md5(of(encryptedContent)));
|
|
494
|
-
const md5Encrypted = await md5(encryptedContent);
|
|
495
|
-
if (md5Encrypted !== dataContent.md5Encrypted) {
|
|
496
|
-
throw new Error(`Encrypted content does not match`);
|
|
497
|
-
}
|
|
498
|
-
const key = dataContent.key
|
|
499
|
-
? decryptCryptoBox(sodium.from_hex(dataContent.key), dataContent.type === 'received_mail'
|
|
500
|
-
? dataContent.senderPublicKey
|
|
501
|
-
: dataContent.type === 'cloud'
|
|
502
|
-
? dataContent.publicKey
|
|
503
|
-
: this.#keys.publicKey, this.#keys.privateKey)
|
|
504
|
-
: null;
|
|
505
|
-
const src = key
|
|
506
|
-
? await decrypt(key, encryptedContent, progressDecrypt, signal)
|
|
507
|
-
: encryptedContent;
|
|
508
|
-
// const md5Content = await firstValueFrom(md5(of(src)));
|
|
509
|
-
const md5Content = await md5(src);
|
|
510
|
-
if (md5Content !== dataContent.md5) {
|
|
511
|
-
throw new Error(`Content does not match`);
|
|
512
|
-
}
|
|
513
|
-
return decompress(src);
|
|
514
|
-
};
|
|
515
|
-
const encrypt = async (dataContent) => {
|
|
516
|
-
const encryptedContent = dataContent.type === 'lite'
|
|
517
|
-
? new Uint8Array(dataContent.content)
|
|
518
|
-
: dataContent.type === 'cloud'
|
|
519
|
-
? await encryptedContentFromParts({
|
|
520
|
-
dataId: dataContent.id,
|
|
521
|
-
dataParts: dataContent.parts,
|
|
522
|
-
})
|
|
523
|
-
: dataContent.maybeContent !== null
|
|
524
|
-
? new Uint8Array(dataContent.maybeContent)
|
|
525
|
-
: dataContent.maybeParts !== null
|
|
526
|
-
? await encryptedContentFromParts({
|
|
527
|
-
dataId: dataContent.id,
|
|
528
|
-
dataParts: dataContent.maybeParts,
|
|
529
|
-
})
|
|
530
|
-
: null;
|
|
531
|
-
if (encryptedContent === null) {
|
|
532
|
-
throw `Can't find content for data ${dataContent.id}`;
|
|
533
|
-
}
|
|
534
|
-
return encryptedContent;
|
|
535
|
-
};
|
|
536
|
-
const data = await Promise.all(missingContents.map(async (missingContent) => {
|
|
537
|
-
const encrypted = await encrypt(missingContent);
|
|
538
|
-
const finalized = await finalize(missingContent, encrypted);
|
|
539
|
-
const datum = {
|
|
540
|
-
id: missingContent.id,
|
|
541
|
-
size: missingContent.totalSize,
|
|
542
|
-
storageType: missingContent.storageType,
|
|
543
|
-
data: finalized,
|
|
544
|
-
};
|
|
545
|
-
dataContentCache.set(missingContent.id, datum);
|
|
546
|
-
return datum;
|
|
547
404
|
}));
|
|
548
|
-
|
|
405
|
+
}
|
|
406
|
+
async deleteNodes({ nodeIds, }) {
|
|
407
|
+
return this.#apiClient.cloud.deleteNodes.mutate({
|
|
408
|
+
ids: nodeIds,
|
|
409
|
+
});
|
|
549
410
|
}
|
|
550
411
|
async deleteData({ dataId, nodeId, }) {
|
|
551
412
|
const { isDeleted } = await this.#apiClient.cloud.deleteData.mutate({
|
|
@@ -692,4 +553,94 @@ export class SecrecyCloudClient {
|
|
|
692
553
|
: null,
|
|
693
554
|
});
|
|
694
555
|
}
|
|
556
|
+
async _handleDataContent({ dataContent, totalBytes, progressParts, onDownloadProgress, progressDecrypt, signal, }) {
|
|
557
|
+
const onProgress = (key, progressEvent) => {
|
|
558
|
+
progressParts[key] = progressEvent;
|
|
559
|
+
const transferredBytes = Object.values(progressParts).reduce((prv, cur) => prv + cur.transferredBytes, 0);
|
|
560
|
+
onDownloadProgress?.({
|
|
561
|
+
percent: transferredBytes / totalBytes,
|
|
562
|
+
totalBytes,
|
|
563
|
+
transferredBytes,
|
|
564
|
+
});
|
|
565
|
+
};
|
|
566
|
+
const encryptedContentFromParts = async (arg) => {
|
|
567
|
+
const parts = {};
|
|
568
|
+
const byPart = async (part) => {
|
|
569
|
+
const buf = new Uint8Array(await ky
|
|
570
|
+
.get(part.contentUrl, {
|
|
571
|
+
timeout: false,
|
|
572
|
+
onDownloadProgress: (pr) => {
|
|
573
|
+
onProgress(`${arg.dataId}-${part.order}`, pr);
|
|
574
|
+
},
|
|
575
|
+
signal,
|
|
576
|
+
})
|
|
577
|
+
.arrayBuffer());
|
|
578
|
+
const md5Part = await md5(buf);
|
|
579
|
+
if (md5Part !== part.md5) {
|
|
580
|
+
throw new Error(`Invalid md5 for part ${part.order} of data ${arg.dataId}`);
|
|
581
|
+
}
|
|
582
|
+
if (typeof parts[arg.dataId] === 'undefined') {
|
|
583
|
+
parts[arg.dataId] = [{ data: buf, order: part.order }];
|
|
584
|
+
}
|
|
585
|
+
else {
|
|
586
|
+
parts[arg.dataId].push({ data: buf, order: part.order });
|
|
587
|
+
}
|
|
588
|
+
};
|
|
589
|
+
await promiseAllLimit(3, arg.dataParts.map((p) => async () => byPart(p)));
|
|
590
|
+
return concatenate(...parts[arg.dataId]
|
|
591
|
+
.sort((a, b) => a.order - b.order)
|
|
592
|
+
.map((p) => p.data));
|
|
593
|
+
};
|
|
594
|
+
const encryptedContent = dataContent.type === 'lite'
|
|
595
|
+
? new Uint8Array(dataContent.content)
|
|
596
|
+
: dataContent.type === 'cloud'
|
|
597
|
+
? await encryptedContentFromParts({
|
|
598
|
+
dataId: dataContent.id,
|
|
599
|
+
dataParts: dataContent.parts,
|
|
600
|
+
})
|
|
601
|
+
: dataContent.maybeContent !== null
|
|
602
|
+
? new Uint8Array(dataContent.maybeContent)
|
|
603
|
+
: dataContent.maybeParts !== null
|
|
604
|
+
? await encryptedContentFromParts({
|
|
605
|
+
dataId: dataContent.id,
|
|
606
|
+
dataParts: dataContent.maybeParts,
|
|
607
|
+
})
|
|
608
|
+
: null;
|
|
609
|
+
if (encryptedContent === null) {
|
|
610
|
+
throw `Can't find content for data ${dataContent.id}`;
|
|
611
|
+
}
|
|
612
|
+
const md5Encrypted = await md5(encryptedContent);
|
|
613
|
+
if (md5Encrypted !== dataContent.md5Encrypted) {
|
|
614
|
+
throw new Error(`Encrypted content does not match`);
|
|
615
|
+
}
|
|
616
|
+
const key = dataContent.key
|
|
617
|
+
? decryptCryptoBox(sodium.from_hex(dataContent.key), dataContent.type === 'received_mail'
|
|
618
|
+
? dataContent.senderPublicKey
|
|
619
|
+
: dataContent.type === 'cloud'
|
|
620
|
+
? dataContent.publicKey
|
|
621
|
+
: this.#keys.publicKey, this.#keys.privateKey)
|
|
622
|
+
: null;
|
|
623
|
+
const src = key
|
|
624
|
+
? await decrypt(key, encryptedContent, progressDecrypt, signal)
|
|
625
|
+
: encryptedContent;
|
|
626
|
+
const md5Content = await md5(src);
|
|
627
|
+
if (md5Content !== dataContent.md5) {
|
|
628
|
+
throw new Error(`Content does not match`);
|
|
629
|
+
}
|
|
630
|
+
const decompressed = decompress(src);
|
|
631
|
+
dataContentCache.set(dataContent.id, {
|
|
632
|
+
id: dataContent.id,
|
|
633
|
+
size: dataContent.size,
|
|
634
|
+
sizeEncrypted: dataContent.sizeEncrypted,
|
|
635
|
+
storageType: dataContent.storageType,
|
|
636
|
+
data: decompressed,
|
|
637
|
+
});
|
|
638
|
+
return {
|
|
639
|
+
id: dataContent.id,
|
|
640
|
+
size: dataContent.size,
|
|
641
|
+
sizeEncrypted: dataContent.sizeEncrypted,
|
|
642
|
+
storageType: dataContent.storageType,
|
|
643
|
+
data: decompressed,
|
|
644
|
+
};
|
|
645
|
+
}
|
|
695
646
|
}
|
package/dist/types/cache.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { InternalNode, InternalData, InternalNodeFull,
|
|
1
|
+
import type { InternalNode, InternalData, InternalNodeFull, LocalData } from './client/types/index.js';
|
|
2
2
|
import { LRUCache } from 'lru-cache';
|
|
3
3
|
export declare const dataCache: Map<string, InternalData>;
|
|
4
4
|
export declare const nodesCache: Map<string, InternalNode | InternalNodeFull>;
|
|
@@ -10,9 +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 dataContentCache: LRUCache<string,
|
|
14
|
-
id: string;
|
|
15
|
-
storageType: DataStorageType;
|
|
16
|
-
size: bigint;
|
|
17
|
-
data: Uint8Array;
|
|
18
|
-
}, unknown>;
|
|
13
|
+
export declare const dataContentCache: LRUCache<string, LocalData, unknown>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ProgressCallback, SecrecyClient } from '../index.js';
|
|
2
|
-
import type { DataMetadata, DataStorageType, KeyPair, Node, NodeFull, NodeType, Rights } from './types/index.js';
|
|
2
|
+
import type { DataMetadata, DataStorageType, KeyPair, LocalData, Node, NodeFull, NodeType, Rights } from './types/index.js';
|
|
3
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 {
|
|
@@ -71,21 +71,18 @@ export declare class SecrecyCloudClient {
|
|
|
71
71
|
onDownloadProgress?: (progress: DownloadProgress) => void;
|
|
72
72
|
progressDecrypt?: ProgressCallback;
|
|
73
73
|
signal?: AbortSignal;
|
|
74
|
-
}): Promise<
|
|
75
|
-
id: string;
|
|
76
|
-
storageType: DataStorageType;
|
|
77
|
-
data: Uint8Array;
|
|
78
|
-
}>;
|
|
74
|
+
}): Promise<LocalData>;
|
|
79
75
|
dataContents({ dataIds, onDownloadProgress, progressDecrypt, signal, }: {
|
|
80
76
|
dataIds: string[];
|
|
81
77
|
onDownloadProgress?: (progress: DownloadProgress) => void;
|
|
82
78
|
progressDecrypt?: ProgressCallback;
|
|
83
79
|
signal?: AbortSignal;
|
|
80
|
+
}): Promise<LocalData[]>;
|
|
81
|
+
deleteNodes({ nodeIds, }: {
|
|
82
|
+
nodeIds: string[];
|
|
84
83
|
}): Promise<{
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
data: Uint8Array;
|
|
88
|
-
}[]>;
|
|
84
|
+
count: number;
|
|
85
|
+
}>;
|
|
89
86
|
deleteData({ dataId, nodeId, }: {
|
|
90
87
|
dataId: string;
|
|
91
88
|
nodeId: string;
|
|
@@ -106,4 +103,5 @@ export declare class SecrecyCloudClient {
|
|
|
106
103
|
}): Promise<NodeFull>;
|
|
107
104
|
private readonly perNode;
|
|
108
105
|
reportData({ id, reasons, }: Omit<RouterInputs['cloud']['reportData'], 'encryptedDataKey'>): Promise<RouterOutputs['cloud']['reportData']>;
|
|
106
|
+
private _handleDataContent;
|
|
109
107
|
}
|
|
@@ -2,6 +2,13 @@ import { type RouterOutputs } from '../../client.js';
|
|
|
2
2
|
export type ApiData = NonNullable<RouterOutputs['cloud']['dataById']>;
|
|
3
3
|
export type ApiExtendedData = NonNullable<RouterOutputs['cloud']['dataContentByIds'][number]>;
|
|
4
4
|
export type DataStorageType = ApiData['storageType'];
|
|
5
|
+
export type LocalData = {
|
|
6
|
+
id: string;
|
|
7
|
+
storageType: DataStorageType;
|
|
8
|
+
size: bigint;
|
|
9
|
+
sizeEncrypted: bigint | null;
|
|
10
|
+
data: Uint8Array;
|
|
11
|
+
};
|
|
5
12
|
export type DataMetadata = Pick<ApiData, 'id' | 'size' | 'sizeEncrypted' | 'md5' | 'md5Encrypted' | 'createdAt'>;
|
|
6
13
|
export type InternalData = DataMetadata & {
|
|
7
14
|
key: string | null;
|
package/dist/types/client.d.ts
CHANGED
|
@@ -2086,11 +2086,11 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
|
|
|
2086
2086
|
current: {
|
|
2087
2087
|
id: string;
|
|
2088
2088
|
createdAt: Date;
|
|
2089
|
+
storageType: "s3" | "cold" | "lite";
|
|
2089
2090
|
size: bigint;
|
|
2090
2091
|
md5: string;
|
|
2091
2092
|
userAppUserId: string;
|
|
2092
2093
|
userAppAppId: string;
|
|
2093
|
-
storageType: "s3" | "lite";
|
|
2094
2094
|
sizeEncrypted: bigint | null;
|
|
2095
2095
|
md5Encrypted: string | null;
|
|
2096
2096
|
validatedAt: Date | null;
|
|
@@ -2102,11 +2102,11 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
|
|
|
2102
2102
|
history: {
|
|
2103
2103
|
id: string;
|
|
2104
2104
|
createdAt: Date;
|
|
2105
|
+
storageType: "s3" | "cold" | "lite";
|
|
2105
2106
|
size: bigint;
|
|
2106
2107
|
md5: string;
|
|
2107
2108
|
userAppUserId: string;
|
|
2108
2109
|
userAppAppId: string;
|
|
2109
|
-
storageType: "s3" | "lite";
|
|
2110
2110
|
sizeEncrypted: bigint | null;
|
|
2111
2111
|
md5Encrypted: string | null;
|
|
2112
2112
|
validatedAt: Date | null;
|
|
@@ -2231,11 +2231,11 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
|
|
|
2231
2231
|
current: {
|
|
2232
2232
|
id: string;
|
|
2233
2233
|
createdAt: Date;
|
|
2234
|
+
storageType: "s3" | "cold" | "lite";
|
|
2234
2235
|
size: bigint;
|
|
2235
2236
|
md5: string;
|
|
2236
2237
|
userAppUserId: string;
|
|
2237
2238
|
userAppAppId: string;
|
|
2238
|
-
storageType: "s3" | "lite";
|
|
2239
2239
|
sizeEncrypted: bigint | null;
|
|
2240
2240
|
md5Encrypted: string | null;
|
|
2241
2241
|
validatedAt: Date | null;
|
|
@@ -2247,11 +2247,11 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
|
|
|
2247
2247
|
history: {
|
|
2248
2248
|
id: string;
|
|
2249
2249
|
createdAt: Date;
|
|
2250
|
+
storageType: "s3" | "cold" | "lite";
|
|
2250
2251
|
size: bigint;
|
|
2251
2252
|
md5: string;
|
|
2252
2253
|
userAppUserId: string;
|
|
2253
2254
|
userAppAppId: string;
|
|
2254
|
-
storageType: "s3" | "lite";
|
|
2255
2255
|
sizeEncrypted: bigint | null;
|
|
2256
2256
|
md5Encrypted: string | null;
|
|
2257
2257
|
validatedAt: Date | null;
|
|
@@ -2415,11 +2415,11 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
|
|
|
2415
2415
|
_output_in: {
|
|
2416
2416
|
id: string;
|
|
2417
2417
|
createdAt: Date;
|
|
2418
|
+
storageType: "s3" | "cold" | "lite";
|
|
2418
2419
|
size: bigint;
|
|
2419
2420
|
md5: string;
|
|
2420
2421
|
userAppUserId: string;
|
|
2421
2422
|
userAppAppId: string;
|
|
2422
|
-
storageType: "s3" | "lite";
|
|
2423
2423
|
sizeEncrypted: bigint | null;
|
|
2424
2424
|
md5Encrypted: string | null;
|
|
2425
2425
|
validatedAt: Date | null;
|
|
@@ -2431,11 +2431,11 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
|
|
|
2431
2431
|
_output_out: {
|
|
2432
2432
|
id: string;
|
|
2433
2433
|
createdAt: Date;
|
|
2434
|
+
storageType: "s3" | "cold" | "lite";
|
|
2434
2435
|
size: bigint;
|
|
2435
2436
|
md5: string;
|
|
2436
2437
|
userAppUserId: string;
|
|
2437
2438
|
userAppAppId: string;
|
|
2438
|
-
storageType: "s3" | "lite";
|
|
2439
2439
|
sizeEncrypted: bigint | null;
|
|
2440
2440
|
md5Encrypted: string | null;
|
|
2441
2441
|
validatedAt: Date | null;
|
|
@@ -2480,10 +2480,11 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
|
|
|
2480
2480
|
id: string;
|
|
2481
2481
|
type: "received_mail";
|
|
2482
2482
|
key: string | null;
|
|
2483
|
+
storageType: "s3" | "cold" | "lite";
|
|
2484
|
+
size: bigint;
|
|
2483
2485
|
md5: string;
|
|
2484
|
-
|
|
2486
|
+
sizeEncrypted: bigint | null;
|
|
2485
2487
|
md5Encrypted: string | null;
|
|
2486
|
-
totalSize: bigint;
|
|
2487
2488
|
senderPublicKey: string;
|
|
2488
2489
|
maybeParts: {
|
|
2489
2490
|
md5: string;
|
|
@@ -2495,10 +2496,11 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
|
|
|
2495
2496
|
id: string;
|
|
2496
2497
|
type: "sent_mail";
|
|
2497
2498
|
key: string | null;
|
|
2499
|
+
storageType: "s3" | "cold" | "lite";
|
|
2500
|
+
size: bigint;
|
|
2498
2501
|
md5: string;
|
|
2499
|
-
|
|
2502
|
+
sizeEncrypted: bigint | null;
|
|
2500
2503
|
md5Encrypted: string | null;
|
|
2501
|
-
totalSize: bigint;
|
|
2502
2504
|
maybeParts: {
|
|
2503
2505
|
md5: string;
|
|
2504
2506
|
order: number;
|
|
@@ -2509,8 +2511,10 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
|
|
|
2509
2511
|
id: string;
|
|
2510
2512
|
type: "cloud";
|
|
2511
2513
|
key: string | null;
|
|
2514
|
+
storageType: "s3" | "cold";
|
|
2515
|
+
size: bigint;
|
|
2512
2516
|
md5: string;
|
|
2513
|
-
|
|
2517
|
+
sizeEncrypted: bigint | null;
|
|
2514
2518
|
md5Encrypted: string | null;
|
|
2515
2519
|
parts: {
|
|
2516
2520
|
md5: string;
|
|
@@ -2518,26 +2522,27 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
|
|
|
2518
2522
|
contentUrl: string;
|
|
2519
2523
|
}[];
|
|
2520
2524
|
publicKey: string;
|
|
2521
|
-
totalSize: bigint;
|
|
2522
2525
|
} | {
|
|
2523
2526
|
id: string;
|
|
2524
2527
|
type: "lite";
|
|
2525
2528
|
key: string | null;
|
|
2529
|
+
storageType: "lite";
|
|
2530
|
+
size: bigint;
|
|
2526
2531
|
md5: string;
|
|
2527
|
-
|
|
2532
|
+
sizeEncrypted: bigint | null;
|
|
2528
2533
|
md5Encrypted: string | null;
|
|
2529
2534
|
content: Buffer;
|
|
2530
2535
|
publicKey: string;
|
|
2531
|
-
totalSize: bigint;
|
|
2532
2536
|
};
|
|
2533
2537
|
_output_out: {
|
|
2534
2538
|
id: string;
|
|
2535
2539
|
type: "received_mail";
|
|
2536
2540
|
key: string | null;
|
|
2541
|
+
storageType: "s3" | "cold" | "lite";
|
|
2542
|
+
size: bigint;
|
|
2537
2543
|
md5: string;
|
|
2538
|
-
|
|
2544
|
+
sizeEncrypted: bigint | null;
|
|
2539
2545
|
md5Encrypted: string | null;
|
|
2540
|
-
totalSize: bigint;
|
|
2541
2546
|
senderPublicKey: string;
|
|
2542
2547
|
maybeParts: {
|
|
2543
2548
|
md5: string;
|
|
@@ -2549,10 +2554,11 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
|
|
|
2549
2554
|
id: string;
|
|
2550
2555
|
type: "sent_mail";
|
|
2551
2556
|
key: string | null;
|
|
2557
|
+
storageType: "s3" | "cold" | "lite";
|
|
2558
|
+
size: bigint;
|
|
2552
2559
|
md5: string;
|
|
2553
|
-
|
|
2560
|
+
sizeEncrypted: bigint | null;
|
|
2554
2561
|
md5Encrypted: string | null;
|
|
2555
|
-
totalSize: bigint;
|
|
2556
2562
|
maybeParts: {
|
|
2557
2563
|
md5: string;
|
|
2558
2564
|
order: number;
|
|
@@ -2563,8 +2569,10 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
|
|
|
2563
2569
|
id: string;
|
|
2564
2570
|
type: "cloud";
|
|
2565
2571
|
key: string | null;
|
|
2572
|
+
storageType: "s3" | "cold";
|
|
2573
|
+
size: bigint;
|
|
2566
2574
|
md5: string;
|
|
2567
|
-
|
|
2575
|
+
sizeEncrypted: bigint | null;
|
|
2568
2576
|
md5Encrypted: string | null;
|
|
2569
2577
|
parts: {
|
|
2570
2578
|
md5: string;
|
|
@@ -2572,17 +2580,17 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
|
|
|
2572
2580
|
contentUrl: string;
|
|
2573
2581
|
}[];
|
|
2574
2582
|
publicKey: string;
|
|
2575
|
-
totalSize: bigint;
|
|
2576
2583
|
} | {
|
|
2577
2584
|
id: string;
|
|
2578
2585
|
type: "lite";
|
|
2579
2586
|
key: string | null;
|
|
2587
|
+
storageType: "lite";
|
|
2588
|
+
size: bigint;
|
|
2580
2589
|
md5: string;
|
|
2581
|
-
|
|
2590
|
+
sizeEncrypted: bigint | null;
|
|
2582
2591
|
md5Encrypted: string | null;
|
|
2583
2592
|
content: Buffer;
|
|
2584
2593
|
publicKey: string;
|
|
2585
|
-
totalSize: bigint;
|
|
2586
2594
|
};
|
|
2587
2595
|
}, unknown>>;
|
|
2588
2596
|
};
|
|
@@ -2620,10 +2628,11 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
|
|
|
2620
2628
|
id: string;
|
|
2621
2629
|
type: "received_mail";
|
|
2622
2630
|
key: string | null;
|
|
2631
|
+
storageType: "s3" | "cold" | "lite";
|
|
2632
|
+
size: bigint;
|
|
2623
2633
|
md5: string;
|
|
2624
|
-
|
|
2634
|
+
sizeEncrypted: bigint | null;
|
|
2625
2635
|
md5Encrypted: string | null;
|
|
2626
|
-
totalSize: bigint;
|
|
2627
2636
|
senderPublicKey: string;
|
|
2628
2637
|
maybeParts: {
|
|
2629
2638
|
md5: string;
|
|
@@ -2635,10 +2644,11 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
|
|
|
2635
2644
|
id: string;
|
|
2636
2645
|
type: "sent_mail";
|
|
2637
2646
|
key: string | null;
|
|
2647
|
+
storageType: "s3" | "cold" | "lite";
|
|
2648
|
+
size: bigint;
|
|
2638
2649
|
md5: string;
|
|
2639
|
-
|
|
2650
|
+
sizeEncrypted: bigint | null;
|
|
2640
2651
|
md5Encrypted: string | null;
|
|
2641
|
-
totalSize: bigint;
|
|
2642
2652
|
maybeParts: {
|
|
2643
2653
|
md5: string;
|
|
2644
2654
|
order: number;
|
|
@@ -2649,8 +2659,10 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
|
|
|
2649
2659
|
id: string;
|
|
2650
2660
|
type: "cloud";
|
|
2651
2661
|
key: string | null;
|
|
2662
|
+
storageType: "s3" | "cold";
|
|
2663
|
+
size: bigint;
|
|
2652
2664
|
md5: string;
|
|
2653
|
-
|
|
2665
|
+
sizeEncrypted: bigint | null;
|
|
2654
2666
|
md5Encrypted: string | null;
|
|
2655
2667
|
parts: {
|
|
2656
2668
|
md5: string;
|
|
@@ -2658,26 +2670,27 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
|
|
|
2658
2670
|
contentUrl: string;
|
|
2659
2671
|
}[];
|
|
2660
2672
|
publicKey: string;
|
|
2661
|
-
totalSize: bigint;
|
|
2662
2673
|
} | {
|
|
2663
2674
|
id: string;
|
|
2664
2675
|
type: "lite";
|
|
2665
2676
|
key: string | null;
|
|
2677
|
+
storageType: "lite";
|
|
2678
|
+
size: bigint;
|
|
2666
2679
|
md5: string;
|
|
2667
|
-
|
|
2680
|
+
sizeEncrypted: bigint | null;
|
|
2668
2681
|
md5Encrypted: string | null;
|
|
2669
2682
|
content: Buffer;
|
|
2670
2683
|
publicKey: string;
|
|
2671
|
-
totalSize: bigint;
|
|
2672
2684
|
})[];
|
|
2673
2685
|
_output_out: ({
|
|
2674
2686
|
id: string;
|
|
2675
2687
|
type: "received_mail";
|
|
2676
2688
|
key: string | null;
|
|
2689
|
+
storageType: "s3" | "cold" | "lite";
|
|
2690
|
+
size: bigint;
|
|
2677
2691
|
md5: string;
|
|
2678
|
-
|
|
2692
|
+
sizeEncrypted: bigint | null;
|
|
2679
2693
|
md5Encrypted: string | null;
|
|
2680
|
-
totalSize: bigint;
|
|
2681
2694
|
senderPublicKey: string;
|
|
2682
2695
|
maybeParts: {
|
|
2683
2696
|
md5: string;
|
|
@@ -2689,10 +2702,11 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
|
|
|
2689
2702
|
id: string;
|
|
2690
2703
|
type: "sent_mail";
|
|
2691
2704
|
key: string | null;
|
|
2705
|
+
storageType: "s3" | "cold" | "lite";
|
|
2706
|
+
size: bigint;
|
|
2692
2707
|
md5: string;
|
|
2693
|
-
|
|
2708
|
+
sizeEncrypted: bigint | null;
|
|
2694
2709
|
md5Encrypted: string | null;
|
|
2695
|
-
totalSize: bigint;
|
|
2696
2710
|
maybeParts: {
|
|
2697
2711
|
md5: string;
|
|
2698
2712
|
order: number;
|
|
@@ -2703,8 +2717,10 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
|
|
|
2703
2717
|
id: string;
|
|
2704
2718
|
type: "cloud";
|
|
2705
2719
|
key: string | null;
|
|
2720
|
+
storageType: "s3" | "cold";
|
|
2721
|
+
size: bigint;
|
|
2706
2722
|
md5: string;
|
|
2707
|
-
|
|
2723
|
+
sizeEncrypted: bigint | null;
|
|
2708
2724
|
md5Encrypted: string | null;
|
|
2709
2725
|
parts: {
|
|
2710
2726
|
md5: string;
|
|
@@ -2712,17 +2728,17 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
|
|
|
2712
2728
|
contentUrl: string;
|
|
2713
2729
|
}[];
|
|
2714
2730
|
publicKey: string;
|
|
2715
|
-
totalSize: bigint;
|
|
2716
2731
|
} | {
|
|
2717
2732
|
id: string;
|
|
2718
2733
|
type: "lite";
|
|
2719
2734
|
key: string | null;
|
|
2735
|
+
storageType: "lite";
|
|
2736
|
+
size: bigint;
|
|
2720
2737
|
md5: string;
|
|
2721
|
-
|
|
2738
|
+
sizeEncrypted: bigint | null;
|
|
2722
2739
|
md5Encrypted: string | null;
|
|
2723
2740
|
content: Buffer;
|
|
2724
2741
|
publicKey: string;
|
|
2725
|
-
totalSize: bigint;
|
|
2726
2742
|
})[];
|
|
2727
2743
|
}, unknown>>;
|
|
2728
2744
|
};
|
|
@@ -2760,6 +2776,50 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
|
|
|
2760
2776
|
_output_out: any[];
|
|
2761
2777
|
}, unknown>>;
|
|
2762
2778
|
};
|
|
2779
|
+
moveToStorageType: {
|
|
2780
|
+
mutate: import("@trpc/client").Resolver<import("@trpc/server").BuildProcedure<"mutation", {
|
|
2781
|
+
_config: import("@trpc/server").RootConfig<{
|
|
2782
|
+
ctx: {};
|
|
2783
|
+
meta: object;
|
|
2784
|
+
errorShape: {
|
|
2785
|
+
message: string;
|
|
2786
|
+
code: import("@trpc/server/rpc").TRPC_ERROR_CODE_NUMBER;
|
|
2787
|
+
data: _trpc_server_dist_error_formatter.DefaultErrorData;
|
|
2788
|
+
} | {
|
|
2789
|
+
data: {
|
|
2790
|
+
zodError: import("zod").typeToFlattenedError<any, string> | null;
|
|
2791
|
+
code: import("@trpc/server/rpc").TRPC_ERROR_CODE_KEY;
|
|
2792
|
+
httpStatus: number;
|
|
2793
|
+
path?: string;
|
|
2794
|
+
stack?: string;
|
|
2795
|
+
};
|
|
2796
|
+
message: string;
|
|
2797
|
+
code: import("@trpc/server/rpc").TRPC_ERROR_CODE_NUMBER;
|
|
2798
|
+
};
|
|
2799
|
+
transformer: typeof superjson;
|
|
2800
|
+
}>;
|
|
2801
|
+
_meta: object;
|
|
2802
|
+
_ctx_out: {};
|
|
2803
|
+
_input_in: {
|
|
2804
|
+
dataId: string;
|
|
2805
|
+
storageType: "s3" | "cold";
|
|
2806
|
+
};
|
|
2807
|
+
_input_out: {
|
|
2808
|
+
dataId: string;
|
|
2809
|
+
storageType: "s3" | "cold";
|
|
2810
|
+
};
|
|
2811
|
+
_output_in: {
|
|
2812
|
+
isMoved: boolean;
|
|
2813
|
+
fromType: "s3" | "cold";
|
|
2814
|
+
toType: "s3" | "cold";
|
|
2815
|
+
};
|
|
2816
|
+
_output_out: {
|
|
2817
|
+
isMoved: boolean;
|
|
2818
|
+
fromType: "s3" | "cold";
|
|
2819
|
+
toType: "s3" | "cold";
|
|
2820
|
+
};
|
|
2821
|
+
}, unknown>>;
|
|
2822
|
+
};
|
|
2763
2823
|
saveInCloud: {
|
|
2764
2824
|
mutate: import("@trpc/client").Resolver<import("@trpc/server").BuildProcedure<"mutation", {
|
|
2765
2825
|
_config: import("@trpc/server").RootConfig<{
|
|
@@ -2838,11 +2898,11 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
|
|
|
2838
2898
|
current: {
|
|
2839
2899
|
id: string;
|
|
2840
2900
|
createdAt: Date;
|
|
2901
|
+
storageType: "s3" | "cold" | "lite";
|
|
2841
2902
|
size: bigint;
|
|
2842
2903
|
md5: string;
|
|
2843
2904
|
userAppUserId: string;
|
|
2844
2905
|
userAppAppId: string;
|
|
2845
|
-
storageType: "s3" | "lite";
|
|
2846
2906
|
sizeEncrypted: bigint | null;
|
|
2847
2907
|
md5Encrypted: string | null;
|
|
2848
2908
|
validatedAt: Date | null;
|
|
@@ -2854,11 +2914,11 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
|
|
|
2854
2914
|
history: {
|
|
2855
2915
|
id: string;
|
|
2856
2916
|
createdAt: Date;
|
|
2917
|
+
storageType: "s3" | "cold" | "lite";
|
|
2857
2918
|
size: bigint;
|
|
2858
2919
|
md5: string;
|
|
2859
2920
|
userAppUserId: string;
|
|
2860
2921
|
userAppAppId: string;
|
|
2861
|
-
storageType: "s3" | "lite";
|
|
2862
2922
|
sizeEncrypted: bigint | null;
|
|
2863
2923
|
md5Encrypted: string | null;
|
|
2864
2924
|
validatedAt: Date | null;
|
|
@@ -2983,11 +3043,11 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
|
|
|
2983
3043
|
current: {
|
|
2984
3044
|
id: string;
|
|
2985
3045
|
createdAt: Date;
|
|
3046
|
+
storageType: "s3" | "cold" | "lite";
|
|
2986
3047
|
size: bigint;
|
|
2987
3048
|
md5: string;
|
|
2988
3049
|
userAppUserId: string;
|
|
2989
3050
|
userAppAppId: string;
|
|
2990
|
-
storageType: "s3" | "lite";
|
|
2991
3051
|
sizeEncrypted: bigint | null;
|
|
2992
3052
|
md5Encrypted: string | null;
|
|
2993
3053
|
validatedAt: Date | null;
|
|
@@ -2999,11 +3059,11 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
|
|
|
2999
3059
|
history: {
|
|
3000
3060
|
id: string;
|
|
3001
3061
|
createdAt: Date;
|
|
3062
|
+
storageType: "s3" | "cold" | "lite";
|
|
3002
3063
|
size: bigint;
|
|
3003
3064
|
md5: string;
|
|
3004
3065
|
userAppUserId: string;
|
|
3005
3066
|
userAppAppId: string;
|
|
3006
|
-
storageType: "s3" | "lite";
|
|
3007
3067
|
sizeEncrypted: bigint | null;
|
|
3008
3068
|
md5Encrypted: string | null;
|
|
3009
3069
|
validatedAt: Date | null;
|
|
@@ -3184,14 +3244,13 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
|
|
|
3184
3244
|
history: {
|
|
3185
3245
|
createdAt: Date;
|
|
3186
3246
|
dataId: string;
|
|
3247
|
+
storageType: "s3" | "cold" | "lite";
|
|
3187
3248
|
size: bigint;
|
|
3188
|
-
storageType: "s3" | "lite";
|
|
3189
3249
|
}[];
|
|
3190
3250
|
access: {
|
|
3191
3251
|
appId: string;
|
|
3192
3252
|
nameKey: string;
|
|
3193
3253
|
};
|
|
3194
|
-
totalSize: bigint;
|
|
3195
3254
|
breadcrumb: {
|
|
3196
3255
|
name: string;
|
|
3197
3256
|
id: string;
|
|
@@ -3199,6 +3258,7 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
|
|
|
3199
3258
|
pubKey: string;
|
|
3200
3259
|
}[];
|
|
3201
3260
|
sharedCount: number;
|
|
3261
|
+
totalSize: bigint;
|
|
3202
3262
|
}[];
|
|
3203
3263
|
};
|
|
3204
3264
|
pagination: {
|
|
@@ -3225,14 +3285,13 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
|
|
|
3225
3285
|
history: {
|
|
3226
3286
|
createdAt: Date;
|
|
3227
3287
|
dataId: string;
|
|
3288
|
+
storageType: "s3" | "cold" | "lite";
|
|
3228
3289
|
size: bigint;
|
|
3229
|
-
storageType: "s3" | "lite";
|
|
3230
3290
|
}[];
|
|
3231
3291
|
access: {
|
|
3232
3292
|
appId: string;
|
|
3233
3293
|
nameKey: string;
|
|
3234
3294
|
};
|
|
3235
|
-
totalSize: bigint;
|
|
3236
3295
|
breadcrumb: {
|
|
3237
3296
|
name: string;
|
|
3238
3297
|
id: string;
|
|
@@ -3240,6 +3299,7 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
|
|
|
3240
3299
|
pubKey: string;
|
|
3241
3300
|
}[];
|
|
3242
3301
|
sharedCount: number;
|
|
3302
|
+
totalSize: bigint;
|
|
3243
3303
|
}[];
|
|
3244
3304
|
};
|
|
3245
3305
|
pagination: {
|
|
@@ -3422,6 +3482,84 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
|
|
|
3422
3482
|
};
|
|
3423
3483
|
}, unknown>>;
|
|
3424
3484
|
};
|
|
3485
|
+
uploadColdData: {
|
|
3486
|
+
mutate: import("@trpc/client").Resolver<import("@trpc/server").BuildProcedure<"mutation", {
|
|
3487
|
+
_config: import("@trpc/server").RootConfig<{
|
|
3488
|
+
ctx: {};
|
|
3489
|
+
meta: object;
|
|
3490
|
+
errorShape: {
|
|
3491
|
+
message: string;
|
|
3492
|
+
code: import("@trpc/server/rpc").TRPC_ERROR_CODE_NUMBER;
|
|
3493
|
+
data: _trpc_server_dist_error_formatter.DefaultErrorData;
|
|
3494
|
+
} | {
|
|
3495
|
+
data: {
|
|
3496
|
+
zodError: import("zod").typeToFlattenedError<any, string> | null;
|
|
3497
|
+
code: import("@trpc/server/rpc").TRPC_ERROR_CODE_KEY;
|
|
3498
|
+
httpStatus: number;
|
|
3499
|
+
path?: string;
|
|
3500
|
+
stack?: string;
|
|
3501
|
+
};
|
|
3502
|
+
message: string;
|
|
3503
|
+
code: import("@trpc/server/rpc").TRPC_ERROR_CODE_NUMBER;
|
|
3504
|
+
};
|
|
3505
|
+
transformer: typeof superjson;
|
|
3506
|
+
}>;
|
|
3507
|
+
_meta: object;
|
|
3508
|
+
_ctx_out: {};
|
|
3509
|
+
_input_in: {
|
|
3510
|
+
type: "encrypted";
|
|
3511
|
+
key: string;
|
|
3512
|
+
size: bigint;
|
|
3513
|
+
md5: string;
|
|
3514
|
+
sizeEncrypted: bigint;
|
|
3515
|
+
md5Encrypted: string;
|
|
3516
|
+
} | {
|
|
3517
|
+
type: "unencrypted";
|
|
3518
|
+
size: bigint;
|
|
3519
|
+
md5: string;
|
|
3520
|
+
};
|
|
3521
|
+
_input_out: {
|
|
3522
|
+
type: "encrypted";
|
|
3523
|
+
key: string;
|
|
3524
|
+
size: bigint;
|
|
3525
|
+
md5: string;
|
|
3526
|
+
sizeEncrypted: bigint;
|
|
3527
|
+
md5Encrypted: string;
|
|
3528
|
+
} | {
|
|
3529
|
+
type: "unencrypted";
|
|
3530
|
+
size: bigint;
|
|
3531
|
+
md5: string;
|
|
3532
|
+
};
|
|
3533
|
+
_output_in: {
|
|
3534
|
+
id: string;
|
|
3535
|
+
keyPair: {
|
|
3536
|
+
pub: string;
|
|
3537
|
+
encPriv: string;
|
|
3538
|
+
};
|
|
3539
|
+
key: string | null;
|
|
3540
|
+
parts: {
|
|
3541
|
+
fields: Record<string, string>;
|
|
3542
|
+
url: string;
|
|
3543
|
+
order: number;
|
|
3544
|
+
}[];
|
|
3545
|
+
partSize: bigint;
|
|
3546
|
+
};
|
|
3547
|
+
_output_out: {
|
|
3548
|
+
id: string;
|
|
3549
|
+
keyPair: {
|
|
3550
|
+
pub: string;
|
|
3551
|
+
encPriv: string;
|
|
3552
|
+
};
|
|
3553
|
+
key: string | null;
|
|
3554
|
+
parts: {
|
|
3555
|
+
fields: Record<string, string>;
|
|
3556
|
+
url: string;
|
|
3557
|
+
order: number;
|
|
3558
|
+
}[];
|
|
3559
|
+
partSize: bigint;
|
|
3560
|
+
};
|
|
3561
|
+
}, unknown>>;
|
|
3562
|
+
};
|
|
3425
3563
|
uploadLiteData: {
|
|
3426
3564
|
mutate: import("@trpc/client").Resolver<import("@trpc/server").BuildProcedure<"mutation", {
|
|
3427
3565
|
_config: import("@trpc/server").RootConfig<{
|
|
@@ -3608,11 +3746,11 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
|
|
|
3608
3746
|
current: {
|
|
3609
3747
|
id: string;
|
|
3610
3748
|
createdAt: Date;
|
|
3749
|
+
storageType: "s3" | "cold" | "lite";
|
|
3611
3750
|
size: bigint;
|
|
3612
3751
|
md5: string;
|
|
3613
3752
|
userAppUserId: string;
|
|
3614
3753
|
userAppAppId: string;
|
|
3615
|
-
storageType: "s3" | "lite";
|
|
3616
3754
|
sizeEncrypted: bigint | null;
|
|
3617
3755
|
md5Encrypted: string | null;
|
|
3618
3756
|
validatedAt: Date | null;
|
|
@@ -3624,11 +3762,11 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
|
|
|
3624
3762
|
history: {
|
|
3625
3763
|
id: string;
|
|
3626
3764
|
createdAt: Date;
|
|
3765
|
+
storageType: "s3" | "cold" | "lite";
|
|
3627
3766
|
size: bigint;
|
|
3628
3767
|
md5: string;
|
|
3629
3768
|
userAppUserId: string;
|
|
3630
3769
|
userAppAppId: string;
|
|
3631
|
-
storageType: "s3" | "lite";
|
|
3632
3770
|
sizeEncrypted: bigint | null;
|
|
3633
3771
|
md5Encrypted: string | null;
|
|
3634
3772
|
validatedAt: Date | null;
|
|
@@ -3753,11 +3891,11 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
|
|
|
3753
3891
|
current: {
|
|
3754
3892
|
id: string;
|
|
3755
3893
|
createdAt: Date;
|
|
3894
|
+
storageType: "s3" | "cold" | "lite";
|
|
3756
3895
|
size: bigint;
|
|
3757
3896
|
md5: string;
|
|
3758
3897
|
userAppUserId: string;
|
|
3759
3898
|
userAppAppId: string;
|
|
3760
|
-
storageType: "s3" | "lite";
|
|
3761
3899
|
sizeEncrypted: bigint | null;
|
|
3762
3900
|
md5Encrypted: string | null;
|
|
3763
3901
|
validatedAt: Date | null;
|
|
@@ -3769,11 +3907,11 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
|
|
|
3769
3907
|
history: {
|
|
3770
3908
|
id: string;
|
|
3771
3909
|
createdAt: Date;
|
|
3910
|
+
storageType: "s3" | "cold" | "lite";
|
|
3772
3911
|
size: bigint;
|
|
3773
3912
|
md5: string;
|
|
3774
3913
|
userAppUserId: string;
|
|
3775
3914
|
userAppAppId: string;
|
|
3776
|
-
storageType: "s3" | "lite";
|
|
3777
3915
|
sizeEncrypted: bigint | null;
|
|
3778
3916
|
md5Encrypted: string | null;
|
|
3779
3917
|
validatedAt: Date | null;
|
|
@@ -4416,11 +4554,11 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
|
|
|
4416
4554
|
current: {
|
|
4417
4555
|
id: string;
|
|
4418
4556
|
createdAt: Date;
|
|
4557
|
+
storageType: "s3" | "cold" | "lite";
|
|
4419
4558
|
size: bigint;
|
|
4420
4559
|
md5: string;
|
|
4421
4560
|
userAppUserId: string;
|
|
4422
4561
|
userAppAppId: string;
|
|
4423
|
-
storageType: "s3" | "lite";
|
|
4424
4562
|
sizeEncrypted: bigint | null;
|
|
4425
4563
|
md5Encrypted: string | null;
|
|
4426
4564
|
validatedAt: Date | null;
|
|
@@ -4432,11 +4570,11 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
|
|
|
4432
4570
|
history: {
|
|
4433
4571
|
id: string;
|
|
4434
4572
|
createdAt: Date;
|
|
4573
|
+
storageType: "s3" | "cold" | "lite";
|
|
4435
4574
|
size: bigint;
|
|
4436
4575
|
md5: string;
|
|
4437
4576
|
userAppUserId: string;
|
|
4438
4577
|
userAppAppId: string;
|
|
4439
|
-
storageType: "s3" | "lite";
|
|
4440
4578
|
sizeEncrypted: bigint | null;
|
|
4441
4579
|
md5Encrypted: string | null;
|
|
4442
4580
|
validatedAt: Date | null;
|
|
@@ -4561,11 +4699,11 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
|
|
|
4561
4699
|
current: {
|
|
4562
4700
|
id: string;
|
|
4563
4701
|
createdAt: Date;
|
|
4702
|
+
storageType: "s3" | "cold" | "lite";
|
|
4564
4703
|
size: bigint;
|
|
4565
4704
|
md5: string;
|
|
4566
4705
|
userAppUserId: string;
|
|
4567
4706
|
userAppAppId: string;
|
|
4568
|
-
storageType: "s3" | "lite";
|
|
4569
4707
|
sizeEncrypted: bigint | null;
|
|
4570
4708
|
md5Encrypted: string | null;
|
|
4571
4709
|
validatedAt: Date | null;
|
|
@@ -4577,11 +4715,11 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
|
|
|
4577
4715
|
history: {
|
|
4578
4716
|
id: string;
|
|
4579
4717
|
createdAt: Date;
|
|
4718
|
+
storageType: "s3" | "cold" | "lite";
|
|
4580
4719
|
size: bigint;
|
|
4581
4720
|
md5: string;
|
|
4582
4721
|
userAppUserId: string;
|
|
4583
4722
|
userAppAppId: string;
|
|
4584
|
-
storageType: "s3" | "lite";
|
|
4585
4723
|
sizeEncrypted: bigint | null;
|
|
4586
4724
|
md5Encrypted: string | null;
|
|
4587
4725
|
validatedAt: Date | null;
|
|
@@ -5198,11 +5336,11 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
|
|
|
5198
5336
|
current: {
|
|
5199
5337
|
id: string;
|
|
5200
5338
|
createdAt: Date;
|
|
5339
|
+
storageType: "s3" | "cold" | "lite";
|
|
5201
5340
|
size: bigint;
|
|
5202
5341
|
md5: string;
|
|
5203
5342
|
userAppUserId: string;
|
|
5204
5343
|
userAppAppId: string;
|
|
5205
|
-
storageType: "s3" | "lite";
|
|
5206
5344
|
sizeEncrypted: bigint | null;
|
|
5207
5345
|
md5Encrypted: string | null;
|
|
5208
5346
|
validatedAt: Date | null;
|
|
@@ -5214,11 +5352,11 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
|
|
|
5214
5352
|
history: {
|
|
5215
5353
|
id: string;
|
|
5216
5354
|
createdAt: Date;
|
|
5355
|
+
storageType: "s3" | "cold" | "lite";
|
|
5217
5356
|
size: bigint;
|
|
5218
5357
|
md5: string;
|
|
5219
5358
|
userAppUserId: string;
|
|
5220
5359
|
userAppAppId: string;
|
|
5221
|
-
storageType: "s3" | "lite";
|
|
5222
5360
|
sizeEncrypted: bigint | null;
|
|
5223
5361
|
md5Encrypted: string | null;
|
|
5224
5362
|
validatedAt: Date | null;
|
|
@@ -5343,11 +5481,11 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
|
|
|
5343
5481
|
current: {
|
|
5344
5482
|
id: string;
|
|
5345
5483
|
createdAt: Date;
|
|
5484
|
+
storageType: "s3" | "cold" | "lite";
|
|
5346
5485
|
size: bigint;
|
|
5347
5486
|
md5: string;
|
|
5348
5487
|
userAppUserId: string;
|
|
5349
5488
|
userAppAppId: string;
|
|
5350
|
-
storageType: "s3" | "lite";
|
|
5351
5489
|
sizeEncrypted: bigint | null;
|
|
5352
5490
|
md5Encrypted: string | null;
|
|
5353
5491
|
validatedAt: Date | null;
|
|
@@ -5359,11 +5497,11 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
|
|
|
5359
5497
|
history: {
|
|
5360
5498
|
id: string;
|
|
5361
5499
|
createdAt: Date;
|
|
5500
|
+
storageType: "s3" | "cold" | "lite";
|
|
5362
5501
|
size: bigint;
|
|
5363
5502
|
md5: string;
|
|
5364
5503
|
userAppUserId: string;
|
|
5365
5504
|
userAppAppId: string;
|
|
5366
|
-
storageType: "s3" | "lite";
|
|
5367
5505
|
sizeEncrypted: bigint | null;
|
|
5368
5506
|
md5Encrypted: string | null;
|
|
5369
5507
|
validatedAt: Date | null;
|
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.51.0-feat-improvements.
|
|
5
|
+
"version": "1.51.0-feat-improvements.3",
|
|
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-
|
|
77
|
+
"@secrecy/trpc-api-types": "1.33.0-feat-s3-cold-storage.5",
|
|
78
78
|
"@trpc/client": "10.45.2",
|
|
79
79
|
"@trpc/server": "10.45.2",
|
|
80
80
|
"@types/libsodium-wrappers-sumo": "^0.7.8",
|