Creating Users & Wallets

Creating a New User and Wallet

Setting up a new User and Wallet in Capsule involves the following steps:

  • User Creation

  • Email Verification

  • Key creation for session authentication

  • Wallet Creation

  • Sending a backup share to the user's email (or storing it in a reliable and user-accessible location outside the app)

  • (Optional) Setup & enable two-factor authentication

Here are reference code snippets to help you accomplish these steps.

You will need to call capsule.init() after instantiating the Mobile SDK. This is due to differences in how mobile and browser storage work.

For testing convenience, emails under the domain test.usecapsule.com will accept any verification code. This feature is not designed for production use.

// With the Modal, User and Wallet Creation are handled automatically!
import Capsule, {
  Environment,
  CapsuleModal,
} from '@usecapsule/react-sdk';

const capsule = new Capsule(
  Environment.BETA,
  YOUR_API_KEY
);

const [isOpen, setIsOpen] = useState(false)

// React Component
<CapsuleModal capsule={capsule} onClose={() => {setIsOpen(false)}} />

Congrats! Your user and wallet is now set up and ready to use.

NOTE: The storage settings in mobile can be overridden to accommodate different data management setups, per developer preferences. See this section if this is of interest.

However, this flexibility also comes with a high level of responsibility and an increased complexity of integration. If you're unsure about any aspect of this functionality, we strongly recommend you contact us directly for further discussion and assistance.

Last updated