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 @@ -71,7 +71,7 @@ WHERE LCASE(username) = LCASE(${request.username}) `; const promises = [dbQuery(usernameQuery)]; - const { calendarQuery } = request; + const { calendarQuery, publicKey, socialProof } = request; if (calendarQuery) { promises.push(verifyCalendarQueryThreadIDs(calendarQuery)); } @@ -103,6 +103,8 @@ createNewUserCookie(id, { platformDetails: request.platformDetails, deviceToken, + publicKey, + socialProof, }), deleteCookie(viewer.cookieID), dbQuery(newUserQuery), 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 @@ -657,7 +657,7 @@ userID: string, params: UserCookieCreationParams, ): Promise { - const { platformDetails, deviceToken } = params; + const { platformDetails, deviceToken, publicKey, socialProof } = params; const { platform, ...versions } = platformDetails || defaultPlatformDetails; const versionsString = Object.keys(versions).length > 0 ? JSON.stringify(versions) : null; @@ -679,10 +679,12 @@ time, deviceToken, versionsString, + publicKey, + socialProof, ]; const query = SQL` INSERT INTO cookies(id, hash, user, platform, creation_time, last_used, - device_token, versions) + device_token, versions, public_key, social_proof) VALUES ${[cookieRow]} `; await dbQuery(query); diff --git a/lib/types/account-types.js b/lib/types/account-types.js --- a/lib/types/account-types.js +++ b/lib/types/account-types.js @@ -152,9 +152,11 @@ }; export type SIWEServerCall = { - +address: string, - +message: string, - +signature: string, + address: string, + message: string, + signature: string, + publicKey: string, + socialProof: string, ...LogInExtraInfo, }; diff --git a/native/account/siwe-panel.react.js b/native/account/siwe-panel.react.js --- a/native/account/siwe-panel.react.js +++ b/native/account/siwe-panel.react.js @@ -20,7 +20,7 @@ import { useSelector } from '../redux/redux-utils'; import { nativeLogInExtraInfoSelector } from '../selectors/account-selectors'; import { defaultLandingURLPrefix } from '../utils/url-utils'; - +import { commCoreModule } from '../native-modules'; const commSIWE = `${defaultLandingURLPrefix}/siwe`; type BaseProps = { @@ -43,15 +43,18 @@ siweAction, }: Props) { const handleSIWE = React.useCallback( - ({ address, message, signature }) => { - // this is all mocked from register-panel + async ({ address, message, signature }) => { const extraInfo = logInExtraInfo(); + await commCoreModule.initializeCryptoAccount(address); + const { ed25519 } = await commCoreModule.getUserPublicKey(); dispatchActionPromise( siweActionTypes, siweAction({ address, message, signature, + publicKey: ed25519, + socialProof: signature, ...extraInfo, }), undefined,