@secrecy/lib 1.7.0-integration-mixed-feats.3 → 1.7.0-integration-trpc-client.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 (273) hide show
  1. package/dist/lib/base-client.js +85 -0
  2. package/dist/lib/cache.js +4 -0
  3. package/dist/lib/client/SecrecyAppClient.js +81 -0
  4. package/dist/lib/client/SecrecyCloudClient.js +475 -0
  5. package/dist/lib/client/SecrecyDbClient.js +46 -0
  6. package/dist/lib/client/SecrecyMailClient.js +283 -0
  7. package/dist/lib/client/SecrecyPayClient.js +34 -0
  8. package/dist/lib/client/SecrecyWalletClient.js +50 -0
  9. package/dist/lib/client/convert/file.js +29 -0
  10. package/dist/lib/client/convert/mail.js +42 -0
  11. package/dist/lib/client/convert/node.js +98 -0
  12. package/dist/lib/client/helpers.js +107 -0
  13. package/dist/lib/client/index.js +43 -0
  14. package/dist/lib/client/storage.js +7 -0
  15. package/dist/lib/client/types/file.js +1 -0
  16. package/dist/lib/client/types/index.js +19 -0
  17. package/dist/lib/client/types/mail.js +1 -0
  18. package/dist/lib/client/types/node.js +1 -0
  19. package/dist/lib/client/types/user.js +1 -0
  20. package/dist/lib/client.js +38 -0
  21. package/dist/lib/crypto/file.js +184 -0
  22. package/dist/lib/crypto/index.js +41 -0
  23. package/dist/lib/error/client.js +10 -0
  24. package/dist/lib/error/index.js +10 -0
  25. package/dist/lib/error/server.js +27 -0
  26. package/dist/lib/index.js +10 -0
  27. package/dist/lib/minify/index.js +23 -0
  28. package/dist/lib/minify/lz4.js +517 -0
  29. package/dist/lib/sodium.js +5 -0
  30. package/dist/lib/types.js +1 -0
  31. package/dist/lib/utils/array.js +25 -0
  32. package/dist/lib/utils/base64.js +2 -0
  33. package/dist/lib/utils/popup-tools.js +180 -0
  34. package/dist/lib/utils/promise.js +20 -0
  35. package/dist/lib/utils/store-buddy.js +60 -0
  36. package/dist/lib/utils/time.js +13 -0
  37. package/dist/lib/worker/md5.js +18 -0
  38. package/dist/lib/worker/sodium.js +95 -0
  39. package/dist/{worker → lib/worker}/workerCodes.js +4 -4
  40. package/dist/types/base-client.d.ts +29 -0
  41. package/dist/types/cache.d.ts +9 -0
  42. package/dist/types/client/SecrecyAppClient.d.ts +18 -0
  43. package/dist/types/client/SecrecyCloudClient.d.ts +88 -0
  44. package/dist/types/client/SecrecyDbClient.d.ts +30 -0
  45. package/dist/types/client/SecrecyMailClient.d.ts +42 -0
  46. package/dist/types/client/SecrecyPayClient.d.ts +27 -0
  47. package/dist/types/client/SecrecyWalletClient.d.ts +27 -0
  48. package/dist/types/client/convert/file.d.ts +4 -0
  49. package/dist/types/client/convert/mail.d.ts +8 -0
  50. package/dist/types/client/convert/node.d.ts +7 -0
  51. package/dist/types/client/helpers.d.ts +25 -0
  52. package/dist/types/client/index.d.ts +25 -0
  53. package/dist/types/client/storage.d.ts +7 -0
  54. package/dist/types/client/types/file.d.ts +6 -0
  55. package/dist/types/client/types/index.d.ts +45 -0
  56. package/dist/types/client/types/mail.d.ts +87 -0
  57. package/dist/types/client/types/node.d.ts +51 -0
  58. package/dist/types/client/types/user.d.ts +3 -0
  59. package/dist/types/client.d.ts +9149 -0
  60. package/dist/types/crypto/file.d.ts +14 -0
  61. package/dist/types/crypto/index.d.ts +9 -0
  62. package/dist/types/error/client.d.ts +22 -0
  63. package/dist/types/error/index.d.ts +40 -0
  64. package/dist/types/error/server.d.ts +26 -0
  65. package/dist/types/index.d.ts +12 -0
  66. package/dist/types/minify/index.d.ts +2 -0
  67. package/dist/types/minify/lz4.d.ts +35 -0
  68. package/dist/types/sodium.d.ts +3 -0
  69. package/dist/types/types.d.ts +10 -0
  70. package/dist/types/utils/array.d.ts +3 -0
  71. package/dist/types/utils/base64.d.ts +1 -0
  72. package/dist/types/utils/popup-tools.d.ts +52 -0
  73. package/dist/types/utils/promise.d.ts +1 -0
  74. package/dist/types/utils/store-buddy.d.ts +130 -0
  75. package/dist/{utils → types/utils}/time.d.ts +2 -4
  76. package/dist/types/worker/md5.d.ts +1 -0
  77. package/dist/types/worker/sodium.d.ts +3 -0
  78. package/dist/types/worker/workerCodes.d.ts +2 -0
  79. package/package.json +48 -73
  80. package/dist/BaseClient-2af8a400.d.ts +0 -405
  81. package/dist/BaseClient.cjs +0 -2
  82. package/dist/BaseClient.cjs.map +0 -1
  83. package/dist/BaseClient.d.ts +0 -16
  84. package/dist/BaseClient.js +0 -2
  85. package/dist/BaseClient.js.map +0 -1
  86. package/dist/PopupTools.cjs +0 -2
  87. package/dist/PopupTools.cjs.map +0 -1
  88. package/dist/PopupTools.d.ts +0 -18
  89. package/dist/PopupTools.js +0 -2
  90. package/dist/PopupTools.js.map +0 -1
  91. package/dist/ZeusThunder.cjs +0 -2
  92. package/dist/ZeusThunder.cjs.map +0 -1
  93. package/dist/ZeusThunder.d.ts +0 -6
  94. package/dist/ZeusThunder.js +0 -2
  95. package/dist/ZeusThunder.js.map +0 -1
  96. package/dist/cache.cjs +0 -2
  97. package/dist/cache.cjs.map +0 -1
  98. package/dist/cache.d.ts +0 -24
  99. package/dist/cache.js +0 -2
  100. package/dist/cache.js.map +0 -1
  101. package/dist/client/SecrecyAppClient.cjs +0 -2
  102. package/dist/client/SecrecyAppClient.cjs.map +0 -1
  103. package/dist/client/SecrecyAppClient.d.ts +0 -16
  104. package/dist/client/SecrecyAppClient.js +0 -2
  105. package/dist/client/SecrecyAppClient.js.map +0 -1
  106. package/dist/client/SecrecyCloudClient.cjs +0 -2
  107. package/dist/client/SecrecyCloudClient.cjs.map +0 -1
  108. package/dist/client/SecrecyCloudClient.d.ts +0 -16
  109. package/dist/client/SecrecyCloudClient.js +0 -2
  110. package/dist/client/SecrecyCloudClient.js.map +0 -1
  111. package/dist/client/SecrecyDbClient.cjs +0 -2
  112. package/dist/client/SecrecyDbClient.cjs.map +0 -1
  113. package/dist/client/SecrecyDbClient.d.ts +0 -16
  114. package/dist/client/SecrecyDbClient.js +0 -2
  115. package/dist/client/SecrecyDbClient.js.map +0 -1
  116. package/dist/client/SecrecyMailClient.cjs +0 -2
  117. package/dist/client/SecrecyMailClient.cjs.map +0 -1
  118. package/dist/client/SecrecyMailClient.d.ts +0 -16
  119. package/dist/client/SecrecyMailClient.js +0 -2
  120. package/dist/client/SecrecyMailClient.js.map +0 -1
  121. package/dist/client/SecrecyPayClient.cjs +0 -2
  122. package/dist/client/SecrecyPayClient.cjs.map +0 -1
  123. package/dist/client/SecrecyPayClient.d.ts +0 -16
  124. package/dist/client/SecrecyPayClient.js +0 -2
  125. package/dist/client/SecrecyPayClient.js.map +0 -1
  126. package/dist/client/SecrecyWalletClient.cjs +0 -2
  127. package/dist/client/SecrecyWalletClient.cjs.map +0 -1
  128. package/dist/client/SecrecyWalletClient.d.ts +0 -16
  129. package/dist/client/SecrecyWalletClient.js +0 -2
  130. package/dist/client/SecrecyWalletClient.js.map +0 -1
  131. package/dist/client/convert/file.cjs +0 -2
  132. package/dist/client/convert/file.cjs.map +0 -1
  133. package/dist/client/convert/file.d.ts +0 -11
  134. package/dist/client/convert/file.js +0 -2
  135. package/dist/client/convert/file.js.map +0 -1
  136. package/dist/client/convert/mail.cjs +0 -2
  137. package/dist/client/convert/mail.cjs.map +0 -1
  138. package/dist/client/convert/mail.d.ts +0 -13
  139. package/dist/client/convert/mail.js +0 -2
  140. package/dist/client/convert/mail.js.map +0 -1
  141. package/dist/client/convert/node.cjs +0 -2
  142. package/dist/client/convert/node.cjs.map +0 -1
  143. package/dist/client/convert/node.d.ts +0 -18
  144. package/dist/client/convert/node.js +0 -2
  145. package/dist/client/convert/node.js.map +0 -1
  146. package/dist/client/helpers.cjs +0 -2
  147. package/dist/client/helpers.cjs.map +0 -1
  148. package/dist/client/helpers.d.ts +0 -16
  149. package/dist/client/helpers.js +0 -2
  150. package/dist/client/helpers.js.map +0 -1
  151. package/dist/client/index.cjs +0 -2
  152. package/dist/client/index.cjs.map +0 -1
  153. package/dist/client/index.d.ts +0 -16
  154. package/dist/client/index.js +0 -2
  155. package/dist/client/index.js.map +0 -1
  156. package/dist/client/storage.cjs +0 -2
  157. package/dist/client/storage.cjs.map +0 -1
  158. package/dist/client/storage.d.ts +0 -10
  159. package/dist/client/storage.js +0 -2
  160. package/dist/client/storage.js.map +0 -1
  161. package/dist/client/types/File.cjs +0 -1
  162. package/dist/client/types/File.cjs.map +0 -1
  163. package/dist/client/types/File.d.ts +0 -18
  164. package/dist/client/types/File.js +0 -1
  165. package/dist/client/types/File.js.map +0 -1
  166. package/dist/client/types/Inputs.cjs +0 -1
  167. package/dist/client/types/Inputs.cjs.map +0 -1
  168. package/dist/client/types/Inputs.d.ts +0 -18
  169. package/dist/client/types/Inputs.js +0 -1
  170. package/dist/client/types/Inputs.js.map +0 -1
  171. package/dist/client/types/Node.cjs +0 -1
  172. package/dist/client/types/Node.cjs.map +0 -1
  173. package/dist/client/types/Node.d.ts +0 -9
  174. package/dist/client/types/Node.js +0 -1
  175. package/dist/client/types/Node.js.map +0 -1
  176. package/dist/client/types/UserAppNotifications.cjs +0 -1
  177. package/dist/client/types/UserAppNotifications.cjs.map +0 -1
  178. package/dist/client/types/UserAppNotifications.d.ts +0 -8
  179. package/dist/client/types/UserAppNotifications.js +0 -1
  180. package/dist/client/types/UserAppNotifications.js.map +0 -1
  181. package/dist/client/types/UserAppSettings.cjs +0 -1
  182. package/dist/client/types/UserAppSettings.cjs.map +0 -1
  183. package/dist/client/types/UserAppSettings.d.ts +0 -7
  184. package/dist/client/types/UserAppSettings.js +0 -1
  185. package/dist/client/types/UserAppSettings.js.map +0 -1
  186. package/dist/client/types/index.cjs +0 -2
  187. package/dist/client/types/index.cjs.map +0 -1
  188. package/dist/client/types/index.d.ts +0 -176
  189. package/dist/client/types/index.js +0 -2
  190. package/dist/client/types/index.js.map +0 -1
  191. package/dist/client/types/selectors.cjs +0 -2
  192. package/dist/client/types/selectors.cjs.map +0 -1
  193. package/dist/client/types/selectors.d.ts +0 -402
  194. package/dist/client/types/selectors.js +0 -2
  195. package/dist/client/types/selectors.js.map +0 -1
  196. package/dist/crypto/file.cjs +0 -2
  197. package/dist/crypto/file.cjs.map +0 -1
  198. package/dist/crypto/file.d.ts +0 -16
  199. package/dist/crypto/file.js +0 -2
  200. package/dist/crypto/file.js.map +0 -1
  201. package/dist/crypto/index.cjs +0 -2
  202. package/dist/crypto/index.cjs.map +0 -1
  203. package/dist/crypto/index.d.ts +0 -14
  204. package/dist/crypto/index.js +0 -2
  205. package/dist/crypto/index.js.map +0 -1
  206. package/dist/error.cjs +0 -1
  207. package/dist/error.cjs.map +0 -1
  208. package/dist/error.d.ts +0 -38
  209. package/dist/error.js +0 -1
  210. package/dist/error.js.map +0 -1
  211. package/dist/index.cjs +0 -2
  212. package/dist/index.cjs.map +0 -1
  213. package/dist/index.d.ts +0 -19
  214. package/dist/index.js +0 -2
  215. package/dist/index.js.map +0 -1
  216. package/dist/minify/index.cjs +0 -2
  217. package/dist/minify/index.cjs.map +0 -1
  218. package/dist/minify/index.d.ts +0 -4
  219. package/dist/minify/index.js +0 -2
  220. package/dist/minify/index.js.map +0 -1
  221. package/dist/minify/lz4.cjs +0 -3
  222. package/dist/minify/lz4.cjs.map +0 -1
  223. package/dist/minify/lz4.d.ts +0 -7
  224. package/dist/minify/lz4.js +0 -3
  225. package/dist/minify/lz4.js.map +0 -1
  226. package/dist/sodium.cjs +0 -2
  227. package/dist/sodium.cjs.map +0 -1
  228. package/dist/sodium.d.ts +0 -5
  229. package/dist/sodium.js +0 -2
  230. package/dist/sodium.js.map +0 -1
  231. package/dist/utils/encoders.cjs +0 -2
  232. package/dist/utils/encoders.cjs.map +0 -1
  233. package/dist/utils/encoders.d.ts +0 -28
  234. package/dist/utils/encoders.js +0 -2
  235. package/dist/utils/encoders.js.map +0 -1
  236. package/dist/utils/store-buddy.cjs +0 -2
  237. package/dist/utils/store-buddy.cjs.map +0 -1
  238. package/dist/utils/store-buddy.d.ts +0 -15
  239. package/dist/utils/store-buddy.js +0 -2
  240. package/dist/utils/store-buddy.js.map +0 -1
  241. package/dist/utils/time.cjs +0 -2
  242. package/dist/utils/time.cjs.map +0 -1
  243. package/dist/utils/time.js +0 -2
  244. package/dist/utils/time.js.map +0 -1
  245. package/dist/utils/utils.cjs +0 -2
  246. package/dist/utils/utils.cjs.map +0 -1
  247. package/dist/utils/utils.d.ts +0 -6
  248. package/dist/utils/utils.js +0 -2
  249. package/dist/utils/utils.js.map +0 -1
  250. package/dist/worker/md5.cjs +0 -2
  251. package/dist/worker/md5.cjs.map +0 -1
  252. package/dist/worker/md5.d.ts +0 -3
  253. package/dist/worker/md5.js +0 -2
  254. package/dist/worker/md5.js.map +0 -1
  255. package/dist/worker/sodium.cjs +0 -2
  256. package/dist/worker/sodium.cjs.map +0 -1
  257. package/dist/worker/sodium.d.ts +0 -6
  258. package/dist/worker/sodium.js +0 -2
  259. package/dist/worker/sodium.js.map +0 -1
  260. package/dist/worker/workerCodes.cjs +0 -254
  261. package/dist/worker/workerCodes.cjs.map +0 -1
  262. package/dist/worker/workerCodes.d.ts +0 -4
  263. package/dist/worker/workerCodes.js.map +0 -1
  264. package/dist/zeus/const.cjs +0 -2
  265. package/dist/zeus/const.cjs.map +0 -1
  266. package/dist/zeus/const.d.ts +0 -9
  267. package/dist/zeus/const.js +0 -2
  268. package/dist/zeus/const.js.map +0 -1
  269. package/dist/zeus/index.cjs +0 -5
  270. package/dist/zeus/index.cjs.map +0 -1
  271. package/dist/zeus/index.d.ts +0 -9428
  272. package/dist/zeus/index.js +0 -5
  273. package/dist/zeus/index.js.map +0 -1
@@ -0,0 +1,27 @@
1
+ import type { SecrecyClient, InfuraNetwork } from '../index.js';
2
+ import { type TransactionRequest } from 'ethers';
3
+ interface SuccessWalletResponse<T> {
4
+ success: true;
5
+ data: T;
6
+ }
7
+ interface ErrorWalletResponse {
8
+ success: false;
9
+ error: string;
10
+ }
11
+ export type SecrecyWalletResponse<T> = SuccessWalletResponse<T> | ErrorWalletResponse;
12
+ export declare class SecrecyWalletClient {
13
+ #private;
14
+ constructor(client: SecrecyClient);
15
+ createTransaction({ network, tx, }: {
16
+ network?: InfuraNetwork;
17
+ tx: TransactionRequest;
18
+ }): Promise<SecrecyWalletResponse<{
19
+ id: string;
20
+ hash: string;
21
+ }>>;
22
+ createSignature({ network, message, }: {
23
+ network?: InfuraNetwork;
24
+ message: string;
25
+ }): Promise<SecrecyWalletResponse<string>>;
26
+ }
27
+ export {};
@@ -0,0 +1,4 @@
1
+ import type { ApiFile, InternalFile, FileMetadata, KeyPair } from '../types/index.js';
2
+ export declare function apiFileToInternal(apiFile: ApiFile, keyPair: KeyPair): InternalFile;
3
+ export declare function internalFileToFile(internal: InternalFile): FileMetadata;
4
+ export declare function apiFileToExternal(apiFile: ApiFile, keyPair: KeyPair): FileMetadata;
@@ -0,0 +1,8 @@
1
+ import { type Mail, type SecrecyClient } from '../../index.js';
2
+ import { type KeyPair } from '../types/index.js';
3
+ import { type ApiMail } from '../types/mail.js';
4
+ export declare function convertInternalMailToExternal({ client, mail, keyPair, }: {
5
+ mail: ApiMail;
6
+ client: SecrecyClient;
7
+ keyPair: KeyPair;
8
+ }): Promise<Mail>;
@@ -0,0 +1,7 @@
1
+ import type { Node, ApiNode, InternalNode, ApiNodeFull, InternalNodeFull, NodeFull, KeyPair } from '../types/index.js';
2
+ export declare function apiNodeToInternal(apiNode: ApiNode | ApiNodeFull, keyPair: KeyPair): Promise<InternalNode>;
3
+ export declare function apiNodeFullToInternalFull(apiNodeFull: ApiNodeFull, keyPair: KeyPair): Promise<InternalNodeFull>;
4
+ export declare function internalNodeToNode(internal: InternalNode): Node;
5
+ export declare function internalNodeFullToNodeFull(internal: InternalNodeFull): NodeFull;
6
+ export declare function apiNodeToExternalNodeFull(apiNodeFull: ApiNodeFull, keyPair: KeyPair): Promise<NodeFull>;
7
+ export declare function apiNodeToExternal(apiNode: ApiNode, keyPair: KeyPair): Promise<Node>;
@@ -0,0 +1,25 @@
1
+ import { SecrecyClient } from './index.js';
2
+ import { type SecrecyUserApp } from './types/index.js';
3
+ export declare function parseInfos(): SecrecyUserApp | null;
4
+ export declare const getUrl: ({ hash, path, }: {
5
+ hash: string;
6
+ path: string;
7
+ }) => string;
8
+ export interface HashInfos {
9
+ appUrl: string;
10
+ backPath?: string;
11
+ appCode?: string | null | undefined;
12
+ path?: string | null | undefined;
13
+ redirect?: boolean;
14
+ scopes?: {
15
+ email: boolean;
16
+ };
17
+ }
18
+ export type UseSecrecyParams = Omit<HashInfos, 'appUrl'> & {
19
+ session?: boolean | undefined;
20
+ };
21
+ export type Value<T extends UseSecrecyParams> = T extends {
22
+ redirect: true;
23
+ } ? SecrecyClient | null : SecrecyClient;
24
+ export declare function getSecrecyClient(session?: boolean | undefined): SecrecyClient | null;
25
+ export declare function login<T extends UseSecrecyParams>({ appCode, path, redirect, scopes, backPath, session, }: T): Promise<Value<T>>;
@@ -0,0 +1,25 @@
1
+ import { BaseClient } from '../base-client.js';
2
+ import type { Progress } from '../crypto/file.js';
3
+ import { SecrecyCloudClient } from './SecrecyCloudClient.js';
4
+ import { SecrecyMailClient } from './SecrecyMailClient.js';
5
+ import { SecrecyAppClient } from './SecrecyAppClient.js';
6
+ import { SecrecyDbClient } from './SecrecyDbClient.js';
7
+ import { SecrecyWalletClient } from './SecrecyWalletClient.js';
8
+ import { SecrecyPayClient } from './SecrecyPayClient.js';
9
+ import { type RouterInputs } from '../client.js';
10
+ import { type KeyPair } from './types/index.js';
11
+ export type NewMail = Pick<RouterInputs['mail']['createDraft'], 'body' | 'subject' | 'senderFiles' | 'recipients' | 'replyToId'>;
12
+ export type ProgressCallback = (progress: Progress) => Promise<void>;
13
+ export declare const encryptName: (name: string, nameKey: string) => Promise<string>;
14
+ export declare class SecrecyClient extends BaseClient {
15
+ #private;
16
+ cloud: SecrecyCloudClient;
17
+ mail: SecrecyMailClient;
18
+ app: SecrecyAppClient;
19
+ db: SecrecyDbClient;
20
+ wallet: SecrecyWalletClient;
21
+ pay: SecrecyPayClient;
22
+ constructor(uaSession: string, uaKeys: KeyPair, uaJwt: string);
23
+ get publicKey(): string;
24
+ logout(sessionId?: string | null | undefined): Promise<void>;
25
+ }
@@ -0,0 +1,7 @@
1
+ import type { StoreBuddy } from '../utils/store-buddy.js';
2
+ import { type KeyPair } from './types/index.js';
3
+ export declare function getStorage(session?: boolean | undefined): {
4
+ userAppKeys: StoreBuddy<KeyPair | null>;
5
+ userAppSession: StoreBuddy<string | null>;
6
+ jwt: StoreBuddy<string | null>;
7
+ };
@@ -0,0 +1,6 @@
1
+ import { type RouterOutputs } from '../../client.js';
2
+ export type FileMetadata = Pick<ApiFile, 'id' | 'size' | 'sizeBefore' | 'md5' | 'md5Encrypted' | 'createdAt'>;
3
+ export type InternalFile = FileMetadata & {
4
+ key: string;
5
+ };
6
+ export type ApiFile = NonNullable<RouterOutputs['cloud']['fileById']>;
@@ -0,0 +1,45 @@
1
+ import { z } from 'zod';
2
+ export * from './file.js';
3
+ export * from './node.js';
4
+ export * from './mail.js';
5
+ export * from './user.js';
6
+ declare const keyPair: z.ZodObject<{
7
+ publicKey: z.ZodString;
8
+ privateKey: z.ZodString;
9
+ }, "strict", z.ZodTypeAny, {
10
+ publicKey: string;
11
+ privateKey: string;
12
+ }, {
13
+ publicKey: string;
14
+ privateKey: string;
15
+ }>;
16
+ export type KeyPair = z.infer<typeof keyPair>;
17
+ export declare const secrecyUserApp: z.ZodReadonly<z.ZodObject<{
18
+ keys: z.ZodObject<{
19
+ publicKey: z.ZodString;
20
+ privateKey: z.ZodString;
21
+ }, "strict", z.ZodTypeAny, {
22
+ publicKey: string;
23
+ privateKey: string;
24
+ }, {
25
+ publicKey: string;
26
+ privateKey: string;
27
+ }>;
28
+ jwt: z.ZodString;
29
+ uaSession: z.ZodString;
30
+ }, "strict", z.ZodTypeAny, {
31
+ keys: {
32
+ publicKey: string;
33
+ privateKey: string;
34
+ };
35
+ jwt: string;
36
+ uaSession: string;
37
+ }, {
38
+ keys: {
39
+ publicKey: string;
40
+ privateKey: string;
41
+ };
42
+ jwt: string;
43
+ uaSession: string;
44
+ }>>;
45
+ export type SecrecyUserApp = z.infer<typeof secrecyUserApp>;
@@ -0,0 +1,87 @@
1
+ import { type RouterOutputs } from '../../client.js';
2
+ import { type PublicUser } from './user.js';
3
+ export type MailType = 'sent' | 'received' | 'draft';
4
+ export type ApiMail = RouterOutputs['mail']['byId'];
5
+ export interface BaseMail {
6
+ type: MailType;
7
+ id: string;
8
+ mailIntegrityId: string;
9
+ replyTo?: string;
10
+ body: string;
11
+ subject: string;
12
+ createdAt: Date;
13
+ deletedAt: Date | null;
14
+ openedAt: Date | null;
15
+ isAltered: boolean;
16
+ recipients: Array<Omit<PublicUser, 'publicKey'>>;
17
+ temporaryRecipients: TemporaryMailUser[];
18
+ files: Array<{
19
+ id: string;
20
+ name: string;
21
+ key: string;
22
+ }>;
23
+ }
24
+ export interface ReceivedMail extends BaseMail {
25
+ type: 'received';
26
+ sender: PublicUser;
27
+ }
28
+ export interface InternalSentMail {
29
+ user: {
30
+ sentMails: ApiMail[];
31
+ };
32
+ }
33
+ export interface InternalDraftMails {
34
+ user: {
35
+ draftMails: ApiMail[];
36
+ };
37
+ }
38
+ export interface SentMail extends BaseMail {
39
+ type: 'sent';
40
+ }
41
+ export interface DraftMail extends BaseMail {
42
+ type: 'draft';
43
+ }
44
+ export type Mail = DraftMail | SentMail | ReceivedMail;
45
+ export interface MailIntegrity {
46
+ id: string;
47
+ hash: string;
48
+ hashKey: string;
49
+ replyTo?: {
50
+ id: string;
51
+ };
52
+ temporaryRecipients: TemporaryMailUser[];
53
+ recipients: PublicUser[];
54
+ }
55
+ export type MailIntegrityDraft = MailIntegrity & {
56
+ recipients: PublicUser[];
57
+ };
58
+ export interface TemporaryMailUser {
59
+ email?: string;
60
+ }
61
+ export interface InternalWaitingReceivedMail {
62
+ sender: PublicUser;
63
+ date: string;
64
+ attachmentsCount: number;
65
+ recipients: PublicUser[];
66
+ temporaryRecipients: TemporaryMailUser[];
67
+ }
68
+ export interface WaitingReceivedMail {
69
+ id: string;
70
+ sender: PublicUser;
71
+ date: Date;
72
+ attachmentsCount: number;
73
+ recipients: PublicUser[];
74
+ temporaryRecipients: TemporaryMailUser[];
75
+ }
76
+ export interface MailFile {
77
+ fileKey: string;
78
+ filename: string;
79
+ file: {
80
+ id: string;
81
+ };
82
+ }
83
+ export interface InternalReceivedMail {
84
+ user: {
85
+ receivedMails: ApiMail[];
86
+ };
87
+ }
@@ -0,0 +1,51 @@
1
+ import { type RouterOutputs } from '../../client.js';
2
+ import type { FileMetadata, InternalFile, PublicUser } from './index.js';
3
+ export type Rights = ApiNode['users'][number][1];
4
+ export type NodeAccess<T extends Record<string, unknown> = Record<string, unknown>> = T & {
5
+ rights: Rights;
6
+ isRoot: boolean;
7
+ sharedByPubKey: string;
8
+ };
9
+ export interface NodeBreadcrumbItem {
10
+ id: string;
11
+ name: string;
12
+ }
13
+ export interface NodeBreadcrumbItemWithPubKey extends NodeBreadcrumbItem {
14
+ pubKey: string;
15
+ }
16
+ export interface NodeSize {
17
+ size: bigint;
18
+ sizeBefore: bigint;
19
+ }
20
+ type NameKey = {
21
+ nameKey: string | null;
22
+ };
23
+ export type InternalNodeBreadcrumbItem = NodeBreadcrumbItemWithPubKey & NameKey;
24
+ export interface Node<T extends NodeBreadcrumbItem = NodeBreadcrumbItem, U extends Record<string, unknown> = Record<string, unknown>> {
25
+ id: string;
26
+ isFavorite: boolean;
27
+ type: NodeType;
28
+ createdAt: Date;
29
+ deletedAt: Date | null;
30
+ updatedAt: Date;
31
+ sizes: NodeSize;
32
+ name: string;
33
+ breadcrumb: T[];
34
+ createdBy: PublicUser;
35
+ access: NodeAccess<U>;
36
+ users: Array<[PublicUser, Rights]>;
37
+ parentId: string | null;
38
+ currentFileId: string | null;
39
+ }
40
+ export type NodeFull<T extends NodeBreadcrumbItem = NodeBreadcrumbItem, U extends Record<string, unknown> = Record<string, unknown>, V extends FileMetadata = FileMetadata> = Node<T, U> & {
41
+ parent: Node<T, U> | null;
42
+ children: Array<Node<T, U>>;
43
+ current?: V;
44
+ history: V[];
45
+ };
46
+ export type InternalNode = Node<InternalNodeBreadcrumbItem, NameKey>;
47
+ export type InternalNodeFull = NodeFull<InternalNodeBreadcrumbItem, NameKey, InternalFile>;
48
+ export type ApiNode = RouterOutputs['cloud']['nodeById'];
49
+ export type ApiNodeFull = RouterOutputs['cloud']['nodeFullById'];
50
+ export type NodeType = ApiNode['type'];
51
+ export {};
@@ -0,0 +1,3 @@
1
+ import { type RouterOutputs } from '../../client.js';
2
+ export type SelfUser = RouterOutputs['user']['self'];
3
+ export type PublicUser = RouterOutputs['user']['byId'];