Page MenuHomePhorge

D12239.1765340283.diff
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

D12239.1765340283.diff

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
@@ -194,10 +194,35 @@
await updateDeviceList(signedDeviceList);
}
+async function removeDeviceFromDeviceList(
+ identityClient: IdentityServiceClient,
+ userID: string,
+ deviceIDToRemove: string,
+): Promise<void> {
+ const { updateDeviceList } = identityClient;
+ invariant(
+ updateDeviceList,
+ 'updateDeviceList() should be defined on native. ' +
+ 'Are you calling it on a non-primary device?',
+ );
+
+ const { devices } = await fetchLatestDeviceList(identityClient, userID);
+ const newDevices = devices.filter(it => it !== deviceIDToRemove);
+ if (devices.length === newDevices.length) {
+ // the device wasn't on the device list
+ return;
+ }
+
+ const newDeviceList = composeRawDeviceList(newDevices);
+ const signedDeviceList = await signDeviceListUpdate(newDeviceList);
+ await updateDeviceList(signedDeviceList);
+}
+
export {
verifyAndGetDeviceList,
createAndSignInitialDeviceList,
fetchLatestDeviceList,
addDeviceToDeviceList,
+ removeDeviceFromDeviceList,
signDeviceListUpdate,
};

File Metadata

Mime Type
text/plain
Expires
Wed, Dec 10, 4:18 AM (16 h, 40 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5860821
Default Alt Text
D12239.1765340283.diff (1 KB)

Event Timeline