@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.
@@ -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
- historyFileDaysForDelete: settings.historyDataDaysForDelete,
86
- historyMaxFileCount: settings.historyDataMaxCount,
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((f) => f.id === dataId);
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 uploadPartEnded = async (md5, order) => {
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 uploadPartEnded(chunk.md5, chunk.order);
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.data.some((f) => f.id === dataId));
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 data ${dataId}`,
408
+ message: `Can't find mail with the attachment ${dataId}`,
409
409
  };
410
410
  throw err;
411
411
  }
412
- const dataMail = mail.data.find((f) => f.id === dataId);
413
- if (dataMail === undefined) {
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 data ${dataId}`,
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(dataMail.key), senderPubKey, this.#keys.privateKey);
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.data, draft.subject, draft.body, email);
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.data, draft.subject, draft.body, id);
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.data, mail.subject, mail.body, email);
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
- dataKey: sodium.to_hex(encryptCryptoBox(sodium.from_hex(key), pubKey, this.#keys.privateKey)),
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
- data: mail.attachments.map((f) => {
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,
@@ -15,7 +15,7 @@ export interface BaseMail {
15
15
  isAltered: boolean;
16
16
  recipients: Array<Omit<PublicUser, 'publicKey'>>;
17
17
  temporaryRecipients: TemporaryMailUser[];
18
- data: Array<{
18
+ attachments: Array<{
19
19
  id: string;
20
20
  name: string;
21
21
  key: string;
@@ -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
- historyFileDaysForDelete?: number | null | undefined;
941
- historyMaxFileCount?: number | null | undefined;
940
+ historyDataMaxCount?: number | null | undefined;
941
+ historyDataDaysForDelete?: number | null | undefined;
942
942
  };
943
943
  _input_out: {
944
944
  cloudNodeDaysForDelete?: number | null | undefined;
945
- historyFileDaysForDelete?: number | null | undefined;
946
- historyMaxFileCount?: number | null | undefined;
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.29.0-feat-rename-file.3",
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.12",
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",