Page MenuHomePhabricator

[landing] Pull `siweNonce` from `SIWENonceContext` and include in SIWE message
ClosedPublic

Authored by atul on Dec 21 2022, 2:06 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, May 18, 6:07 PM
Unknown Object (File)
Thu, Apr 25, 12:13 PM
Unknown Object (File)
Sun, Apr 21, 3:03 AM
Unknown Object (File)
Sun, Apr 21, 3:03 AM
Unknown Object (File)
Sun, Apr 21, 3:03 AM
Unknown Object (File)
Sun, Apr 21, 3:03 AM
Unknown Object (File)
Sun, Apr 21, 2:56 AM
Unknown Object (File)
Mar 25 2024, 7:25 PM
Subscribers
None

Details

Summary

Consume SIWENonceContext to retrieve siweNonce and pass to createSiweMessage so the nonce can be included in the signed message.

Depends on D5977

Test Plan

Logged nonce values from keyserver to native to landing to the SIWE message and made sure they were as expected. Also checked the siwe_nonces table to make sure nonce matched the most recent: https://blob.sh/139f21.png

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

atul requested review of this revision.Dec 21 2022, 2:20 PM
landing/siwe.react.js
43 ↗(On Diff #19978)

Yes the way things are right now it's impossible for this situation to occur, but I wanted to be extra careful so included this precondition.

59 ↗(On Diff #19978)

Yes the way things are right now it's impossible for this situation to occur, but I wanted to be extra careful so included this precondition.

ashoat added inline comments.
landing/siwe.react.js
42 ↗(On Diff #19978)

Can you annotate the types? It helps for documentation imo

This revision is now accepted and ready to land.Dec 21 2022, 5:34 PM

annotate function argument types

landing/siwe.react.js
42 ↗(On Diff #19978)

Typed address, statement and nonce here...

unfortunately the signer argument for signInWithEthereum is a bit more complex:

57218c.png (1×1 px, 279 KB)

so I created a task: https://linear.app/comm/issue/ENG-2522/flow-type-signer-in-landingsiwe-component and will defer for now.