Page MenuHomePhabricator

D11806.id39569.diff
No OneTemporary

D11806.id39569.diff

diff --git a/lib/actions/siwe-actions.js b/lib/actions/siwe-actions.js
--- a/lib/actions/siwe-actions.js
+++ b/lib/actions/siwe-actions.js
@@ -11,7 +11,7 @@
type LegacyLogInResult,
logInActionSources,
} from '../types/account-types.js';
-import type { SIWEAuthServerCall } from '../types/siwe-types.js';
+import type { LegacySIWEAuthServerCall } from '../types/siwe-types.js';
import { authoritativeKeyserverID } from '../utils/authoritative-keyserver.js';
import { getConfig } from '../utils/config.js';
@@ -41,7 +41,7 @@
(
callSingleKeyserverEndpoint: CallSingleKeyserverEndpoint,
): ((
- siweAuthPayload: SIWEAuthServerCall,
+ siweAuthPayload: LegacySIWEAuthServerCall,
options?: ?CallSingleKeyserverEndpointOptions,
) => Promise<LegacyLogInResult>) =>
async (siweAuthPayload, options) => {
diff --git a/lib/selectors/account-selectors.js b/lib/selectors/account-selectors.js
--- a/lib/selectors/account-selectors.js
+++ b/lib/selectors/account-selectors.js
@@ -11,7 +11,7 @@
} from './keyserver-selectors.js';
import { useDerivedObject } from '../hooks/objects.js';
import type {
- LogInExtraInfo,
+ LegacyLogInExtraInfo,
DeviceTokenUpdateRequest,
} from '../types/account-types.js';
import type { CalendarFilter } from '../types/filter-types.js';
@@ -25,7 +25,7 @@
import type { CurrentUserInfo } from '../types/user-types.js';
import { useSelector } from '../utils/redux-utils.js';
-const logInExtraInfoSelector: (state: AppState) => LogInExtraInfo =
+const legacyLogInExtraInfoSelector: (state: AppState) => LegacyLogInExtraInfo =
createSelector(
(state: BaseAppState<>) => state.navInfo,
(state: BaseAppState<>) => state.calendarFilters,
@@ -109,7 +109,7 @@
}
export {
- logInExtraInfoSelector,
+ legacyLogInExtraInfoSelector,
preRequestUserStateForSingleKeyserverSelector,
usePreRequestUserState,
};
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
@@ -52,7 +52,7 @@
};
export type LegacyRegisterInfo = {
- ...LogInExtraInfo,
+ ...LegacyLogInExtraInfo,
+username: string,
+password: string,
};
@@ -147,7 +147,7 @@
+authActionSource?: AuthActionSource,
};
-export type LogInExtraInfo = {
+export type LegacyLogInExtraInfo = {
+calendarQuery: CalendarQuery,
+deviceTokenUpdateRequest: DeviceTokenUpdateInput,
+signedIdentityKeysBlob?: SignedIdentityKeysBlob,
@@ -156,7 +156,7 @@
};
export type LegacyLogInInfo = {
- ...LogInExtraInfo,
+ ...LegacyLogInExtraInfo,
+username: string,
+password: string,
+authActionSource: AuthActionSource,
diff --git a/lib/types/siwe-types.js b/lib/types/siwe-types.js
--- a/lib/types/siwe-types.js
+++ b/lib/types/siwe-types.js
@@ -1,6 +1,6 @@
// @flow
-import type { LogInExtraInfo } from './account-types.js';
+import type { LegacyLogInExtraInfo } from './account-types.js';
import type { SignedIdentityKeysBlob } from './crypto-types.js';
import {
type DeviceTokenUpdateRequest,
@@ -24,11 +24,11 @@
+doNotRegister?: boolean,
};
-export type SIWEAuthServerCall = {
+export type LegacySIWEAuthServerCall = {
+message: string,
+signature: string,
+doNotRegister?: boolean,
- ...LogInExtraInfo,
+ ...LegacyLogInExtraInfo,
};
export type SIWESocialProof = {
diff --git a/native/account/legacy-recover-keyserver-session.js b/native/account/legacy-recover-keyserver-session.js
--- a/native/account/legacy-recover-keyserver-session.js
+++ b/native/account/legacy-recover-keyserver-session.js
@@ -15,7 +15,7 @@
import { fetchNativeKeychainCredentials } from './native-credentials.js';
import { store } from '../redux/redux-setup.js';
-import { nativeLogInExtraInfoSelector } from '../selectors/account-selectors.js';
+import { nativeLegacyLogInExtraInfoSelector } from '../selectors/account-selectors.js';
async function resolveKeyserverSessionInvalidationUsingNativeCredentials(
callSingleKeyserverEndpoint: CallSingleKeyserverEndpoint,
@@ -35,7 +35,7 @@
const [baseExtraInfo, initialNotificationsEncryptedMessage] =
await Promise.all([
- nativeLogInExtraInfoSelector(store.getState())(),
+ nativeLegacyLogInExtraInfoSelector(store.getState())(),
getInitialNotificationsEncryptedMessage({
callSingleKeyserverEndpoint,
}),
diff --git a/native/account/legacy-register-panel.react.js b/native/account/legacy-register-panel.react.js
--- a/native/account/legacy-register-panel.react.js
+++ b/native/account/legacy-register-panel.react.js
@@ -27,7 +27,7 @@
import { useInitialNotificationsEncryptedMessage } from 'lib/shared/crypto-utils.js';
import type {
LegacyRegisterInfo,
- LogInExtraInfo,
+ LegacyLogInExtraInfo,
LegacyRegisterResult,
LegacyLogInStartingPayload,
} from 'lib/types/account-types.js';
@@ -45,7 +45,7 @@
import { authoritativeKeyserverID } from '../authoritative-keyserver.js';
import SWMansionIcon from '../components/swmansion-icon.react.js';
import { useSelector } from '../redux/redux-utils.js';
-import { nativeLogInExtraInfoSelector } from '../selectors/account-selectors.js';
+import { nativeLegacyLogInExtraInfoSelector } from '../selectors/account-selectors.js';
import type { KeyPressEvent } from '../types/react-native.js';
import {
AppOutOfDateAlertDetails,
@@ -70,7 +70,7 @@
type Props = {
...BaseProps,
+loadingStatus: LoadingStatus,
- +logInExtraInfo: () => Promise<LogInExtraInfo>,
+ +legacyLogInExtraInfo: () => Promise<LegacyLogInExtraInfo>,
+dispatch: Dispatch,
+dispatchActionPromise: DispatchActionPromise,
+legacyRegister: (
@@ -310,7 +310,7 @@
);
} else {
Keyboard.dismiss();
- const extraInfo = await this.props.logInExtraInfo();
+ const extraInfo = await this.props.legacyLogInExtraInfo();
const initialNotificationsEncryptedMessage =
await this.props.getInitialNotificationsEncryptedMessage();
void this.props.dispatchActionPromise(
@@ -355,7 +355,7 @@
};
async legacyRegisterAction(
- extraInfo: LogInExtraInfo,
+ extraInfo: LegacyLogInExtraInfo,
): Promise<LegacyRegisterResult> {
try {
const result = await this.props.legacyRegister({
@@ -491,7 +491,9 @@
olmSessionInitializationDataLoadingStatus,
);
- const logInExtraInfo = useSelector(nativeLogInExtraInfoSelector);
+ const legacyLogInExtraInfo = useSelector(
+ nativeLegacyLogInExtraInfoSelector,
+ );
const dispatch = useDispatch();
const dispatchActionPromise = useDispatchActionPromise();
@@ -505,7 +507,7 @@
<LegacyRegisterPanel
{...props}
loadingStatus={loadingStatus}
- logInExtraInfo={logInExtraInfo}
+ legacyLogInExtraInfo={legacyLogInExtraInfo}
dispatch={dispatch}
dispatchActionPromise={dispatchActionPromise}
legacyRegister={callLegacyRegister}
diff --git a/native/account/log-in-panel.react.js b/native/account/log-in-panel.react.js
--- a/native/account/log-in-panel.react.js
+++ b/native/account/log-in-panel.react.js
@@ -22,7 +22,7 @@
import { useInitialNotificationsEncryptedMessage } from 'lib/shared/crypto-utils.js';
import {
type LegacyLogInInfo,
- type LogInExtraInfo,
+ type LegacyLogInExtraInfo,
type LegacyLogInResult,
type LegacyLogInStartingPayload,
logInActionSources,
@@ -45,7 +45,7 @@
import { authoritativeKeyserverID } from '../authoritative-keyserver.js';
import SWMansionIcon from '../components/swmansion-icon.react.js';
import { useSelector } from '../redux/redux-utils.js';
-import { nativeLogInExtraInfoSelector } from '../selectors/account-selectors.js';
+import { nativeLegacyLogInExtraInfoSelector } from '../selectors/account-selectors.js';
import type { KeyPressEvent } from '../types/react-native.js';
import {
AppOutOfDateAlertDetails,
@@ -67,7 +67,7 @@
type Props = {
...BaseProps,
+loadingStatus: LoadingStatus,
- +logInExtraInfo: () => Promise<LogInExtraInfo>,
+ +legacyLogInExtraInfo: () => Promise<LegacyLogInExtraInfo>,
+dispatchActionPromise: DispatchActionPromise,
+legacyLogIn: (logInInfo: LegacyLogInInfo) => Promise<LegacyLogInResult>,
+identityPasswordLogIn: (username: string, password: string) => Promise<void>,
@@ -263,7 +263,7 @@
return;
}
- const extraInfo = await this.props.logInExtraInfo();
+ const extraInfo = await this.props.legacyLogInExtraInfo();
const initialNotificationsEncryptedMessage =
await this.props.getInitialNotificationsEncryptedMessage();
@@ -279,7 +279,7 @@
};
async legacyLogInAction(
- extraInfo: LogInExtraInfo,
+ extraInfo: LegacyLogInExtraInfo,
): Promise<LegacyLogInResult> {
try {
const result = await this.props.legacyLogIn({
@@ -453,7 +453,9 @@
olmSessionInitializationDataLoadingStatus,
);
- const logInExtraInfo = useSelector(nativeLogInExtraInfoSelector);
+ const legacyLogInExtraInfo = useSelector(
+ nativeLegacyLogInExtraInfoSelector,
+ );
const dispatchActionPromise = useDispatchActionPromise();
const callLegacyLogIn = useLegacyLogIn();
@@ -465,7 +467,7 @@
<LogInPanel
{...props}
loadingStatus={loadingStatus}
- logInExtraInfo={logInExtraInfo}
+ legacyLogInExtraInfo={legacyLogInExtraInfo}
dispatchActionPromise={dispatchActionPromise}
legacyLogIn={callLegacyLogIn}
identityPasswordLogIn={callIdentityPasswordLogIn}
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
@@ -35,7 +35,7 @@
} from '../../avatars/avatar-hooks.js';
import { commCoreModule } from '../../native-modules.js';
import { useSelector } from '../../redux/redux-utils.js';
-import { nativeLogInExtraInfoSelector } from '../../selectors/account-selectors.js';
+import { nativeLegacyLogInExtraInfoSelector } from '../../selectors/account-selectors.js';
import {
AppOutOfDateAlertDetails,
UsernameReservedAlertDetails,
@@ -86,7 +86,7 @@
// STEP 1: ACCOUNT REGISTRATION
- const logInExtraInfo = useSelector(nativeLogInExtraInfoSelector);
+ const legacyLogInExtraInfo = useSelector(nativeLegacyLogInExtraInfoSelector);
const dispatchActionPromise = useDispatchActionPromise();
const callLegacyKeyserverRegister = useLegacyAshoatKeyserverCall(
@@ -145,7 +145,7 @@
accountSelection: UsernameAccountSelection,
keyserverURL: string,
) => {
- const extraInfo = await logInExtraInfo();
+ const extraInfo = await legacyLogInExtraInfo();
const legacyKeyserverRegisterPromise = (async () => {
try {
return await callLegacyKeyserverRegister(
@@ -193,7 +193,7 @@
);
await legacyKeyserverRegisterPromise;
},
- [logInExtraInfo, callLegacyKeyserverRegister, dispatchActionPromise],
+ [legacyLogInExtraInfo, callLegacyKeyserverRegister, dispatchActionPromise],
);
const legacySiweServerCall = useLegacySIWEServerCall();
diff --git a/native/account/siwe-hooks.js b/native/account/siwe-hooks.js
--- a/native/account/siwe-hooks.js
+++ b/native/account/siwe-hooks.js
@@ -15,14 +15,14 @@
import { useInitialNotificationsEncryptedMessage } from 'lib/shared/crypto-utils.js';
import type {
LegacyLogInStartingPayload,
- LogInExtraInfo,
+ LegacyLogInExtraInfo,
} from 'lib/types/account-types.js';
import type { IdentityWalletRegisterInput } from 'lib/types/siwe-types.js';
import { useDispatchActionPromise } from 'lib/utils/redux-promise-utils.js';
import { authoritativeKeyserverID } from '../authoritative-keyserver.js';
import { useSelector } from '../redux/redux-utils.js';
-import { nativeLogInExtraInfoSelector } from '../selectors/account-selectors.js';
+import { nativeLegacyLogInExtraInfoSelector } from '../selectors/account-selectors.js';
type SIWEServerCallParams = {
+message: string,
@@ -40,7 +40,10 @@
(
message: string,
signature: string,
- extraInfo: $ReadOnly<{ ...LogInExtraInfo, +doNotRegister?: boolean }>,
+ extraInfo: $ReadOnly<{
+ ...LegacyLogInExtraInfo,
+ +doNotRegister?: boolean,
+ }>,
callSingleKeyserverEndpointOptions: ?CallSingleKeyserverEndpointOptions,
) =>
legacySiweAuthCall(
@@ -54,7 +57,7 @@
[legacySiweAuthCall],
);
- const logInExtraInfo = useSelector(nativeLogInExtraInfoSelector);
+ const legacyLogInExtraInfo = useSelector(nativeLegacyLogInExtraInfoSelector);
const getInitialNotificationsEncryptedMessage =
useInitialNotificationsEncryptedMessage(authoritativeKeyserverID);
@@ -65,7 +68,7 @@
{ message, signature, doNotRegister },
callSingleKeyserverEndpointOptions,
) => {
- const extraInfo = await logInExtraInfo();
+ const extraInfo = await legacyLogInExtraInfo();
const initialNotificationsEncryptedMessage =
await getInitialNotificationsEncryptedMessage({
callSingleKeyserverEndpointOptions,
@@ -94,7 +97,7 @@
await siwePromise;
},
[
- logInExtraInfo,
+ legacyLogInExtraInfo,
dispatchActionPromise,
callSIWE,
getInitialNotificationsEncryptedMessage,
diff --git a/native/selectors/account-selectors.js b/native/selectors/account-selectors.js
--- a/native/selectors/account-selectors.js
+++ b/native/selectors/account-selectors.js
@@ -3,9 +3,9 @@
import _memoize from 'lodash/memoize.js';
import { createSelector } from 'reselect';
-import { logInExtraInfoSelector } from 'lib/selectors/account-selectors.js';
+import { legacyLogInExtraInfoSelector } from 'lib/selectors/account-selectors.js';
import { currentAsOfSelector } from 'lib/selectors/keyserver-selectors.js';
-import type { LogInExtraInfo } from 'lib/types/account-types.js';
+import type { LegacyLogInExtraInfo } from 'lib/types/account-types.js';
import type { SignedIdentityKeysBlob } from 'lib/types/crypto-types.js';
import type { UserPolicies } from 'lib/types/policy-types.js';
import { values } from 'lib/utils/objects.js';
@@ -14,11 +14,11 @@
import type { AppState } from '../redux/state-types.js';
import type { ConnectivityInfo } from '../types/connectivity.js';
-const nativeLogInExtraInfoSelector: (
+const nativeLegacyLogInExtraInfoSelector: (
state: AppState,
-) => () => Promise<LogInExtraInfo> = createSelector(
- logInExtraInfoSelector,
- (logInExtraInfo: LogInExtraInfo) => {
+) => () => Promise<LegacyLogInExtraInfo> = createSelector(
+ legacyLogInExtraInfoSelector,
+ (logInExtraInfo: LegacyLogInExtraInfo) => {
const loginExtraFuncWithIdentityKey = async () => {
await commCoreModule.initializeCryptoAccount();
const { blobPayload, signature } =
@@ -61,6 +61,6 @@
);
export {
- nativeLogInExtraInfoSelector,
+ nativeLegacyLogInExtraInfoSelector,
noDataAfterPolicyAcknowledgmentSelector,
};
diff --git a/web/account/siwe-login-form.react.js b/web/account/siwe-login-form.react.js
--- a/web/account/siwe-login-form.react.js
+++ b/web/account/siwe-login-form.react.js
@@ -22,11 +22,11 @@
import stores from 'lib/facts/stores.js';
import { useWalletLogIn } from 'lib/hooks/login-hooks.js';
import { useLegacyAshoatKeyserverCall } from 'lib/keyserver-conn/legacy-keyserver-call.js';
-import { logInExtraInfoSelector } from 'lib/selectors/account-selectors.js';
+import { legacyLogInExtraInfoSelector } from 'lib/selectors/account-selectors.js';
import { createLoadingStatusSelector } from 'lib/selectors/loading-selectors.js';
import type {
LegacyLogInStartingPayload,
- LogInExtraInfo,
+ LegacyLogInExtraInfo,
} from 'lib/types/account-types.js';
import { getMessageForException, ServerError } from 'lib/utils/errors.js';
import { useDispatchActionPromise } from 'lib/utils/redux-promise-utils.js';
@@ -77,7 +77,7 @@
legacySiweAuthLoadingStatusSelector,
);
const legacySiweAuthCall = useLegacyAshoatKeyserverCall(legacySiweAuth);
- const logInExtraInfo = useSelector(logInExtraInfoSelector);
+ const legacyLogInExtraInfo = useSelector(legacyLogInExtraInfoSelector);
const walletLogIn = useWalletLogIn();
@@ -117,7 +117,11 @@
]);
const callLegacySIWEAuthEndpoint = React.useCallback(
- async (message: string, signature: string, extraInfo: LogInExtraInfo) => {
+ async (
+ message: string,
+ signature: string,
+ extraInfo: LegacyLogInExtraInfo,
+ ) => {
await olmAPI.initializeCryptoAccount();
const userPublicKey = await olmAPI.getUserPublicKey();
try {
@@ -148,14 +152,14 @@
(message: string, signature: string) => {
return dispatchActionPromise(
legacySiweAuthActionTypes,
- callLegacySIWEAuthEndpoint(message, signature, logInExtraInfo),
+ callLegacySIWEAuthEndpoint(message, signature, legacyLogInExtraInfo),
undefined,
({
- calendarQuery: logInExtraInfo.calendarQuery,
+ calendarQuery: legacyLogInExtraInfo.calendarQuery,
}: LegacyLogInStartingPayload),
);
},
- [callLegacySIWEAuthEndpoint, dispatchActionPromise, logInExtraInfo],
+ [callLegacySIWEAuthEndpoint, dispatchActionPromise, legacyLogInExtraInfo],
);
const attemptWalletLogIn = React.useCallback(
diff --git a/web/account/traditional-login-form.react.js b/web/account/traditional-login-form.react.js
--- a/web/account/traditional-login-form.react.js
+++ b/web/account/traditional-login-form.react.js
@@ -9,14 +9,14 @@
} from 'lib/actions/user-actions.js';
import { useModalContext } from 'lib/components/modal-provider.react.js';
import { usePasswordLogIn } from 'lib/hooks/login-hooks.js';
-import { logInExtraInfoSelector } from 'lib/selectors/account-selectors.js';
+import { legacyLogInExtraInfoSelector } from 'lib/selectors/account-selectors.js';
import { createLoadingStatusSelector } from 'lib/selectors/loading-selectors.js';
import {
oldValidUsernameRegex,
validEmailRegex,
} from 'lib/shared/account-utils.js';
import type {
- LogInExtraInfo,
+ LegacyLogInExtraInfo,
LegacyLogInStartingPayload,
} from 'lib/types/account-types.js';
import { logInActionSources } from 'lib/types/account-types.js';
@@ -42,7 +42,7 @@
React.useState(false);
const inputDisabled = legacyAuthInProgress || identityAuthInProgress;
- const loginExtraInfo = useSelector(logInExtraInfoSelector);
+ const legacyLoginExtraInfo = useSelector(legacyLogInExtraInfoSelector);
const callLegacyLogIn = useLegacyLogIn();
const dispatchActionPromise = useDispatchActionPromise();
@@ -78,7 +78,7 @@
const [errorMessage, setErrorMessage] = React.useState<string>('');
const legacyLogInAction = React.useCallback(
- async (extraInfo: LogInExtraInfo) => {
+ async (extraInfo: LegacyLogInExtraInfo) => {
await olmAPI.initializeCryptoAccount();
const userPublicKey = await olmAPI.getUserPublicKey();
try {
@@ -168,10 +168,10 @@
} else {
void dispatchActionPromise(
legacyLogInActionTypes,
- legacyLogInAction(loginExtraInfo),
+ legacyLogInAction(legacyLoginExtraInfo),
undefined,
({
- calendarQuery: loginExtraInfo.calendarQuery,
+ calendarQuery: legacyLoginExtraInfo.calendarQuery,
}: LegacyLogInStartingPayload),
);
}
@@ -180,7 +180,7 @@
dispatchActionPromise,
identityPasswordLogInAction,
legacyLogInAction,
- loginExtraInfo,
+ legacyLoginExtraInfo,
username,
password,
],

File Metadata

Mime Type
text/plain
Expires
Thu, Jan 9, 7:11 AM (8 h, 40 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2829680
Default Alt Text
D11806.id39569.diff (19 KB)

Event Timeline