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
F3492834: D5978.id19978.diff
Thu, Dec 19, 1:47 AM
F3491233: D5978.id20007.diff
Wed, Dec 18, 6:19 PM
F3491232: D5978.id20006.diff
Wed, Dec 18, 6:19 PM
F3491231: D5978.id19978.diff
Wed, Dec 18, 6:19 PM
Unknown Object (File)
Sun, Nov 24, 2:40 PM
Unknown Object (File)
Nov 15 2024, 12:53 PM
Unknown Object (File)
Nov 15 2024, 12:12 PM
Unknown Object (File)
Nov 15 2024, 10:50 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
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.