Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3366076
D6880.id23088.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D6880.id23088.diff
View Options
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
@@ -16,6 +16,7 @@
import SWMansionIcon from 'lib/components/SWMansionIcon.react.js';
import { createLoadingStatusSelector } from 'lib/selectors/loading-selectors.js';
import type { LogInStartingPayload } from 'lib/types/account-types.js';
+import type { OLMIdentityKeys } from 'lib/types/crypto-types.js';
import {
useDispatchActionPromise,
useServerCall,
@@ -70,8 +71,8 @@
);
}, [dispatchActionPromise, getSIWENonceCall, siweNonceShouldBeFetched]);
- const primaryIdentityPublicKey = useSelector(
- state => state.cryptoStore.primaryIdentityKeys?.ed25519,
+ const primaryIdentityPublicKeys: ?OLMIdentityKeys = useSelector(
+ state => state.cryptoStore.primaryIdentityKeys,
);
const callSIWEAuthEndpoint = React.useCallback(
@@ -101,14 +102,16 @@
invariant(signer, 'signer must be present during SIWE attempt');
invariant(siweNonce, 'nonce must be present during SIWE attempt');
invariant(
- primaryIdentityPublicKey,
- 'primaryIdentityPublicKey must be present during SIWE attempt',
+ primaryIdentityPublicKeys,
+ 'primaryIdentityPublicKeys must be present during SIWE attempt',
+ );
+ const statement = getSIWEStatementForPublicKey(
+ primaryIdentityPublicKeys.ed25519,
);
- const statement = getSIWEStatementForPublicKey(primaryIdentityPublicKey);
const message = createSIWEMessage(address, statement, siweNonce);
const signature = await signer.signMessage(message);
attemptSIWEAuth(message, signature);
- }, [address, attemptSIWEAuth, primaryIdentityPublicKey, signer, siweNonce]);
+ }, [address, attemptSIWEAuth, primaryIdentityPublicKeys, signer, siweNonce]);
const { cancelSIWEAuthFlow } = props;
@@ -122,7 +125,7 @@
[],
);
- if (!siweNonce || !primaryIdentityPublicKey) {
+ if (!siweNonce || !primaryIdentityPublicKeys) {
return (
<div className={css.loadingIndicator}>
<LoadingIndicator status="loading" size="large" />
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
@@ -15,6 +15,7 @@
LogInStartingPayload,
} from 'lib/types/account-types.js';
import { logInActionSources } from 'lib/types/account-types.js';
+import type { OLMIdentityKeys } from 'lib/types/crypto-types.js';
import {
useDispatchActionPromise,
useServerCall,
@@ -37,8 +38,8 @@
const dispatchActionPromise = useDispatchActionPromise();
const modalContext = useModalContext();
- const primaryIdentityPublicKey = useSelector(
- state => state.cryptoStore.primaryIdentityKeys?.ed25519,
+ const primaryIdentityPublicKeys: ?OLMIdentityKeys = useSelector(
+ state => state.cryptoStore.primaryIdentityKeys,
);
const usernameInputRef = React.useRef();
@@ -68,15 +69,15 @@
async (extraInfo: LogInExtraInfo) => {
try {
invariant(
- primaryIdentityPublicKey,
- 'primaryIdentityPublicKey must be set in logInAction',
+ primaryIdentityPublicKeys,
+ 'primaryIdentityPublicKeys must be set in logInAction',
);
const result = await callLogIn({
...extraInfo,
username,
password,
logInActionSource: logInActionSources.logInFromWebForm,
- primaryIdentityPublicKey,
+ primaryIdentityPublicKey: primaryIdentityPublicKeys.ed25519,
});
modalContext.popModal();
return result;
@@ -92,7 +93,7 @@
throw e;
}
},
- [callLogIn, modalContext, password, primaryIdentityPublicKey, username],
+ [callLogIn, modalContext, password, primaryIdentityPublicKeys, username],
);
const onSubmit = React.useCallback(
@@ -173,8 +174,8 @@
variant="filled"
type="submit"
disabled={
- primaryIdentityPublicKey === null ||
- primaryIdentityPublicKey === undefined ||
+ primaryIdentityPublicKeys === null ||
+ primaryIdentityPublicKeys === undefined ||
inputDisabled
}
onClick={onSubmit}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Nov 26, 9:27 AM (13 h, 38 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2584143
Default Alt Text
D6880.id23088.diff (4 KB)
Attached To
Mode
D6880: [web] Update `primaryIdentityPublicKey[s]` selector to capture `primaryIdentityPublicKeys`
Attached
Detach File
Event Timeline
Log In to Comment