Skip to content

Commit 1a4107b

Browse files
committed
feat: Update documentation and guides for DataProtector
- Adjusted outline levels in VitePress configuration for better navigation. - Removed outdated 'Guides' link from sidebar. - Enhanced README with additional instructions and a TODO section for future improvements. - Updated package-lock.json and package.json to reflect new project name and version. - Refined index.md to correct links and improve clarity. - Enhanced grantAccess.md with clearer instructions and additional notes on access management. - Expanded getting-started.md with detailed installation steps and SDK usage examples. - Deleted obsolete guides.md file and integrated relevant content into manage-data/guides.md. - Revamped manage-data/guides.md to provide a comprehensive overview of DataProtector guides and structured navigation. - Created detailed create-and-share-access.md guide with installation, data protection, and access granting instructions. - Developed handle-schemas-dataset-types.md to explain schema functionality and its importance in DataProtector. - Expanded manage-data-monetization.md to cover monetization strategies, including pay-per-use and DataProtector Sharing models.
1 parent eaecd19 commit 1a4107b

File tree

13 files changed

+1044
-107
lines changed

13 files changed

+1044
-107
lines changed

.vitepress/config.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export default defineConfig({
9191
{ text: 'Core Concept', link: '/core-concept/glossary' },
9292
],
9393
outline: {
94-
level: [2, 3],
94+
level: [2, 4],
9595
},
9696

9797
sidebar: getSidebar(),

.vitepress/sidebar.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,6 @@ export function getSidebar() {
9090
text: 'Getting Started',
9191
link: '/manage-data/dataProtector/getting-started',
9292
},
93-
{
94-
text: 'Guides',
95-
link: '/manage-data/dataProtector/guides',
96-
},
9793
{
9894
text: 'DataProtector Core',
9995
link: '/manage-data/dataProtector/dataProtectorCore',

README.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ Fork this repository and ensure you're working on the `main` branch:
9797
```
9898

9999
3. Start the development server:
100+
100101
```bash
101102
npm run dev
102103
```
@@ -138,14 +139,18 @@ Fork this repository and ensure you're working on the `main` branch:
138139
> - All pull requests are reviewed by our team before being merged
139140
> - Feel free to ask questions in the pull request if you need clarification
140141
141-
## 📄 License
142-
143-
This project is part of the iExec ecosystem. Please refer to the main iExec
144-
repositories for licensing information.
145-
146142
## 🆘 Support
147143

148144
- 📖 [Documentation](https://docs.iex.ec)
149145
- 💬 [Discord Community](https://discord.com/invite/pbt9m98wnU)
150146
- 🐛
151147
[Issue Tracker](https://github.com/iExecBlockchainComputing/documentation/issues)
148+
149+
## TODO
150+
151+
- Add Arbitrum support
152+
- Adapt hardcoded address to feat with new contracts deployed on arbitrum
153+
- complete `use-iapp` section
154+
- complete `explorer` section
155+
- complete `build-iapp` section
156+
- complete `deep-dive`section

package-lock.json

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"dev": "vitepress dev",
66
"build": "vitepress build",
77
"preview": "vitepress preview",
8-
"check-format": "prettier --ignore-path .gitignore --check .",
98
"format": "prettier --ignore-path .gitignore --write ."
109
},
1110
"dependencies": {

src/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ features:
2525
details:
2626
Secure your data with advanced encryption and control access while
2727
maintaining privacy using DataProtector
28-
link: /manage-data/dataProtector/what-is-protected-data
28+
link: /manage-data/what-is-protected-data
2929
- icon: 🤖
3030
title: Build iApps
3131
details:

src/manage-data/dataProtector/dataProtectorCore/grantAccess.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ import { type GrantAccessParams } from '@iexec/dataprotector';
4444

4545
**Type:** `AddressOrENS`
4646

47-
The ethereum address of the protected data supplied by the user.
47+
The ethereum address of the protected data supplied by the user (returned when
48+
you created it). **You must own this data** to grant access.
4849

4950
```ts twoslash
5051
import { IExecDataProtectorCore, getWeb3Provider } from '@iexec/dataprotector';
@@ -68,9 +69,9 @@ The address of the application you wish to authorize to process the
6869
single application or an application whitelist. To specify a whitelist, you
6970
provide the ETH address of an
7071
[iExec Whitelist Smart Contract](https://github.com/iExecBlockchainComputing/whitelist-smart-contract/tree/main).
71-
This smart contract aggregates multiple application versions. This allows you to
72-
introduce new versions of your application without needing to grant access for
73-
the `protectedData` each time you do so.
72+
This smart contract should aggregates multiple application versions. This allows
73+
you to introduce new versions of your application without needing to grant
74+
access for the `protectedData` each time you do so.
7475

7576
```ts twoslash
7677
import { IExecDataProtectorCore, getWeb3Provider } from '@iexec/dataprotector';
@@ -180,12 +181,14 @@ used.
180181
It is not technically possible to set an unlimited number of accesses, but you
181182
can set `numberOfAccess` to `10000` for example.
182183

183-
::: info Important Notes: If you attempt to process the protected data more
184-
times than specified in `numberOfAccess`, you will encounter a **"no dataset
185-
orders"** error.
184+
::: info
185+
186+
If you attempt to process the protected data more times than specified in
187+
`numberOfAccess`, you will encounter a **"no dataset orders"** error.
186188

187189
To prevent this error, ensure the `numberOfAccess` is properly set when calling
188-
the `grantAccess` method.
190+
the `grantAccess` method.
191+
189192
:::
190193

191194
```ts twoslash
Lines changed: 234 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,241 @@
11
---
22
title: Getting Started
3-
description: DataProtector getting started guide
3+
description: DataProtector getting started
44
---
55

66
# Getting Started
77

8-
This page is under development.
8+
[![GitHub package.json version (branch)](https://img.shields.io/badge/npm-2.0.0--beta-green)](https://www.npmjs.com/package/@iexec/dataprotector)
99

10-
<!-- TODO: Add the getting started guide -->
10+
## Overview
11+
12+
### Prerequisites
13+
14+
Before getting started, ensure that you have the following installed on your
15+
system:
16+
17+
\- [**Node.js**](https://nodejs.org/en/) version 18 or higher
18+
19+
\- [**NPM**](https://docs.npmjs.com/) (Node.js package manager)
20+
21+
### Installation
22+
23+
::: code-group
24+
25+
```sh [npm]
26+
npm install @iexec/dataprotector
27+
```
28+
29+
```sh [yarn]
30+
yarn add @iexec/dataprotector
31+
```
32+
33+
```sh [pnpm]
34+
pnpm add @iexec/dataprotector
35+
```
36+
37+
```sh [bun]
38+
bun add @iexec/dataprotector
39+
```
40+
41+
:::
42+
43+
**This package is an ESM package. Your project needs to use ESM too.**
44+
&nbsp;[**Read more**](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c)
45+
46+
If you use it with **Webpack**, some polyfills will be needed. You can find a
47+
minimal working project
48+
[here](https://github.com/iExecBlockchainComputing/dataprotector-sdk/tree/115b797cf62dcff0f41e2ba783405d5083d78922/packages/demo/browser-webpack).
49+
50+
### Instantiate SDK
51+
52+
Depending on your project's requirements, you can instantiate the SDK using the
53+
umbrella module for full functionality or opt for one of the submodules to
54+
access specific sets of features.
55+
56+
#### Instantiate using the umbrella module
57+
58+
For projects requiring the full functionality of the SDK, including both core
59+
and sharing functions.
60+
61+
::: code-group
62+
63+
```ts twoslash [Browser]
64+
declare global {
65+
interface Window {
66+
ethereum: any;
67+
}
68+
}
69+
// ---cut---
70+
import { IExecDataProtector } from '@iexec/dataprotector';
71+
72+
const web3Provider = window.ethereum;
73+
// Instantiate using the umbrella module for full functionality
74+
const dataProtector = new IExecDataProtector(web3Provider);
75+
76+
const dataProtectorCore = dataProtector.core;
77+
const dataProtectorSharing = dataProtector.sharing;
78+
```
79+
80+
```ts twoslash [NodeJS]
81+
import { IExecDataProtector, getWeb3Provider } from '@iexec/dataprotector';
82+
83+
// Get Web3 provider from a private key
84+
const web3Provider = getWeb3Provider('YOUR_PRIVATE_KEY');
85+
86+
// Instantiate using the umbrella module for full functionality
87+
const dataProtector = new IExecDataProtector(web3Provider);
88+
89+
const dataProtectorCore = dataProtector.core; // access to core methods
90+
const dataProtectorSharing = dataProtector.sharing; // access to methods
91+
```
92+
93+
:::
94+
95+
#### Instantiate only the `core` module
96+
97+
For projects focusing solely on core data protection functions.
98+
99+
::: code-group
100+
101+
```ts twoslash [Browser]
102+
declare global {
103+
interface Window {
104+
ethereum: any;
105+
}
106+
}
107+
// ---cut---
108+
import { IExecDataProtectorCore } from '@iexec/dataprotector';
109+
110+
const web3Provider = window.ethereum;
111+
// Instantiate only the Core module
112+
const dataProtectorCore = new IExecDataProtectorCore(web3Provider);
113+
```
114+
115+
```ts twoslash [NodeJS]
116+
import { IExecDataProtectorCore, getWeb3Provider } from '@iexec/dataprotector';
117+
118+
// Get Web3 provider from a private key
119+
const web3Provider = getWeb3Provider('YOUR_PRIVATE_KEY');
120+
121+
// Instantiate only the Core module
122+
const dataProtectorCore = new IExecDataProtectorCore(web3Provider);
123+
```
124+
125+
:::
126+
127+
#### Instantiate only the `sharing` module
128+
129+
For projects that need access management functions specifically.
130+
131+
::: code-group
132+
133+
```ts twoslash [Browser]
134+
declare global {
135+
interface Window {
136+
ethereum: any;
137+
}
138+
}
139+
// ---cut---
140+
import { IExecDataProtectorSharing } from '@iexec/dataprotector';
141+
142+
const web3Provider = window.ethereum;
143+
// Instantiate only the Sharing module
144+
const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider);
145+
```
146+
147+
```ts twoslash [NodeJS]
148+
import {
149+
IExecDataProtectorSharing,
150+
getWeb3Provider,
151+
} from '@iexec/dataprotector';
152+
153+
// Get Web3 provider from a private key
154+
const web3Provider = getWeb3Provider('YOUR_PRIVATE_KEY');
155+
156+
// Instantiate only the Sharing module
157+
const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider);
158+
```
159+
160+
:::
161+
162+
#### Instantiate without a Web3 provider
163+
164+
For projects that only require read functions, you can instantiate the SDK
165+
without a Web3 provider.
166+
167+
::: code-group
168+
169+
```ts twoslash [Singleton Modules]
170+
import {
171+
IExecDataProtectorSharing,
172+
IExecDataProtectorCore,
173+
} from '@iexec/dataprotector';
174+
175+
// Instantiate only the Core module for read-only core methods
176+
const dataProtectorCore = new IExecDataProtectorCore();
177+
// Instantiate only the Sharing module for read-only sharing methods
178+
const dataProtectorSharing = new IExecDataProtectorSharing();
179+
```
180+
181+
```ts twoslash [Umbrella Module]
182+
import { IExecDataProtector } from '@iexec/dataprotector';
183+
184+
// Instantiate using the umbrella module for read-only functions
185+
const dataProtector = new IExecDataProtector();
186+
187+
// Access to read-only core methods
188+
const dataProtectorCore = dataProtector.core;
189+
// Access to read-only sharing methods
190+
const dataProtectorSharing = dataProtector.sharing;
191+
```
192+
193+
:::
194+
195+
#### Advanced configuration
196+
197+
To add optional parameters, see
198+
[advanced configuration](./advanced/advanced-configuration.md).
199+
200+
::: info
201+
202+
🧪 While protected data are processed in **TEE** by **intel SGX** technology by
203+
default, `@iexec/dataprotector` can be configured to create and process
204+
protected data in the experimental **intel TDX** environment.
205+
206+
For more details see:
207+
208+
- [configure DataProtector TDX](./advanced/advanced-configuration.md#iexecoptions)
209+
- [create TDX protected data](./dataProtectorCore/protectData.md#usage)
210+
- [process TDX protected data](./dataProtectorCore/processProtectedData.md#workerpool)
211+
212+
⚠️ Keep in mind: TDX mode is experimental and can be subject to instabilities or
213+
discontinuity.
214+
215+
:::
216+
217+
## Sandbox
218+
219+
### Core methods
220+
221+
<a href="https://codesandbox.io/p/github/iExecBlockchainComputing/dataprotector-sandbox/main" target="_blank" rel="noreferrer" class="link-as-block" style="margin-top: 16px">
222+
&nbsp;Code Sandbox
223+
</a>
224+
225+
Corresponding GitHub repository:
226+
227+
<a href="https://github.com/iExecBlockchainComputing/dataprotector-sandbox" target="_blank" rel="noreferrer" class="link-as-block">
228+
🔎 &nbsp;GitHub repository sandbox
229+
</a>
230+
231+
### Sharing methods
232+
233+
<a href="https://codesandbox.io/p/github/iExecBlockchainComputing/dataprotector-sharing-sandbox/main" target="_blank" rel="noreferrer" class="link-as-block" style="margin-top: 16px">
234+
&nbsp;Code Sandbox
235+
</a>
236+
237+
Corresponding GitHub repository:
238+
239+
<a href="https://github.com/iExecBlockchainComputing/dataprotector-sharing-sandbox" target="_blank" rel="noreferrer" class="link-as-block">
240+
🔎 &nbsp;GitHub repository sandbox
241+
</a>

src/manage-data/dataProtector/guides.md

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)