Skip to main content

Use Case Example

How does a typical dApp integrate and use Arcana SDKs?

There are a few easy steps and minimal code that you need to follow. Here is an example use case.

Example

This example demonstrates a dApp use case where the developer needs to enable passwordless login for onboarding dApp users. Once authenticated, the users must have complete ownership of their data with full data privacy. Any user data that is stored and accessed via this dApp must be access controlled.

Use Case Specifics

  • Enable dApp user onboarding via passwordless login.
  • Allow dApp users to store any data file of their choice in the distributed Arcana Store and retrieve it later with full data privacy.

Steps

For the use case listed above, here is how developers can easily integrate and call Arcana SDK functions. Follow these two simple steps:

Step 1: Configure dApp

First, register and configure your dApp using the Arcana Developer Dashboard:

As part of registration, each dApp is assigned a unique appID.

While configuring your dApp using the dashboard, make sure you select the passwordless login option as shown in the figure: Dashboard Configure dApp Passwordless

Step 2: Integrate Auth, Storage SDKs

Step 2a: Integrate with Arcana Auth SDK

After dApp configuration, follow the instructions on how to integrate your dApp with Auth SDK

Once the Auth SDK is integrated and initialized, you can trigger social login through your dApp as shown in the passwordless login step later.

Step 2b: Integrate with Arcana Storage SDK

After integrating with the Auth SDK, follow the instructions on how to integrate with Storage SDK

Once the Storage SDK is integrated and initialized, you can call file data store and retrieve functions through your dApp as shown in the following steps.

Step 2c: Trigger passwordless login

After your dApp is successfully integrated with the Auth SDK, you can plug in passwordless login functionality. Make sure you check that a user is not already logged in before triggering a fresh login.

  const loginStatus = await wallet.isLoggedIn();
if (!loginStatus){
const promise = await wallet.requestPasswordlessLogin(`${email}`)
}

Here, the email is the string specified by the dApp user through the dApp user interfaces. A one time magic link is emailed to the user. User is authenticated once they successfully receive this email and choose to click on the magic link shared via email. For more details, see how to enable passwordless login in dApp using Auth SDK.

Step 2d: Store File/Retrieve File

Once the Storage SDK is integrated and initialized, you can invoke file access operations from the SDK in response to user actions such as upload, download a file etc. The example could below shows how to integrate file upload and download from the Arcana Store.

const Uploader = await dAppStorageProvider.getUploader();
// file: Blob format
const fileID = Uploader.upload(file);
const Downloader = await dAppStorageProvider.getDownloader();
Downloader.download(fileID);

Refer to these How To guides for more details: how to upload a file using Storage SDK and how to download a file using Storage SDK.

tip

Check out code samples and templates section of this documentation. You will find ready to use code.

Simply copy, paste and modify for quickly integrating your dApp with Arcana Network SDKs.

Arcana Network SDKs make it super easy to enable social authentication, passwordless login for your dApps. The dApp users can store, access their data in a secure and privacy preserving manner.

See Also