Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3113822
D11834.id39659.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
D11834.id39659.diff
View Options
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
@@ -1,6 +1,6 @@
// @flow
-import t, { type TInterface, type TList } from 'tcomb';
+import t, { type TInterface, type TList, type TDict } from 'tcomb';
import {
identityKeysBlobValidator,
@@ -157,6 +157,9 @@
userID: string,
sinceTimestamp?: number,
) => Promise<$ReadOnlyArray<SignedDeviceList>>;
+ +getDeviceListsForUsers?: (
+ userIDs: $ReadOnlyArray<string>,
+ ) => Promise<UsersSignedDeviceLists>;
// updating device list is possible only on Native
// web cannot be a primary device, so there's no need to expose it to JS
+updateDeviceList?: (newDeviceList: SignedDeviceList) => Promise<void>;
@@ -229,6 +232,12 @@
export const signedDeviceListHistoryValidator: TList<Array<SignedDeviceList>> =
t.list(signedDeviceListValidator);
+export type UsersSignedDeviceLists = {
+ +[userID: string]: SignedDeviceList,
+};
+export const usersSignedDeviceListsValidator: TDict<UsersSignedDeviceLists> =
+ t.dict(t.String, signedDeviceListValidator);
+
export type SignedNonce = {
+nonce: string,
+nonceSignature: string,
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
@@ -10,21 +10,23 @@
type OneTimeKeysResultValues,
} from 'lib/types/crypto-types.js';
import {
- type SignedDeviceList,
- signedDeviceListHistoryValidator,
- type SignedNonce,
+ type DeviceOlmInboundKeys,
+ deviceOlmInboundKeysValidator,
type DeviceOlmOutboundKeys,
deviceOlmOutboundKeysValidator,
+ farcasterUsersValidator,
+ identityAuthResultValidator,
type IdentityServiceClient,
- type UserDevicesOlmOutboundKeys,
- type UserAuthMetadata,
ONE_TIME_KEYS_NUMBER,
- identityAuthResultValidator,
- type DeviceOlmInboundKeys,
- type UserDevicesOlmInboundKeys,
- deviceOlmInboundKeysValidator,
+ type SignedDeviceList,
+ signedDeviceListHistoryValidator,
+ type SignedNonce,
+ type UserAuthMetadata,
userDeviceOlmInboundKeysValidator,
- farcasterUsersValidator,
+ type UserDevicesOlmInboundKeys,
+ type UserDevicesOlmOutboundKeys,
+ type UsersSignedDeviceLists,
+ usersSignedDeviceListsValidator,
} from 'lib/types/identity-service-types.js';
import { getContentSigningKey } from 'lib/utils/crypto-utils.js';
import { assertWithValidator } from 'lib/utils/validation-utils.js';
@@ -545,6 +547,33 @@
signedDeviceListHistoryValidator,
);
},
+ getDeviceListsForUsers: async (userIDs: $ReadOnlyArray<string>) => {
+ const {
+ deviceID: authDeviceID,
+ userID: authUserID,
+ accessToken: token,
+ } = await getAuthMetadata();
+ const result = await commRustModule.getDeviceListsForUsers(
+ authUserID,
+ authDeviceID,
+ token,
+ userIDs,
+ );
+ const rawPayloads: { +[userID: string]: string } = JSON.parse(result);
+
+ let usersDeviceLists: UsersSignedDeviceLists = {};
+ for (const userID in rawPayloads) {
+ usersDeviceLists = {
+ ...usersDeviceLists,
+ [userID]: JSON.parse(rawPayloads[userID]),
+ };
+ }
+
+ return assertWithValidator(
+ usersDeviceLists,
+ usersSignedDeviceListsValidator,
+ );
+ },
updateDeviceList: async (newDeviceList: SignedDeviceList) => {
const {
deviceID: authDeviceID,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 1, 7:28 PM (19 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2399456
Default Alt Text
D11834.id39659.diff (3 KB)
Attached To
Mode
D11834: [native] add `GetDeviceListsForUsers` in `IdentityServiceClient`
Attached
Detach File
Event Timeline
Log In to Comment