User Sign-in and registration

Singularity Wallet allows users to sign-in and onboard to your app by linking their existing blockchain wallet or by creating a new blockcain wallet using an auth method of your choice. Learn more about our wallet offerings here.

First, follow steps 1, 2 and 3 from the SDK setup and initialization section to setup your Singularity account and initialize the Singularity SDK inside your app.

Important: Make sure you configure the chain(s) that you want new users to create wallets on, and also configure the social login methods you want to allow your users to use and the external wallets you want to allow users to connect with.

Now, you have 2 ways in which you can create Wallet accounts.

  1. Singularity Auth: Use the Singularity drawer to on-board users using one of the SSO authentication methods that you have configured in your Singularity account.

  2. Custom Auth: Create your own authentication flow and UI, and use Singularity APIs to silently create wallets for the user in the background.

Singularity Auth

To onboard a new users or re-signin a returning user, simply open the Singularity Drawer by using the

window.SingularityEvent.open()

api call, which will open the Singularity drawer and allow the user to login using one of your chosen options. Once the user has successfully logged in, you will get all user details by calling the getConnectUserInfo API or subscribing to the SingularityEvent-login callbacks mentioned here.

Custom Auth

Singularity's Custom Auth solution allows you to sign in users on your own app's UI and silently create non-custodial wallets for them through our hidden APIs. This is a completely whitelabled solution where the user can sign into your app using any login method you desire and you can call our SDK's API to simultaneously create a wallet on the specified chain for that user. You can allow the user to open the Singularity Drawer at any time if you like or keep it hidden, depending on your app's design.

Note, for a single project, you can either choose to use Singularity using your own custom auth and UI or by using the Singularity Drawer modal. We cannot support both options in the same project.

Important: Please reach out to us first to setup the custom auth feature so that we can guide you through the setup and ensure it works well end to end and is secure.

To create a new Singularity wallet for your signed-in user, or to restore an returning user's wallet, simply get the user ID token and Auth token and call the following Singularity API:

window.SingularityEvent.customAuth('FIREBASE', { idToken: idToken, accessToken: accessToken });

The exact parameters to be passed would depend on the type of auth you are using, hence please reach out to us to correctly setup this feature.

Sample Implementation

For Singularity Auth: https://github.com/coinbrix/demo-app/

For Custom Auth: https://github.com/coinbrix/firebase-custom-auth-demo

Last updated