Registration Flow:
1. Internet Identity Registration:
- When a user connects via Internet Identity, we first check if they are registered in the system.
- If not, we proceed to the Registration flow. Since the ICP principal is already available, no additional action is needed on the frontend, but the backend will store the user’s principal, create and associate a session to it.
2. Ethereum Wallet Registration:
- Upon connecting via Metamask, we first check for an existing user linked to the connected wallet address.
- If the user is not registered, they are prompted to complete the Registration process.
- After registration, the user must sign a nonce with their wallet to authenticate and link the wallet address to the user profile.
3. Email Registration:
- When the email login option is selected, if the email is not associated with an existing user, they will be prompted to register.
- Upon registration, a verification token is sent to the email address.
- The user must then enter the verification code to confirm their account and proceed with the login flow.
The registration flow looks the same for the three methods:

Users can register as offramper or onramper. It can set up the paypal provider now or do it later. Later it will be able to change or add providers, and also pair an ethereum or a principal address (independently of the method used for authentication) to be able to create (offramper) or buy (onramper) orders for those blockchains.
Post-Registration Flow:
Once the user is successfully registered, they are taken back to the respective authentication flow:
- For Internet Identity users, the authentication is completed using their ICP principal.
- Metamask users need to sign the nonce after registration to complete authentication.