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 @@ -24,7 +24,10 @@ notificationTypeValues, logInActionSources, } from 'lib/types/account-types.js'; -import type { IdentityKeysBlob } from 'lib/types/crypto-types.js'; +import type { + IdentityKeysBlob, + SignedIdentityKeysBlob, +} from 'lib/types/crypto-types.js'; import type { CalendarQuery } from 'lib/types/entry-types.js'; import { defaultNumberPerThread } from 'lib/types/message-types.js'; import type { @@ -217,12 +220,20 @@ +userID: string, +calendarQuery: ?CalendarQuery, +socialProof?: ?SIWESocialProof, + +signedIdentityKeysBlob?: ?SignedIdentityKeysBlob, }; async function processSuccessfulLogin( params: ProcessSuccessfulLoginParams, ): Promise { - const { viewer, input, userID, calendarQuery, socialProof } = params; + const { + viewer, + input, + userID, + calendarQuery, + socialProof, + signedIdentityKeysBlob, + } = params; const request: LogInRequest = input; const newServerTime = Date.now(); @@ -234,6 +245,7 @@ platformDetails: request.platformDetails, deviceToken, socialProof, + signedIdentityKeysBlob, }), fetchNotAcknowledgedPolicies(userID, baseLegalPolicies), deleteCookie(viewer.cookieID), @@ -396,6 +408,7 @@ input, userID: id, calendarQuery, + signedIdentityKeysBlob, }); } 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 @@ -8,6 +8,7 @@ import { hasMinCodeVersion } from 'lib/shared/version-utils.js'; import type { Shape } from 'lib/types/core.js'; +import type { SignedIdentityKeysBlob } from 'lib/types/crypto-types.js'; import type { Platform, PlatformDetails } from 'lib/types/device-types.js'; import type { CalendarQuery } from 'lib/types/entry-types.js'; import { @@ -649,6 +650,7 @@ platformDetails: PlatformDetails, deviceToken?: ?string, socialProof?: ?SIWESocialProof, + signedIdentityKeysBlob?: ?SignedIdentityKeysBlob, }; // The result of this function should never be passed directly to the Viewer @@ -662,7 +664,8 @@ userID: string, params: UserCookieCreationParams, ): Promise { - const { platformDetails, deviceToken, socialProof } = params; + const { platformDetails, deviceToken, socialProof, signedIdentityKeysBlob } = + params; const { platform, ...versions } = platformDetails || defaultPlatformDetails; const versionsString = Object.keys(versions).length > 0 ? JSON.stringify(versions) : null; @@ -685,10 +688,11 @@ deviceToken, versionsString, JSON.stringify(socialProof), + signedIdentityKeysBlob ? JSON.stringify(signedIdentityKeysBlob) : null, ]; const query = SQL` INSERT INTO cookies(id, hash, user, platform, creation_time, last_used, - device_token, versions, social_proof) + device_token, versions, social_proof, signed_identity_keys) VALUES ${[cookieRow]} `; await dbQuery(query);