@secrecy/lib 1.29.0-feat-rename-file.3 → 1.30.0-feat-rename-file.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.
- package/dist/lib/client/SecrecyAppClient.js +2 -2
- package/dist/lib/client/SecrecyCloudClient.js +9 -9
- package/dist/lib/client/SecrecyMailClient.js +4 -4
- package/dist/lib/client/convert/mail.js +1 -1
- package/dist/types/client/types/mail.d.ts +1 -1
- package/dist/types/client.d.ts +4 -4
- package/package.json +2 -2
|
@@ -82,8 +82,8 @@ export class SecrecyAppClient {
|
|
|
82
82
|
async updateSettings(settings) {
|
|
83
83
|
const updateAppSettings = await this.#apiClient.application.updateSettings.mutate({
|
|
84
84
|
cloudNodeDaysForDelete: settings.cloudNodeDaysForDelete,
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
historyDataDaysForDelete: settings.historyDataDaysForDelete,
|
|
86
|
+
historyDataMaxCount: settings.historyDataMaxCount,
|
|
87
87
|
});
|
|
88
88
|
return updateAppSettings;
|
|
89
89
|
}
|
|
@@ -29,7 +29,7 @@ export class SecrecyCloudClient {
|
|
|
29
29
|
nodeId,
|
|
30
30
|
});
|
|
31
31
|
const node = await apiNodeFullToInternalFull(addDataToHistory, this.#keys);
|
|
32
|
-
const data = node.history.find((
|
|
32
|
+
const data = node.history.find((d) => d.id === dataId);
|
|
33
33
|
if (data !== undefined) {
|
|
34
34
|
const users = node.users.filter(([u]) => u.id !== this.#client.app.userId);
|
|
35
35
|
await this.#apiClient.cloud.shareDataInHistory.mutate({
|
|
@@ -72,7 +72,7 @@ export class SecrecyCloudClient {
|
|
|
72
72
|
});
|
|
73
73
|
return uploadData.dataId;
|
|
74
74
|
}
|
|
75
|
-
const
|
|
75
|
+
const uploadDataPartEnd = async (md5, order) => {
|
|
76
76
|
const { isUploadPartEnded } = await this.#apiClient.cloud.uploadDataPartEnd.mutate({
|
|
77
77
|
dataId: uploadData.dataId,
|
|
78
78
|
md5,
|
|
@@ -120,7 +120,7 @@ export class SecrecyCloudClient {
|
|
|
120
120
|
},
|
|
121
121
|
signal,
|
|
122
122
|
});
|
|
123
|
-
await
|
|
123
|
+
await uploadDataPartEnd(chunk.md5, chunk.order);
|
|
124
124
|
};
|
|
125
125
|
await promiseAllLimit(3, uploadData.parts.map((p) => async () => {
|
|
126
126
|
await byPart(p);
|
|
@@ -400,26 +400,26 @@ export class SecrecyCloudClient {
|
|
|
400
400
|
const data = dataCache.get(dataId);
|
|
401
401
|
if (data === undefined) {
|
|
402
402
|
const receivedMails = await this.#client.mail.receivedMails();
|
|
403
|
-
const mail = receivedMails.find((m) => m.
|
|
403
|
+
const mail = receivedMails.find((m) => m.attachments.some((f) => f.id === dataId));
|
|
404
404
|
if (mail === undefined) {
|
|
405
405
|
const err = {
|
|
406
406
|
name: 'ClientError',
|
|
407
407
|
code: 'NOT_FOUND',
|
|
408
|
-
message: `Can't find mail with the
|
|
408
|
+
message: `Can't find mail with the attachment ${dataId}`,
|
|
409
409
|
};
|
|
410
410
|
throw err;
|
|
411
411
|
}
|
|
412
|
-
const
|
|
413
|
-
if (
|
|
412
|
+
const attachment = mail.attachments.find((d) => d.id === dataId);
|
|
413
|
+
if (attachment === undefined) {
|
|
414
414
|
const err = {
|
|
415
415
|
name: 'ClientError',
|
|
416
416
|
code: 'NOT_FOUND',
|
|
417
|
-
message: `Can't find mail with the
|
|
417
|
+
message: `Can't find mail with the attachment ${dataId}`,
|
|
418
418
|
};
|
|
419
419
|
throw err;
|
|
420
420
|
}
|
|
421
421
|
const senderPubKey = await this.#client.app.userPublicKey(mail.sender.id);
|
|
422
|
-
const dataKey = decryptCryptoBox(sodium.from_hex(
|
|
422
|
+
const dataKey = decryptCryptoBox(sodium.from_hex(attachment.key), senderPubKey, this.#keys.privateKey);
|
|
423
423
|
key = sodium.to_hex(dataKey);
|
|
424
424
|
}
|
|
425
425
|
else {
|
|
@@ -132,7 +132,7 @@ export class SecrecyMailClient {
|
|
|
132
132
|
if (email === undefined) {
|
|
133
133
|
continue;
|
|
134
134
|
}
|
|
135
|
-
const input = await this._eachUser(draft.
|
|
135
|
+
const input = await this._eachUser(draft.attachments, draft.subject, draft.body, email);
|
|
136
136
|
if (input === null) {
|
|
137
137
|
temporaryRecipients.push(email);
|
|
138
138
|
}
|
|
@@ -141,7 +141,7 @@ export class SecrecyMailClient {
|
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
for (const { id } of draft.recipients) {
|
|
144
|
-
const input = await this._eachUser(draft.
|
|
144
|
+
const input = await this._eachUser(draft.attachments, draft.subject, draft.body, id);
|
|
145
145
|
if (input === null) {
|
|
146
146
|
temporaryRecipients.push(id);
|
|
147
147
|
}
|
|
@@ -167,7 +167,7 @@ export class SecrecyMailClient {
|
|
|
167
167
|
continue;
|
|
168
168
|
}
|
|
169
169
|
try {
|
|
170
|
-
const input = await this._eachUser(mail.
|
|
170
|
+
const input = await this._eachUser(mail.attachments, mail.subject, mail.body, email);
|
|
171
171
|
if (input === null) {
|
|
172
172
|
continue;
|
|
173
173
|
}
|
|
@@ -279,7 +279,7 @@ export class SecrecyMailClient {
|
|
|
279
279
|
attachments.push({
|
|
280
280
|
id: f.id,
|
|
281
281
|
name: sodium.to_hex(encryptCryptoBox(sodium.from_string(f.name), pubKey, this.#keys.privateKey)),
|
|
282
|
-
|
|
282
|
+
key: sodium.to_hex(encryptCryptoBox(sodium.from_hex(key), pubKey, this.#keys.privateKey)),
|
|
283
283
|
});
|
|
284
284
|
}
|
|
285
285
|
return {
|
|
@@ -30,7 +30,7 @@ export async function convertInternalMailToExternal({ client, mail, keyPair, })
|
|
|
30
30
|
temporaryRecipients: [], // TODO
|
|
31
31
|
recipients: mI.recipients,
|
|
32
32
|
sender: mail.sender,
|
|
33
|
-
|
|
33
|
+
attachments: mail.attachments.map((f) => {
|
|
34
34
|
const name = sodium.to_string(decryptCryptoBox(sodium.from_hex(f.name), pubKey, privateKey));
|
|
35
35
|
return {
|
|
36
36
|
id: f.dataId,
|
package/dist/types/client.d.ts
CHANGED
|
@@ -937,13 +937,13 @@ export declare const createTRPCClient: (session?: string | null | undefined, onA
|
|
|
937
937
|
};
|
|
938
938
|
_input_in: {
|
|
939
939
|
cloudNodeDaysForDelete?: number | null | undefined;
|
|
940
|
-
|
|
941
|
-
|
|
940
|
+
historyDataMaxCount?: number | null | undefined;
|
|
941
|
+
historyDataDaysForDelete?: number | null | undefined;
|
|
942
942
|
};
|
|
943
943
|
_input_out: {
|
|
944
944
|
cloudNodeDaysForDelete?: number | null | undefined;
|
|
945
|
-
|
|
946
|
-
|
|
945
|
+
historyDataMaxCount?: number | null | undefined;
|
|
946
|
+
historyDataDaysForDelete?: number | null | undefined;
|
|
947
947
|
};
|
|
948
948
|
_output_in: {
|
|
949
949
|
id: string;
|
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.
|
|
5
|
+
"version": "1.30.0-feat-rename-file.1",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "https://github.com/anonymize-org/lib.git"
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
76
|
"@secrecy/lib-utils": "^1.0.18",
|
|
77
|
-
"@secrecy/trpc-api-types": "1.27.0-feat-rename-file.
|
|
77
|
+
"@secrecy/trpc-api-types": "1.27.0-feat-rename-file.13",
|
|
78
78
|
"@trpc/client": "10.45.2",
|
|
79
79
|
"@trpc/server": "10.45.2",
|
|
80
80
|
"@types/libsodium-wrappers-sumo": "^0.7.8",
|