Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3720909
D6983.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D6983.diff
View Options
diff --git a/keyserver/src/fetchers/cookie-fetchers.js b/keyserver/src/fetchers/cookie-fetchers.js
new file mode 100644
--- /dev/null
+++ b/keyserver/src/fetchers/cookie-fetchers.js
@@ -0,0 +1,25 @@
+// @flow
+
+import { deviceTypes } from 'lib/types/device-types.js';
+
+import { dbQuery, SQL } from '../database/database.js';
+
+// This function is used for invalidating native sessions so that we can trigger
+// a log-in on the next socket connection attempt. We initially introduced this
+// during the rollout of the identity service, where we needed the user's
+// password on the keyserver to populate the identity service. We only
+// invalidate native sessions because web sessions don't cache the user's
+// password, and we don't want any user-visible issues to result from this.
+async function fetchNativeCookieIDsForUserIDs(
+ userIDs: $ReadOnlyArray<string>,
+): Promise<string[]> {
+ const query = SQL`
+ SELECT id
+ FROM cookies
+ WHERE platform IN (${deviceTypes}) AND user IN (${userIDs})
+ `;
+ const [result] = await dbQuery(query);
+ return result.map(({ id }) => id.toString());
+}
+
+export { fetchNativeCookieIDsForUserIDs };
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jan 9, 12:57 PM (4 h, 11 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2835135
Default Alt Text
D6983.diff (1 KB)
Attached To
Mode
D6983: [keyserver] Introduce fetchNativeCookieIDsForUserIDs
Attached
Detach File
Event Timeline
Log In to Comment