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 = (
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) {
13 poolSize: clamp(navigator.hardwareConcurrency, 1, 2),
18 return { openpgpConfigOptions };