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 & {
8 urlPasswordSalt: string;
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 {
21 export enum ShareState {
27 export interface Share {
34 isVolumeSoftDeleted: boolean;
35 possibleKeyPackets: string[];
41 export interface ShareWithKey extends Share {
45 passphraseSignature: string;
46 rootLinkRecoveryPassphrase?: string;
47 memberships: ShareMembership[];
50 export type ShareURLLEGACY = WithSRPPayload<{
53 expirationTime: number | null;
59 sharePassphraseKeyPacket: string;
60 sharePasswordSalt: string;
61 hasCustomPassword: boolean;
62 hasGeneratedPasswordIncluded: boolean;
68 export type ShareURL = WithSRPPayload<{
71 expirationTime: number | null;
77 sharePassphraseKeyPacket: string;
78 sharePasswordSalt: string;
79 hasGeneratedPasswordIncluded: boolean;
85 export type UpdateSharedURL = WithSRPPayload<{
86 expirationDuration: number | null;
87 expirationTime: number | null;
92 sharePassphraseKeyPacket: string;
93 sharePasswordSalt: string;
96 export interface LockedVolumeForRestore {
97 lockedVolumeId: string;
98 defaultShare: LockedShareForRestore;
99 devices: LockedDeviceForRestore[];
100 photos: LockedDeviceForRestore[];
103 export interface LockedShareForRestore {
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 {
119 inviterEmail: string;
123 permissions: SHARE_MEMBER_PERMISSIONS;
124 keyPacketSignature: string;
125 sessionKeySignature: string;
128 export interface ShareMembership {
132 addressKeyId: string;
133 inviterEmail: string;
136 permissions: SHARE_MEMBER_PERMISSIONS;
137 state: SHARE_MEMBER_STATE;
139 keyPacketSignature: string;
140 sessionKeySignature: string;
144 export interface ShareInvitation {
145 invitationId: string;
146 inviterEmail: string;
147 inviteeEmail: string;
148 permissions: SHARE_MEMBER_PERMISSIONS;
150 keyPacketSignature: string;
152 state: SHARE_MEMBER_STATE;
155 export interface ShareInvitationEmailDetails {
160 interface ShareInvitationShare {
165 creatorEmail: string;
168 interface ShareInvitationLink {
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;
186 permissions: SHARE_MEMBER_PERMISSIONS;
187 state: SHARE_EXTERNAL_INVITATION_STATE;
188 externalInvitationSignature: string;
191 export interface ShareInvitee {
197 isExternal?: boolean;
199 publicKey?: PublicKeyReference;