HomePhabricator
Diffusion Comm 71ffd4946c97

[keyserver][native] treat valid eth address as invalid username in non-siwe…

Description

[keyserver][native] treat valid eth address as invalid username in non-siwe registration

Summary: on native, we currently check if the username chosen by a user satisfies the validUsernameRegex check, but we don't check if it is a valid eth address. when the user tries to register with a valid eth address as their username in non-siwe registration, the keyserver sends back a reserved username error. this is confusing, because it's actually an invalid username, not a reserved one. in this diff i've added the isValidEthereumAddress check to the UsernameSelection component on native and i've updated createAccount on keyserver to return an invalid username error instead of a reserved username error in this scenario.

Test Plan:

  1. set validUsername to true on native and confirmed that the keyserver returns an invalid username error
  2. with the updated validUsername check on native, the "next" button is now grayed out if the user tries to pick a valid eth address as their username

Reviewers: atul, ashoat

Reviewed By: ashoat

Subscribers: tomek

Differential Revision: https://phab.comm.dev/D11201

Details