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 @@ -15,7 +15,7 @@ } from 'lib/facts/policies.js'; import { hasMinCodeVersion } from 'lib/shared/version-utils.js'; import type { - KeyserverAuthRequest, + ServerKeyserverAuthRequest, ResetPasswordRequest, LogOutResponse, RegisterResponse, @@ -756,8 +756,8 @@ }); } -export const keyserverAuthRequestInputValidator: TInterface = - tShape({ +export const keyserverAuthRequestInputValidator: TInterface = + tShape({ userID: tUserID, deviceID: t.String, calendarQuery: entryQueryInputValidator, @@ -773,7 +773,7 @@ async function keyserverAuthResponder( viewer: Viewer, - request: KeyserverAuthRequest, + request: ServerKeyserverAuthRequest, ): Promise { const { userID, @@ -781,7 +781,6 @@ initialContentEncryptedMessage, initialNotificationsEncryptedMessage, doNotRegister, - password, } = request; const calendarQuery = normalizeCalendarQuery(request.calendarQuery); @@ -849,17 +848,15 @@ return; } - const hash = password ? bcrypt.hashSync(password) : null; const time = Date.now(); const newUserRow = [ userID, username, inboundKeysForUser.walletAddress, - hash, time, ]; const newUserQuery = SQL` - INSERT INTO users(id, username, ethereum_address, hash, creation_time) + INSERT INTO users(id, username, ethereum_address, creation_time) VALUES ${[newUserRow]} `; await dbQuery(newUserQuery); diff --git a/lib/actions/user-actions.js b/lib/actions/user-actions.js --- a/lib/actions/user-actions.js +++ b/lib/actions/user-actions.js @@ -48,7 +48,7 @@ LogInRequest, KeyserverAuthResult, KeyserverAuthInfo, - KeyserverAuthRequest, + ClientKeyserverAuthRequest, ClientLogInResponse, KeyserverLogOutResult, LogOutResult, @@ -643,21 +643,13 @@ const keyserverIDs = Object.keys(keyserverData); - const authKeyserverID = authoritativeKeyserverID(); - if (restLogInInfo.password) { - invariant( - keyserverIDs.length === 1 && keyserverIDs[0] === authKeyserverID, - 'passing password to non-auth keyserver', - ); - } - const watchedIDsPerKeyserver = sortThreadIDsPerKeyserver(watchedIDs); const calendarQueryPerKeyserver = sortCalendarQueryPerKeyserver( calendarQuery, keyserverIDs, ); - const requests: { [string]: KeyserverAuthRequest } = {}; + const requests: { [string]: ClientKeyserverAuthRequest } = {}; for (const keyserverID of keyserverIDs) { requests[keyserverID] = { ...restLogInInfo, @@ -719,6 +711,7 @@ }; } + const authKeyserverID = authoritativeKeyserverID(); let userInfos: $ReadOnlyArray = []; if (responses[authKeyserverID]) { const userInfosArrays = [ diff --git a/lib/keyserver-conn/keyserver-auth.js b/lib/keyserver-conn/keyserver-auth.js --- a/lib/keyserver-conn/keyserver-auth.js +++ b/lib/keyserver-conn/keyserver-auth.js @@ -34,7 +34,6 @@ +setInProgress: boolean => mixed, +hasBeenCancelled: () => boolean, +doNotRegister: boolean, - +password?: ?string, }; type RawKeyserverAuthFunc = @@ -86,7 +85,6 @@ setInProgress, hasBeenCancelled, doNotRegister, - password, } = inputs; try { const [keyserverKeys] = await Promise.all([ @@ -141,7 +139,6 @@ }, }, preRequestUserInfo: currentUserInfo, - password, }); void dispatchActionPromise(keyserverAuthActionTypes, authPromise); 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 @@ -239,10 +239,9 @@ +deviceTokenUpdateInput: DeviceTokenUpdateInput, +authActionSource: AuthActionSource, +keyserverData: { +[keyserverID: string]: KeyserverRequestData }, - +password?: ?string, }; -export type KeyserverAuthRequest = $ReadOnly<{ +export type ClientKeyserverAuthRequest = $ReadOnly<{ ...KeyserverRequestData, +userID: string, +deviceID: string, @@ -252,6 +251,10 @@ +watchedIDs: $ReadOnlyArray, +platformDetails: PlatformDetails, +source?: AuthActionSource, +}>; + +export type ServerKeyserverAuthRequest = $ReadOnly<{ + ...ClientKeyserverAuthRequest, +password?: ?string, }>; diff --git a/native/account/registration/registration-server-call.js b/native/account/registration/registration-server-call.js --- a/native/account/registration/registration-server-call.js +++ b/native/account/registration/registration-server-call.js @@ -451,7 +451,6 @@ setInProgress: () => {}, hasBeenCancelled: () => false, doNotRegister: false, - password: credentialsToSave?.password, }); setCurrentStep({ step: 'authoritative_keyserver_registration_dispatched',