DRVDOC-1129: Clicking on editor margins should focus editor
[ProtonMail-WebClient.git] / packages / account / bootstrap / cryptoWorkerOptions.ts
blob166054017c623eadade5ccf7348077203ae177c9
1 import { APPS, APP_NAMES } from '@proton/shared/lib/constants';
2 import { CryptoWorkerOptions } from '@proton/shared/lib/helpers/setupCryptoWorker';
3 import clamp from '@proton/utils/clamp';
5 export const getCryptoWorkerOptions = (
6     appName: APP_NAMES,
7     openpgpConfigOptions: NonNullable<CryptoWorkerOptions['openpgpConfigOptions']>
8 ): CryptoWorkerOptions => {
9     // The account and vpn app typically requires less crypto workers than others, mainly for SRP and key management.
10     // This is to avoid loading too many workers to prevent load issues.
11     if (appName === APPS.PROTONACCOUNT || appName === APPS.PROTONVPN_SETTINGS) {
12         return {
13             poolSize: clamp(navigator.hardwareConcurrency, 1, 2),
14             openpgpConfigOptions,
15         };
16     }
18     return { openpgpConfigOptions };