Page MenuHomePhabricator

D6028.id20132.diff
No OneTemporary

D6028.id20132.diff

diff --git a/lib/types/redux-types.js b/lib/types/redux-types.js
--- a/lib/types/redux-types.js
+++ b/lib/types/redux-types.js
@@ -901,7 +901,7 @@
}
| {
+type: 'SIWE_AUTH_SUCCESS',
- +payload?: void,
+ +payload?: boolean,
+loadingInfo: LoadingInfo,
}
| {
diff --git a/native/account/siwe-panel.react.js b/native/account/siwe-panel.react.js
--- a/native/account/siwe-panel.react.js
+++ b/native/account/siwe-panel.react.js
@@ -9,8 +9,9 @@
import {
getSIWENonce,
getSIWENonceActionTypes,
+ siweAuth,
+ siweAuthActionTypes,
} from 'lib/actions/siwe-actions';
-import { registerActionTypes, register } from 'lib/actions/user-actions';
import { createLoadingStatusSelector } from 'lib/selectors/loading-selectors';
import type { LogInStartingPayload } from 'lib/types/account-types';
import type { SIWEWebViewMessage } from 'lib/types/siwe-types';
@@ -24,7 +25,6 @@
import { nativeLogInExtraInfoSelector } from '../selectors/account-selectors';
import { defaultLandingURLPrefix } from '../utils/url-utils';
import type { LoggedOutMode } from './logged-out-modal.react';
-import { setNativeCredentials } from './native-credentials';
const commSIWE = `${defaultLandingURLPrefix}/siwe`;
@@ -39,8 +39,8 @@
function SIWEPanel(props: Props): React.Node {
const navContext = React.useContext(NavContext);
const dispatchActionPromise = useDispatchActionPromise();
- const registerAction = useServerCall(register);
const getSIWENonceCall = useServerCall(getSIWENonce);
+ const siweAuthCall = useServerCall(siweAuth);
const logInExtraInfo = useSelector(state =>
nativeLogInExtraInfoSelector({
@@ -92,22 +92,20 @@
}, [snapToIndex, snapPoints]);
const handleSIWE = React.useCallback(
- ({ address, signature }) => {
- // this is all mocked from register-panel
+ ({ message, signature }) => {
const extraInfo = logInExtraInfo();
dispatchActionPromise(
- registerActionTypes,
- registerAction({
- username: address,
- password: signature,
+ siweAuthActionTypes,
+ siweAuthCall({
+ message,
+ signature,
...extraInfo,
}),
undefined,
({ calendarQuery: extraInfo.calendarQuery }: LogInStartingPayload),
);
- setNativeCredentials({ username: address, password: signature });
},
- [logInExtraInfo, dispatchActionPromise, registerAction],
+ [logInExtraInfo, dispatchActionPromise, siweAuthCall],
);
const closeBottomSheet = bottomSheetRef.current?.close;
const { onClose, nextMode } = props;
@@ -115,9 +113,9 @@
event => {
const data: SIWEWebViewMessage = JSON.parse(event.nativeEvent.data);
if (data.type === 'siwe_success') {
- const { address, signature } = data;
+ const { address, message, signature } = data;
if (address && signature) {
- handleSIWE({ address, signature });
+ handleSIWE({ message, signature });
}
} else if (data.type === 'siwe_closed') {
onClose();

File Metadata

Mime Type
text/plain
Expires
Sun, Dec 29, 12:15 PM (7 h, 40 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2729135
Default Alt Text
D6028.id20132.diff (3 KB)

Event Timeline