@secrecy/lib 1.7.0 → 1.8.0

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 (152) hide show
  1. package/LICENSE +1 -1
  2. package/dist/lib/base-client.js +91 -0
  3. package/dist/lib/cache.js +4 -0
  4. package/dist/lib/client/SecrecryCareClient.js +19 -0
  5. package/dist/lib/client/SecrecyAppClient.js +87 -0
  6. package/dist/lib/client/SecrecyCloudClient.js +475 -0
  7. package/dist/lib/client/SecrecyDbClient.js +10 -0
  8. package/dist/lib/client/SecrecyMailClient.js +283 -0
  9. package/dist/lib/client/SecrecyPayClient.js +34 -0
  10. package/dist/lib/client/SecrecyUserClient.js +27 -0
  11. package/dist/lib/client/SecrecyWalletClient.js +50 -0
  12. package/dist/lib/client/convert/file.js +29 -0
  13. package/dist/lib/client/convert/mail.js +42 -0
  14. package/dist/lib/client/convert/node.js +100 -0
  15. package/dist/lib/client/helpers.js +103 -0
  16. package/dist/lib/client/index.js +49 -0
  17. package/dist/lib/client/storage.js +7 -0
  18. package/dist/lib/client/types/app.js +1 -0
  19. package/dist/lib/client/types/file.js +1 -0
  20. package/dist/lib/client/types/index.js +15 -0
  21. package/dist/lib/client/types/mail.js +1 -0
  22. package/dist/lib/client/types/node.js +1 -0
  23. package/dist/lib/client/types/user.js +1 -0
  24. package/dist/lib/client.js +47 -0
  25. package/dist/lib/crypto/file.js +184 -0
  26. package/dist/lib/crypto/index.js +41 -0
  27. package/dist/lib/error/client.js +10 -0
  28. package/dist/lib/error/index.js +10 -0
  29. package/dist/lib/error/server.js +27 -0
  30. package/dist/lib/index.js +10 -0
  31. package/dist/lib/minify/index.js +23 -0
  32. package/dist/lib/minify/lz4.js +517 -0
  33. package/dist/lib/sodium.js +5 -0
  34. package/dist/lib/types.js +1 -0
  35. package/dist/lib/utils/array.js +25 -0
  36. package/dist/lib/utils/base64.js +2 -0
  37. package/dist/lib/utils/popup-tools.js +180 -0
  38. package/dist/lib/utils/promise.js +20 -0
  39. package/dist/lib/utils/store-buddy.js +60 -0
  40. package/dist/lib/utils/time.js +13 -0
  41. package/dist/lib/worker/md5.js +18 -0
  42. package/dist/lib/worker/sodium.js +95 -0
  43. package/dist/lib/worker/workerCodes.js +254 -0
  44. package/dist/types/base-client.d.ts +28 -0
  45. package/dist/types/cache.d.ts +11 -0
  46. package/dist/types/client/SecrecryCareClient.d.ts +9 -0
  47. package/dist/types/client/SecrecyAppClient.d.ts +20 -0
  48. package/dist/types/client/SecrecyCloudClient.d.ts +88 -0
  49. package/dist/types/client/SecrecyDbClient.d.ts +7 -0
  50. package/dist/types/client/SecrecyMailClient.d.ts +42 -0
  51. package/dist/types/client/SecrecyPayClient.d.ts +27 -0
  52. package/dist/types/client/SecrecyUserClient.d.ts +14 -0
  53. package/dist/{client → types/client}/SecrecyWalletClient.d.ts +9 -12
  54. package/dist/types/client/convert/file.d.ts +4 -0
  55. package/dist/types/client/convert/mail.d.ts +8 -0
  56. package/dist/types/client/convert/node.d.ts +7 -0
  57. package/dist/types/client/helpers.d.ts +26 -0
  58. package/dist/types/client/index.d.ts +29 -0
  59. package/dist/{client → types/client}/storage.d.ts +2 -2
  60. package/dist/types/client/types/app.d.ts +2 -0
  61. package/dist/types/client/types/file.d.ts +6 -0
  62. package/dist/types/client/types/index.d.ts +46 -0
  63. package/dist/types/client/types/mail.d.ts +87 -0
  64. package/dist/{client/types/Node.d.ts → types/client/types/node.d.ts} +20 -25
  65. package/dist/types/client/types/user.d.ts +3 -0
  66. package/dist/types/client.d.ts +12138 -0
  67. package/dist/{crypto → types/crypto}/file.d.ts +4 -4
  68. package/dist/{crypto → types/crypto}/index.d.ts +1 -4
  69. package/dist/types/error/client.d.ts +22 -0
  70. package/dist/types/error/index.d.ts +40 -0
  71. package/dist/types/error/server.d.ts +26 -0
  72. package/dist/types/index.d.ts +13 -0
  73. package/dist/{minify → types/minify}/index.d.ts +1 -1
  74. package/dist/types/minify/lz4.d.ts +35 -0
  75. package/dist/{sodium.d.ts → types/sodium.d.ts} +1 -1
  76. package/dist/types/types.d.ts +10 -0
  77. package/dist/{utils/utils.d.ts → types/utils/array.d.ts} +0 -1
  78. package/dist/types/utils/base64.d.ts +1 -0
  79. package/dist/types/utils/popup-tools.d.ts +52 -0
  80. package/dist/types/utils/promise.d.ts +1 -0
  81. package/dist/types/utils/store-buddy.d.ts +130 -0
  82. package/dist/{worker → types/worker}/sodium.d.ts +1 -1
  83. package/package.json +48 -73
  84. package/dist/BaseClient.d.ts +0 -111
  85. package/dist/BaseClient.js +0 -506
  86. package/dist/PopupTools.d.ts +0 -17
  87. package/dist/PopupTools.js +0 -195
  88. package/dist/ZeusThunder.d.ts +0 -2
  89. package/dist/ZeusThunder.js +0 -65
  90. package/dist/cache.d.ts +0 -6
  91. package/dist/cache.js +0 -4
  92. package/dist/client/SecrecyAppClient.d.ts +0 -17
  93. package/dist/client/SecrecyAppClient.js +0 -226
  94. package/dist/client/SecrecyCloudClient.d.ts +0 -89
  95. package/dist/client/SecrecyCloudClient.js +0 -1405
  96. package/dist/client/SecrecyDbClient.d.ts +0 -48
  97. package/dist/client/SecrecyDbClient.js +0 -419
  98. package/dist/client/SecrecyMailClient.d.ts +0 -42
  99. package/dist/client/SecrecyMailClient.js +0 -1022
  100. package/dist/client/SecrecyPayClient.d.ts +0 -28
  101. package/dist/client/SecrecyPayClient.js +0 -68
  102. package/dist/client/SecrecyWalletClient.js +0 -73
  103. package/dist/client/convert/file.d.ts +0 -5
  104. package/dist/client/convert/file.js +0 -33
  105. package/dist/client/convert/mail.d.ts +0 -3
  106. package/dist/client/convert/mail.js +0 -42
  107. package/dist/client/convert/node.d.ts +0 -9
  108. package/dist/client/convert/node.js +0 -87
  109. package/dist/client/helpers.d.ts +0 -28
  110. package/dist/client/helpers.js +0 -119
  111. package/dist/client/index.d.ts +0 -34
  112. package/dist/client/index.js +0 -46
  113. package/dist/client/storage.js +0 -12
  114. package/dist/client/types/File.d.ts +0 -14
  115. package/dist/client/types/File.js +0 -3
  116. package/dist/client/types/Inputs.d.ts +0 -16
  117. package/dist/client/types/Inputs.js +0 -3
  118. package/dist/client/types/Node.js +0 -3
  119. package/dist/client/types/UserAppNotifications.d.ts +0 -6
  120. package/dist/client/types/UserAppNotifications.js +0 -3
  121. package/dist/client/types/UserAppSettings.d.ts +0 -5
  122. package/dist/client/types/UserAppSettings.js +0 -3
  123. package/dist/client/types/index.d.ts +0 -120
  124. package/dist/client/types/index.js +0 -8
  125. package/dist/client/types/selectors.d.ts +0 -400
  126. package/dist/client/types/selectors.js +0 -135
  127. package/dist/crypto/file.js +0 -195
  128. package/dist/crypto/index.js +0 -45
  129. package/dist/error.d.ts +0 -33
  130. package/dist/error.js +0 -3
  131. package/dist/index.d.ts +0 -14
  132. package/dist/index.js +0 -10
  133. package/dist/minify/index.js +0 -23
  134. package/dist/minify/lz4.d.ts +0 -5
  135. package/dist/minify/lz4.js +0 -539
  136. package/dist/sodium.js +0 -6
  137. package/dist/utils/encoders.d.ts +0 -26
  138. package/dist/utils/encoders.js +0 -18
  139. package/dist/utils/store-buddy.d.ts +0 -14
  140. package/dist/utils/store-buddy.js +0 -58
  141. package/dist/utils/time.js +0 -12
  142. package/dist/utils/utils.js +0 -47
  143. package/dist/worker/md5.js +0 -24
  144. package/dist/worker/sodium.js +0 -118
  145. package/dist/worker/workerCodes.js +0 -255
  146. package/dist/zeus/const.d.ts +0 -7
  147. package/dist/zeus/const.js +0 -1846
  148. package/dist/zeus/index.d.ts +0 -8721
  149. package/dist/zeus/index.js +0 -642
  150. /package/dist/{utils → types/utils}/time.d.ts +0 -0
  151. /package/dist/{worker → types/worker}/md5.d.ts +0 -0
  152. /package/dist/{worker → types/worker}/workerCodes.d.ts +0 -0
@@ -0,0 +1,20 @@
1
+ import type { SecrecyClient, UserAppNotifications, UserAppSettings } from '../index.js';
2
+ import type { JwtPayload } from 'jsonwebtoken';
3
+ import { type RouterOutputs, type ApiClient } from '../client.js';
4
+ import { type KeyPair } from './types/index.js';
5
+ export declare class SecrecyAppClient {
6
+ #private;
7
+ jwt: string;
8
+ jwtDecoded: JwtPayload;
9
+ constructor(uaJwt: string, _client: SecrecyClient, _keys: KeyPair, apiClient: ApiClient);
10
+ get userId(): string;
11
+ getJwt(): Promise<string>;
12
+ limits(): Promise<RouterOutputs['application']['limits']>;
13
+ metrics(): Promise<RouterOutputs['application']['metrics']>;
14
+ quotas(): Promise<RouterOutputs['application']['quotas']>;
15
+ updateNotifications(notifications: Partial<UserAppNotifications>): Promise<UserAppNotifications>;
16
+ notifications(): Promise<UserAppNotifications>;
17
+ userPublicKey(userId: string): Promise<string>;
18
+ settings(): Promise<UserAppSettings>;
19
+ updateSettings(settings: Partial<UserAppSettings>): Promise<UserAppSettings>;
20
+ }
@@ -0,0 +1,88 @@
1
+ import type { ProgressCallback, SecrecyClient } from '../index.js';
2
+ import type { FileMetadata, KeyPair, Node, NodeFull, NodeType, Rights } from './types/index.js';
3
+ import { type ApiClient } from '../client.js';
4
+ import { type DownloadProgress } from '../types.js';
5
+ export declare class SecrecyCloudClient {
6
+ #private;
7
+ constructor(client: SecrecyClient, keys: KeyPair, apiClient: ApiClient);
8
+ addFileToHistory({ fileId, nodeId, }: {
9
+ fileId: string;
10
+ nodeId: string;
11
+ }): Promise<NodeFull>;
12
+ uploadFile({ file, encryptProgress, uploadProgress, signal, }: {
13
+ file: globalThis.File | Uint8Array;
14
+ encryptProgress?: ProgressCallback;
15
+ uploadProgress?: ProgressCallback;
16
+ signal?: AbortSignal;
17
+ }): Promise<string>;
18
+ uploadFileInCloud({ file, name, nodeId, encryptProgress, uploadProgress, signal, }: {
19
+ file: globalThis.File | Uint8Array;
20
+ name: string;
21
+ nodeId?: string;
22
+ encryptProgress?: ProgressCallback;
23
+ uploadProgress?: ProgressCallback;
24
+ signal?: AbortSignal;
25
+ }): Promise<NodeFull>;
26
+ deletedNodes(): Promise<Node[]>;
27
+ sharedNodes(): Promise<Node[]>;
28
+ nodesSharedWithMe(type?: NodeType): Promise<Node[]>;
29
+ deleteNodeSharing({ nodeId, userId, }: {
30
+ nodeId: string;
31
+ userId: string;
32
+ }): Promise<boolean>;
33
+ duplicateNode({ nodeId, folderId, customName, }: {
34
+ nodeId: string;
35
+ folderId?: string | null | undefined;
36
+ customName?: string | null | undefined;
37
+ }): Promise<boolean>;
38
+ deleteNodeCloudTrash({ ids }: {
39
+ ids: string[];
40
+ }): Promise<boolean>;
41
+ createFolder({ name, parentFolderId, }: {
42
+ name: string;
43
+ parentFolderId?: string | null;
44
+ }): Promise<NodeFull>;
45
+ node({ id, deleted, }?: {
46
+ id?: string | null | undefined;
47
+ deleted?: boolean | null | undefined;
48
+ }): Promise<NodeFull>;
49
+ fileMetadata({ id }: {
50
+ id: string;
51
+ }): Promise<FileMetadata>;
52
+ shareNode({ nodeId, userId, rights, }: {
53
+ nodeId: string;
54
+ userId: string;
55
+ rights: Rights;
56
+ }): Promise<boolean>;
57
+ updateNode({ nodeId, name, isFavorite, deletedAt, }: {
58
+ nodeId: string;
59
+ name?: string | null | undefined;
60
+ isFavorite?: boolean | null | undefined;
61
+ deletedAt?: Date | null | undefined;
62
+ }): Promise<NodeFull>;
63
+ fileContent({ fileId, onDownloadProgress, progressDecrypt, signal, }: {
64
+ fileId: string;
65
+ onDownloadProgress?: (progress: DownloadProgress) => void;
66
+ progressDecrypt?: ProgressCallback;
67
+ signal?: AbortSignal;
68
+ }): Promise<Uint8Array>;
69
+ deleteFile({ fileId, nodeId, }: {
70
+ fileId: string;
71
+ nodeId: string;
72
+ }): Promise<boolean>;
73
+ deleteNode({ nodeId }: {
74
+ nodeId: string;
75
+ }): Promise<boolean>;
76
+ emptyTrash(): Promise<boolean>;
77
+ recoverNode(id: string): Promise<boolean>;
78
+ moveNodes({ nodeIds, parentNodeId, }: {
79
+ nodeIds: string[];
80
+ parentNodeId?: string | null | undefined;
81
+ }): Promise<boolean>;
82
+ saveInCloud({ fileId, name, nodeId, }: {
83
+ fileId: string;
84
+ name: string;
85
+ nodeId?: string;
86
+ }): Promise<NodeFull>;
87
+ private readonly perNode;
88
+ }
@@ -0,0 +1,7 @@
1
+ import { type ApiClient } from '../client.js';
2
+ import type { SecrecyClient } from '../index.js';
3
+ import { type KeyPair } from './types/index.js';
4
+ export declare class SecrecyDbClient {
5
+ #private;
6
+ constructor(_client: SecrecyClient, _keys: KeyPair, apiClient: ApiClient);
7
+ }
@@ -0,0 +1,42 @@
1
+ import { type ApiClient } from '../client.js';
2
+ import type { DraftMail, Mail, NewMail, ReceivedMail, SecrecyClient, SentMail, WaitingReceivedMail } from '../index.js';
3
+ import { type KeyPair } from './types/index.js';
4
+ import { type ApiMail } from './types/mail.js';
5
+ export declare class SecrecyMailClient {
6
+ #private;
7
+ constructor(client: SecrecyClient, keys: KeyPair, apiClient: ApiClient);
8
+ get({ id }: {
9
+ id: string;
10
+ }): Promise<Mail>;
11
+ recover({ mailId }: {
12
+ mailId: string;
13
+ }): Promise<boolean>;
14
+ deletedMails({ mailType, }: {
15
+ mailType: ApiMail['type'];
16
+ }): Promise<Mail[]>;
17
+ create(data: NewMail, customMessage?: string | null | undefined): Promise<boolean>;
18
+ waitingReceivedMails(): Promise<WaitingReceivedMail[]>;
19
+ updateDraft(draftId: string, { body, subject, senderFiles, recipients, replyToId }: Partial<NewMail>): Promise<DraftMail>;
20
+ deleteDraft(draftId: string): Promise<boolean>;
21
+ deleteTrash({ ids }: {
22
+ ids: string[];
23
+ }): Promise<boolean>;
24
+ emptyTrash(): Promise<boolean>;
25
+ delete({ mailId }: {
26
+ mailId: string;
27
+ }): Promise<boolean>;
28
+ sendDraft(draftId: string, customMessage?: string | null | undefined): Promise<boolean>;
29
+ sendWaitingEmails(): Promise<void>;
30
+ createDraft({ body, subject, senderFiles, recipients, replyToId, }: NewMail): Promise<DraftMail>;
31
+ read({ mailId }: {
32
+ mailId: string;
33
+ }): Promise<boolean>;
34
+ unread({ mailId }: {
35
+ mailId: string;
36
+ }): Promise<boolean>;
37
+ receivedMails(): Promise<ReceivedMail[]>;
38
+ sentMails(): Promise<SentMail[]>;
39
+ draftMails(): Promise<DraftMail[]>;
40
+ unreadReceivedMailsCount(): Promise<number>;
41
+ private readonly _eachUser;
42
+ }
@@ -0,0 +1,27 @@
1
+ import type { SecrecyClient } from '../index.js';
2
+ import { type ApiClient } from '../client.js';
3
+ import { type KeyPair } from './types/index.js';
4
+ interface SuccessPayResponse<T> {
5
+ success: true;
6
+ data: T;
7
+ }
8
+ interface ErrorPayResponse {
9
+ success: false;
10
+ error: string;
11
+ }
12
+ export type SecrecyPayResponse<T> = SuccessPayResponse<T> | ErrorPayResponse;
13
+ export declare class SecrecyPayClient {
14
+ #private;
15
+ constructor(client: SecrecyClient, _keys: KeyPair, _apiClient: ApiClient);
16
+ confirmPaymentIntent({ paymentIntentId, secrecyIdWhoCreatedPaymentIntent, secrecyIdWhoNeedToConfirmPaymentIntent, amount, currency, }: {
17
+ paymentIntentId: string;
18
+ secrecyIdWhoCreatedPaymentIntent: string;
19
+ secrecyIdWhoNeedToConfirmPaymentIntent: string;
20
+ amount: number;
21
+ currency: 'eur' | 'usd';
22
+ }): Promise<SecrecyPayResponse<{
23
+ id: string;
24
+ message: string;
25
+ }>>;
26
+ }
27
+ export {};
@@ -0,0 +1,14 @@
1
+ import type { RouterInputs, ApiClient, RouterOutputs } from '../client.js';
2
+ import type { SecrecyClient } from '../index.js';
3
+ import type { KeyPair } from './types/index.js';
4
+ export declare class SecrecyUserClient {
5
+ #private;
6
+ constructor(_client: SecrecyClient, _keys: KeyPair, apiClient: ApiClient);
7
+ answerInvitation(input: RouterInputs['contacts']['answerInvitation']): Promise<RouterOutputs['contacts']['answerInvitation']>;
8
+ cancelInvitation(input: RouterInputs['contacts']['cancelInvitation']): Promise<RouterOutputs['contacts']['cancelInvitation']>;
9
+ createInvitation(input: RouterInputs['contacts']['createInvitation']): Promise<RouterOutputs['contacts']['createInvitation']>;
10
+ getContacts(input: RouterInputs['contacts']['getContacts']): Promise<RouterOutputs['contacts']['getContacts']>;
11
+ getReceivedInvitations(input: RouterInputs['contacts']['getReceivedInvitations']): Promise<RouterOutputs['contacts']['getReceivedInvitations']>;
12
+ getSentInvitations(input: RouterInputs['contacts']['getSentInvitations']): Promise<RouterOutputs['contacts']['getSentInvitations']>;
13
+ removeContact(input: RouterInputs['contacts']['removeContact']): Promise<RouterOutputs['contacts']['removeContact']>;
14
+ }
@@ -1,28 +1,25 @@
1
- import type { SecrecyClient, SecrecyEnv } from "../index.js";
2
- import { InfuraNetwork } from "../zeus/index.js";
3
- import type { providers } from "ethers";
4
- type SuccessWalletResponse<T> = {
1
+ import type { SecrecyClient, InfuraNetwork } from '../index.js';
2
+ import { type TransactionRequest } from 'ethers';
3
+ interface SuccessWalletResponse<T> {
5
4
  success: true;
6
5
  data: T;
7
- };
8
- type ErrorWalletResponse = {
6
+ }
7
+ interface ErrorWalletResponse {
9
8
  success: false;
10
9
  error: string;
11
- };
10
+ }
12
11
  export type SecrecyWalletResponse<T> = SuccessWalletResponse<T> | ErrorWalletResponse;
13
12
  export declare class SecrecyWalletClient {
14
13
  #private;
15
14
  constructor(client: SecrecyClient);
16
- createTransaction({ env, network, tx }: {
17
- env?: SecrecyEnv;
15
+ createTransaction({ network, tx, }: {
18
16
  network?: InfuraNetwork;
19
- tx: providers.TransactionRequest;
17
+ tx: TransactionRequest;
20
18
  }): Promise<SecrecyWalletResponse<{
21
19
  id: string;
22
20
  hash: string;
23
21
  }>>;
24
- createSignature({ env, network, message }: {
25
- env?: SecrecyEnv;
22
+ createSignature({ network, message, }: {
26
23
  network?: InfuraNetwork;
27
24
  message: string;
28
25
  }): Promise<SecrecyWalletResponse<string>>;
@@ -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,26 @@
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
+ appId: string;
10
+ appUrl: string;
11
+ backPath?: string;
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 declare function getSecrecyClient(session?: boolean): SecrecyClient | null;
22
+ type LoginResponse<Params extends UseSecrecyParams> = Params extends {
23
+ redirect: true;
24
+ } ? SecrecyClient | null : SecrecyClient;
25
+ export declare function login<Params extends UseSecrecyParams>({ appId, path, redirect, scopes, backPath, session, }: Params): Promise<LoginResponse<Params>>;
26
+ export {};
@@ -0,0 +1,29 @@
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
+ import { SecrecyUserClient } from './SecrecyUserClient.js';
12
+ import { SecrecyCareClient } from './SecrecryCareClient.js';
13
+ export type NewMail = Pick<RouterInputs['mail']['createDraft'], 'body' | 'subject' | 'senderFiles' | 'recipients' | 'replyToId'>;
14
+ export type ProgressCallback = (progress: Progress) => Promise<void>;
15
+ export declare const encryptName: (name: string, nameKey: string) => Promise<string>;
16
+ export declare class SecrecyClient extends BaseClient {
17
+ #private;
18
+ care: SecrecyCareClient;
19
+ cloud: SecrecyCloudClient;
20
+ mail: SecrecyMailClient;
21
+ app: SecrecyAppClient;
22
+ db: SecrecyDbClient;
23
+ wallet: SecrecyWalletClient;
24
+ pay: SecrecyPayClient;
25
+ user: SecrecyUserClient;
26
+ constructor(uaSession: string, uaKeys: KeyPair, uaJwt: string);
27
+ get publicKey(): string;
28
+ logout(sessionId?: string | null | undefined): Promise<void>;
29
+ }
@@ -1,5 +1,5 @@
1
- import type { KeyPair } from "../index.js";
2
- import type { StoreBuddy } from "../utils/store-buddy.js";
1
+ import type { StoreBuddy } from '../utils/store-buddy.js';
2
+ import { type KeyPair } from './types/index.js';
3
3
  export declare function getStorage(session?: boolean | undefined): {
4
4
  userAppKeys: StoreBuddy<KeyPair | null>;
5
5
  userAppSession: StoreBuddy<string | null>;
@@ -0,0 +1,2 @@
1
+ import type { RouterOutputs } from '../../client';
2
+ export type Application = RouterOutputs['tech']['application'];
@@ -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,46 @@
1
+ import { z } from 'zod';
2
+ export type * from './app.js';
3
+ export type * from './file.js';
4
+ export type * from './node.js';
5
+ export type * from './mail.js';
6
+ export type * from './user.js';
7
+ declare const keyPair: z.ZodObject<{
8
+ publicKey: z.ZodString;
9
+ privateKey: z.ZodString;
10
+ }, "strict", z.ZodTypeAny, {
11
+ publicKey: string;
12
+ privateKey: string;
13
+ }, {
14
+ publicKey: string;
15
+ privateKey: string;
16
+ }>;
17
+ export type KeyPair = z.infer<typeof keyPair>;
18
+ export declare const secrecyUserApp: z.ZodReadonly<z.ZodObject<{
19
+ keys: z.ZodObject<{
20
+ publicKey: z.ZodString;
21
+ privateKey: z.ZodString;
22
+ }, "strict", z.ZodTypeAny, {
23
+ publicKey: string;
24
+ privateKey: string;
25
+ }, {
26
+ publicKey: string;
27
+ privateKey: string;
28
+ }>;
29
+ jwt: z.ZodString;
30
+ uaSession: z.ZodString;
31
+ }, "strict", z.ZodTypeAny, {
32
+ keys: {
33
+ publicKey: string;
34
+ privateKey: string;
35
+ };
36
+ jwt: string;
37
+ uaSession: string;
38
+ }, {
39
+ keys: {
40
+ publicKey: string;
41
+ privateKey: string;
42
+ };
43
+ jwt: string;
44
+ uaSession: string;
45
+ }>>;
46
+ 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
+ }
@@ -1,33 +1,27 @@
1
- import type { NodeType, Rights } from "../../zeus/index.js";
2
- import type { FileMetadata, InternalFile, PublicUser } from "./index.js";
3
- import type { nodeFullSelector, nodeSelector } from "./selectors.js";
4
- import type { GraphQLTypes, InputType } from "../../zeus/index.js";
1
+ import { type RouterOutputs } from '../../client.js';
2
+ import type { FileMetadata, InternalFile, PublicUser } from './index.js';
3
+ export type Rights = ApiNode['users'][number][1];
5
4
  export type NodeAccess<T extends Record<string, unknown> = Record<string, unknown>> = T & {
6
5
  rights: Rights;
7
6
  isRoot: boolean;
8
- sharedBy: {
9
- keyPair?: {
10
- pub: string;
11
- };
12
- };
13
- userApp: {
14
- user: PublicUser;
15
- };
7
+ sharedByPubKey: string;
16
8
  };
17
- export type NodeBreadcrumbItem = {
9
+ export interface NodeBreadcrumbItem {
18
10
  id: string;
19
11
  name: string;
12
+ }
13
+ export interface NodeBreadcrumbItemWithPubKey extends NodeBreadcrumbItem {
20
14
  pubKey: string;
21
- };
22
- export type NodeSize = {
15
+ }
16
+ export interface NodeSize {
23
17
  size: bigint;
24
18
  sizeBefore: bigint;
25
- };
19
+ }
26
20
  type NameKey = {
27
- nameKey?: string;
21
+ nameKey: string | null;
28
22
  };
29
- export type InternalNodeBreadcrumbItem = NodeBreadcrumbItem & NameKey;
30
- export type Node<T extends NodeBreadcrumbItem = NodeBreadcrumbItem, U extends Record<string, unknown> = Record<string, unknown>> = {
23
+ export type InternalNodeBreadcrumbItem = NodeBreadcrumbItemWithPubKey & NameKey;
24
+ export interface Node<T extends NodeBreadcrumbItem = NodeBreadcrumbItem, U extends Record<string, unknown> = Record<string, unknown>> {
31
25
  id: string;
32
26
  isFavorite: boolean;
33
27
  type: NodeType;
@@ -38,19 +32,20 @@ export type Node<T extends NodeBreadcrumbItem = NodeBreadcrumbItem, U extends Re
38
32
  name: string;
39
33
  breadcrumb: T[];
40
34
  createdBy: PublicUser;
41
- access?: NodeAccess<U>;
42
- users: [PublicUser, Rights][];
35
+ access: NodeAccess<U>;
36
+ users: Array<[PublicUser, Rights]>;
43
37
  parentId: string | null;
44
38
  currentFileId: string | null;
45
- };
39
+ }
46
40
  export type NodeFull<T extends NodeBreadcrumbItem = NodeBreadcrumbItem, U extends Record<string, unknown> = Record<string, unknown>, V extends FileMetadata = FileMetadata> = Node<T, U> & {
47
41
  parent: Node<T, U> | null;
48
- children: Node<T, U>[];
42
+ children: Array<Node<T, U>>;
49
43
  current?: V;
50
44
  history: V[];
51
45
  };
52
46
  export type InternalNode = Node<InternalNodeBreadcrumbItem, NameKey>;
53
47
  export type InternalNodeFull = NodeFull<InternalNodeBreadcrumbItem, NameKey, InternalFile>;
54
- export type GQLNode = InputType<GraphQLTypes["Node"], typeof nodeSelector>;
55
- export type GQLNodeFull = InputType<GraphQLTypes["Node"], typeof nodeFullSelector>;
48
+ export type ApiNode = RouterOutputs['cloud']['nodeById'];
49
+ export type ApiNodeFull = RouterOutputs['cloud']['nodeFullById'];
50
+ export type NodeType = ApiNode['type'];
56
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'];