gnoverse / dsocial

Experimental: Social apps, tools, researchs and dApps on Gno.land
8 stars 4 forks source link

In the Sign up screen, check if the account name already exists on the phone/blockchain #72

Closed jefft0 closed 3 months ago

jefft0 commented 5 months ago

The Sign up screen creates an account on the phone and then calls onboarding to register with r/demo/users on the blockchain. But the account names in the keystore on the phone and the blockchain are linked. If the account name already exists in r/demo/users, then oboarding fails to register with r/demo/users. And the keystore on the phone may have an account with the same name but different addresses.

We need to keep the keystore in sync with r/demo/users when the user enters name N on the signup screen. The following table covers all cases and the action to take.

Request name N. N in keystore? N in r/demo/users? same addr? action
yes yes yes Offer to do normal signin, or choose new N
yes yes no Bad case. Choose new N. (Delete N in keystore?)
yes no X Offer to onboard existing account (check if need faucet to add coins), replace it, or choose new N
no yes yes (keystore has same r/demo/users addr with different N2.) Offer to recreate as N in keystore, do signin.
no yes no (keystore doesn't have r/demo/users addr.) Name is unavailable. Choose new N
no no X Create name/addr in keystore, register in r/demo/users
jefft0 commented 4 months ago

For "rename key", perhaps use PrivKey directly (instead of Keybase) like the faucet does here: