Changeset View
Changeset View
Standalone View
Standalone View
web/account/siwe-login-form.react.js
Show All 23 Lines | import { | ||||
useServerCall, | useServerCall, | ||||
} from 'lib/utils/action-utils.js'; | } from 'lib/utils/action-utils.js'; | ||||
import { | import { | ||||
createSIWEMessage, | createSIWEMessage, | ||||
getSIWEStatementForPublicKey, | getSIWEStatementForPublicKey, | ||||
siweMessageSigningExplanationStatements, | siweMessageSigningExplanationStatements, | ||||
} from 'lib/utils/siwe-utils.js'; | } from 'lib/utils/siwe-utils.js'; | ||||
import { useSignedIdentityKeysBlob } from './account-hooks.js'; | |||||
import HeaderSeparator from './header-separator.react.js'; | import HeaderSeparator from './header-separator.react.js'; | ||||
import css from './siwe.css'; | import css from './siwe.css'; | ||||
import Button from '../components/button.react.js'; | import Button from '../components/button.react.js'; | ||||
import OrBreak from '../components/or-break.react.js'; | import OrBreak from '../components/or-break.react.js'; | ||||
import LoadingIndicator from '../loading-indicator.react.js'; | import LoadingIndicator from '../loading-indicator.react.js'; | ||||
import { useSelector } from '../redux/redux-utils.js'; | import { useSelector } from '../redux/redux-utils.js'; | ||||
import { webLogInExtraInfoSelector } from '../selectors/account-selectors.js'; | import { webLogInExtraInfoSelector } from '../selectors/account-selectors.js'; | ||||
import { signedIdentityKeysBlobSelector } from '../selectors/socket-selectors.js'; | |||||
type SIWELoginFormProps = { | type SIWELoginFormProps = { | ||||
+cancelSIWEAuthFlow: () => void, | +cancelSIWEAuthFlow: () => void, | ||||
}; | }; | ||||
const getSIWENonceLoadingStatusSelector = createLoadingStatusSelector( | const getSIWENonceLoadingStatusSelector = createLoadingStatusSelector( | ||||
getSIWENonceActionTypes, | getSIWENonceActionTypes, | ||||
); | ); | ||||
Show All 25 Lines | dispatchActionPromise( | ||||
})(), | })(), | ||||
); | ); | ||||
}, [dispatchActionPromise, getSIWENonceCall, siweNonceShouldBeFetched]); | }, [dispatchActionPromise, getSIWENonceCall, siweNonceShouldBeFetched]); | ||||
const primaryIdentityPublicKeys: ?OLMIdentityKeys = useSelector( | const primaryIdentityPublicKeys: ?OLMIdentityKeys = useSelector( | ||||
state => state.cryptoStore.primaryIdentityKeys, | state => state.cryptoStore.primaryIdentityKeys, | ||||
); | ); | ||||
const signedIdentityKeysBlob: ?SignedIdentityKeysBlob = useSelector( | const signedIdentityKeysBlob: ?SignedIdentityKeysBlob = | ||||
signedIdentityKeysBlobSelector, | useSignedIdentityKeysBlob(); | ||||
); | |||||
const callSIWEAuthEndpoint = React.useCallback( | const callSIWEAuthEndpoint = React.useCallback( | ||||
(message: string, signature: string, extraInfo) => { | (message: string, signature: string, extraInfo) => { | ||||
invariant( | invariant( | ||||
signedIdentityKeysBlob, | signedIdentityKeysBlob, | ||||
'signedIdentityKeysBlob must be set in attemptSIWEAuth', | 'signedIdentityKeysBlob must be set in attemptSIWEAuth', | ||||
); | ); | ||||
return siweAuthCall({ | return siweAuthCall({ | ||||
▲ Show 20 Lines • Show All 96 Lines • Show Last 20 Lines |