@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.
- package/LICENSE +1 -1
- package/dist/lib/base-client.js +91 -0
- package/dist/lib/cache.js +4 -0
- package/dist/lib/client/SecrecryCareClient.js +19 -0
- package/dist/lib/client/SecrecyAppClient.js +87 -0
- package/dist/lib/client/SecrecyCloudClient.js +475 -0
- package/dist/lib/client/SecrecyDbClient.js +10 -0
- package/dist/lib/client/SecrecyMailClient.js +283 -0
- package/dist/lib/client/SecrecyPayClient.js +34 -0
- package/dist/lib/client/SecrecyUserClient.js +27 -0
- package/dist/lib/client/SecrecyWalletClient.js +50 -0
- package/dist/lib/client/convert/file.js +29 -0
- package/dist/lib/client/convert/mail.js +42 -0
- package/dist/lib/client/convert/node.js +100 -0
- package/dist/lib/client/helpers.js +103 -0
- package/dist/lib/client/index.js +49 -0
- package/dist/lib/client/storage.js +7 -0
- package/dist/lib/client/types/app.js +1 -0
- package/dist/lib/client/types/file.js +1 -0
- package/dist/lib/client/types/index.js +15 -0
- package/dist/lib/client/types/mail.js +1 -0
- package/dist/lib/client/types/node.js +1 -0
- package/dist/lib/client/types/user.js +1 -0
- package/dist/lib/client.js +47 -0
- package/dist/lib/crypto/file.js +184 -0
- package/dist/lib/crypto/index.js +41 -0
- package/dist/lib/error/client.js +10 -0
- package/dist/lib/error/index.js +10 -0
- package/dist/lib/error/server.js +27 -0
- package/dist/lib/index.js +10 -0
- package/dist/lib/minify/index.js +23 -0
- package/dist/lib/minify/lz4.js +517 -0
- package/dist/lib/sodium.js +5 -0
- package/dist/lib/types.js +1 -0
- package/dist/lib/utils/array.js +25 -0
- package/dist/lib/utils/base64.js +2 -0
- package/dist/lib/utils/popup-tools.js +180 -0
- package/dist/lib/utils/promise.js +20 -0
- package/dist/lib/utils/store-buddy.js +60 -0
- package/dist/lib/utils/time.js +13 -0
- package/dist/lib/worker/md5.js +18 -0
- package/dist/lib/worker/sodium.js +95 -0
- package/dist/lib/worker/workerCodes.js +254 -0
- package/dist/types/base-client.d.ts +28 -0
- package/dist/types/cache.d.ts +11 -0
- package/dist/types/client/SecrecryCareClient.d.ts +9 -0
- package/dist/types/client/SecrecyAppClient.d.ts +20 -0
- package/dist/types/client/SecrecyCloudClient.d.ts +88 -0
- package/dist/types/client/SecrecyDbClient.d.ts +7 -0
- package/dist/types/client/SecrecyMailClient.d.ts +42 -0
- package/dist/types/client/SecrecyPayClient.d.ts +27 -0
- package/dist/types/client/SecrecyUserClient.d.ts +14 -0
- package/dist/{client → types/client}/SecrecyWalletClient.d.ts +9 -12
- package/dist/types/client/convert/file.d.ts +4 -0
- package/dist/types/client/convert/mail.d.ts +8 -0
- package/dist/types/client/convert/node.d.ts +7 -0
- package/dist/types/client/helpers.d.ts +26 -0
- package/dist/types/client/index.d.ts +29 -0
- package/dist/{client → types/client}/storage.d.ts +2 -2
- package/dist/types/client/types/app.d.ts +2 -0
- package/dist/types/client/types/file.d.ts +6 -0
- package/dist/types/client/types/index.d.ts +46 -0
- package/dist/types/client/types/mail.d.ts +87 -0
- package/dist/{client/types/Node.d.ts → types/client/types/node.d.ts} +20 -25
- package/dist/types/client/types/user.d.ts +3 -0
- package/dist/types/client.d.ts +12138 -0
- package/dist/{crypto → types/crypto}/file.d.ts +4 -4
- package/dist/{crypto → types/crypto}/index.d.ts +1 -4
- package/dist/types/error/client.d.ts +22 -0
- package/dist/types/error/index.d.ts +40 -0
- package/dist/types/error/server.d.ts +26 -0
- package/dist/types/index.d.ts +13 -0
- package/dist/{minify → types/minify}/index.d.ts +1 -1
- package/dist/types/minify/lz4.d.ts +35 -0
- package/dist/{sodium.d.ts → types/sodium.d.ts} +1 -1
- package/dist/types/types.d.ts +10 -0
- package/dist/{utils/utils.d.ts → types/utils/array.d.ts} +0 -1
- package/dist/types/utils/base64.d.ts +1 -0
- package/dist/types/utils/popup-tools.d.ts +52 -0
- package/dist/types/utils/promise.d.ts +1 -0
- package/dist/types/utils/store-buddy.d.ts +130 -0
- package/dist/{worker → types/worker}/sodium.d.ts +1 -1
- package/package.json +48 -73
- package/dist/BaseClient.d.ts +0 -111
- package/dist/BaseClient.js +0 -506
- package/dist/PopupTools.d.ts +0 -17
- package/dist/PopupTools.js +0 -195
- package/dist/ZeusThunder.d.ts +0 -2
- package/dist/ZeusThunder.js +0 -65
- package/dist/cache.d.ts +0 -6
- package/dist/cache.js +0 -4
- package/dist/client/SecrecyAppClient.d.ts +0 -17
- package/dist/client/SecrecyAppClient.js +0 -226
- package/dist/client/SecrecyCloudClient.d.ts +0 -89
- package/dist/client/SecrecyCloudClient.js +0 -1405
- package/dist/client/SecrecyDbClient.d.ts +0 -48
- package/dist/client/SecrecyDbClient.js +0 -419
- package/dist/client/SecrecyMailClient.d.ts +0 -42
- package/dist/client/SecrecyMailClient.js +0 -1022
- package/dist/client/SecrecyPayClient.d.ts +0 -28
- package/dist/client/SecrecyPayClient.js +0 -68
- package/dist/client/SecrecyWalletClient.js +0 -73
- package/dist/client/convert/file.d.ts +0 -5
- package/dist/client/convert/file.js +0 -33
- package/dist/client/convert/mail.d.ts +0 -3
- package/dist/client/convert/mail.js +0 -42
- package/dist/client/convert/node.d.ts +0 -9
- package/dist/client/convert/node.js +0 -87
- package/dist/client/helpers.d.ts +0 -28
- package/dist/client/helpers.js +0 -119
- package/dist/client/index.d.ts +0 -34
- package/dist/client/index.js +0 -46
- package/dist/client/storage.js +0 -12
- package/dist/client/types/File.d.ts +0 -14
- package/dist/client/types/File.js +0 -3
- package/dist/client/types/Inputs.d.ts +0 -16
- package/dist/client/types/Inputs.js +0 -3
- package/dist/client/types/Node.js +0 -3
- package/dist/client/types/UserAppNotifications.d.ts +0 -6
- package/dist/client/types/UserAppNotifications.js +0 -3
- package/dist/client/types/UserAppSettings.d.ts +0 -5
- package/dist/client/types/UserAppSettings.js +0 -3
- package/dist/client/types/index.d.ts +0 -120
- package/dist/client/types/index.js +0 -8
- package/dist/client/types/selectors.d.ts +0 -400
- package/dist/client/types/selectors.js +0 -135
- package/dist/crypto/file.js +0 -195
- package/dist/crypto/index.js +0 -45
- package/dist/error.d.ts +0 -33
- package/dist/error.js +0 -3
- package/dist/index.d.ts +0 -14
- package/dist/index.js +0 -10
- package/dist/minify/index.js +0 -23
- package/dist/minify/lz4.d.ts +0 -5
- package/dist/minify/lz4.js +0 -539
- package/dist/sodium.js +0 -6
- package/dist/utils/encoders.d.ts +0 -26
- package/dist/utils/encoders.js +0 -18
- package/dist/utils/store-buddy.d.ts +0 -14
- package/dist/utils/store-buddy.js +0 -58
- package/dist/utils/time.js +0 -12
- package/dist/utils/utils.js +0 -47
- package/dist/worker/md5.js +0 -24
- package/dist/worker/sodium.js +0 -118
- package/dist/worker/workerCodes.js +0 -255
- package/dist/zeus/const.d.ts +0 -7
- package/dist/zeus/const.js +0 -1846
- package/dist/zeus/index.d.ts +0 -8721
- package/dist/zeus/index.js +0 -642
- /package/dist/{utils → types/utils}/time.d.ts +0 -0
- /package/dist/{worker → types/worker}/md5.d.ts +0 -0
- /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,
|
|
2
|
-
import {
|
|
3
|
-
|
|
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
|
-
|
|
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({
|
|
17
|
-
env?: SecrecyEnv;
|
|
15
|
+
createTransaction({ network, tx, }: {
|
|
18
16
|
network?: InfuraNetwork;
|
|
19
|
-
tx:
|
|
17
|
+
tx: TransactionRequest;
|
|
20
18
|
}): Promise<SecrecyWalletResponse<{
|
|
21
19
|
id: string;
|
|
22
20
|
hash: string;
|
|
23
21
|
}>>;
|
|
24
|
-
createSignature({
|
|
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 {
|
|
2
|
-
import type
|
|
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,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
|
|
2
|
-
import type { FileMetadata, InternalFile, PublicUser } from
|
|
3
|
-
|
|
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
|
-
|
|
9
|
-
keyPair?: {
|
|
10
|
-
pub: string;
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
userApp: {
|
|
14
|
-
user: PublicUser;
|
|
15
|
-
};
|
|
7
|
+
sharedByPubKey: string;
|
|
16
8
|
};
|
|
17
|
-
export
|
|
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
|
|
15
|
+
}
|
|
16
|
+
export interface NodeSize {
|
|
23
17
|
size: bigint;
|
|
24
18
|
sizeBefore: bigint;
|
|
25
|
-
}
|
|
19
|
+
}
|
|
26
20
|
type NameKey = {
|
|
27
|
-
nameKey
|
|
21
|
+
nameKey: string | null;
|
|
28
22
|
};
|
|
29
|
-
export type InternalNodeBreadcrumbItem =
|
|
30
|
-
export
|
|
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
|
|
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
|
|
55
|
-
export type
|
|
48
|
+
export type ApiNode = RouterOutputs['cloud']['nodeById'];
|
|
49
|
+
export type ApiNodeFull = RouterOutputs['cloud']['nodeFullById'];
|
|
50
|
+
export type NodeType = ApiNode['type'];
|
|
56
51
|
export {};
|