Page MenuHomePhabricator

[identity] wallet login
ClosedPublic

Authored by varun on Apr 19 2023, 1:28 PM.
Tags
None
Referenced Files
F3534604: D7540.diff
Wed, Dec 25, 12:37 PM
Unknown Object (File)
Sat, Dec 21, 12:00 PM
Unknown Object (File)
Sun, Dec 15, 7:08 PM
Unknown Object (File)
Sun, Dec 15, 7:08 PM
Unknown Object (File)
Sun, Dec 15, 7:08 PM
Unknown Object (File)
Sun, Dec 15, 7:08 PM
Unknown Object (File)
Sun, Dec 15, 7:08 PM
Unknown Object (File)
Sun, Dec 15, 7:07 PM
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
No Lint Coverage
Unit
No Test Coverage

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.