Page MenuHomePhabricator

D11835.id39686.diff
No OneTemporary

D11835.id39686.diff

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
@@ -157,7 +157,7 @@
userID: string,
sinceTimestamp?: number,
) => Promise<$ReadOnlyArray<SignedDeviceList>>;
- +getDeviceListsForUsers?: (
+ +getDeviceListsForUsers: (
userIDs: $ReadOnlyArray<string>,
) => Promise<UsersSignedDeviceLists>;
// updating device list is possible only on Native
diff --git a/web/grpc/identity-service-client-wrapper.js b/web/grpc/identity-service-client-wrapper.js
--- a/web/grpc/identity-service-client-wrapper.js
+++ b/web/grpc/identity-service-client-wrapper.js
@@ -28,6 +28,8 @@
userDeviceOlmInboundKeysValidator,
type FarcasterUser,
farcasterUsersValidator,
+ type UsersSignedDeviceLists,
+ usersSignedDeviceListsValidator,
} from 'lib/types/identity-service-types.js';
import { getMessageForException } from 'lib/utils/errors.js';
import { assertWithValidator } from 'lib/utils/validation-utils.js';
@@ -533,6 +535,32 @@
);
};
+ getDeviceListsForUsers: (
+ userIDs: $ReadOnlyArray<string>,
+ ) => Promise<UsersSignedDeviceLists> = async userIDs => {
+ const client = this.authClient;
+ if (!client) {
+ throw new Error('Identity service client is not initialized');
+ }
+ const request = new IdentityAuthStructs.PeersDeviceListsRequest();
+ request.setUserIdsList([...userIDs]);
+ const response = await client.getDeviceListsForUsers(request);
+ const rawPayloads = response.toObject()?.usersDeviceListsMap;
+
+ let usersDeviceLists: UsersSignedDeviceLists = {};
+ rawPayloads.forEach(([userID, rawPayload]) => {
+ usersDeviceLists = {
+ ...usersDeviceLists,
+ [userID]: JSON.parse(rawPayload),
+ };
+ });
+
+ return assertWithValidator(
+ usersDeviceLists,
+ usersSignedDeviceListsValidator,
+ );
+ };
+
getFarcasterUsers: (
farcasterIDs: $ReadOnlyArray<string>,
) => Promise<$ReadOnlyArray<FarcasterUser>> = async farcasterIDs => {
diff --git a/web/grpc/identity-service-context-provider.react.js b/web/grpc/identity-service-context-provider.react.js
--- a/web/grpc/identity-service-context-provider.react.js
+++ b/web/grpc/identity-service-context-provider.react.js
@@ -134,6 +134,7 @@
getDeviceListHistoryForUser: proxyMethodToWorker(
'getDeviceListHistoryForUser',
),
+ getDeviceListsForUsers: proxyMethodToWorker('getDeviceListsForUsers'),
getFarcasterUsers: proxyMethodToWorker('getFarcasterUsers'),
linkFarcasterAccount: proxyMethodToWorker('linkFarcasterAccount'),
unlinkFarcasterAccount: proxyMethodToWorker('unlinkFarcasterAccount'),

File Metadata

Mime Type
text/plain
Expires
Tue, Nov 19, 1:21 AM (19 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2536314
Default Alt Text
D11835.id39686.diff (2 KB)

Event Timeline