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)
Mon, Nov 4, 11:33 AM
Unknown Object (File)
Mon, Nov 4, 8:25 AM
Unknown Object (File)
Mon, Nov 4, 8:25 AM
Unknown Object (File)
Mon, Nov 4, 8:25 AM
Unknown Object (File)
Mon, Nov 4, 8:24 AM
Unknown Object (File)
Mon, Nov 4, 8:07 AM
Unknown Object (File)
Mon, Nov 4, 1:16 AM
Unknown Object (File)
Mon, Nov 4, 1:16 AM
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
Branch
master
Lint
No Lint Coverage
Unit
No Test Coverage

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.