Cleanup - unused files / unused exports / duplicate exports
[ProtonMail-WebClient.git] / packages / components / containers / resetPassword / interface.ts
blobc8ceb24100ba51bd1cbcda8faf43247d01e867d0
1 import type { ProductParam } from '@proton/shared/lib/apps/product';
2 import type { AuthResponse } from '@proton/shared/lib/authentication/interface';
3 import type { APP_NAMES } from '@proton/shared/lib/constants';
4 import type {
5     Address,
6     Api,
7     DecryptedKey,
8     KeyTransparencyActivation,
9     ResetSelfAudit,
10 } from '@proton/shared/lib/interfaces';
12 import type { AuthSession } from '../login/interface';
14 export enum STEPS {
15     LOADING,
16     REQUEST_RECOVERY_METHODS = 1,
17     NO_RECOVERY_METHODS,
18     FORGOT_RECOVERY_METHOD,
19     REQUEST_RESET_TOKEN,
20     VALIDATE_RESET_TOKEN,
21     NEW_PASSWORD,
22     ERROR,
23     DONE,
26 // Login is valid for external accounts
27 export type RecoveryMethod = 'email' | 'sms' | 'login' | 'mnemonic';
28 export type AccountType = 'internal' | 'external';
30 export interface ValidateResetTokenResponse {
31     Addresses: Address[];
32     ToMigrate: 0 | 1;
35 interface MnemonicData {
36     api: Api;
37     decryptedUserKeys: DecryptedKey[];
38     authResponse: AuthResponse;
41 export interface ResetCacheResult {
42     appName: APP_NAMES;
43     username: string;
44     persistent: boolean;
45     productParam: ProductParam;
46     Methods: RecoveryMethod[];
47     type: AccountType;
48     method?: RecoveryMethod;
49     value?: string;
50     token?: string;
51     resetResponse?: ValidateResetTokenResponse;
52     mnemonicData?: MnemonicData;
53     ktActivation: KeyTransparencyActivation;
54     setupVPN: boolean;
55     resetSelfAudit: ResetSelfAudit;
58 export type ResetActionResponse =
59     | {
60           to: STEPS.DONE;
61           session: AuthSession;
62       }
63     | {
64           to: STEPS.NO_RECOVERY_METHODS;
65           error?: string;
66       }
67     | {
68           cache: ResetCacheResult;
69           to: Exclude<STEPS, STEPS.DONE | STEPS.NO_RECOVERY_METHODS>;
70       };