Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3383074
D11223.id37848.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D11223.id37848.diff
View Options
diff --git a/lib/components/keyserver-connection-handler.js b/lib/components/keyserver-connection-handler.js
--- a/lib/components/keyserver-connection-handler.js
+++ b/lib/components/keyserver-connection-handler.js
@@ -247,6 +247,7 @@
cancelled = true;
setAuthInProgress(false);
};
+ const hasBeenCancelled = () => cancelled;
const promise = (async () => {
const userStateBeforeRecovery = preRequestUserStateRef.current;
@@ -259,6 +260,7 @@
recoveryActionSource,
keyserverID,
getInitialNotificationsEncryptedMessageForRecovery,
+ hasBeenCancelled,
);
const sessionChange =
recoverySessionChange ?? genericCookieInvalidation;
diff --git a/lib/keyserver-conn/recovery-utils.js b/lib/keyserver-conn/recovery-utils.js
--- a/lib/keyserver-conn/recovery-utils.js
+++ b/lib/keyserver-conn/recovery-utils.js
@@ -49,6 +49,7 @@
getInitialNotificationsEncryptedMessage: (
options?: ?InitialNotifMessageOptions,
) => Promise<string>,
+ hasBeenCancelled: () => boolean,
): Promise<?ClientSessionChange> {
const { resolveKeyserverSessionInvalidationUsingNativeCredentials } =
getConfig();
@@ -149,6 +150,7 @@
recoveryActionSource,
keyserverID,
getInitialNotificationsEncryptedMessage,
+ hasBeenCancelled,
);
return newSessionChange;
}
diff --git a/lib/utils/config.js b/lib/utils/config.js
--- a/lib/utils/config.js
+++ b/lib/utils/config.js
@@ -22,6 +22,7 @@
getInitialNotificationsEncryptedMessage: (
options?: ?InitialNotifMessageOptions,
) => Promise<string>,
+ hasBeenCancelled: () => boolean,
) => Promise<void>,
+setSessionIDOnRequest: boolean,
+calendarRangeInactivityLimit: ?number,
diff --git a/native/account/legacy-recover-keyserver-session.js b/native/account/legacy-recover-keyserver-session.js
--- a/native/account/legacy-recover-keyserver-session.js
+++ b/native/account/legacy-recover-keyserver-session.js
@@ -1,9 +1,10 @@
// @flow
import { logInActionTypes, logInRawAction } from 'lib/actions/user-actions.js';
-import type {
- DispatchRecoveryAttempt,
- CallKeyserverEndpoint,
+import {
+ type DispatchRecoveryAttempt,
+ type CallKeyserverEndpoint,
+ CANCELLED_ERROR,
} from 'lib/keyserver-conn/keyserver-conn-types.js';
import type { InitialNotifMessageOptions } from 'lib/shared/crypto-utils.js';
import type { RecoveryActionSource } from 'lib/types/account-types.js';
@@ -22,9 +23,10 @@
getInitialNotificationsEncryptedMessage: (
?InitialNotifMessageOptions,
) => Promise<string>,
+ hasBeenCancelled: () => boolean,
) {
const keychainCredentials = await fetchNativeKeychainCredentials();
- if (!keychainCredentials) {
+ if (!keychainCredentials || hasBeenCancelled()) {
return;
}
@@ -35,6 +37,9 @@
callSingleKeyserverEndpoint,
}),
]);
+ if (hasBeenCancelled()) {
+ throw new Error(CANCELLED_ERROR);
+ }
const extraInfo = { ...baseExtraInfo, initialNotificationsEncryptedMessage };
const { calendarQuery } = extraInfo;
diff --git a/native/data/sqlite-data-handler.js b/native/data/sqlite-data-handler.js
--- a/native/data/sqlite-data-handler.js
+++ b/native/data/sqlite-data-handler.js
@@ -73,6 +73,7 @@
source,
authoritativeKeyserverID,
getInitialNotificationsEncryptedMessage,
+ () => false,
);
dispatch({ type: setStoreLoadedActionType });
} catch (fetchCookieException) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 29, 1:27 PM (21 h, 28 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2597124
Default Alt Text
D11223.id37848.diff (3 KB)
Attached To
Mode
D11223: [lib][native] Make cancellation work for keyserver session recovery
Attached
Detach File
Event Timeline
Log In to Comment