Page MenuHomePhabricator

[identity] wallet login
ClosedPublic

Authored by varun on Apr 19 2023, 1:28 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Mar 27, 3:54 AM
Unknown Object (File)
Mon, Mar 18, 12:49 PM
Unknown Object (File)
Tue, Mar 12, 6:12 PM
Unknown Object (File)
Thu, Mar 7, 6:53 AM
Unknown Object (File)
Thu, Mar 7, 6:33 AM
Unknown Object (File)
Thu, Mar 7, 6:28 AM
Unknown Object (File)
Thu, Mar 7, 5:26 AM
Unknown Object (File)
Thu, Mar 7, 4:44 AM
Subscribers

Details

Summary

this RPC is called by both new and existing users signing in with an ethereum wallet. as a result, we need to use the wallet address to check if the user exists before determining whether to update a given user in DDB or create a new entry. we return an access token on successful login.

used the siwe-rs crate to verify the SIWE signature.

Depends on D7539

Test Plan

called the RPC, got back an access token, saw that a new item was created in DDB. then tried logging in again with the same wallet and the existing item in DDB users table was updated.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Harbormaster returned this revision to the author for changes because remote builds failed.Apr 19 2023, 1:40 PM
Harbormaster failed remote builds in B18540: Diff 25404!
Harbormaster returned this revision to the author for changes because remote builds failed.Apr 19 2023, 2:36 PM
Harbormaster failed remote builds in B18556: Diff 25421!

proto comment change looks fine; no context on the Rust

jon requested changes to this revision.Apr 24 2023, 1:24 PM
jon added inline comments.
services/identity/src/siwe.rs
18–41 ↗(On Diff #25465)

Feels weird to have a mix of match and map_err. Generally I prefer map_err. It keeps the cyclomatic complexity down. And with only a 80 char limit, it usually makes it a bit more readable as you aren't losing a lot of indention space.

This revision now requires changes to proceed.Apr 24 2023, 1:24 PM
jon added inline comments.
services/identity/src/siwe.rs
10–16 ↗(On Diff #25624)

also uses match

This revision is now accepted and ready to land.Apr 24 2023, 3:25 PM
This revision was automatically updated to reflect the committed changes.