Skip to content

Getting Started

GitHub package.json version (branch)

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/dataprotector
sh
yarn add @iexec/dataprotector
sh
pnpm add @iexec/dataprotector
sh
bun add @iexec/dataprotector

This 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

Interactive

Essential data protection features including encryption, access control, and secure storage.