Page MenuHomePhabricator

[native] Hit `siwe_nonce` endpoint and pass `nonce` to SIWE `WebView`
ClosedPublic

Authored by atul on Dec 20 2022, 11:44 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Nov 24, 11:26 PM
Unknown Object (File)
Fri, Nov 22, 12:22 PM
Unknown Object (File)
Sun, Nov 17, 3:46 PM
Unknown Object (File)
Sun, Nov 17, 1:43 PM
Unknown Object (File)
Fri, Nov 8, 9:13 PM
Unknown Object (File)
Fri, Nov 8, 9:13 PM
Unknown Object (File)
Fri, Nov 8, 9:13 PM
Unknown Object (File)
Fri, Nov 8, 9:13 PM
Subscribers
None

Details

Summary

We make a call to siwe_nonce from native to fetch a nonce from the keyserver.

Once we have the nonce we pass it to the WebView that loads /commlanding/siwe by including it as a header passed through the source prop.

We use createLoadingStatusSelector to determine whether the request failed, in which case we display an error message.

If the request has succeeded we should have a nonce in which case we render the WebView.

Finally, if the request has neither succeeded or failed we display a spinner (via ActivityIndicator) to indicate that the request is in progress.


Depends on D5965

Test Plan
  • Logged values and set breakpoints to ensure that things were as expected.
  • Used Redux remote dev tools to ensure that loadingStatuses were as expected at each action
  • Killed keyserver and made sure that error message was displayed instead of ActivityIndicator spinning indefinitely

Diff Detail

Repository
rCOMM Comm
Branch
master
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

atul published this revision for review.Dec 20 2022, 11:53 PM

As for how the header is consumed, I pull out the siwe-nonce header if it exists in keyserver/src/responders/landing-handler.js and pass it to down to LandingSSR and then down to SIWE. Going to clean this up and put up a diff tomorrow morning.

This revision is now accepted and ready to land.Dec 21 2022, 8:52 AM
This revision was landed with ongoing or failed builds.Dec 21 2022, 10:54 AM
This revision was automatically updated to reflect the committed changes.
native/account/siwe-panel.react.js
51 ↗(On Diff #19964)

This layer doesn't seem to need to exist, unless you're purposefully just trying to wrap everything in a setTimeout