Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3382494
D11220.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D11220.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
@@ -21,6 +21,7 @@
sessionIDSelector,
} from '../selectors/keyserver-selectors.js';
import { isLoggedInToKeyserver } from '../selectors/user-selectors.js';
+import { useInitialNotificationsEncryptedMessage } from '../shared/crypto-utils.js';
import { IdentityClientContext } from '../shared/identity-client-context.js';
import { OlmSessionCreatorContext } from '../shared/olm-session-creator-context.js';
import type { BaseSocketProps } from '../socket/socket.react.js';
@@ -229,6 +230,11 @@
const preRequestUserStateRef = React.useRef(preRequestUserState);
preRequestUserStateRef.current = preRequestUserState;
+ // This async function asks the keyserver for its keys, whereas performAuth
+ // above gets the keyserver's keys from the identity service
+ const getInitialNotificationsEncryptedMessageForRecovery =
+ useInitialNotificationsEncryptedMessage(keyserverID);
+
const dispatch = useDispatch();
const urlPrefix = useSelector(urlPrefixSelector(keyserverID));
const performRecovery = React.useCallback(
@@ -256,6 +262,7 @@
urlPrefix,
recoveryActionSource,
keyserverID,
+ getInitialNotificationsEncryptedMessageForRecovery,
);
if (cancelled) {
// TODO: cancellation won't work because above call handles Redux
@@ -304,7 +311,13 @@
})();
return [promise, cancel];
},
- [dispatch, cookie, urlPrefix, keyserverID],
+ [
+ dispatch,
+ cookie,
+ urlPrefix,
+ keyserverID,
+ getInitialNotificationsEncryptedMessageForRecovery,
+ ],
);
const cancelPendingAuth = React.useRef<?() => void>(null);
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
@@ -46,7 +46,7 @@
urlPrefix: string,
recoveryActionSource: RecoveryActionSource,
keyserverID: string,
- getInitialNotificationsEncryptedMessage?: (
+ getInitialNotificationsEncryptedMessage: (
options?: ?InitialNotifMessageOptions,
) => Promise<string>,
): Promise<?ClientSessionChange> {
diff --git a/lib/utils/config.js b/lib/utils/config.js
--- a/lib/utils/config.js
+++ b/lib/utils/config.js
@@ -19,7 +19,7 @@
dispatchRecoveryAttempt: DispatchRecoveryAttempt,
recoveryActionSource: RecoveryActionSource,
keyserverID: string,
- getInitialNotificationsEncryptedMessage?: (
+ getInitialNotificationsEncryptedMessage: (
options?: ?InitialNotifMessageOptions,
) => Promise<string>,
) => Promise<void>,
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
@@ -19,7 +19,7 @@
dispatchRecoveryAttempt: DispatchRecoveryAttempt,
recoveryActionSource: RecoveryActionSource,
keyserverID: string,
- getInitialNotificationsEncryptedMessage?: (
+ getInitialNotificationsEncryptedMessage: (
?InitialNotifMessageOptions,
) => Promise<string>,
) {
@@ -27,15 +27,15 @@
if (!keychainCredentials) {
return;
}
- let extraInfo = await nativeLogInExtraInfoSelector(store.getState())();
- if (getInitialNotificationsEncryptedMessage) {
- const initialNotificationsEncryptedMessage =
- await getInitialNotificationsEncryptedMessage({
+ const [baseExtraInfo, initialNotificationsEncryptedMessage] =
+ await Promise.all([
+ nativeLogInExtraInfoSelector(store.getState())(),
+ getInitialNotificationsEncryptedMessage({
callSingleKeyserverEndpoint,
- });
- extraInfo = { ...extraInfo, initialNotificationsEncryptedMessage };
- }
+ }),
+ ]);
+ const extraInfo = { ...baseExtraInfo, initialNotificationsEncryptedMessage };
const { calendarQuery } = extraInfo;
await dispatchRecoveryAttempt(
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 29, 11:06 AM (19 h, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2596753
Default Alt Text
D11220.diff (4 KB)
Attached To
Mode
D11220: [lib][native] Initialize notif Olm channel during keyserver session recovery
Attached
Detach File
Event Timeline
Log In to Comment