Skip to main content

Storage SDK

In this tutorial you will learn how to integrate your dApp with Arcana Storage SDK. You need to perform this integration for enabling dApp users to store, retrieve, share, revoke access or change ownership of their file data in a secure and privacy preserving manner.

Prerequisites

  • Make sure you can access Arcana Developer Dashboard:

    https://dashboard.beta.arcana.network

  • Configure your dApp and save the appID generated by the dashboard. This appID is required to initialize the Storage SDK.

  • You need to have an authenticated, logged in user before any Storage SDK functionality can be used through the dApp. Each file access, upload or other storage actions can be performed only by an authenticated user that is either a file owner or has been granted access to file data. It is recommended that you integrate with Arcana Auth SDK and use one of the supported authentication mechanisms to authenticate dApp users and obtain an Ethereum provider. This is a prerequisite for enabling dApp user to sign file storage transactions. Each authenticated user is associated with a secure key that is never exposed but accessible via the standard Ethereum provider interface via the wallet. You can also use a third party wallet instead of Arcana Auth SDK. The Ethereum provider obtained through the wallet is used to initialize Storage SDK.

Steps

At a high level, there are three key steps to integrate with the Storage SDK. You need to install the SDK, initialize a StorageProvider and obtain file storage access before you can perform any operations on Arcana Store.

Step 1: Install Arcana Storage SDK

You can use npm or yarn to install the Storage SDK. Refer to Storage SDK Quick Start Guide for detailed instructions.

Step 2: Initialize StorageProvider

After successfully installing the Storage SDK, initialize the StorageProvider as shown below:

import { StorageProvider } from '@arcana/storage/dist/standalone/storage.umd';

dAppStorageProvider = new StorageProvider({
appId: ARCANA_APP_ID,
provider: window.ethereum,
email: user_email_string,
});

Make sure you replace ARCANA_APP_ID with the appID that you saved earlier while configuring your dApp using the Arcana Developer Dashboard.

The parameter provider refers to the unique Ethereum provider for the currently logged dApp user. If the dApp is integrated with Arcana Auth, the window.etherem value is automatically set to the corresponding Ethereum provider for the current logged in user. In case of third party wallet, the user must be logged into the wallet to ensure window.ethereum is correctly set and available in order to successfully initialize the Storage SDK.

Refer to the sample integration code on GitHub:

This StorageProvider can be used to perform the following storage operations:

  • Upload file to Arcana store
  • Download file from Arcana Store
  • Get Arcana Store usage statistics for the current logged in user such as the list of files shared with the user, list of files uploaded to Arcana Store by the user and storage usage metrics

Step 3: Obtain file storage access

You can perform the certain storage operations only after you obtain access to file storage via StorageProvider as listed below:

const Access = new dAppStorageProvider.getAccess();

You can use file storage Access to perform the following operations:

tip

Check out code samples and tutorial to integrate your dApp with Arcana Network SDKs and enable social, passwordless authentication in a dApp and store, access dApp user data in a secure and privacy preserving manner.

What's Next?

You can integrate with Arcana Auth SDK to ensure the privacy of your data by encrypting data before uploading and decrypt data after download and to better manage user blockchain signing experience for Arcana Store storage access operations.

See also