Getting Started
Overview
Prerequisites
Before getting started, ensure that you have the following installed on your system:
- Node.js version 18 or higher
- NPM (Node.js package manager)
Installation
sh
npm install @iexec/dataprotectorsh
yarn add @iexec/dataprotectorsh
pnpm add @iexec/dataprotectorsh
bun add @iexec/dataprotectorThis package is an ESM package. Your project needs to use ESM too. Read more
If you use it with Webpack, some polyfills will be needed. You can find a minimal working project here.
Instantiate SDK
ts
import { IExecDataProtectorCore } from '@iexec/dataprotector';
const web3Provider = window.ethereum;
// Instantiate only the Core module
const dataProtectorCore = new IExecDataProtectorCore(web3Provider);ts
import { IExecDataProtectorCore, getWeb3Provider } from '@iexec/dataprotector';
// Get Web3 provider from a private key
const web3Provider = getWeb3Provider('YOUR_PRIVATE_KEY', 'RPC_URL');
// Instantiate the Core module
const dataProtectorCore = new IExecDataProtectorCore(web3Provider);Instantiate Without a Web3 Provider
For projects that only require read functions, you can instantiate the SDK without a Web3 provider.
ts
import { IExecDataProtectorCore } from '@iexec/dataprotector';
// Instantiate only the Core module for read-only core methods
const dataProtectorCore = new IExecDataProtectorCore('RPC_URL');ts
import { IExecDataProtector } from '@iexec/dataprotector';
// Instantiate using the umbrella module for read-only functions
const dataProtector = new IExecDataProtector('RPC_URL');
// Access to read-only core methods
const dataProtectorCore = dataProtector.core;Advanced Configuration
To add optional parameters, see advanced configuration.
Sandbox
DataProtector Core
InteractiveEssential data protection features including encryption, access control, and secure storage.
