Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32512202
D14506.1767115950.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D14506.1767115950.diff
View Options
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,7 +21,11 @@
import { useKeyserverCall } from '../keyserver-conn/keyserver-call.js';
import type { CallKeyserverEndpoint } from '../keyserver-conn/keyserver-conn-types.js';
import { usePreRequestUserState } from '../selectors/account-selectors.js';
-import { getForeignPeerDeviceIDs } from '../selectors/user-selectors.js';
+import {
+ getForeignPeerDeviceIDs,
+ getOwnPeerDevices,
+ getKeyserverDeviceID,
+} from '../selectors/user-selectors.js';
import {
getOneTimeKeyValuesFromBlob,
getPrekeyValueFromBlob,
@@ -172,6 +176,12 @@
state => state.commServicesAccessToken,
);
+ const ownPeerDevices = useSelector(getOwnPeerDevices);
+ const ownedKeyserverDeviceID = React.useMemo(
+ () => getKeyserverDeviceID(ownPeerDevices),
+ [ownPeerDevices],
+ );
+
const { logOutType, skipIdentityLogOut, handleUseNewFlowResponse } = options;
return React.useCallback(
async (keyserverIDs?: $ReadOnlyArray<string>) => {
@@ -204,7 +214,12 @@
'Are you calling it on non-primary device?',
);
}
- callIdentityClientLogOut = identityClient.logOutPrimaryDevice;
+ // For Flow - we want above null-check to throw now,
+ // not inside below async block.
+ const logOutFunc = identityClient.logOutPrimaryDevice;
+ callIdentityClientLogOut = async () => {
+ await logOutFunc(ownedKeyserverDeviceID);
+ };
} else if (logOutType === 'secondary_device') {
callIdentityClientLogOut = identityClient.logOutSecondaryDevice;
} else {
@@ -266,6 +281,7 @@
commServicesAccessToken,
identityClient,
logOutType,
+ ownedKeyserverDeviceID,
preRequestUserState,
removeAllHolders,
skipIdentityLogOut,
diff --git a/lib/shared/device-list-utils.js b/lib/shared/device-list-utils.js
--- a/lib/shared/device-list-utils.js
+++ b/lib/shared/device-list-utils.js
@@ -134,8 +134,12 @@
async function createAndSignSingletonDeviceList(
primaryDeviceID: string,
+ keyserverDeviceID?: ?string,
): Promise<SignedDeviceList> {
- const initialDeviceList = composeRawDeviceList([primaryDeviceID]);
+ const devices = keyserverDeviceID
+ ? [primaryDeviceID, keyserverDeviceID]
+ : [primaryDeviceID];
+ const initialDeviceList = composeRawDeviceList(devices);
const rawDeviceList = JSON.stringify(initialDeviceList);
const { olmAPI } = getConfig();
const curPrimarySignature = await olmAPI.signMessage(rawDeviceList);
diff --git a/lib/types/identity-service-types.js b/lib/types/identity-service-types.js
--- a/lib/types/identity-service-types.js
+++ b/lib/types/identity-service-types.js
@@ -129,7 +129,7 @@
+logOut: () => Promise<void>;
// This log out type is specific to primary device, and web cannot be a
// primary device
- +logOutPrimaryDevice?: () => Promise<void>;
+ +logOutPrimaryDevice?: (keyserverDeviceID: ?string) => Promise<void>;
+logOutSecondaryDevice: () => Promise<void>;
+getKeyserverKeys: string => Promise<DeviceOlmOutboundKeys>;
// Users cannot register from web
diff --git a/native/identity-service/identity-service-context-provider.react.js b/native/identity-service/identity-service-context-provider.react.js
--- a/native/identity-service/identity-service-context-provider.react.js
+++ b/native/identity-service/identity-service-context-provider.react.js
@@ -157,14 +157,16 @@
commRustModule.logOut(userID, deviceID, token),
);
},
- logOutPrimaryDevice: async () => {
+ logOutPrimaryDevice: async (keyserverDeviceID: ?string) => {
const {
deviceID,
userID,
accessToken: token,
} = await getAuthMetadata();
- const signedDeviceList =
- await createAndSignSingletonDeviceList(deviceID);
+ const signedDeviceList = await createAndSignSingletonDeviceList(
+ deviceID,
+ keyserverDeviceID,
+ );
return authVerifiedEndpoint(
commRustModule.logOutPrimaryDevice(
userID,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Dec 30, 5:32 PM (10 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5868357
Default Alt Text
D14506.1767115950.diff (4 KB)
Attached To
Mode
D14506: [lib][native] Keep keyserver in device list after primary logout
Attached
Detach File
Event Timeline
Log In to Comment