Page MenuHomePhabricator

D11405.id38383.diff
No OneTemporary

D11405.id38383.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
@@ -89,6 +89,23 @@
+walletAddress?: ?string,
};
+type FarcasterUser = {
+ +userID: string,
+ +username: string,
+ +farcasterID: string,
+};
+
+export const farcasterUserValidator: TInterface<FarcasterUser> =
+ tShape<FarcasterUser>({
+ userID: t.String,
+ username: t.String,
+ farcasterID: t.String,
+ });
+
+export const farcasterUsersValidator: TList<Array<FarcasterUser>> = t.list(
+ farcasterUserValidator,
+);
+
export const userDeviceOlmInboundKeysValidator: TInterface<UserDevicesOlmInboundKeys> =
tShape<UserDevicesOlmInboundKeys>({
keys: t.dict(t.String, t.maybe(deviceOlmInboundKeysValidator)),
@@ -140,6 +157,10 @@
userID: string,
nonceChallengeResponse: SignedMessage,
) => Promise<IdentityAuthResult>;
+ // getFarcasterUsers is only implemented on native at the moment
+ +getFarcasterUsers?: (
+ farcasterIDs: $ReadOnlyArray<string>,
+ ) => Promise<$ReadOnlyArray<FarcasterUser>>;
}
export type IdentityServiceAuthLayer = {
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
@@ -24,6 +24,7 @@
type UserDevicesOlmInboundKeys,
deviceOlmInboundKeysValidator,
userDeviceOlmInboundKeysValidator,
+ farcasterUsersValidator,
} from 'lib/types/identity-service-types.js';
import { assertWithValidator } from 'lib/utils/validation-utils.js';
@@ -533,6 +534,12 @@
payload,
);
},
+ getFarcasterUsers: async (farcasterIDs: $ReadOnlyArray<string>) => {
+ const farcasterUsersJSONString =
+ await commRustModule.getFarcasterUsers(farcasterIDs);
+ const farcasterUsers = JSON.parse(farcasterUsersJSONString);
+ return assertWithValidator(farcasterUsers, farcasterUsersValidator);
+ },
}),
[getAuthMetadata],
);

File Metadata

Mime Type
text/plain
Expires
Thu, Jan 9, 6:40 AM (31 m, 12 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2829154
Default Alt Text
D11405.id38383.diff (2 KB)

Event Timeline