diff --git a/lib/actions/siwe-actions.js b/lib/actions/siwe-actions.js --- a/lib/actions/siwe-actions.js +++ b/lib/actions/siwe-actions.js @@ -6,6 +6,7 @@ CallSingleKeyserverEndpointOptions, } from '../keyserver-conn/call-single-keyserver-endpoint.js'; import threadWatcher from '../shared/thread-watcher.js'; +import { permissionsAndAuthRelatedRequestTimeout } from '../shared/timeouts.js'; import { type LogInResult, logInActionSources, @@ -33,7 +34,9 @@ success: 'SIWE_AUTH_SUCCESS', failed: 'SIWE_AUTH_FAILED', }); -const siweAuthCallSingleKeyserverEndpointOptions = { timeout: 60000 }; +const siweAuthCallSingleKeyserverEndpointOptions = { + timeout: permissionsAndAuthRelatedRequestTimeout, +}; const siweAuth = ( callSingleKeyserverEndpoint: CallSingleKeyserverEndpoint, diff --git a/lib/actions/thread-actions.js b/lib/actions/thread-actions.js --- a/lib/actions/thread-actions.js +++ b/lib/actions/thread-actions.js @@ -6,6 +6,7 @@ import { extractKeyserverIDFromID } from '../keyserver-conn/keyserver-call-utils.js'; import { useKeyserverCall } from '../keyserver-conn/keyserver-call.js'; import type { CallKeyserverEndpoint } from '../keyserver-conn/keyserver-conn-types.js'; +import { permissionsAndAuthRelatedRequestTimeout } from '../shared/timeouts.js'; import type { ChangeThreadSettingsPayload, LeaveThreadPayload, @@ -34,7 +35,7 @@ }); const deleteThreadEndpointOptions = { - timeout: 60000, + timeout: permissionsAndAuthRelatedRequestTimeout, }; const deleteThread = @@ -68,7 +69,7 @@ }); const changeThreadSettingsEndpointOptions = { - timeout: 60000, + timeout: permissionsAndAuthRelatedRequestTimeout, }; const changeThreadSettings = @@ -114,7 +115,7 @@ }); const removeMembersFromThreadEndpointOptions = { - timeout: 60000, + timeout: permissionsAndAuthRelatedRequestTimeout, }; const removeUsersFromThread = @@ -159,7 +160,7 @@ }); const changeThreadMemberRoleEndpointOptions = { - timeout: 60000, + timeout: permissionsAndAuthRelatedRequestTimeout, }; const changeThreadMemberRoles = diff --git a/lib/actions/user-actions.js b/lib/actions/user-actions.js --- a/lib/actions/user-actions.js +++ b/lib/actions/user-actions.js @@ -21,6 +21,7 @@ } from '../shared/crypto-utils.js'; import { IdentityClientContext } from '../shared/identity-client-context.js'; import threadWatcher from '../shared/thread-watcher.js'; +import { permissionsAndAuthRelatedRequestTimeout } from '../shared/timeouts.js'; import type { LogInInfo, LogInResult, @@ -289,7 +290,9 @@ success: 'KEYSERVER_REGISTER_SUCCESS', failed: 'KEYSERVER_REGISTER_FAILED', }); -const registerCallSingleKeyserverEndpointOptions = { timeout: 60000 }; +const registerCallSingleKeyserverEndpointOptions = { + timeout: permissionsAndAuthRelatedRequestTimeout, +}; const keyserverRegister = ( callSingleKeyserverEndpoint: CallSingleKeyserverEndpoint, @@ -333,7 +336,9 @@ success: 'KEYSERVER_AUTH_SUCCESS', failed: 'KEYSERVER_AUTH_FAILED', }); -const keyserverAuthCallSingleKeyserverEndpointOptions = { timeout: 60000 }; +const keyserverAuthCallSingleKeyserverEndpointOptions = { + timeout: permissionsAndAuthRelatedRequestTimeout, +}; const keyserverAuth = ( callKeyserverEndpoint: CallKeyserverEndpoint, @@ -560,7 +565,9 @@ success: 'LOG_IN_SUCCESS', failed: 'LOG_IN_FAILED', }); -const logInCallSingleKeyserverEndpointOptions = { timeout: 60000 }; +const logInCallSingleKeyserverEndpointOptions = { + timeout: permissionsAndAuthRelatedRequestTimeout, +}; const logIn = ( callKeyserverEndpoint: CallKeyserverEndpoint, diff --git a/lib/hooks/invite-links.js b/lib/hooks/invite-links.js --- a/lib/hooks/invite-links.js +++ b/lib/hooks/invite-links.js @@ -18,7 +18,7 @@ import { isLoggedInToKeyserver } from '../selectors/user-selectors.js'; import type { KeyserverOverride } from '../shared/invite-links.js'; import { useIsKeyserverURLValid } from '../shared/keyserver-utils.js'; -import { callSingleKeyserverEndpointTimeout } from '../shared/timeouts.js'; +import { permissionsAndAuthRelatedRequestTimeout } from '../shared/timeouts.js'; import type { CalendarQuery } from '../types/entry-types.js'; import type { SetState } from '../types/hook-types.js'; import { defaultKeyserverInfo } from '../types/keyserver-types.js'; @@ -208,7 +208,7 @@ } return null; }); - }, callSingleKeyserverEndpointTimeout); + }, permissionsAndAuthRelatedRequestTimeout); timeoutRef.current = timeoutID; const resolveAndClearTimeout = (result: ThreadJoinPayload) => { clearTimeout(timeoutID); diff --git a/lib/shared/timeouts.js b/lib/shared/timeouts.js --- a/lib/shared/timeouts.js +++ b/lib/shared/timeouts.js @@ -48,3 +48,7 @@ // Time after which the client consider the Identity Search connection // as unhealthy and chooses to close the socket. export const identitySearchHeartbeatTimeout = 9000; // in milliseconds + +// This timeout is used for all the requests that perform expensive operations +// related to permissions and auth, e.g. change role, etc. +export const permissionsAndAuthRelatedRequestTimeout = 60000;