Cleanup - unused files / unused exports / duplicate exports
[ProtonMail-WebClient.git] / applications / drive / src / app / store / _shares / interface.ts
blob5c40a99df3f275b1b60cef0fa1e3a9e4e1594ced
1 import type { PublicKeyReference, SessionKey } from '@proton/crypto';
2 import type { SHARE_EXTERNAL_INVITATION_STATE, SHARE_MEMBER_STATE } from '@proton/shared/lib/drive/constants';
3 import type { SHARE_MEMBER_PERMISSIONS } from '@proton/shared/lib/drive/permissions';
5 type WithSRPPayload<T extends any> = T & {
6     srpModulusID: string;
7     srpVerifier: string;
8     urlPasswordSalt: string;
9 };
11 // Share type string used in metrics context, do not confuse with ShareType enum.
12 export type ShareTypeString = 'main' | 'device' | 'photo' | 'shared';
14 export enum ShareType {
15     default = 1,
16     standard,
17     device,
18     photos,
21 export enum ShareState {
22     active = 1,
23     deleted,
24     restored,
27 export interface Share {
28     shareId: string;
29     rootLinkId: string;
30     volumeId: string;
31     creator: string;
32     isLocked: boolean;
33     isDefault: boolean;
34     isVolumeSoftDeleted: boolean;
35     possibleKeyPackets: string[];
36     type: ShareType;
37     state: ShareState;
38     createTime: number;
41 export interface ShareWithKey extends Share {
42     addressId: string;
43     key: string;
44     passphrase: string;
45     passphraseSignature: string;
46     rootLinkRecoveryPassphrase?: string;
47     memberships: ShareMembership[];
50 export type ShareURLLEGACY = WithSRPPayload<{
51     shareId: string;
52     shareUrlId: string;
53     expirationTime: number | null;
54     creatorEmail: string;
55     password: string;
56     flags: number;
57     token: string;
58     publicUrl: string;
59     sharePassphraseKeyPacket: string;
60     sharePasswordSalt: string;
61     hasCustomPassword: boolean;
62     hasGeneratedPasswordIncluded: boolean;
63     numAccesses: number;
64     maxAccesses: number;
65     permissions: number;
66 }>;
68 export type ShareURL = WithSRPPayload<{
69     shareId: string;
70     shareUrlId: string;
71     expirationTime: number | null;
72     creatorEmail: string;
73     password: string;
74     flags: number;
75     token: string;
76     publicUrl: string;
77     sharePassphraseKeyPacket: string;
78     sharePasswordSalt: string;
79     hasGeneratedPasswordIncluded: boolean;
80     numAccesses: number;
81     maxAccesses: number;
82     permissions: number;
83 }>;
85 export type UpdateSharedURL = WithSRPPayload<{
86     expirationDuration: number | null;
87     expirationTime: number | null;
88     flags: number;
89     maxAccesses: number;
90     password: string;
91     permissions: number;
92     sharePassphraseKeyPacket: string;
93     sharePasswordSalt: string;
94 }>;
96 export interface LockedVolumeForRestore {
97     lockedVolumeId: string;
98     defaultShare: LockedShareForRestore;
99     devices: LockedDeviceForRestore[];
100     photos: LockedDeviceForRestore[];
103 export interface LockedShareForRestore {
104     shareId: string;
105     linkDecryptedPassphrase: string;
108 export interface LockedDeviceForRestore extends LockedShareForRestore {
109     shareDecryptedPassphrase: string;
110     shareSessionKey: SessionKey;
112 export interface LockedPhotosForRestore extends LockedShareForRestore {
113     shareDecryptedPassphrase: string;
114     shareSessionKey: SessionKey;
116 export interface ShareMember {
117     memberId: string;
118     email: string;
119     inviterEmail: string;
120     addressId: string;
121     createTime: number;
122     modifyTime: number;
123     permissions: SHARE_MEMBER_PERMISSIONS;
124     keyPacketSignature: string;
125     sessionKeySignature: string;
128 export interface ShareMembership {
129     memberId: string;
130     shareId: string;
131     addressId: string;
132     addressKeyId: string;
133     inviterEmail: string;
134     createTime: number;
135     modifyTime: number;
136     permissions: SHARE_MEMBER_PERMISSIONS;
137     state: SHARE_MEMBER_STATE;
138     keyPacket: string;
139     keyPacketSignature: string;
140     sessionKeySignature: string;
141     unlockable: boolean;
144 export interface ShareInvitation {
145     invitationId: string;
146     inviterEmail: string;
147     inviteeEmail: string;
148     permissions: SHARE_MEMBER_PERMISSIONS;
149     keyPacket: string;
150     keyPacketSignature: string;
151     createTime: number;
152     state: SHARE_MEMBER_STATE;
155 export interface ShareInvitationEmailDetails {
156     message?: string;
157     itemName?: string;
160 interface ShareInvitationShare {
161     shareId: string;
162     volumeId: string;
163     passphrase: string;
164     shareKey: string;
165     creatorEmail: string;
168 interface ShareInvitationLink {
169     linkId: string;
170     name: string;
171     mimeType: string;
172     isFile: boolean;
175 export interface ShareInvitationDetails {
176     invitation: ShareInvitation;
177     share: ShareInvitationShare;
178     link: ShareInvitationLink;
181 export interface ShareExternalInvitation {
182     externalInvitationId: string;
183     inviterEmail: string;
184     inviteeEmail: string;
185     createTime: number;
186     permissions: SHARE_MEMBER_PERMISSIONS;
187     state: SHARE_EXTERNAL_INVITATION_STATE;
188     externalInvitationSignature: string;
191 export interface ShareInvitee {
192     name: string;
193     email: string;
194     contactId?: string;
195     error?: Error;
196     group?: string;
197     isExternal?: boolean;
198     isLoading?: boolean;
199     publicKey?: PublicKeyReference;