Skip to content

snowball-tools/showcase.in-app-wallets

Repository files navigation

Example: Snowball In-App Wallets

This example shows how to easily create in-app wallets using Snowball SDK.

See How it Works for a full explanation of the code.

In short, it allows you to create and manage your own in-app wallets

In-App Wallets vs 3rd Party Wallets

Getting started

Make sure you have node installed locally; we recommend using Node v18+.

npm install
cp .env.local.example .env.local
# Then fill out the values in .env.local

To obtain an API key:

  • Sign up for an account at snowball.build
  • Create a new project
  • Open your new project and copy its API key

How it Works

  1. The app starts off by initializing a Snowball instance.
    • This is the primary handle you will use to manage in-app wallets throughout your app's auth process.
  2. [React-specific] A useSnowball hook is defined for React components to import.
    • This is a generic snippet you can copy/paste into your own projects.
  3. The page component imports and calls useSnowball(), grabbing a reference to passkey auth.

Once you have a Snowball instance, you can start managing user accounts / wallets:

  1. If a user already has an account, just call login() and you're done!
  2. If not, accounts are created via calling sendOtp() on a user's email address, and verifyOtp() on the code they enter.
  3. After a user verifies their OTP, just call createPasskey() to prompt the user to create a new passkey for your app.

Creating a passkey not only secures your user's account, it also creates a new non-custodial wallet you can start using!

Specifically:

Development

npm run dev

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published