Cleanup - unused files / unused exports / duplicate exports
[ProtonMail-WebClient.git] / packages / shared / lib / keys / reactivation / reactivateKeysProcess.ts
blob190d9f294175a4e9a9a3a779acde2fe78e535edd
1 import { getHasMigratedAddressKeys } from '../keyMigration';
2 import type { ReactivateKeysProcessLegacyArguments } from './reactivateKeysProcessLegacy';
3 import reactivateKeysProcessLegacy from './reactivateKeysProcessLegacy';
4 import type { ReactivateKeysProcessV2Arguments } from './reactivateKeysProcessV2';
5 import reactivateKeysProcessV2 from './reactivateKeysProcessV2';
7 interface Arguments extends ReactivateKeysProcessV2Arguments, ReactivateKeysProcessLegacyArguments {}
9 export const reactivateKeysProcess = async ({
10     api,
11     user,
12     userKeys,
13     addresses,
14     addressesKeys,
15     keyReactivationRecords,
16     keyPassword,
17     onReactivation,
18     keyTransparencyVerify,
19 }: Arguments) => {
20     const hasMigratedAddressKeys = getHasMigratedAddressKeys(addresses);
22     if (hasMigratedAddressKeys) {
23         return reactivateKeysProcessV2({
24             api,
25             keyReactivationRecords,
26             keyPassword,
27             user,
28             userKeys,
29             addresses,
30             onReactivation,
31             keyTransparencyVerify,
32         });
33     }
35     return reactivateKeysProcessLegacy({
36         api,
37         keyReactivationRecords,
38         userKeys,
39         keyPassword,
40         onReactivation,
41         addressesKeys,
42         keyTransparencyVerify,
43     });