Tweed's solution does not require platforms to change their login flow or use a dedicated login provider, but instead integrates into the platform's existing login flows. Integrating into the existing flow and creating a wallet does not add extra steps or friction for the user.
The platform then has an optional widget that allows the user to create a “Recovery Kit” (SSO + Password) as a backup to their wallet. If the user does not create the Recovery Kit, they can lose access to the wallet if they clear their browser cache and did not store their seed phrase.
The user does not have to create a Recovery Kit during the sign-up process necessarily, and can instead do it at a later time, whenever the platform allows them to.
When a logged-in user (to the platform) needs to regain access to their wallet (because they cleared their cache or want to switch devices), they can sign in using the Sign-in widget.
When the platform calls the sdk.wallet.create() function, Tweed will identify that the user is known to the platform and the Sign-in widget will automatically open.
If the user created a recovery kit, the dedicated social sign-in modals will appear. If they did not, they will be able to sign in with their seed phrase.
After the user is logged in to the platform, the platform should check if this user already has an account with Tweed by calling sdk.wallet.exist()if not, the platform should create an account for the user by calling sdk.wallet.create().
The platform can call sdk.wallet.createRecovery() right after the wallet creation or let the user create the recovery kit on his own discression.
If the recovery kit is to created on a later stage the platform should validate its existence by using sdk.wallet.getRecoveryStatus().
If the platform chose not to give the users a recovery kit they might want to allow them to see the mnemonic phrase using sdk.wallet.showMnemonics().
When creating an account for the user, the platform should supply two parameters: userId and userWallet to identify the user.