Skip to main content

Change File Owner

In this tutorial you will learn how to use Arcana Storage SDK and change the file owner for a file previously uploaded by the current user to the Arcana Store.

Prerequisites

  • Make sure your dApp is integrated with Arcana Storage SDK.
  • You need to have access to the target user's wallet address for authenticating and transferring file ownership
  • The DID of the file is required in order to transfer its ownership and identify it uniquely on the Arcana Store
  • The code in the steps section below refers to StorageProvider and Access objects initialized during Storage SDK integration:
import { StorageProvider } from '@arcana/storage/dist/standalone/storage.umd';

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

const Access = new dAppStorageProvider.getAccess();

Changing a file owner

// address: new owner's address
// did: file identifier returned during file upload
Access.changeFileOwner(did, address);

You can verify that the file ownership has changed by either trying to download the file or listing the files that are uploaded by you on Arcana Store. If the file is shared, it will show up in the list of files shared with the dApp user. Refer to storage metrics guide for details.

What's Next?

You can also share files or revoke file access using Storage SDK.

If you are using Storage SDK with a third party wallet, you can also consider integrating with Arcana Auth SDK to ensure the privacy of your data by encrypting data before uploading and decrypt data after download.

See also