@secrecy/lib 1.0.0-dev.68 → 1.0.0-dev.69

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 (196) hide show
  1. package/dist/index.cjs +257 -2
  2. package/dist/index.d.ts +5016 -18
  3. package/dist/index.js +257 -2
  4. package/package.json +4 -4
  5. package/dist/BaseClient-e5e97df7.d.ts +0 -351
  6. package/dist/BaseClient.cjs +0 -2
  7. package/dist/BaseClient.cjs.map +0 -1
  8. package/dist/BaseClient.d.ts +0 -16
  9. package/dist/BaseClient.js +0 -2
  10. package/dist/BaseClient.js.map +0 -1
  11. package/dist/PopupTools.cjs +0 -2
  12. package/dist/PopupTools.cjs.map +0 -1
  13. package/dist/PopupTools.d.ts +0 -18
  14. package/dist/PopupTools.js +0 -2
  15. package/dist/PopupTools.js.map +0 -1
  16. package/dist/ZeusThunder.cjs +0 -2
  17. package/dist/ZeusThunder.cjs.map +0 -1
  18. package/dist/ZeusThunder.d.ts +0 -6
  19. package/dist/ZeusThunder.js +0 -2
  20. package/dist/ZeusThunder.js.map +0 -1
  21. package/dist/cache.cjs +0 -2
  22. package/dist/cache.cjs.map +0 -1
  23. package/dist/cache.d.ts +0 -24
  24. package/dist/cache.js +0 -2
  25. package/dist/cache.js.map +0 -1
  26. package/dist/chunk-UPFDSEKI.js +0 -2
  27. package/dist/chunk-UPFDSEKI.js.map +0 -1
  28. package/dist/chunk-XDPEU3HV.cjs +0 -2
  29. package/dist/chunk-XDPEU3HV.cjs.map +0 -1
  30. package/dist/client/SecrecyAppClient.cjs +0 -2
  31. package/dist/client/SecrecyAppClient.cjs.map +0 -1
  32. package/dist/client/SecrecyAppClient.d.ts +0 -16
  33. package/dist/client/SecrecyAppClient.js +0 -2
  34. package/dist/client/SecrecyAppClient.js.map +0 -1
  35. package/dist/client/SecrecyCloudClient.cjs +0 -2
  36. package/dist/client/SecrecyCloudClient.cjs.map +0 -1
  37. package/dist/client/SecrecyCloudClient.d.ts +0 -16
  38. package/dist/client/SecrecyCloudClient.js +0 -2
  39. package/dist/client/SecrecyCloudClient.js.map +0 -1
  40. package/dist/client/SecrecyDbClient.cjs +0 -2
  41. package/dist/client/SecrecyDbClient.cjs.map +0 -1
  42. package/dist/client/SecrecyDbClient.d.ts +0 -16
  43. package/dist/client/SecrecyDbClient.js +0 -2
  44. package/dist/client/SecrecyDbClient.js.map +0 -1
  45. package/dist/client/SecrecyMailClient.cjs +0 -2
  46. package/dist/client/SecrecyMailClient.cjs.map +0 -1
  47. package/dist/client/SecrecyMailClient.d.ts +0 -16
  48. package/dist/client/SecrecyMailClient.js +0 -2
  49. package/dist/client/SecrecyMailClient.js.map +0 -1
  50. package/dist/client/SecrecyPayClient.cjs +0 -2
  51. package/dist/client/SecrecyPayClient.cjs.map +0 -1
  52. package/dist/client/SecrecyPayClient.d.ts +0 -16
  53. package/dist/client/SecrecyPayClient.js +0 -2
  54. package/dist/client/SecrecyPayClient.js.map +0 -1
  55. package/dist/client/SecrecyWalletClient.cjs +0 -2
  56. package/dist/client/SecrecyWalletClient.cjs.map +0 -1
  57. package/dist/client/SecrecyWalletClient.d.ts +0 -16
  58. package/dist/client/SecrecyWalletClient.js +0 -2
  59. package/dist/client/SecrecyWalletClient.js.map +0 -1
  60. package/dist/client/convert/file.cjs +0 -2
  61. package/dist/client/convert/file.cjs.map +0 -1
  62. package/dist/client/convert/file.d.ts +0 -11
  63. package/dist/client/convert/file.js +0 -2
  64. package/dist/client/convert/file.js.map +0 -1
  65. package/dist/client/convert/mail.cjs +0 -2
  66. package/dist/client/convert/mail.cjs.map +0 -1
  67. package/dist/client/convert/mail.d.ts +0 -13
  68. package/dist/client/convert/mail.js +0 -2
  69. package/dist/client/convert/mail.js.map +0 -1
  70. package/dist/client/convert/node.cjs +0 -2
  71. package/dist/client/convert/node.cjs.map +0 -1
  72. package/dist/client/convert/node.d.ts +0 -18
  73. package/dist/client/convert/node.js +0 -2
  74. package/dist/client/convert/node.js.map +0 -1
  75. package/dist/client/helpers.cjs +0 -2
  76. package/dist/client/helpers.cjs.map +0 -1
  77. package/dist/client/helpers.d.ts +0 -16
  78. package/dist/client/helpers.js +0 -2
  79. package/dist/client/helpers.js.map +0 -1
  80. package/dist/client/index.cjs +0 -2
  81. package/dist/client/index.cjs.map +0 -1
  82. package/dist/client/index.d.ts +0 -16
  83. package/dist/client/index.js +0 -2
  84. package/dist/client/index.js.map +0 -1
  85. package/dist/client/storage.cjs +0 -2
  86. package/dist/client/storage.cjs.map +0 -1
  87. package/dist/client/storage.d.ts +0 -10
  88. package/dist/client/storage.js +0 -2
  89. package/dist/client/storage.js.map +0 -1
  90. package/dist/client/types/File.cjs +0 -1
  91. package/dist/client/types/File.cjs.map +0 -1
  92. package/dist/client/types/File.d.ts +0 -18
  93. package/dist/client/types/File.js +0 -1
  94. package/dist/client/types/File.js.map +0 -1
  95. package/dist/client/types/Inputs.cjs +0 -1
  96. package/dist/client/types/Inputs.cjs.map +0 -1
  97. package/dist/client/types/Inputs.d.ts +0 -18
  98. package/dist/client/types/Inputs.js +0 -1
  99. package/dist/client/types/Inputs.js.map +0 -1
  100. package/dist/client/types/Node.cjs +0 -1
  101. package/dist/client/types/Node.cjs.map +0 -1
  102. package/dist/client/types/Node.d.ts +0 -9
  103. package/dist/client/types/Node.js +0 -1
  104. package/dist/client/types/Node.js.map +0 -1
  105. package/dist/client/types/UserAppNotifications.cjs +0 -1
  106. package/dist/client/types/UserAppNotifications.cjs.map +0 -1
  107. package/dist/client/types/UserAppNotifications.d.ts +0 -8
  108. package/dist/client/types/UserAppNotifications.js +0 -1
  109. package/dist/client/types/UserAppNotifications.js.map +0 -1
  110. package/dist/client/types/UserAppSettings.cjs +0 -1
  111. package/dist/client/types/UserAppSettings.cjs.map +0 -1
  112. package/dist/client/types/UserAppSettings.d.ts +0 -7
  113. package/dist/client/types/UserAppSettings.js +0 -1
  114. package/dist/client/types/UserAppSettings.js.map +0 -1
  115. package/dist/client/types/index.cjs +0 -2
  116. package/dist/client/types/index.cjs.map +0 -1
  117. package/dist/client/types/index.d.ts +0 -176
  118. package/dist/client/types/index.js +0 -2
  119. package/dist/client/types/index.js.map +0 -1
  120. package/dist/client/types/selectors.cjs +0 -2
  121. package/dist/client/types/selectors.cjs.map +0 -1
  122. package/dist/client/types/selectors.d.ts +0 -402
  123. package/dist/client/types/selectors.js +0 -2
  124. package/dist/client/types/selectors.js.map +0 -1
  125. package/dist/crypto/file.cjs +0 -2
  126. package/dist/crypto/file.cjs.map +0 -1
  127. package/dist/crypto/file.d.ts +0 -16
  128. package/dist/crypto/file.js +0 -2
  129. package/dist/crypto/file.js.map +0 -1
  130. package/dist/crypto/index.cjs +0 -2
  131. package/dist/crypto/index.cjs.map +0 -1
  132. package/dist/crypto/index.d.ts +0 -14
  133. package/dist/crypto/index.js +0 -2
  134. package/dist/crypto/index.js.map +0 -1
  135. package/dist/error.cjs +0 -1
  136. package/dist/error.cjs.map +0 -1
  137. package/dist/error.d.ts +0 -35
  138. package/dist/error.js +0 -1
  139. package/dist/error.js.map +0 -1
  140. package/dist/index.cjs.map +0 -1
  141. package/dist/index.js.map +0 -1
  142. package/dist/minify/index.cjs +0 -2
  143. package/dist/minify/index.cjs.map +0 -1
  144. package/dist/minify/index.d.ts +0 -4
  145. package/dist/minify/index.js +0 -2
  146. package/dist/minify/index.js.map +0 -1
  147. package/dist/minify/lz4.cjs +0 -3
  148. package/dist/minify/lz4.cjs.map +0 -1
  149. package/dist/minify/lz4.d.ts +0 -7
  150. package/dist/minify/lz4.js +0 -3
  151. package/dist/minify/lz4.js.map +0 -1
  152. package/dist/sodium.cjs +0 -2
  153. package/dist/sodium.cjs.map +0 -1
  154. package/dist/sodium.d.ts +0 -5
  155. package/dist/sodium.js +0 -2
  156. package/dist/sodium.js.map +0 -1
  157. package/dist/utils/store-buddy.cjs +0 -2
  158. package/dist/utils/store-buddy.cjs.map +0 -1
  159. package/dist/utils/store-buddy.d.ts +0 -15
  160. package/dist/utils/store-buddy.js +0 -2
  161. package/dist/utils/store-buddy.js.map +0 -1
  162. package/dist/utils/time.cjs +0 -2
  163. package/dist/utils/time.cjs.map +0 -1
  164. package/dist/utils/time.d.ts +0 -12
  165. package/dist/utils/time.js +0 -2
  166. package/dist/utils/time.js.map +0 -1
  167. package/dist/utils/utils.cjs +0 -2
  168. package/dist/utils/utils.cjs.map +0 -1
  169. package/dist/utils/utils.d.ts +0 -6
  170. package/dist/utils/utils.js +0 -2
  171. package/dist/utils/utils.js.map +0 -1
  172. package/dist/worker/md5.cjs +0 -2
  173. package/dist/worker/md5.cjs.map +0 -1
  174. package/dist/worker/md5.d.ts +0 -3
  175. package/dist/worker/md5.js +0 -2
  176. package/dist/worker/md5.js.map +0 -1
  177. package/dist/worker/sodium.cjs +0 -2
  178. package/dist/worker/sodium.cjs.map +0 -1
  179. package/dist/worker/sodium.d.ts +0 -6
  180. package/dist/worker/sodium.js +0 -2
  181. package/dist/worker/sodium.js.map +0 -1
  182. package/dist/worker/workerCodes.cjs +0 -254
  183. package/dist/worker/workerCodes.cjs.map +0 -1
  184. package/dist/worker/workerCodes.d.ts +0 -4
  185. package/dist/worker/workerCodes.js +0 -254
  186. package/dist/worker/workerCodes.js.map +0 -1
  187. package/dist/zeus/const.cjs +0 -2
  188. package/dist/zeus/const.cjs.map +0 -1
  189. package/dist/zeus/const.d.ts +0 -9
  190. package/dist/zeus/const.js +0 -2
  191. package/dist/zeus/const.js.map +0 -1
  192. package/dist/zeus/index.cjs +0 -5
  193. package/dist/zeus/index.cjs.map +0 -1
  194. package/dist/zeus/index.d.ts +0 -8218
  195. package/dist/zeus/index.js +0 -5
  196. package/dist/zeus/index.js.map +0 -1
@@ -1,176 +0,0 @@
1
- import { Rights, NodeType, InputType, GraphQLTypes } from '../../zeus/index.js';
2
- import { KeyPair } from '../../crypto/index.js';
3
- import { nodeSelector, nodeFullSelector, mailSelector, userSelector } from './selectors.js';
4
- import { FileMetadata, InternalFile } from './File.js';
5
- export { FileMetadata, GQLFile, InternalFile } from './File.js';
6
- export { UserAppSettings } from './UserAppSettings.js';
7
- export { UserAppNotifications } from './UserAppNotifications.js';
8
- export { NameKeyInput, ShareFileInHistoryInput, ShareFileKeyInput, ShareNodesInput } from './Inputs.js';
9
- import '../../zeus/const.js';
10
-
11
- declare type NodeAccess<T extends Record<string, unknown> = Record<string, unknown>> = T & {
12
- rights: Rights;
13
- isRoot: boolean;
14
- sharedBy: {
15
- keyPair?: {
16
- pub: string;
17
- };
18
- };
19
- userApp: {
20
- user: PublicUser;
21
- };
22
- };
23
- declare type NodeBreadcrumbItem = {
24
- id: string;
25
- name: string;
26
- pubKey: string;
27
- };
28
- declare type NodeSize = {
29
- size: bigint;
30
- sizeBefore: bigint;
31
- };
32
- declare type NameKey = {
33
- nameKey?: string;
34
- };
35
- declare type InternalNodeBreadcrumbItem = NodeBreadcrumbItem & NameKey;
36
- declare type Node<T extends NodeBreadcrumbItem = NodeBreadcrumbItem, U extends Record<string, unknown> = Record<string, unknown>> = {
37
- id: string;
38
- isFavorite: boolean;
39
- type: NodeType;
40
- createdAt: Date;
41
- deletedAt: Date | null;
42
- updatedAt: Date;
43
- sizes: NodeSize;
44
- name: string;
45
- breadcrumb: T[];
46
- createdBy: PublicUser;
47
- access?: NodeAccess<U>;
48
- users: [PublicUser, Rights][];
49
- parentId: string | null;
50
- currentFileId: string | null;
51
- };
52
- declare type NodeFull<T extends NodeBreadcrumbItem = NodeBreadcrumbItem, U extends Record<string, unknown> = Record<string, unknown>, V extends FileMetadata = FileMetadata> = Node<T, U> & {
53
- parent: Node<T, U> | null;
54
- children: Node<T, U>[];
55
- current?: V;
56
- history: V[];
57
- };
58
- declare type InternalNode = Node<InternalNodeBreadcrumbItem, NameKey>;
59
- declare type InternalNodeFull = NodeFull<InternalNodeBreadcrumbItem, NameKey, InternalFile>;
60
- declare type GQLNode = InputType<GraphQLTypes["Node"], typeof nodeSelector>;
61
- declare type GQLNodeFull = InputType<GraphQLTypes["Node"], typeof nodeFullSelector>;
62
-
63
- declare type SecrecyUserApp = {
64
- keys: KeyPair;
65
- jwt: string;
66
- uaSession: string;
67
- };
68
- interface FileContentPart {
69
- contentUrl: string;
70
- order: number;
71
- md5: string;
72
- }
73
- declare type FilePartResponse = {
74
- order: number;
75
- fields: Record<string, string>;
76
- url: string;
77
- };
78
- declare type MailFileInput = {
79
- id: string;
80
- name: string;
81
- fileKey: string;
82
- };
83
- declare type MailIntegrity = {
84
- id: string;
85
- hash: string;
86
- hashKey: string;
87
- replyTo?: {
88
- id: string;
89
- };
90
- temporaryRecipients: TemporaryMailUser[];
91
- recipients: PublicUser[];
92
- };
93
- declare type MailIntegrityDraft = MailIntegrity & {
94
- recipients: PublicUser[];
95
- };
96
- declare type TemporaryMailUser = {
97
- email?: string;
98
- };
99
- declare type InternalWaitingReceivedMail = {
100
- sender: PublicUser;
101
- date: string;
102
- attachmentsCount: number;
103
- recipients: PublicUser[];
104
- temporaryRecipients: TemporaryMailUser[];
105
- };
106
- declare type WaitingReceivedMail = {
107
- id: string;
108
- sender: PublicUser;
109
- date: Date;
110
- attachmentsCount: number;
111
- recipients: PublicUser[];
112
- temporaryRecipients: TemporaryMailUser[];
113
- };
114
- declare type MailFile = {
115
- fileKey: string;
116
- filename: string;
117
- file: {
118
- id: string;
119
- };
120
- };
121
- declare type MailType = "sent" | "received" | "draft";
122
- declare type GQLMail = InputType<GraphQLTypes["Mail"], typeof mailSelector>;
123
- declare type InternalReceivedMail = {
124
- user: {
125
- receivedMails: GQLMail[];
126
- };
127
- };
128
- declare type BaseMail = {
129
- type: MailType;
130
- id: string;
131
- mailIntegrityId: string;
132
- replyTo?: string;
133
- body: string;
134
- subject: string;
135
- createdAt: Date;
136
- deletedAt: Date | null;
137
- openedAt: Date | null;
138
- isAltered: boolean;
139
- recipients: Omit<PublicUser, "publicKey">[];
140
- temporaryRecipients: TemporaryMailUser[];
141
- files: {
142
- id: string;
143
- name: string;
144
- key: string;
145
- }[];
146
- };
147
- declare type PublicUser = InputType<GraphQLTypes["User"], typeof userSelector>;
148
- interface ReceivedMail extends BaseMail {
149
- type: "received";
150
- sender: PublicUser;
151
- }
152
- declare type InternalSentMail = {
153
- user: {
154
- sentMails: GQLMail[];
155
- };
156
- };
157
- declare type InternalDraftMails = {
158
- user: {
159
- draftMails: GQLMail[];
160
- };
161
- };
162
- interface SentMail extends BaseMail {
163
- type: "sent";
164
- }
165
- interface DraftMail extends BaseMail {
166
- type: "draft";
167
- }
168
- declare type Mail = DraftMail | SentMail | ReceivedMail;
169
- declare type MailRecipientInput = {
170
- body: string;
171
- subject: string;
172
- recipientId: string;
173
- files: MailFileInput[];
174
- };
175
-
176
- export { BaseMail, DraftMail, FileContentPart, FilePartResponse, GQLMail, GQLNode, GQLNodeFull, InternalDraftMails, InternalNode, InternalNodeBreadcrumbItem, InternalNodeFull, InternalReceivedMail, InternalSentMail, InternalWaitingReceivedMail, Mail, MailFile, MailFileInput, MailIntegrity, MailIntegrityDraft, MailRecipientInput, MailType, Node, NodeAccess, NodeBreadcrumbItem, NodeFull, NodeSize, PublicUser, ReceivedMail, SecrecyUserApp, SentMail, TemporaryMailUser, WaitingReceivedMail };
@@ -1,2 +0,0 @@
1
- export*from"./File.js";export*from"./Node.js";export*from"./UserAppSettings.js";export*from"./UserAppNotifications.js";export*from"./Inputs.js";
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/client/types/index.ts"],"sourcesContent":["import type { KeyPair } from \"../../index.js\";\nimport type { InputType, GraphQLTypes } from \"../../zeus/index.js\";\nimport type { mailSelector, userSelector } from \"./selectors.js\";\nexport * from \"./File.js\";\nexport * from \"./Node.js\";\nexport * from \"./UserAppSettings.js\";\nexport * from \"./UserAppNotifications.js\";\nexport * from \"./Inputs.js\";\n\nexport type SecrecyUserApp = {\n keys: KeyPair;\n jwt: string;\n uaSession: string;\n};\n\nexport interface FileContentPart {\n contentUrl: string;\n order: number;\n md5: string;\n}\n\nexport type FilePartResponse = {\n order: number;\n fields: Record<string, string>;\n url: string;\n};\n\nexport type MailFileInput = { id: string; name: string; fileKey: string };\n\nexport type MailIntegrity = {\n id: string;\n hash: string;\n hashKey: string;\n replyTo?: {\n id: string;\n };\n temporaryRecipients: TemporaryMailUser[];\n recipients: PublicUser[];\n};\n\nexport type MailIntegrityDraft = MailIntegrity & {\n recipients: PublicUser[];\n};\n\nexport type TemporaryMailUser = {\n email?: string;\n};\n\nexport type InternalWaitingReceivedMail = {\n sender: PublicUser;\n date: string;\n attachmentsCount: number;\n recipients: PublicUser[];\n temporaryRecipients: TemporaryMailUser[];\n};\n\nexport type WaitingReceivedMail = {\n id: string;\n sender: PublicUser;\n date: Date;\n attachmentsCount: number;\n recipients: PublicUser[];\n temporaryRecipients: TemporaryMailUser[];\n};\n\nexport type MailFile = {\n fileKey: string;\n filename: string;\n file: {\n id: string;\n };\n};\n\nexport type MailType = \"sent\" | \"received\" | \"draft\";\n\nexport type GQLMail = InputType<GraphQLTypes[\"Mail\"], typeof mailSelector>;\n\nexport type InternalReceivedMail = {\n user: {\n receivedMails: GQLMail[];\n };\n};\n\nexport type BaseMail = {\n type: MailType;\n id: string;\n mailIntegrityId: string;\n replyTo?: string;\n body: string;\n subject: string;\n createdAt: Date;\n deletedAt: Date | null;\n openedAt: Date | null;\n isAltered: boolean;\n recipients: Omit<PublicUser, \"publicKey\">[];\n temporaryRecipients: TemporaryMailUser[];\n files: { id: string; name: string; key: string }[];\n};\n\nexport type PublicUser = InputType<GraphQLTypes[\"User\"], typeof userSelector>;\n\nexport interface ReceivedMail extends BaseMail {\n type: \"received\";\n sender: PublicUser;\n}\n\nexport type InternalSentMail = {\n user: {\n sentMails: GQLMail[];\n };\n};\n\nexport type InternalDraftMails = {\n user: {\n draftMails: GQLMail[];\n };\n};\n\nexport interface SentMail extends BaseMail {\n type: \"sent\";\n}\n\nexport interface DraftMail extends BaseMail {\n type: \"draft\";\n}\n\nexport type Mail = DraftMail | SentMail | ReceivedMail;\n\nexport type MailRecipientInput = {\n body: string;\n subject: string;\n recipientId: string;\n files: MailFileInput[];\n};\n"],"mappings":"AAGA,WAAc,YACd,WAAc,YACd,WAAc,uBACd,WAAc,4BACd,WAAc","names":[]}
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkXDPEU3HVcjs = require('../../chunk-XDPEU3HV.cjs');var _indexjs = require('../../zeus/index.js');const s=_indexjs.Selector.call(void 0, "File")({id:!0,size:!0,sizeBefore:!0,createdAt:!0,md5:!0,md5Encrypted:!0,access:{key:!0,sharedBy:{keyPair:{pub:!0}}}}),e= exports.userSelector =_indexjs.Selector.call(void 0, "User")({id:!0,firstname:!0,lastname:!0,email:!0,publicKey:!0}),i= exports.nodeSelector =_indexjs.Selector.call(void 0, "Node")({id:!0,isFavorite:!0,type:!0,createdAt:!0,deletedAt:!0,createdBy:{user:e},sizes:{size:!0,sizeBefore:!0},updatedAt:!0,name:!0,access:{rights:!0,isRoot:!0,nameKey:!0,sharedBy:{keyPair:{pub:!0}},userApp:{user:e}},accesses:{rights:!0,isRoot:!0,nameKey:!0,sharedBy:{keyPair:{pub:!0}},userApp:{user:e}},breadcrumb:{id:!0,name:!0,nameKey:!0,pubKey:!0},parentId:!0,currentFileId:!0}),c= exports.nodeFullSelector =_indexjs.Selector.call(void 0, "Node")(_chunkXDPEU3HVcjs.b.call(void 0, _chunkXDPEU3HVcjs.a.call(void 0, {},i),{parent:i,children:i,history:s,current:s})),d= exports.mailSelector =_indexjs.Selector.call(void 0, "Mail")({id:!0,type:!0,body:!0,subject:!0,openedAt:!0,createdAt:!0,deletedAt:!0,recipients:_chunkXDPEU3HVcjs.b.call(void 0, _chunkXDPEU3HVcjs.a.call(void 0, {},e),{publicKey:!1}),recipient:_chunkXDPEU3HVcjs.b.call(void 0, _chunkXDPEU3HVcjs.a.call(void 0, {},e),{publicKey:!1}),sender:e,mailIntegrity:{id:!0,hash:!0,hashKey:!0,replyTo:{id:!0},temporaryRecipients:{email:!0},recipients:_chunkXDPEU3HVcjs.b.call(void 0, _chunkXDPEU3HVcjs.a.call(void 0, {},e),{publicKey:!1})},mailIntegrityDraft:{id:!0,hash:!0,hashKey:!0,replyTo:{id:!0},temporaryRecipients:{email:!0},recipients:_chunkXDPEU3HVcjs.b.call(void 0, _chunkXDPEU3HVcjs.a.call(void 0, {},e),{publicKey:!1})},files:{fileKey:!0,filename:!0,file:{id:!0}}});exports.fileSelector = s; exports.mailSelector = d; exports.nodeFullSelector = c; exports.nodeSelector = i; exports.userSelector = e;
2
- //# sourceMappingURL=selectors.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/client/types/selectors.ts"],"names":["Selector","fileSelector","userSelector","nodeSelector","nodeFullSelector","__spreadProps","__spreadValues","mailSelector"],"mappings":"oDAAA,OAAS,YAAAA,MAAgB,sBAElB,MAAMC,EAAeD,EAAS,MAAM,EAAE,CAC3C,GAAI,GACJ,KAAM,GACN,WAAY,GACZ,UAAW,GACX,IAAK,GACL,aAAc,GACd,OAAQ,CACN,IAAK,GACL,SAAU,CACR,QAAS,CACP,IAAK,EACP,CACF,CACF,CACF,CAAC,EAEYE,EAAeF,EAAS,MAAM,EAAE,CAC3C,GAAI,GACJ,UAAW,GACX,SAAU,GACV,MAAO,GACP,UAAW,EACb,CAAC,EAEYG,EAAeH,EAAS,MAAM,EAAE,CAC3C,GAAI,GACJ,WAAY,GACZ,KAAM,GACN,UAAW,GACX,UAAW,GACX,UAAW,CACT,KAAME,CACR,EACA,MAAO,CACL,KAAM,GACN,WAAY,EACd,EACA,UAAW,GACX,KAAM,GACN,OAAQ,CACN,OAAQ,GACR,OAAQ,GACR,QAAS,GACT,SAAU,CACR,QAAS,CACP,IAAK,EACP,CACF,EACA,QAAS,CACP,KAAMA,CACR,CACF,EACA,SAAU,CACR,OAAQ,GACR,OAAQ,GACR,QAAS,GACT,SAAU,CACR,QAAS,CACP,IAAK,EACP,CACF,EACA,QAAS,CACP,KAAMA,CACR,CACF,EACA,WAAY,CACV,GAAI,GACJ,KAAM,GACN,QAAS,GACT,OAAQ,EACV,EACA,SAAU,GACV,cAAe,EACjB,CAAC,EAEYE,EAAmBJ,EAAS,MAAM,EAAEK,EAAAC,EAAA,GAC5CH,GAD4C,CAE/C,OAAQA,EACR,SAAUA,EACV,QAASF,EACT,QAASA,CACX,EAAC,EAEYM,EAAeP,EAAS,MAAM,EAAE,CAC3C,GAAI,GACJ,KAAM,GACN,KAAM,GACN,QAAS,GACT,SAAU,GACV,UAAW,GACX,UAAW,GACX,WAAYK,EAAAC,EAAA,GACPJ,GADO,CAEV,UAAW,EACb,GACA,UAAWG,EAAAC,EAAA,GACNJ,GADM,CAET,UAAW,EACb,GACA,OAAQA,EACR,cAAe,CACb,GAAI,GACJ,KAAM,GACN,QAAS,GACT,QAAS,CACP,GAAI,EACN,EACA,oBAAqB,CACnB,MAAO,EACT,EACA,WAAYG,EAAAC,EAAA,GACPJ,GADO,CAEV,UAAW,EACb,EACF,EACA,mBAAoB,CAClB,GAAI,GACJ,KAAM,GACN,QAAS,GACT,QAAS,CACP,GAAI,EACN,EACA,oBAAqB,CACnB,MAAO,EACT,EACA,WAAYG,EAAAC,EAAA,GACPJ,GADO,CAEV,UAAW,EACb,EACF,EACA,MAAO,CACL,QAAS,GACT,SAAU,GACV,KAAM,CACJ,GAAI,EACN,CACF,CACF,CAAC","sourcesContent":["import { Selector } from \"../../zeus/index.js\";\n\nexport const fileSelector = Selector(\"File\")({\n id: true,\n size: true,\n sizeBefore: true,\n createdAt: true,\n md5: true,\n md5Encrypted: true,\n access: {\n key: true,\n sharedBy: {\n keyPair: {\n pub: true\n }\n }\n }\n});\n\nexport const userSelector = Selector(\"User\")({\n id: true,\n firstname: true,\n lastname: true,\n email: true,\n publicKey: true\n});\n\nexport const nodeSelector = Selector(\"Node\")({\n id: true,\n isFavorite: true,\n type: true,\n createdAt: true,\n deletedAt: true,\n createdBy: {\n user: userSelector\n },\n sizes: {\n size: true,\n sizeBefore: true\n },\n updatedAt: true,\n name: true,\n access: {\n rights: true,\n isRoot: true,\n nameKey: true,\n sharedBy: {\n keyPair: {\n pub: true\n }\n },\n userApp: {\n user: userSelector\n }\n },\n accesses: {\n rights: true,\n isRoot: true,\n nameKey: true,\n sharedBy: {\n keyPair: {\n pub: true\n }\n },\n userApp: {\n user: userSelector\n }\n },\n breadcrumb: {\n id: true,\n name: true,\n nameKey: true,\n pubKey: true\n },\n parentId: true,\n currentFileId: true\n});\n\nexport const nodeFullSelector = Selector(\"Node\")({\n ...nodeSelector,\n parent: nodeSelector,\n children: nodeSelector,\n history: fileSelector,\n current: fileSelector\n});\n\nexport const mailSelector = Selector(\"Mail\")({\n id: true,\n type: true,\n body: true,\n subject: true,\n openedAt: true,\n createdAt: true,\n deletedAt: true,\n recipients: {\n ...userSelector,\n publicKey: false\n },\n recipient: {\n ...userSelector,\n publicKey: false\n },\n sender: userSelector,\n mailIntegrity: {\n id: true,\n hash: true,\n hashKey: true,\n replyTo: {\n id: true\n },\n temporaryRecipients: {\n email: true\n },\n recipients: {\n ...userSelector,\n publicKey: false\n }\n },\n mailIntegrityDraft: {\n id: true,\n hash: true,\n hashKey: true,\n replyTo: {\n id: true\n },\n temporaryRecipients: {\n email: true\n },\n recipients: {\n ...userSelector,\n publicKey: false\n }\n },\n files: {\n fileKey: true,\n filename: true,\n file: {\n id: true\n }\n }\n});\n"]}
@@ -1,402 +0,0 @@
1
- declare const fileSelector: {
2
- id: true;
3
- size: true;
4
- sizeBefore: true;
5
- createdAt: true;
6
- md5: true;
7
- md5Encrypted: true;
8
- access: {
9
- key: true;
10
- sharedBy: {
11
- keyPair: {
12
- pub: true;
13
- };
14
- };
15
- };
16
- };
17
- declare const userSelector: {
18
- id: true;
19
- firstname: true;
20
- lastname: true;
21
- email: true;
22
- publicKey: true;
23
- };
24
- declare const nodeSelector: {
25
- id: true;
26
- isFavorite: true;
27
- type: true;
28
- createdAt: true;
29
- deletedAt: true;
30
- createdBy: {
31
- user: {
32
- id: true;
33
- firstname: true;
34
- lastname: true;
35
- email: true;
36
- publicKey: true;
37
- };
38
- };
39
- sizes: {
40
- size: true;
41
- sizeBefore: true;
42
- };
43
- updatedAt: true;
44
- name: true;
45
- access: {
46
- rights: true;
47
- isRoot: true;
48
- nameKey: true;
49
- sharedBy: {
50
- keyPair: {
51
- pub: true;
52
- };
53
- };
54
- userApp: {
55
- user: {
56
- id: true;
57
- firstname: true;
58
- lastname: true;
59
- email: true;
60
- publicKey: true;
61
- };
62
- };
63
- };
64
- accesses: {
65
- rights: true;
66
- isRoot: true;
67
- nameKey: true;
68
- sharedBy: {
69
- keyPair: {
70
- pub: true;
71
- };
72
- };
73
- userApp: {
74
- user: {
75
- id: true;
76
- firstname: true;
77
- lastname: true;
78
- email: true;
79
- publicKey: true;
80
- };
81
- };
82
- };
83
- breadcrumb: {
84
- id: true;
85
- name: true;
86
- nameKey: true;
87
- pubKey: true;
88
- };
89
- parentId: true;
90
- currentFileId: true;
91
- };
92
- declare const nodeFullSelector: {
93
- parent: {
94
- id: true;
95
- isFavorite: true;
96
- type: true;
97
- createdAt: true;
98
- deletedAt: true;
99
- createdBy: {
100
- user: {
101
- id: true;
102
- firstname: true;
103
- lastname: true;
104
- email: true;
105
- publicKey: true;
106
- };
107
- };
108
- sizes: {
109
- size: true;
110
- sizeBefore: true;
111
- };
112
- updatedAt: true;
113
- name: true;
114
- access: {
115
- rights: true;
116
- isRoot: true;
117
- nameKey: true;
118
- sharedBy: {
119
- keyPair: {
120
- pub: true;
121
- };
122
- };
123
- userApp: {
124
- user: {
125
- id: true;
126
- firstname: true;
127
- lastname: true;
128
- email: true;
129
- publicKey: true;
130
- };
131
- };
132
- };
133
- accesses: {
134
- rights: true;
135
- isRoot: true;
136
- nameKey: true;
137
- sharedBy: {
138
- keyPair: {
139
- pub: true;
140
- };
141
- };
142
- userApp: {
143
- user: {
144
- id: true;
145
- firstname: true;
146
- lastname: true;
147
- email: true;
148
- publicKey: true;
149
- };
150
- };
151
- };
152
- breadcrumb: {
153
- id: true;
154
- name: true;
155
- nameKey: true;
156
- pubKey: true;
157
- };
158
- parentId: true;
159
- currentFileId: true;
160
- };
161
- children: {
162
- id: true;
163
- isFavorite: true;
164
- type: true;
165
- createdAt: true;
166
- deletedAt: true;
167
- createdBy: {
168
- user: {
169
- id: true;
170
- firstname: true;
171
- lastname: true;
172
- email: true;
173
- publicKey: true;
174
- };
175
- };
176
- sizes: {
177
- size: true;
178
- sizeBefore: true;
179
- };
180
- updatedAt: true;
181
- name: true;
182
- access: {
183
- rights: true;
184
- isRoot: true;
185
- nameKey: true;
186
- sharedBy: {
187
- keyPair: {
188
- pub: true;
189
- };
190
- };
191
- userApp: {
192
- user: {
193
- id: true;
194
- firstname: true;
195
- lastname: true;
196
- email: true;
197
- publicKey: true;
198
- };
199
- };
200
- };
201
- accesses: {
202
- rights: true;
203
- isRoot: true;
204
- nameKey: true;
205
- sharedBy: {
206
- keyPair: {
207
- pub: true;
208
- };
209
- };
210
- userApp: {
211
- user: {
212
- id: true;
213
- firstname: true;
214
- lastname: true;
215
- email: true;
216
- publicKey: true;
217
- };
218
- };
219
- };
220
- breadcrumb: {
221
- id: true;
222
- name: true;
223
- nameKey: true;
224
- pubKey: true;
225
- };
226
- parentId: true;
227
- currentFileId: true;
228
- };
229
- history: {
230
- id: true;
231
- size: true;
232
- sizeBefore: true;
233
- createdAt: true;
234
- md5: true;
235
- md5Encrypted: true;
236
- access: {
237
- key: true;
238
- sharedBy: {
239
- keyPair: {
240
- pub: true;
241
- };
242
- };
243
- };
244
- };
245
- current: {
246
- id: true;
247
- size: true;
248
- sizeBefore: true;
249
- createdAt: true;
250
- md5: true;
251
- md5Encrypted: true;
252
- access: {
253
- key: true;
254
- sharedBy: {
255
- keyPair: {
256
- pub: true;
257
- };
258
- };
259
- };
260
- };
261
- id: true;
262
- isFavorite: true;
263
- type: true;
264
- createdAt: true;
265
- deletedAt: true;
266
- createdBy: {
267
- user: {
268
- id: true;
269
- firstname: true;
270
- lastname: true;
271
- email: true;
272
- publicKey: true;
273
- };
274
- };
275
- sizes: {
276
- size: true;
277
- sizeBefore: true;
278
- };
279
- updatedAt: true;
280
- name: true;
281
- access: {
282
- rights: true;
283
- isRoot: true;
284
- nameKey: true;
285
- sharedBy: {
286
- keyPair: {
287
- pub: true;
288
- };
289
- };
290
- userApp: {
291
- user: {
292
- id: true;
293
- firstname: true;
294
- lastname: true;
295
- email: true;
296
- publicKey: true;
297
- };
298
- };
299
- };
300
- accesses: {
301
- rights: true;
302
- isRoot: true;
303
- nameKey: true;
304
- sharedBy: {
305
- keyPair: {
306
- pub: true;
307
- };
308
- };
309
- userApp: {
310
- user: {
311
- id: true;
312
- firstname: true;
313
- lastname: true;
314
- email: true;
315
- publicKey: true;
316
- };
317
- };
318
- };
319
- breadcrumb: {
320
- id: true;
321
- name: true;
322
- nameKey: true;
323
- pubKey: true;
324
- };
325
- parentId: true;
326
- currentFileId: true;
327
- };
328
- declare const mailSelector: {
329
- id: true;
330
- type: true;
331
- body: true;
332
- subject: true;
333
- openedAt: true;
334
- createdAt: true;
335
- deletedAt: true;
336
- recipients: {
337
- publicKey: false;
338
- id: true;
339
- firstname: true;
340
- lastname: true;
341
- email: true;
342
- };
343
- recipient: {
344
- publicKey: false;
345
- id: true;
346
- firstname: true;
347
- lastname: true;
348
- email: true;
349
- };
350
- sender: {
351
- id: true;
352
- firstname: true;
353
- lastname: true;
354
- email: true;
355
- publicKey: true;
356
- };
357
- mailIntegrity: {
358
- id: true;
359
- hash: true;
360
- hashKey: true;
361
- replyTo: {
362
- id: true;
363
- };
364
- temporaryRecipients: {
365
- email: true;
366
- };
367
- recipients: {
368
- publicKey: false;
369
- id: true;
370
- firstname: true;
371
- lastname: true;
372
- email: true;
373
- };
374
- };
375
- mailIntegrityDraft: {
376
- id: true;
377
- hash: true;
378
- hashKey: true;
379
- replyTo: {
380
- id: true;
381
- };
382
- temporaryRecipients: {
383
- email: true;
384
- };
385
- recipients: {
386
- publicKey: false;
387
- id: true;
388
- firstname: true;
389
- lastname: true;
390
- email: true;
391
- };
392
- };
393
- files: {
394
- fileKey: true;
395
- filename: true;
396
- file: {
397
- id: true;
398
- };
399
- };
400
- };
401
-
402
- export { fileSelector, mailSelector, nodeFullSelector, nodeSelector, userSelector };
@@ -1,2 +0,0 @@
1
- import{a as r,b as t}from"../../chunk-UPFDSEKI.js";import{Selector as u}from"../../zeus/index.js";const s=u("File")({id:!0,size:!0,sizeBefore:!0,createdAt:!0,md5:!0,md5Encrypted:!0,access:{key:!0,sharedBy:{keyPair:{pub:!0}}}}),e=u("User")({id:!0,firstname:!0,lastname:!0,email:!0,publicKey:!0}),i=u("Node")({id:!0,isFavorite:!0,type:!0,createdAt:!0,deletedAt:!0,createdBy:{user:e},sizes:{size:!0,sizeBefore:!0},updatedAt:!0,name:!0,access:{rights:!0,isRoot:!0,nameKey:!0,sharedBy:{keyPair:{pub:!0}},userApp:{user:e}},accesses:{rights:!0,isRoot:!0,nameKey:!0,sharedBy:{keyPair:{pub:!0}},userApp:{user:e}},breadcrumb:{id:!0,name:!0,nameKey:!0,pubKey:!0},parentId:!0,currentFileId:!0}),c=u("Node")(t(r({},i),{parent:i,children:i,history:s,current:s})),d=u("Mail")({id:!0,type:!0,body:!0,subject:!0,openedAt:!0,createdAt:!0,deletedAt:!0,recipients:t(r({},e),{publicKey:!1}),recipient:t(r({},e),{publicKey:!1}),sender:e,mailIntegrity:{id:!0,hash:!0,hashKey:!0,replyTo:{id:!0},temporaryRecipients:{email:!0},recipients:t(r({},e),{publicKey:!1})},mailIntegrityDraft:{id:!0,hash:!0,hashKey:!0,replyTo:{id:!0},temporaryRecipients:{email:!0},recipients:t(r({},e),{publicKey:!1})},files:{fileKey:!0,filename:!0,file:{id:!0}}});export{s as fileSelector,d as mailSelector,c as nodeFullSelector,i as nodeSelector,e as userSelector};
2
- //# sourceMappingURL=selectors.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/client/types/selectors.ts"],"sourcesContent":["import { Selector } from \"../../zeus/index.js\";\n\nexport const fileSelector = Selector(\"File\")({\n id: true,\n size: true,\n sizeBefore: true,\n createdAt: true,\n md5: true,\n md5Encrypted: true,\n access: {\n key: true,\n sharedBy: {\n keyPair: {\n pub: true\n }\n }\n }\n});\n\nexport const userSelector = Selector(\"User\")({\n id: true,\n firstname: true,\n lastname: true,\n email: true,\n publicKey: true\n});\n\nexport const nodeSelector = Selector(\"Node\")({\n id: true,\n isFavorite: true,\n type: true,\n createdAt: true,\n deletedAt: true,\n createdBy: {\n user: userSelector\n },\n sizes: {\n size: true,\n sizeBefore: true\n },\n updatedAt: true,\n name: true,\n access: {\n rights: true,\n isRoot: true,\n nameKey: true,\n sharedBy: {\n keyPair: {\n pub: true\n }\n },\n userApp: {\n user: userSelector\n }\n },\n accesses: {\n rights: true,\n isRoot: true,\n nameKey: true,\n sharedBy: {\n keyPair: {\n pub: true\n }\n },\n userApp: {\n user: userSelector\n }\n },\n breadcrumb: {\n id: true,\n name: true,\n nameKey: true,\n pubKey: true\n },\n parentId: true,\n currentFileId: true\n});\n\nexport const nodeFullSelector = Selector(\"Node\")({\n ...nodeSelector,\n parent: nodeSelector,\n children: nodeSelector,\n history: fileSelector,\n current: fileSelector\n});\n\nexport const mailSelector = Selector(\"Mail\")({\n id: true,\n type: true,\n body: true,\n subject: true,\n openedAt: true,\n createdAt: true,\n deletedAt: true,\n recipients: {\n ...userSelector,\n publicKey: false\n },\n recipient: {\n ...userSelector,\n publicKey: false\n },\n sender: userSelector,\n mailIntegrity: {\n id: true,\n hash: true,\n hashKey: true,\n replyTo: {\n id: true\n },\n temporaryRecipients: {\n email: true\n },\n recipients: {\n ...userSelector,\n publicKey: false\n }\n },\n mailIntegrityDraft: {\n id: true,\n hash: true,\n hashKey: true,\n replyTo: {\n id: true\n },\n temporaryRecipients: {\n email: true\n },\n recipients: {\n ...userSelector,\n publicKey: false\n }\n },\n files: {\n fileKey: true,\n filename: true,\n file: {\n id: true\n }\n }\n});\n"],"mappings":"mDAAA,OAA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CACP,GAAI,EACN,EACA,oBAAqB,CACnB,MAAO,EACT,EACA,WAAYG,EAAAC,EAAA,GACPJ,GADO,CAEV,UAAW,EACb,EACF,EACA,mBAAoB,CAClB,GAAI,GACJ,KAAM,GACN,QAAS,GACT,QAAS,CACP,GAAI,EACN,EACA,oBAAqB,CACnB,MAAO,EACT,EACA,WAAYG,EAAAC,EAAA,GACPJ,GADO,CAEV,UAAW,EACb,EACF,EACA,MAAO,CACL,QAAS,GACT,SAAU,GACV,KAAM,CACJ,GAAI,EACN,CACF,CACF,CAAC","names":["Selector","fileSelector","userSelector","nodeSelector","nodeFullSelector","__spreadProps","__spreadValues","mailSelector"]}
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkXDPEU3HVcjs = require('../chunk-XDPEU3HV.cjs');var _sodiumjs = require('../sodium.js');var _sparkmd5 = require('spark-md5'); var _sparkmd52 = _interopRequireDefault(_sparkmd5);var _utilsjs = require('../utils/utils.js');function _(o,e){if(!o)throw new Error(e)}function F(){return _sodiumjs.sodium.crypto_secretstream_xchacha20poly1305_keygen()}function w(o){let e=!1;const{state:t,header:y}=_sodiumjs.sodium.crypto_secretstream_xchacha20poly1305_init_push(o),l=(i,d)=>(_(e===!1,"state already destroyed"),_sodiumjs.sodium.crypto_secretstream_xchacha20poly1305_push(t,d,null,i));function p(){_(e===!1,"state already destroyed"),e=!0}return{encrypt:l,destroy:p,header:y}}function Y(o,e){_(o.byteLength>=_sodiumjs.sodium.crypto_secretstream_xchacha20poly1305_HEADERBYTES,`header must be at least HEADERBYTES (${_sodiumjs.sodium.crypto_secretstream_xchacha20poly1305_HEADERBYTES}) long`),_(e.byteLength>=_sodiumjs.sodium.crypto_secretstream_xchacha20poly1305_KEYBYTES,`key must be at least KEYBYTES (${_sodiumjs.sodium.crypto_secretstream_xchacha20poly1305_KEYBYTES}) long`);let t=!1;const y=_sodiumjs.sodium.crypto_secretstream_xchacha20poly1305_init_pull(o,e),l=i=>(_(t===!1,"state already destroyed"),_sodiumjs.sodium.crypto_secretstream_xchacha20poly1305_pull(y,i));function p(){_(t===!1,"state already destroyed"),t=!0}return{decrypt:l,destroy:p}}const m=8192;function L(o,e,t,y){return _chunkXDPEU3HVcjs.h.call(void 0, this,null,function*(){yield _sodiumjs.setup.call(void 0, );const{encrypt:l,destroy:p,header:i}=w(o),d=m+_sodiumjs.sodium.crypto_secretstream_xchacha20poly1305_ABYTES,c=Math.ceil(e.byteLength/m)*d+i.byteLength;t==null||t({percent:0,total:c,current:0});const h=new Uint8Array(c),n=new _sparkmd52.default.ArrayBuffer,u=new _sparkmd52.default.ArrayBuffer;h.set(i),n.append(i);let a=i.byteLength;t==null||t({percent:a/c,total:c,current:a});let E=a/c;for(const s of _utilsjs.chunks.call(void 0, e,m)){if(y!=null&&y.signal.aborted)throw new Error("Encrypt aborted");u.append(s);const T=s.length<m?_sodiumjs.sodium.crypto_secretstream_xchacha20poly1305_TAG_FINAL:_sodiumjs.sodium.crypto_secretstream_xchacha20poly1305_TAG_MESSAGE,f=l(T,s);n.append(f),h.set(f,a),a+=f.byteLength;const A=a/c;A>E+.01&&(t==null||t({percent:A,total:c,current:a}),E=A)}return p(),t==null||t({percent:1,total:a,current:a}),{data:h.slice(0,a),md5Encrypted:n.end(),md5:u.end()}})}function P(o,e,t,y){return _chunkXDPEU3HVcjs.h.call(void 0, this,null,function*(){yield _sodiumjs.setup.call(void 0, );const l=e.slice(0,_sodiumjs.sodium.crypto_secretstream_xchacha20poly1305_HEADERBYTES);e=e.slice(_sodiumjs.sodium.crypto_secretstream_xchacha20poly1305_HEADERBYTES);const{decrypt:p,destroy:i}=Y(l,o),d=m+_sodiumjs.sodium.crypto_secretstream_xchacha20poly1305_ABYTES,c=Math.ceil(e.byteLength/d)*m;t==null||t({percent:0,total:c,current:0});const h=new Uint8Array(c);let n=0,u=n/c;for(const a of _utilsjs.chunks.call(void 0, e,d)){if(y!=null&&y.signal.aborted)throw new Error("Decrypt aborted");const E=p(a);h.set(E.message,n),n+=E.message.byteLength;const s=n/c;s>u+.01&&(t==null||t({percent:s,total:c,current:n}),u=s)}return i(),t==null||t({percent:1,total:n,current:n}),h.slice(0,n)})}exports.CHUNK_SIZE = m; exports.decryptSecretstream = P; exports.encryptSecretstream = L; exports.secretstreamKeygen = F;
2
- //# sourceMappingURL=file.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/crypto/file.ts"],"names":["setup","sodium","SparkMD5","chunks","assert","c","message","secretstreamKeygen","encrypt","key","destroyed","state","header","tag","plaintext","destroy","decrypt","ciphertext","CHUNK_SIZE","encryptSecretstream","data","progress","abort","__async","crypt","cryptedChunk","max","final","sparkEncrypted","spark","total","lastPercent","chunk","crypted","percent","decryptSecretstream","decryptt","chunkSize","tmp"],"mappings":"0CACA,OAAS,SAAAA,EAAO,UAAAC,MAAc,eAC9B,OAAOC,MAAc,YACrB,OAAS,UAAAC,MAAc,oBAQvB,SAASC,EAAOC,EAAYC,EAAuB,CACjD,GAAI,CAACD,EACH,MAAM,IAAI,MAAMC,CAAO,CAE3B,CAMO,SAASC,GAAiC,CAC/C,OAAON,EAAO,6CAA6C,CAC7D,CAEA,SAASO,EAAQC,EAIf,CACA,IAAIC,EAAY,GAChB,KAAM,CAAE,MAAAC,EAAO,OAAAC,CAAO,EACpBX,EAAO,gDAAgDQ,CAAG,EAEtDD,EAAqB,CAACK,EAAKC,KAC/BV,EAAOM,IAAc,GAAO,yBAAyB,EAE9CT,EAAO,2CACZU,EACAG,EACA,KACAD,CACF,GAGF,SAASE,GAAgB,CACvBX,EAAOM,IAAc,GAAO,yBAAyB,EACrDA,EAAY,EACd,CAEA,MAAO,CACL,QAAAF,EACA,QAAAO,EACA,OAAAH,CACF,CACF,CAEA,SAASI,EACPJ,EACAH,EAIA,CACAL,EACEQ,EAAO,YACLX,EAAO,kDACT,wCAAwCA,EAAO,yDACjD,EACAG,EACEK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A,OAAAnB,EAAQ,EACRM,GAAA,MAAAA,EAAW,CACT,QAAS,EACT,MAAAS,EACA,QAASA,CACX,GACOH,EAAM,MAAM,EAAGG,CAAK,CAC7B","sourcesContent":["import type { MessageTag } from \"libsodium-wrappers\";\nimport { setup, sodium } from \"../sodium.js\";\nimport SparkMD5 from \"spark-md5\";\nimport { chunks } from \"../utils/utils.js\";\n\nexport type EncryptedFile = {\n data: Uint8Array;\n md5: string;\n md5Encrypted: string;\n};\n\nfunction assert(c: boolean, message: string): void {\n if (!c) {\n throw new Error(message);\n }\n}\n\ntype EncryptFn = (tag: number, plaintext: Uint8Array) => Uint8Array;\n\ntype DecryptFn = (ciphertext: Uint8Array) => MessageTag;\n\nexport function secretstreamKeygen(): Uint8Array {\n return sodium.crypto_secretstream_xchacha20poly1305_keygen();\n}\n\nfunction encrypt(key: Uint8Array): {\n destroy: () => void;\n encrypt: EncryptFn;\n header: Uint8Array;\n} {\n let destroyed = false;\n const { state, header } =\n sodium.crypto_secretstream_xchacha20poly1305_init_push(key);\n\n const encrypt: EncryptFn = (tag, plaintext) => {\n assert(destroyed === false, \"state already destroyed\");\n\n return sodium.crypto_secretstream_xchacha20poly1305_push(\n state,\n plaintext,\n null,\n tag\n );\n };\n\n function destroy(): void {\n assert(destroyed === false, \"state already destroyed\");\n destroyed = true;\n }\n\n return {\n encrypt,\n destroy,\n header\n };\n}\n\nfunction decrypt(\n header: Uint8Array,\n key: Uint8Array\n): {\n destroy: () => void;\n decrypt: DecryptFn;\n} {\n assert(\n header.byteLength >=\n sodium.crypto_secretstream_xchacha20poly1305_HEADERBYTES,\n `header must be at least HEADERBYTES (${sodium.crypto_secretstream_xchacha20poly1305_HEADERBYTES}) long`\n );\n assert(\n key.byteLength >= sodium.crypto_secretstream_xchacha20poly1305_KEYBYTES,\n `key must be at least KEYBYTES (${sodium.crypto_secretstream_xchacha20poly1305_KEYBYTES}) long`\n );\n\n let destroyed = false;\n const state = sodium.crypto_secretstream_xchacha20poly1305_init_pull(\n header,\n key\n );\n\n const decrypt: DecryptFn = ciphertext => {\n assert(destroyed === false, \"state already destroyed\");\n\n return sodium.crypto_secretstream_xchacha20poly1305_pull(state, ciphertext);\n };\n\n function destroy(): void {\n assert(destroyed === false, \"state already destroyed\");\n destroyed = true;\n }\n\n return {\n decrypt,\n destroy\n };\n}\n\nexport const CHUNK_SIZE = 8192;\n\nexport type Progress = {\n percent: number;\n total: number;\n current: number;\n};\n\nexport async function encryptSecretstream(\n key: Uint8Array,\n data: Uint8Array,\n progress?: (progress: Progress) => Promise<void>,\n abort?: AbortController\n): Promise<EncryptedFile> {\n await setup();\n const { encrypt: crypt, destroy, header } = encrypt(key);\n const cryptedChunk =\n CHUNK_SIZE + sodium.crypto_secretstream_xchacha20poly1305_ABYTES;\n const max =\n Math.ceil(data.byteLength / CHUNK_SIZE) * cryptedChunk + header.byteLength;\n\n progress?.({\n percent: 0,\n total: max,\n current: 0\n });\n const final = new Uint8Array(max);\n const sparkEncrypted = new SparkMD5.ArrayBuffer();\n const spark = new SparkMD5.ArrayBuffer();\n\n final.set(header);\n sparkEncrypted.append(header);\n let total = header.byteLength;\n progress?.({\n percent: total / max,\n total: max,\n current: total\n });\n let lastPercent = total / max;\n\n for (const chunk of chunks(data, CHUNK_SIZE)) {\n if (abort?.signal.aborted) {\n throw new Error(`Encrypt aborted`);\n }\n spark.append(chunk);\n const tag =\n chunk.length < CHUNK_SIZE\n ? sodium.crypto_secretstream_xchacha20poly1305_TAG_FINAL\n : sodium.crypto_secretstream_xchacha20poly1305_TAG_MESSAGE;\n const crypted = crypt(tag, chunk);\n sparkEncrypted.append(crypted);\n final.set(crypted, total);\n total += crypted.byteLength;\n const percent = total / max;\n if (percent > lastPercent + 0.01) {\n progress?.({\n percent,\n total: max,\n current: total\n });\n lastPercent = percent;\n }\n }\n\n destroy();\n progress?.({\n percent: 1,\n total,\n current: total\n });\n return {\n data: final.slice(0, total),\n md5Encrypted: sparkEncrypted.end(),\n md5: spark.end()\n };\n}\n\nexport async function decryptSecretstream(\n key: Uint8Array,\n data: Uint8Array,\n progress?: (progress: Progress) => Promise<void>,\n abort?: AbortController\n): Promise<Uint8Array> {\n await setup();\n const header = data.slice(\n 0,\n sodium.crypto_secretstream_xchacha20poly1305_HEADERBYTES\n );\n data = data.slice(sodium.crypto_secretstream_xchacha20poly1305_HEADERBYTES);\n\n const { decrypt: decryptt, destroy } = decrypt(header, key);\n const chunkSize =\n CHUNK_SIZE + sodium.crypto_secretstream_xchacha20poly1305_ABYTES;\n const max = Math.ceil(data.byteLength / chunkSize) * CHUNK_SIZE;\n\n progress?.({\n percent: 0,\n total: max,\n current: 0\n });\n const final = new Uint8Array(max);\n let total = 0;\n\n let lastPercent = total / max;\n\n for (const chunk of chunks(data, chunkSize)) {\n if (abort?.signal.aborted) {\n throw new Error(`Decrypt aborted`);\n }\n const tmp = decryptt(chunk);\n final.set(tmp.message, total);\n total += tmp.message.byteLength;\n const percent = total / max;\n if (percent > lastPercent + 0.01) {\n progress?.({\n percent,\n total: max,\n current: total\n });\n lastPercent = percent;\n }\n }\n\n destroy();\n progress?.({\n percent: 1,\n total,\n current: total\n });\n return final.slice(0, total);\n}\n\n// async function mainSecretstream(random: Uint8Array): Promise<void> {\n// const key = secretstreamKeygen();\n// console.time(\"secretstream_encrypt\");\n// const crypted = encryptSecretstream(key, random);\n// console.timeEnd(\"secretstream_encrypt\");\n// console.time(\"secretstream_decrypt\");\n// const decrypted = decryptSecretstream(key, crypted);\n// console.timeEnd(\"secretstream_decrypt\");\n// const first = to_hex(random).slice(0, 32);\n// const final = to_hex(decrypted).slice(0, 32);\n// console.log({\n// first,\n// final,\n// equals: first === final\n// });\n// }\n// async function mainSecretbox(random: Uint8Array): Promise<void> {\n// const key = generateSecretBox();\n// console.time(\"secretbox_encrypt\");\n// const crypted = encryptFile(random, key);\n// console.timeEnd(\"secretbox_encrypt\");\n// console.time(\"secretbox_decrypt\");\n// const decrypted = decryptFile(crypted, key);\n// console.timeEnd(\"secretbox_decrypt\");\n// const first = to_hex(random).slice(0, 32);\n// const final = to_hex(decrypted).slice(0, 32);\n// console.log({\n// first,\n// final,\n// equals: first === final\n// });\n// }\n\n// async function main(): Promise<void> {\n// await ready;\n// console.time(\"randombytes_buf\");\n// const random = randombytes_buf(1_000_000 * 1024);\n// console.timeEnd(\"randombytes_buf\");\n// await Promise.all([mainSecretstream(random), mainSecretbox(random)]);\n// }\n\n// main();\n"]}
@@ -1,16 +0,0 @@
1
- declare type EncryptedFile = {
2
- data: Uint8Array;
3
- md5: string;
4
- md5Encrypted: string;
5
- };
6
- declare function secretstreamKeygen(): Uint8Array;
7
- declare const CHUNK_SIZE = 8192;
8
- declare type Progress = {
9
- percent: number;
10
- total: number;
11
- current: number;
12
- };
13
- declare function encryptSecretstream(key: Uint8Array, data: Uint8Array, progress?: (progress: Progress) => Promise<void>, abort?: AbortController): Promise<EncryptedFile>;
14
- declare function decryptSecretstream(key: Uint8Array, data: Uint8Array, progress?: (progress: Progress) => Promise<void>, abort?: AbortController): Promise<Uint8Array>;
15
-
16
- export { CHUNK_SIZE, EncryptedFile, Progress, decryptSecretstream, encryptSecretstream, secretstreamKeygen };
@@ -1,2 +0,0 @@
1
- import{h as x}from"../chunk-UPFDSEKI.js";import{setup as S,sodium as r}from"../sodium.js";import U from"spark-md5";import{chunks as b}from"../utils/utils.js";function _(o,e){if(!o)throw new Error(e)}function F(){return r.crypto_secretstream_xchacha20poly1305_keygen()}function w(o){let e=!1;const{state:t,header:y}=r.crypto_secretstream_xchacha20poly1305_init_push(o),l=(i,d)=>(_(e===!1,"state already destroyed"),r.crypto_secretstream_xchacha20poly1305_push(t,d,null,i));function p(){_(e===!1,"state already destroyed"),e=!0}return{encrypt:l,destroy:p,header:y}}function Y(o,e){_(o.byteLength>=r.crypto_secretstream_xchacha20poly1305_HEADERBYTES,`header must be at least HEADERBYTES (${r.crypto_secretstream_xchacha20poly1305_HEADERBYTES}) long`),_(e.byteLength>=r.crypto_secretstream_xchacha20poly1305_KEYBYTES,`key must be at least KEYBYTES (${r.crypto_secretstream_xchacha20poly1305_KEYBYTES}) long`);let t=!1;const y=r.crypto_secretstream_xchacha20poly1305_init_pull(o,e),l=i=>(_(t===!1,"state already destroyed"),r.crypto_secretstream_xchacha20poly1305_pull(y,i));function p(){_(t===!1,"state already destroyed"),t=!0}return{decrypt:l,destroy:p}}const m=8192;function L(o,e,t,y){return x(this,null,function*(){yield S();const{encrypt:l,destroy:p,header:i}=w(o),d=m+r.crypto_secretstream_xchacha20poly1305_ABYTES,c=Math.ceil(e.byteLength/m)*d+i.byteLength;t==null||t({percent:0,total:c,current:0});const h=new Uint8Array(c),n=new U.ArrayBuffer,u=new U.ArrayBuffer;h.set(i),n.append(i);let a=i.byteLength;t==null||t({percent:a/c,total:c,current:a});let E=a/c;for(const s of b(e,m)){if(y!=null&&y.signal.aborted)throw new Error("Encrypt aborted");u.append(s);const T=s.length<m?r.crypto_secretstream_xchacha20poly1305_TAG_FINAL:r.crypto_secretstream_xchacha20poly1305_TAG_MESSAGE,f=l(T,s);n.append(f),h.set(f,a),a+=f.byteLength;const A=a/c;A>E+.01&&(t==null||t({percent:A,total:c,current:a}),E=A)}return p(),t==null||t({percent:1,total:a,current:a}),{data:h.slice(0,a),md5Encrypted:n.end(),md5:u.end()}})}function P(o,e,t,y){return x(this,null,function*(){yield S();const l=e.slice(0,r.crypto_secretstream_xchacha20poly1305_HEADERBYTES);e=e.slice(r.crypto_secretstream_xchacha20poly1305_HEADERBYTES);const{decrypt:p,destroy:i}=Y(l,o),d=m+r.crypto_secretstream_xchacha20poly1305_ABYTES,c=Math.ceil(e.byteLength/d)*m;t==null||t({percent:0,total:c,current:0});const h=new Uint8Array(c);let n=0,u=n/c;for(const a of b(e,d)){if(y!=null&&y.signal.aborted)throw new Error("Decrypt aborted");const E=p(a);h.set(E.message,n),n+=E.message.byteLength;const s=n/c;s>u+.01&&(t==null||t({percent:s,total:c,current:n}),u=s)}return i(),t==null||t({percent:1,total:n,current:n}),h.slice(0,n)})}export{m as CHUNK_SIZE,P as decryptSecretstream,L as encryptSecretstream,F as secretstreamKeygen};
2
- //# sourceMappingURL=file.js.map