Page MenuHomePhabricator

[protos][identity] Add RPC to find username by user ID
ClosedPublic

Authored by bartek on Mar 25 2024, 7:03 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Nov 8, 1:52 PM
Unknown Object (File)
Fri, Nov 8, 1:39 PM
Unknown Object (File)
Fri, Nov 8, 7:15 AM
Unknown Object (File)
Fri, Nov 8, 7:15 AM
Unknown Object (File)
Fri, Nov 8, 7:15 AM
Unknown Object (File)
Fri, Nov 8, 7:15 AM
Unknown Object (File)
Fri, Nov 8, 7:15 AM
Unknown Object (File)
Oct 7 2024, 3:47 PM
Subscribers

Details

Summary

Addresses ENG-7190.
Added RPC that, given user ID, retrieves username or wallet address

Depends on D11378

Test Plan
  • registered two users: one password user and one wallet user
  • called the RPC for each, made sure that username is retrieved for the first, and wallet address + social proof pair is retrieved for the second

If the RPC format is approved, I'll add a commtest test too.

Diff Detail

Repository
rCOMM Comm
Branch
barthap/protos1
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

bartek held this revision as a draft.
bartek published this revision for review.Mar 25 2024, 8:03 AM
bartek added inline comments.
shared/protos/identity_auth.proto
71 ↗(On Diff #38286)

I called the RPC FindUserIdentity because of this type, but the word Identity was initially a bit confusing to me

ashoat added 1 blocking reviewer(s): varun.

Would be good for @varun to review the Rust.

At a later point we might want to introduce a feature where somebody with an ETH account can still have a username. This would make sense for ETH users that don't have an ENS name.

I wonder if we should future-proof this API now. I guess the best thing to do would be to modify Identity as follows:

message Identity {
  string username = 1;
  optional EthereumIdentity eth_identity = 2;
}

If the user is using their ETH wallet address as a username, then username will just be set to the wallet address.

I'm guessing making that change for all places that use Identity now might be tough, but it should be easier to do for this new RPC. And arguably, this is the time to change all of the RPCs since we're trying to finalizing RPC protos.

Accepting to avoid blocking this work, but curious for what you think of my proposed changes.

At a later point we might want to introduce a feature where somebody with an ETH account can still have a username. This would make sense for ETH users that don't have an ENS name.

I wonder if we should future-proof this API now. I guess the best thing to do would be to modify Identity as follows:

message Identity {
  string username = 1;
  optional EthereumIdentity eth_identity = 2;
}

If the user is using their ETH wallet address as a username, then username will just be set to the wallet address.

Actually I like this proposal, created ENG-7532 to discuss this

I'm guessing making that change for all places that use Identity now might be tough, but it should be easier to do for this new RPC. And arguably, this is the time to change all of the RPCs since we're trying to finalizing RPC protos.

Actually, looked at client code and we're using the Identity field only in one place on keyserver (inbound keys), so it might be easy to update it

what happens if the user doesn't exist? it seems like we'd want to return a "not found" tonic status in this case, but i'm not sure that's what we're doing here

This revision is now accepted and ready to land.Mar 27 2024, 8:28 AM
varun requested changes to this revision.Mar 27 2024, 8:28 AM
This revision now requires changes to proceed.Mar 27 2024, 8:28 AM
  • Made get_user_identifier() return Option
  • Updated callsites to return Status::not_found if missing identifier

do we need to change any client code now that some of these RPCs are returning "not found" ?

This revision is now accepted and ready to land.Mar 28 2024, 12:03 PM

do we need to change any client code now that some of these RPCs are returning "not found" ?

No, I don't think so. Apparently, clients haven't had to deal with this error case. Previously it was "unexpected error" so we would know if clients were failing for any reason, including user not found.