Page MenuHomePhabricator

D13811.id45557.diff
No OneTemporary

D13811.id45557.diff

diff --git a/keyserver/src/utils/farcaster-utils.js b/keyserver/src/utils/farcaster-utils.js
new file mode 100644
--- /dev/null
+++ b/keyserver/src/utils/farcaster-utils.js
@@ -0,0 +1,26 @@
+// @flow
+
+import { getRustAPI } from 'rust-node-addon';
+
+import { verifyUserIDs } from '../fetchers/user-fetchers.js';
+
+async function getVerifiedUserIDForFID(fid: string): Promise<?string> {
+ const rustAPI = await getRustAPI();
+ const farcasterUsers = await rustAPI.getFarcasterUsers([fid]);
+
+ if (farcasterUsers.length !== 1) {
+ return null;
+ }
+
+ const userIDForFID = farcasterUsers[0].userID;
+
+ const verifiedUserIDs = await verifyUserIDs([userIDForFID]);
+
+ if (verifiedUserIDs.length !== 1) {
+ return null;
+ }
+
+ return userIDForFID;
+}
+
+export { getVerifiedUserIDForFID };

File Metadata

Mime Type
text/plain
Expires
Thu, Dec 5, 12:30 AM (13 h, 34 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2615293
Default Alt Text
D13811.id45557.diff (808 B)

Event Timeline