diff --git a/keyserver/src/creators/account-creator.js b/keyserver/src/creators/account-creator.js --- a/keyserver/src/creators/account-creator.js +++ b/keyserver/src/creators/account-creator.js @@ -236,6 +236,7 @@ createNewUserCookie(id, { platformDetails: request.platformDetails, deviceToken, + primaryIdentityPublicKey: request.primaryIdentityPublicKey, }), deleteCookie(viewer.cookieID), dbQuery(newUserQuery), diff --git a/keyserver/src/responders/user-responders.js b/keyserver/src/responders/user-responders.js --- a/keyserver/src/responders/user-responders.js +++ b/keyserver/src/responders/user-responders.js @@ -203,6 +203,7 @@ input: any, userID: string, calendarQuery: ?CalendarQuery, + primaryIdentityPublicKey?: ?string, ): Promise { const request: LogInRequest = input; const newServerTime = Date.now(); @@ -213,6 +214,7 @@ createNewUserCookie(userID, { platformDetails: request.platformDetails, deviceToken, + primaryIdentityPublicKey, }), deleteCookie(viewer.cookieID), ]); @@ -398,7 +400,13 @@ } // 6. Complete login with call to `processSuccessfulLogin(...)`. - return await processSuccessfulLogin(viewer, input, userID, calendarQuery); + return await processSuccessfulLogin( + viewer, + input, + userID, + calendarQuery, + primaryIdentityPublicKey, + ); } const updatePasswordRequestInputValidator = tShape({ diff --git a/keyserver/src/session/cookies.js b/keyserver/src/session/cookies.js --- a/keyserver/src/session/cookies.js +++ b/keyserver/src/session/cookies.js @@ -644,6 +644,7 @@ type UserCookieCreationParams = { platformDetails: PlatformDetails, deviceToken?: ?string, + primaryIdentityPublicKey?: ?string, }; // The result of this function should never be passed directly to the Viewer @@ -657,7 +658,7 @@ userID: string, params: UserCookieCreationParams, ): Promise { - const { platformDetails, deviceToken } = params; + const { platformDetails, deviceToken, primaryIdentityPublicKey } = params; const { platform, ...versions } = platformDetails || defaultPlatformDetails; const versionsString = Object.keys(versions).length > 0 ? JSON.stringify(versions) : null; @@ -679,10 +680,11 @@ time, deviceToken, versionsString, + primaryIdentityPublicKey, ]; const query = SQL` INSERT INTO cookies(id, hash, user, platform, creation_time, last_used, - device_token, versions) + device_token, versions, public_key) VALUES ${[cookieRow]} `; await dbQuery(query);