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 (
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}