diff --git a/.vitepress/sidebar.ts b/.vitepress/sidebar.ts index f5f3deb6..2033d5d3 100644 --- a/.vitepress/sidebar.ts +++ b/.vitepress/sidebar.ts @@ -215,187 +215,50 @@ export function getSidebar() { { text: '🔐 DataProtector', link: '/references/dataProtector', - collapsed: true, items: [ { text: 'Getting Started', link: '/references/dataProtector/getting-started', }, { - text: 'DataProtector Core', - link: '/references/dataProtector/dataProtectorCore', + text: 'Methods', collapsed: true, items: [ { text: 'protectData', - link: '/references/dataProtector/dataProtectorCore/protectData', + link: '/references/dataProtector/methods/protectData', }, { text: 'getProtectedData', - link: '/references/dataProtector/dataProtectorCore/getProtectedData', + link: '/references/dataProtector/methods/getProtectedData', }, { text: 'transferOwnership', - link: '/references/dataProtector/dataProtectorCore/transferOwnership', + link: '/references/dataProtector/methods/transferOwnership', }, { text: 'grantAccess', - link: '/references/dataProtector/dataProtectorCore/grantAccess', + link: '/references/dataProtector/methods/grantAccess', }, { text: 'getGrantedAccess', - link: '/references/dataProtector/dataProtectorCore/getGrantedAccess', + link: '/references/dataProtector/methods/getGrantedAccess', }, { text: 'revokeOneAccess', - link: '/references/dataProtector/dataProtectorCore/revokeOneAccess', + link: '/references/dataProtector/methods/revokeOneAccess', }, { text: 'revokeAllAccess', - link: '/references/dataProtector/dataProtectorCore/revokeAllAccess', + link: '/references/dataProtector/methods/revokeAllAccess', }, { text: 'processProtectedData', - link: '/references/dataProtector/dataProtectorCore/processProtectedData', + link: '/references/dataProtector/methods/processProtectedData', }, { text: 'getResultFromCompletedTask', - link: '/references/dataProtector/dataProtectorCore/getResultFromCompletedTask', - }, - ], - }, - { - text: 'DataProtector Sharing', - link: '/references/dataProtector/dataProtectorSharing', - collapsed: true, - items: [ - { - text: 'Collection', - link: '/references/dataProtector/dataProtectorSharing/collection', - collapsed: true, - items: [ - { - text: 'createCollection', - link: '/references/dataProtector/dataProtectorSharing/collection/createCollection', - }, - { - text: 'removeCollection', - link: '/references/dataProtector/dataProtectorSharing/collection/removeCollection', - }, - { - text: 'addToCollection', - link: '/references/dataProtector/dataProtectorSharing/collection/addToCollection', - }, - { - text: 'removeProtectedDataFromCollection', - link: '/references/dataProtector/dataProtectorSharing/collection/removeProtectedDataFromCollection', - }, - ], - }, - { - text: 'Renting', - link: '/references/dataProtector/dataProtectorSharing/renting', - collapsed: true, - items: [ - { - text: 'setProtectedDataToRenting', - link: '/references/dataProtector/dataProtectorSharing/renting/setProtectedDataToRenting', - }, - { - text: 'setProtectedDataRentingParams', - link: '/references/dataProtector/dataProtectorSharing/renting/setProtectedDataRentingParams', - }, - { - text: 'rentProtectedData', - link: '/references/dataProtector/dataProtectorSharing/renting/rentProtectedData', - }, - { - text: 'removeProtectedDataFromRenting', - link: '/references/dataProtector/dataProtectorSharing/renting/removeProtectedDataFromRenting', - }, - ], - }, - { - text: 'Selling', - link: '/references/dataProtector/dataProtectorSharing/selling', - collapsed: true, - items: [ - { - text: 'setProtectedDataForSale', - link: '/references/dataProtector/dataProtectorSharing/selling/setProtectedDataForSale', - }, - { - text: 'buyProtectedData', - link: '/references/dataProtector/dataProtectorSharing/selling/buyProtectedData', - }, - { - text: 'removeProtectedDataForSale', - link: '/references/dataProtector/dataProtectorSharing/selling/removeProtectedDataForSale', - }, - ], - }, - { - text: 'Subscription', - link: '/references/dataProtector/dataProtectorSharing/subscription', - collapsed: true, - items: [ - { - text: 'setProtectedDataToSubscription', - link: '/references/dataProtector/dataProtectorSharing/subscription/setProtectedDataToSubscription', - }, - { - text: 'setSubscriptionParams', - link: '/references/dataProtector/dataProtectorSharing/subscription/setSubscriptionParams', - }, - { - text: 'subscribeToCollection', - link: '/references/dataProtector/dataProtectorSharing/subscription/subscribeToCollection', - }, - { - text: 'removeProtectedDataFromSubscription', - link: '/references/dataProtector/dataProtectorSharing/subscription/removeProtectedDataFromSubscription', - }, - ], - }, - { - text: 'Consume', - collapsed: true, - items: [ - { - text: 'consumeProtectedData', - link: '/references/dataProtector/dataProtectorSharing/consume/consumeProtectedData', - }, - ], - }, - { - text: 'Read Data', - collapsed: true, - items: [ - { - text: 'getProtectedDataInCollections', - link: '/references/dataProtector/dataProtectorSharing/read/getProtectedDataInCollections', - }, - { - text: 'getProtectedDataPricingParams', - link: '/references/dataProtector/dataProtectorSharing/read/getProtectedDataPricingParams', - }, - { - text: 'getCollectionOwners', - link: '/references/dataProtector/dataProtectorSharing/read/getCollectionOwners', - }, - { - text: 'getCollectionsByOwner', - link: '/references/dataProtector/dataProtectorSharing/read/getCollectionsByOwner', - }, - { - text: 'getCollectionSubscriptions', - link: '/references/dataProtector/dataProtectorSharing/read/getCollectionSubscriptions', - }, - { - text: 'getRentals', - link: '/references/dataProtector/dataProtectorSharing/read/getRentals', - }, - ], + link: '/references/dataProtector/methods/getResultFromCompletedTask', }, ], }, @@ -404,33 +267,8 @@ export function getSidebar() { link: '/references/dataProtector/types', }, { - text: 'Advanced', - collapsed: true, - items: [ - { - text: 'Advanced Configuration', - link: '/references/dataProtector/advanced/advanced-configuration', - }, - { - text: 'Apps whitelist', - link: '/references/dataProtector/advanced/apps-whitelist', - collapsed: true, - items: [ - { - text: 'createAddOnlyAppWhitelist', - link: '/references/dataProtector/advanced/apps-whitelist/createAddOnlyAppWhitelist', - }, - { - text: 'addAppToAddOnlyAppWhitelist', - link: '/references/dataProtector/advanced/apps-whitelist/addAppToAddOnlyAppWhitelist', - }, - { - text: 'getUserAddOnlyAppWhitelist', - link: '/references/dataProtector/advanced/apps-whitelist/getUserAddOnlyAppWhitelist', - }, - ], - }, - ], + text: 'Advanced Configuration', + link: '/references/dataProtector/advanced-configuration', }, ], }, diff --git a/src/get-started/helloWorld/3-buildIApp.md b/src/get-started/helloWorld/3-buildIApp.md index 24db293c..11c428d4 100644 --- a/src/get-started/helloWorld/3-buildIApp.md +++ b/src/get-started/helloWorld/3-buildIApp.md @@ -56,12 +56,6 @@ Telegram handles. [Github](https://github.com/iExecBlockchainComputing/web3telegram-sdk/tree/main/dapp) | [Documentation](/references/web3telegram) -### 🌐 Content delivery - -Transfer, sell or rent protected content to authorized users. -[Github](https://github.com/iExecBlockchainComputing/protected-data-delivery-dapp) -| [Documentation](/references/dataProtector/dataProtectorSharing) - ::: tip These are just a few examples, the possibilities are endless. Want to explore diff --git a/src/get-started/helloWorld/4-manageDataAccess.md b/src/get-started/helloWorld/4-manageDataAccess.md index bb5e542a..3f227642 100644 --- a/src/get-started/helloWorld/4-manageDataAccess.md +++ b/src/get-started/helloWorld/4-manageDataAccess.md @@ -112,21 +112,9 @@ users and iApp, and **process it safely**. But here's where it gets even more exciting... **monetization!**. -Our SDK offers flexible **monetization mechanisms**, allowing you to create -**protected data collections** and implement advanced models like -**subscriptions**, **rentals**, or **direct sales**. The choice is yours! - -Want to see it in action? Check out our -[Content Creator Demo](https://demo.iex.ec/content-creator/) where you can: - -- Create and protect your own content -- Set pricing and access rules -- Manage subscriptions and rentals -- Track your earnings - -For more technical details, see the -[DataProtector Sharing](/references/dataProtector/dataProtectorSharing) -documentation. +Our SDK offers flexible **monetization mechanisms**, allowing you to monetize +your protected data. For more technical details, see the guide +[Monetize your Protected Data](/guides/manage-data/monetize-protected-data). diff --git a/src/get-started/overview/iapp.md b/src/get-started/overview/iapp.md deleted file mode 100644 index ef36dc4f..00000000 --- a/src/get-started/overview/iapp.md +++ /dev/null @@ -1,177 +0,0 @@ ---- -title: What is an iApp? -description: - Learn about iExec Applications (iApp) - confidential computing apps that - process sensitive data in secure TEE environments. Build privacy-preserving - AI, data analysis, and Web3 apps. ---- - - - -# What is an iApp? - -An iExec Application (iApp) is an application that runs inside a confidential -environment (TEEs) to process Protected Data (created with DataProtector). - -Your Python scripts, AI models, or data processors can securely process -protected data inside a TEE. - -## Why iApp Matters? - -iApps provide privacy capabilities, allowing you to process sensitive data while -keeping it private and secure. - -Imagine you want to build: - - - -- An AI that analyzes personal health data -- An email tool that needs access to contact lists -- A financial advisor that processes bank statements -- A content filter that reads private messages - - - -Users have this data, but they won't trust your regular app with it. **With -Privacy iApps, they will.** - -**You gain their trust. They gain their privacy. Everyone wins.** - -## Key Concepts - - - -✅ **True Privacy:** Users never expose their raw data. Your app processes it -privately inside secure enclaves. - -✅ **Trusted Execution:** iExec ensures your code runs inside a Trusted -Execution Environment (TEE), guaranteeing only the specified Docker image -executes in a secure, isolated environment. - -✅ **Decentralized Infrastructure:** No single point of failure. Your app runs -across a distributed network of workers. - -✅ **Zero Trust Architecture:** User data is protected by hardware-based TEEs, -keeping data confidential and inaccessible to the host, cloud provider, or -operating system during execution. - - - -## How it Works - -Your code runs in a Trusted Execution Environment (TEE). This secure area exists -inside specific processors (Intel Software Guard Extensions (SGX) or Trust -Domain Extensions (TDX) chipsets). Everything stays private and protected there, -even from the operating system. - -Authorized users trigger an iApp that processes protected data inside this -private environment. Your iApp uses the data but never exposes it, not even to -you. - - - -1. User provides private data -2. Data is protected with DataProtector -3. You build and deploy a confidential iApp that processes protected data -4. Run the iApp with the corresponding protected data, performing confidential - computing - - - -Your iApp can send emails, update contracts, make transactions, trigger -notifications - anything your code needs. This isn't about trust. We provide -**cryptographic and hardware-enforced guarantees** that preserve privacy within -the TEE execution environment. - -## Use Cases - - - - -### Healthcare - -Process medical data for AI diagnosis without exposing patient information - - - - - -### Finance - -Analyze financial data for credit scoring while maintaining privacy - - - - - -### Media - -Content recommendation engines that don't track user behavior - - - - - -### Research - -Collaborative research on sensitive datasets across institutions - - - - - -## Getting Started - - - -## Time to build - -Let's build an iApp that can process protected data in a secure environment -using the [iExec iApp generator tool](/references/iapp-generator). This tool -helps you create, test and deploy iApps with just a few commands. - - - -### Quick Start Path - -1. **Protect your data** with [DataProtector](/references/dataProtector) -2. **Build your iApp** using the [iApp Generator](/references/iapp-generator) -3. **Deploy and test** your application -4. **Process protected data** securely - -### What You'll Learn - -- How to create a Docker container for your application -- How to handle inputs and outputs securely -- How to deploy to the iExec network -- How to process protected data in TEE environments - -::: tip - -These are just a few examples, the possibilities are endless. Want to explore -iApp Generator? Check out our [documentation](/references/iapp-generator) and -see what you can build! - -::: - -## Technical Requirements - -- **Docker**: Your application must be containerized -- **Input/Output**: Define clear input and output schemas -- **TEE Compatibility**: Ensure your code runs in secure enclaves -- **Network Access**: Configure any external API calls or dependencies - -## Next Steps - -Ready to build your first privacy-preserving application? Start with our -[Hello World tutorial](/get-started/helloWorld) or dive into the -[iApp Generator documentation](/references/iapp-generator). - -For more technical details, see the -[DataProtector Sharing](/references/dataProtector/dataProtectorSharing) -documentation. diff --git a/src/get-started/overview/privacy-iapp.md b/src/get-started/overview/privacy-iapp.md index 885d61cc..ceedfedf 100644 --- a/src/get-started/overview/privacy-iapp.md +++ b/src/get-started/overview/privacy-iapp.md @@ -171,7 +171,3 @@ see what you can build! Ready to build your first privacy-preserving application? Start with our [Hello World tutorial](/get-started/helloWorld) or dive into the [iApp Generator documentation](/references/iapp-generator). - -For more technical details, see the -[DataProtector Sharing](/references/dataProtector/dataProtectorSharing) -documentation. diff --git a/src/get-started/quick-start.md b/src/get-started/quick-start.md index 29eb8f29..9a818aff 100644 --- a/src/get-started/quick-start.md +++ b/src/get-started/quick-start.md @@ -70,16 +70,6 @@ learning and prototyping. buttonHref="https://codesandbox.io/p/github/iExecBlockchainComputing/dataprotector-sandbox/main" /> - - - - @@ -19,16 +19,6 @@ and **record ownership on a smart contract**, ensuring confidentiality and traceability. Granting access to authorized applications is streamlined, facilitating secure data management. -## DataProtector Sharing - -Building upon DataProtector Core, DataProtector Sharing introduces **advanced -features for data sharing** and ownership transfer. Users can securely transfer -ownership of protected data, enabling collaboration and potential **monetization -opportunities**. This module empowers users to share and manage their data -securely, fostering innovation and collaboration in the digital realm. - -## Which One to Use? - With `DataProtector Core`, you can **grant access** to your protected data **to a specific user**. @@ -37,12 +27,3 @@ a specific user**. protected data. - You'll have to sign a transaction at the moment you grant access to the user and the iApp (iExec TEE Dapp). - -With `DataProtector Sharing`, you can **distribute** your protected data to **a -wider audience**. - -- You don't need to know the user's Ethereum address. -- You define a period of time and a price for which the user can access the - data. -- Any user can access your content as long as they comply with your distribution - and monetization choices. diff --git a/src/references/dataProtector/advanced/advanced-configuration.md b/src/references/dataProtector/advanced-configuration.md similarity index 89% rename from src/references/dataProtector/advanced/advanced-configuration.md rename to src/references/dataProtector/advanced-configuration.md index 780fc0e9..5e46bc91 100644 --- a/src/references/dataProtector/advanced/advanced-configuration.md +++ b/src/references/dataProtector/advanced-configuration.md @@ -41,24 +41,6 @@ const dataProtector = new IExecDataProtector(web3Provider, { }); ``` -### sharingContractAddress - -`AddressOrENS` - -The Ethereum contract address or ENS (Ethereum Name Service) for dataProtector -sharing smart contract. If not provided, the default dataProtector sharing -contract address will be used. - -```ts twoslash -import { IExecDataProtector, getWeb3Provider } from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -// ---cut--- -const dataProtector = new IExecDataProtector(web3Provider, { - sharingContractAddress: '0x123abc...', // [!code focus] -}); -``` - ### subgraphUrl `string` diff --git a/src/references/dataProtector/advanced/apps-whitelist.md b/src/references/dataProtector/advanced/apps-whitelist.md deleted file mode 100644 index 63fda766..00000000 --- a/src/references/dataProtector/advanced/apps-whitelist.md +++ /dev/null @@ -1,81 +0,0 @@ ---- -title: Apps Whitelist -description: - Understand the Apps Whitelist mechanism for consuming protected data in the - iExec DataProtector Sharing module. Learn about the Trusted Execution - Environment (TEE) iApp and whitelist usage for secure data delivery. ---- - -# Apps whitelist - -In order to consume a protected data, an iExec TEE iApp needs to be provided. - -::: tip - -**TEE** stands for Trusted Execution Environment. Find more details -[in the TEE introduction guide](/protocol/tee/introduction) - -::: - -The story goes as follow: - -1. The collection owner adds a protected data to a collection. When doing so, - they need to set an `addOnlyAppWhitelist` parameter (see - [in the addToCollection documentation](/references/dataProtector/dataProtectorSharing/collection/addToCollection#addonlyappwhitelist)). - This parameter is the address of a whitelist smart contract that contains - applications allowed to consume the protected data. - -2. When a user wants to consume the protected data, they need to provide the - address of the application they want to use to consume the data (See - [consumeProtectedData](/references/dataProtector/dataProtectorSharing/consume/consumeProtectedData#app-param) -  `app` parameter). This chosen application must be in the whitelist - defined by the collection owner. - -## Protected data delivery iApp - -Built for the needs of -[Content Creator use case](https://demo.iex.ec/content-creator/), this iExec TEE -iApp is simple: - -1. Download the protected data from IPFS. It expects to find a property named - `file` in the protected data. - -```json -{ - "file": "" -} -``` - -2. Encrypt the protected data with the beneficiary public key. - -3. Re-upload the encrypted data to IPFS and return the URL. - -::: warning - -Please note: This application and its whitelist can only be used **within the -dataProtectorSharing module**, as it is owned by the DataProtector Sharing smart -contract. - -::: - -### Whitelist - -**Whitelist address:** `0x256bcd881c33bdf9df952f2a0148f27d439f2e64` - -This whitelist contains current and past versions of the "Protected data -delivery iApp" - -See it in -[https://blockscout-bellecour.iex.ec/](https://blockscout-bellecour.iex.ec/address/0x256bcd881c33bdf9df952f2a0148f27d439f2e64). - -### iApp - -**Most recent iApp from this whitelist:** -`0x1cb7D4F3FFa203F211e57357D759321C6CE49921` - -See it in -[https://explorer.iex.ec/bellecour](https://explorer.iex.ec/bellecour/app/0x1cb7d4f3ffa203f211e57357d759321c6ce49921) - - diff --git a/src/references/dataProtector/advanced/apps-whitelist/addAppToAddOnlyAppWhitelist.md b/src/references/dataProtector/advanced/apps-whitelist/addAppToAddOnlyAppWhitelist.md deleted file mode 100644 index bbc717b1..00000000 --- a/src/references/dataProtector/advanced/apps-whitelist/addAppToAddOnlyAppWhitelist.md +++ /dev/null @@ -1,104 +0,0 @@ ---- -title: addAppToAddOnlyAppWhitelist -description: - Method to add an app (iExec TEE iApp) into the AddOnlyAppWhitelist for secure - data access control. ---- - -# addAppToAddOnlyAppWhitelist - -Method to add an app (iExec TEE iApp) into the `AddOnlyAppWhitelist`. - -::: warning - -Once added, you can't remove an app from the whitelist. - -_Why?_ - -This is mainly **to protect users** who have paid for protected data. Imagine -the collection owner could remove all apps from the initial whitelist, users -having rented the protected data could no longer consume it. - -::: - -## Usage - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const isAddedToAddAppToAddOnlyAppWhitelist = - await dataProtectorSharing.addAppToAddOnlyAppWhitelist({ - addOnlyAppWhitelist: '0x123abc...', - app: '0x127ahs...', - }); -``` - -## Parameters - -```ts twoslash -import { type AddAppToAppWhitelistParams } from '@iexec/dataprotector'; -``` - -### addOnlyAppWhitelist - -**Type:** `Address` - -Address of the `addOnlyAppWhitelist` in which you want to add an app. - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const isAddedToAddAppToAddOnlyAppWhitelist = - await dataProtectorSharing.addAppToAddOnlyAppWhitelist({ - addOnlyAppWhitelist: '0x123abc...', // [!code focus] - app: '0x127ahs...', - }); -``` - -### app {#app-param} - -**Type:** `AddressOrENS` - -Address of app that you want to add to the `addOnlyAppWhitelist`. - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const isAddedToAddAppToAddOnlyAppWhitelist = - await dataProtectorSharing.addAppToAddOnlyAppWhitelist({ - addOnlyAppWhitelist: '0x123abc...', - app: '0x127ahs...', // [!code focus] - }); -``` - -## Return Value - -```ts twoslash -import { type SuccessWithTransactionHash } from '@iexec/dataprotector'; -``` - -See -[`SuccessWithTransactionHash`](/references/dataProtector/types#successwithtransactionhash) - - diff --git a/src/references/dataProtector/advanced/apps-whitelist/createAddOnlyAppWhitelist.md b/src/references/dataProtector/advanced/apps-whitelist/createAddOnlyAppWhitelist.md deleted file mode 100644 index 935ee810..00000000 --- a/src/references/dataProtector/advanced/apps-whitelist/createAddOnlyAppWhitelist.md +++ /dev/null @@ -1,37 +0,0 @@ ---- -title: createAddOnlyAppWhitelist -description: - Method to create an AddOnlyAppWhitelist for controlling app access. The caller - becomes the owner by default, with transferable ownership as an ERC721. ---- - -# createAddOnlyAppWhitelist - -Method to create an `AddOnlyAppWhitelist`. By default, the owner will be the -caller of the `createAddOnlyAppWhitelist` method, but as the -`AddOnlyAppWhitelist` is an ERC721, you can transfer ownership to someone else. - -## Usage - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const isAddedToAddAppToAddOnlyAppWhitelist = - await dataProtectorSharing.createAddOnlyAppWhitelist(); -``` - -## Return Value - -```ts twoslash -import { type CreateAppWhitelistResponse } from '@iexec/dataprotector'; -``` - - diff --git a/src/references/dataProtector/advanced/apps-whitelist/getUserAddOnlyAppWhitelist.md b/src/references/dataProtector/advanced/apps-whitelist/getUserAddOnlyAppWhitelist.md deleted file mode 100644 index 5d5842b3..00000000 --- a/src/references/dataProtector/advanced/apps-whitelist/getUserAddOnlyAppWhitelist.md +++ /dev/null @@ -1,66 +0,0 @@ ---- -title: getUserAddOnlyAppWhitelist -description: - Method to get AddOnlyAppWhitelist with filtering by user ethereum address for - app access control management. ---- - -# getUserAddOnlyAppWhitelist - -Method to get `AddOnlyAppWhitelist`, you can filter by user ethereum address. - -## Usage - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const allAppOnlyAppWhitelistAvailable = - await dataProtectorSharing.getUserAddOnlyAppWhitelist(); -``` - -## Parameters - -```ts twoslash -import { type GetUserAppWhitelistParams } from '@iexec/dataprotector'; -``` - -### user - -**Type:** `AddressOrENS` - -Address or ENS of the user that manages the `AddAppToAddOnlyAppWhitelist` - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const allUserAddOnlyAppWhitelist = - await dataProtectorSharing.getUserAddOnlyAppWhitelist({ - user: '0x123abc...', // [!code focus] - }); -``` - -## Return Value - -```ts twoslash -import { type GetUserAppWhitelistResponse } from '@iexec/dataprotector'; - -// Child types -import { type AddOnlyAppWhitelist } from '@iexec/dataprotector'; -``` - - diff --git a/src/references/dataProtector/dataProtectorSharing.md b/src/references/dataProtector/dataProtectorSharing.md deleted file mode 100644 index 25992d4a..00000000 --- a/src/references/dataProtector/dataProtectorSharing.md +++ /dev/null @@ -1,69 +0,0 @@ ---- -title: DataProtector Sharing -description: - Distribute and monetize your protected data effortlessly with DataProtector - Sharing. Use smart contracts to manage access, rent, or sell data while - maintaining control and privacy. ---- - -# DataProtector Sharing - -The DataProtector Sharing module includes a set of methods for distributing and -monetizing your protected data. These work seamlessly in your own applications -in a way that's transparent to end users. The Sharing module supports the -following options for distributing a user's protected data: - -- Sharing freely with other users -- Renting data for a pre-determined period of time -- Providing access for a recurring subscription fee -- Selling ownership of the data - -Once access is obtained through one of these distribution methods, the `consume` -methods allow interaction with the protected data. The application designer uses -these methods to securely retrieve data from IPFS and decrypt it on the client -side. This ensures only the consumer gains access to the data. - -## How Does it Work? - -The user's protected data is managed by a special Data Sharing smart contract. -This smart contract enforces the user's desired sharing paradigm. Protected data -is bundled by the user into one or more collections. Within the collection, the -user may specify different sharing options for different pieces of data. This -illustration shows the hierarchy of a Data Sharing smart contract: - -![Data Sharing smart contract](/references/dataProtector/dataProtectorSharing/data-sharing-sc.png) - -The Data Sharing smart contract enforces governance over the user's protected -data based on their desired distribution choices. The user has complete control -over the mode of sharing for each Collection and each Protected Data contained -in their collections. - -The smart contract also protects the consumer of a user's data. If a consumer -rents access to a video clip, for example, even if the owner of the video clip -removes the rental option, the renter maintains their access for the duration of -the rental period. - -## How Does this Differ from `DataProtector Core`? - -With `DataProtector Core` you must grant each consumer individual access to your -protected data. This has several prerequisites: - -- The data owner must know the consumer's Ethereum address -- The data owner must sign a transaction at the moment you grant the access -- The data owner must define the number of times the consumer can access the - data up front - -With `DataProtector Sharing` a user can easily distribute their protected data -to a wider audience. The user authorizes distribution channels up front and -consumers of the data trigger smart contracts on their own, requiring no -additional activity from the data owner. This has several key benefits - -- The data owner doesn't need to know the consumer's Ethereum address -- The data owner doesn't need to sign a transaction at the moment of - distribution, only the consumer of the data signs their transaction -- The data owner doesn't manage access, the Data Sharing smart contract - automatically enforces the distribution and monetization choices - - diff --git a/src/references/dataProtector/dataProtectorSharing/collection.md b/src/references/dataProtector/dataProtectorSharing/collection.md deleted file mode 100644 index d875283a..00000000 --- a/src/references/dataProtector/dataProtectorSharing/collection.md +++ /dev/null @@ -1,74 +0,0 @@ ---- -title: Data Sharing - Collection Methods -description: - Organize your protected data into collections with iExec's Data Sharing - module. Choose distribution options like renting, free access, subscription, - or selling to control how your data is shared and monetized. ---- - -# Data Sharing - Collection Methods - -A collection is a way to group protected data for sharing by the Data Sharing -module. The Data Sharing smart contract operates on data contained within a -collection. You must group data within a collection before choosing a method of -distribution. The data owner is not restricted to only a single collection. This -diagram illustrates all the options for protected data within a collection: - -![Data Sharing collection](inside-a-collection.png) - -## Distribution Options - -The distribution choice impacts the visibility of the protected data when a -potential consumer is browsing the collection. Inside a collection, a data owner -may specify one of the following states: - -**Not distributed** - -Only the collection's owner can see it. This is useful for things in -development, or when the owner wishes to release things for a limited time. - -**For rent** - -The collection's owner allows a consumer to pay a set price to access the data -for a predetermined period of time. The smart contract ensures the consumer -maintains access. Even if the collection owner de-lists the data or changes the -rental terms, the consumer maintains their access for the duration of their -rental term. Once the rental term is up, the consumer loses access to the -protected data. If the user wishes to re-up their rental term, they are bound to -any new price or duration changes the data owner makes. - -**Free** - -This functions the same as a rental but with no price for the transaction. The -data owner may still set a duration for the free access. This supports scenarios -like a free giveaway, or a timed promotion. - -**Included in Subscription** - -The collection's owner may create one or more subscription models for -distribution of their data. A subscription bundle is a subset of the protected -data within the collection. Subscribers pay a set fee at a set cadence to -maintain access to all protected data within the subscription. The collection -owner may assign protected data to more than one subscription bundles at the -same time. - -The collection owner may add additional protected data to the subscription at -any time. They may not, however, remove protected data from the subscription -bundle if there are any active subscribers. A subscriber maintains access to all -protected data within the subscription as long as they continue paying the -subscription fee. The collection owner may de-list a subscription bundle by -setting either the price, the duration, or both, to zero. - -**Both For Rent and Included in Subscription** - -The collection owner may set any combination of rental and subscription terms -for any protected data in the collection. - -**For sale** - -The collection owner may list any of their protected data for sale. This is -especially useful for dealers of digital assets like NFTs. - - diff --git a/src/references/dataProtector/dataProtectorSharing/collection/addToCollection.md b/src/references/dataProtector/dataProtectorSharing/collection/addToCollection.md deleted file mode 100644 index d590d522..00000000 --- a/src/references/dataProtector/dataProtectorSharing/collection/addToCollection.md +++ /dev/null @@ -1,173 +0,0 @@ ---- -title: addToCollection -description: - Transfer a protected data to one of your collections in the Data Sharing smart - contract. The method approves the contract to manage the data and adds it to - the specified collection. ---- - -# addToCollection - -Method to transfer one of your protected data to a collection of yours in the -Data Sharing smart contract. - -Under the hood, this method performs two actions: - -- Approve the Data Sharing smart contract to manage your protected data. -- Add the protected data to your collection. - -## Usage - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const { txHash } = await dataProtectorSharing.addToCollection({ - protectedData: '0x123abc...', - collectionId: 12, - addOnlyAppWhitelist: '0x541abc...', -}); -``` - -## Parameters - -```ts twoslash -import { type AddToCollectionParams } from '@iexec/dataprotector'; -``` - -### collectionId - -**Type:** `number` - -Collection ID to which you'd like to add the protected data. - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const { txHash } = await dataProtectorSharing.addToCollection({ - collectionId: 12, // [!code focus] - protectedData: '0x123abc...', - addOnlyAppWhitelist: '0x541abc...', -}); -``` - -### protectedData - -**Type:** `AddressOrENS` - -Address of the protected data you'd like to add to your collection. - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const { txHash } = await dataProtectorSharing.addToCollection({ - collectionId: 12, - protectedData: '0x123abc...', // [!code focus] - addOnlyAppWhitelist: '0x541abc...', -}); -``` - -Before any smart contract interaction, the existence of the protected data will -be checked, as well as the ownership: it should be the wallet address you used -to instantiate DataProtector SDK. - -### addOnlyAppWhitelist - -**Type:** `AddressOrENS` - -Address of the whitelist smart contract that contains applications allowed to -consume the protected data. - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const { txHash } = await dataProtectorSharing.addToCollection({ - collectionId: 12, - protectedData: '0x123abc...', - addOnlyAppWhitelist: '0xba46d6...', // [!code focus] -}); -``` - -::: tip - -For this `addOnlyAppWhitelist`, you are free to use -`0x256bcd881c33bdf9df952f2a0148f27d439f2e64`. - -For more details on how to create and manage appsWhitelist, see -[Apps whitelist](/references/dataProtector/advanced/apps-whitelist). - -::: - -### onStatusUpdate - -**Type:** `OnStatusUpdateFn` - -Callback function to be notified at intermediate steps. - - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const { txHash } = await dataProtectorSharing.addToCollection({ - protectedData: '0x123abc...', - collectionId: 12, - addOnlyAppWhitelist: '0xba46d6...', - onStatusUpdate: ({ title, isDone }) => { // [!code focus] - console.log(title, isDone); // [!code focus] - }, // [!code focus] -}); -``` - - -You can expect this callback function to be called with the following titles: - -```ts -'APPROVE_COLLECTION_CONTRACT'; -'ADD_PROTECTED_DATA_TO_COLLECTION'; -``` - -Once with `isDone: false`, and then with `isDone: true` - -## Return Value - -```ts twoslash -import { type SuccessWithTransactionHash } from '@iexec/dataprotector'; -``` - -See -[`SuccessWithTransactionHash`](/references/dataProtector/types#successwithtransactionhash) - - diff --git a/src/references/dataProtector/dataProtectorSharing/collection/createCollection.md b/src/references/dataProtector/dataProtectorSharing/collection/createCollection.md deleted file mode 100644 index b880deaf..00000000 --- a/src/references/dataProtector/dataProtectorSharing/collection/createCollection.md +++ /dev/null @@ -1,40 +0,0 @@ ---- -title: createCollection -description: - Create a new NFT collection with iExec's createCollection method. Organize and - manage your protected data for seamless distribution and monetization through - DataProtector Sharing. ---- - -# createCollection - -Method to create a new collection in the Data Sharing smart contract. - -Having a collection is a required step before choosing how to distribute your -protected data. - -A wallet address may own multiple collections. - -## Usage - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const createCollectionResult = await dataProtectorSharing.createCollection(); -``` - -## Return Value - -```ts twoslash -import { type CreateCollectionResponse } from '@iexec/dataprotector'; -``` - - diff --git a/src/references/dataProtector/dataProtectorSharing/collection/removeCollection.md b/src/references/dataProtector/dataProtectorSharing/collection/removeCollection.md deleted file mode 100644 index 17a565e7..00000000 --- a/src/references/dataProtector/dataProtectorSharing/collection/removeCollection.md +++ /dev/null @@ -1,76 +0,0 @@ ---- -title: removeCollection -description: - Remove a collection from the Data Sharing smart contract by burning its - associated NFT. Transfer the NFT to the zero address and permanently remove - the collection. ---- - -# removeCollection - -Method to remove one of your collections in the Data Sharing smart contract. - -By removing a collection, we mean to burn the associated NFT, that is, to -**transfer it to the zero address**. - -## Usage - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const { txHash } = await dataProtectorSharing.removeCollection({ - collectionId: 15, -}); -``` - -## Pre-conditions - -- You must be the owner of the collection. -- There should be no protected data in the collection. See - [`removeProtectedDataFromCollection`](/references/dataProtector/dataProtectorSharing/collection/removeProtectedDataFromCollection). - -## Parameters - -```ts twoslash -import { type RemoveCollectionParams } from '@iexec/dataprotector'; -``` - -### collectionId - -**Type:** `number` - -The collection ID of the collection you want to remove. - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const { txHash } = await dataProtectorSharing.removeCollection({ - collectionId: 15, // [!code focus] -}); -``` - -## Return Value - -```ts twoslash -import { type SuccessWithTransactionHash } from '@iexec/dataprotector'; -``` - -See -[`SuccessWithTransactionHash`](/references/dataProtector/types#successwithtransactionhash) - - diff --git a/src/references/dataProtector/dataProtectorSharing/collection/removeProtectedDataFromCollection.md b/src/references/dataProtector/dataProtectorSharing/collection/removeProtectedDataFromCollection.md deleted file mode 100644 index f33e24f6..00000000 --- a/src/references/dataProtector/dataProtectorSharing/collection/removeProtectedDataFromCollection.md +++ /dev/null @@ -1,82 +0,0 @@ ---- -title: removeProtectedDataFromCollection -description: - Remove a protected data from one of your collections in the Data Sharing smart - contract. This method transfers the ownership of the protected data back to - the owner. ---- - -# removeProtectedDataFromCollection - -Method to remove one of your protected data from a collection of yours in the -Data Sharing smart contract. - -To put it differently, this method will transfer the ownership of the protected -data back to you. - -## Usage - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const { txHash } = await dataProtectorSharing.removeProtectedDataFromCollection( - { - protectedData: '0x123abc...', - } -); -``` - -## Pre-conditions - -- You must be the owner of the collection of which the protected data is - currently part of. -- There should be no active subscriptions to this collection. -- There should be no active rentals of this protected data. - -## Parameters - -```ts twoslash -import { type RemoveFromCollectionParams } from '@iexec/dataprotector'; -``` - -### protectedData - -**Type:** `AddressOrENS` - -Address of the protected data you'd like to remove from your collection. - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const { txHash } = await dataProtectorSharing.removeProtectedDataFromCollection( - { - protectedData: '0x123abc...', // [!code focus] - } -); -``` - -## Return Value - -```ts twoslash -import { type SuccessWithTransactionHash } from '@iexec/dataprotector'; -``` - -See -[`SuccessWithTransactionHash`](/references/dataProtector/types#successwithtransactionhash) - - diff --git a/src/references/dataProtector/dataProtectorSharing/consume/consumeProtectedData.md b/src/references/dataProtector/dataProtectorSharing/consume/consumeProtectedData.md deleted file mode 100644 index dc61707f..00000000 --- a/src/references/dataProtector/dataProtectorSharing/consume/consumeProtectedData.md +++ /dev/null @@ -1,350 +0,0 @@ ---- -title: consumeProtectedData -description: - Consume protected data in iExec by visualizing or downloading it. This method - involves generating RSA keys, interacting with iExec's Secret Management - Service, and securely retrieving encrypted data from InterPlanetary File - System (IPFS). ---- - -# consumeProtectedData - -Method to consume a protected data, that is, visualize it or download it. - -This method does a few things under the hood: - -- Generate an RSA key pair and save it to indexedDB (if available) -- Push the public key to iExec SMS (Secret Management Service) (For more info, - see - [iExec Advanced documentation](/guides/build-iapp/advanced/access-confidential-assets)) -- Wait for the consuming task to be executed by a worker. The iExec TEE iApp - being executed is the one given with the `app` parameter. The iExec TEE iApp - will get the protected data from IPFS, encrypt it with the public key - generated in the first step, and re-upload it to IPFS. -- Retrieve the encrypted data from IPFS and decrypt it with the private key - generated in the first step. - -## Usage - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const consumeProtectedDataResult = - await dataProtectorSharing.consumeProtectedData({ - protectedData: '0x123abc...', - app: '0x456def...', - }); -``` - -## Pre-conditions - -You need to either have: - -- an active rental for the protected data, -- an active subscription to the corresponding collection if the protected data - is part of the collection subscription bundle. - -## Parameters - -```ts twoslash -import { type ConsumeProtectedDataParams } from '@iexec/dataprotector'; -``` - -### protectedData - -**Type:** `AddressOrENS` - -Address of the protected data you'd like to visualize. - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const consumeProtectedDataResult = - await dataProtectorSharing.consumeProtectedData({ - protectedData: '0x123abc...', // [!code focus] - app: '0x456def...', - }); -``` - -### app - -**Type:** `AddressOrENS` - -Address or Ethereum Name Service (ENS) of the iApp that will be used to consume -the protected data. This iExec TEE iApp is the one that runs within an iExec -worker. - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const consumeProtectedDataResult = - await dataProtectorSharing.consumeProtectedData({ - protectedData: '0x123abc...', - app: '0x456def...', // [!code focus] - }); -``` - -::: tip - -For this `app` parameter you can use the "Protected data delivery TEE iApp": - -``` -0x1cb7D4F3FFa203F211e57357D759321C6CE49921 -``` - -
- -
Please note: This application can only be used within the -dataProtectorSharing module, as it is owned by the DataProtector Sharing smart contract. - -For more details, see -[Apps whitelist](/references/dataProtector/advanced/apps-whitelist). - -::: - -::: tip - -If you want to provide **your own TEE iApp**, you will need to create a -whitelist that contains your app. - -For more details, see -[Apps whitelist](/references/dataProtector/advanced/apps-whitelist). - -::: - -### path - -**Type:** `string` - -Under the hood, a protected data is a zip file. With this `path` parameter, you -can specify the file you're interested in. The zip file will be uncompressed for -you, and only the desired file will be given as the `result`. - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const consumeProtectedDataResult = - await dataProtectorSharing.consumeProtectedData({ - protectedData: '0x123abc...', - app: '0x456def...', - path: 'my-content', // [!code focus] - }); -``` - -### workerpool - -**Type:** `AddressOrENS` -**Default:** `{{ workerpoolAddress }}` (iExec's workerpool) - -Address or ENS of the workerpool on which your confidential task will run. - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const consumeProtectedDataResult = - await dataProtectorSharing.consumeProtectedData({ - protectedData: '0x123abc...', - app: '0x456def...', - workerpool: '0xa5de76...', // [!code focus] - }); -``` - -### maxPrice - -**Type:** `number` -**Default:** `0` - -The maximum price (in nRLC) that a requester is willing to pay for each task -related to consuming the protected data. It is the sum of the application price, -dataset price, and workerpool price per task. - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const consumeProtectedDataResult = - await dataProtectorSharing.consumeProtectedData({ - protectedData: '0x123abc...', - app: '0x456def...', - maxPrice: 10, // [!code focus] - }); -``` - -### pemPublicKey - -**Type:** `string` - -If you have previously called `consumeProtectedData()` and saved the returned -public key, you can reuse it in further calls. - -Alternatively, you can generate a RSA keypair on your own. - -If you provide a public key, you must also provide its corresponding private key -provided. - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const consumeProtectedDataResult = - await dataProtectorSharing.consumeProtectedData({ - protectedData: '0x123abc...', - app: '0x456def...', - pemPublicKey: '-----BEGIN PUBLIC KEY-----\n...\n-----END PUBLIC KEY-----', // [!code focus] - }); -``` - -### pemPrivateKey - -**Type:** `string` - -If you have previously called `consumeProtectedData()` and saved the returned -private key, you can reuse it in further calls. - -Alternatively, you can generate a RSA keypair on your own. - -If you provide a private key, you must also provide its corresponding public key -provided. - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const consumeProtectedDataResult = - await dataProtectorSharing.consumeProtectedData({ - protectedData: '0x123abc...', - app: '0x456def...', - pemPrivateKey: - '-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----', // [!code focus] - }); -``` - -### onStatusUpdate - -**Type:** `OnStatusUpdateFn` - -Callback function to be notified at intermediate steps. - - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const consumeProtectedDataResult = - await dataProtectorSharing.consumeProtectedData({ - protectedData: '0x123abc...', - app: '0x456def...', - onStatusUpdate: ({ title, isDone }) => { // [!code focus] - console.log(title, isDone); // [!code focus] - }, // [!code focus] - }); -``` - - -You can expect this callback function to be called with the following titles: - -```ts -'FETCH_WORKERPOOL_ORDERBOOK'; -'PUSH_ENCRYPTION_KEY'; -'CONSUME_ORDER_REQUESTED'; -'CONSUME_TASK'; -'CONSUME_RESULT_DOWNLOAD'; -'CONSUME_RESULT_DECRYPT'; -``` - -## Return Value - -```ts twoslash -import { type ConsumeProtectedDataResponse } from '@iexec/dataprotector'; -``` - -### txHash - -`string` - -The transaction hash corresponding to the execution of the function. - -### dealId - -`string` - -Identifies the specific deal associated with this transaction. - -### taskId - -`string` - -Identifies the specific task associated with the deal. - -### result - -`ArrayBuffer` - -The actual content of the protected file. - - diff --git a/src/references/dataProtector/dataProtectorSharing/data-sharing-sc.png b/src/references/dataProtector/dataProtectorSharing/data-sharing-sc.png deleted file mode 100644 index 189c4108..00000000 Binary files a/src/references/dataProtector/dataProtectorSharing/data-sharing-sc.png and /dev/null differ diff --git a/src/references/dataProtector/dataProtectorSharing/inside-a-collection.png b/src/references/dataProtector/dataProtectorSharing/inside-a-collection.png deleted file mode 100644 index aac8c11a..00000000 Binary files a/src/references/dataProtector/dataProtectorSharing/inside-a-collection.png and /dev/null differ diff --git a/src/references/dataProtector/dataProtectorSharing/read/getCollectionOwners.md b/src/references/dataProtector/dataProtectorSharing/read/getCollectionOwners.md deleted file mode 100644 index d2747ff1..00000000 --- a/src/references/dataProtector/dataProtectorSharing/read/getCollectionOwners.md +++ /dev/null @@ -1,74 +0,0 @@ ---- -title: getCollectionOwners -description: - Method to get all collection owners with results ordered by creation timestamp - in descending order. ---- - -# getCollectionOwners - -Method to get all collection owners. - -Results of `CollectionOwner.collections` are ordered by -`collections.creationTimestamp` desc. - -## Usage - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const collectionOwners = await dataProtectorSharing.getCollectionOwners(); -``` - -## Parameters - -```ts twoslash -import { type GetCollectionOwnersParams } from '@iexec/dataprotector'; -``` - -### limit - -**Type:** `number` -**Default:** `100` -**Range:** `[1...1000]` - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const collectionOwners = await dataProtectorSharing.getCollectionOwners({ - limit: 100, // [!code focus] -}); -``` - -## Return Value - -```ts twoslash -import type { GetCollectionOwnersResponse } from '@iexec/dataprotector'; - -// Child types -import type { CollectionOwner, SubscriptionParams } from '@iexec/dataprotector'; -``` - -[See Type ↗️](https://github.com/iExecBlockchainComputing/dataprotector-sdk/blob/c83e30e6ce8b55ecf8a35ecb4eb1014cd4ecefe9/packages/sdk/src/lib/types/sharingTypes.ts) - -### hasActiveSubscription - -`true` if you (logged-in user) have an active subscription to one of the -collections. - - diff --git a/src/references/dataProtector/dataProtectorSharing/read/getCollectionSubscriptions.md b/src/references/dataProtector/dataProtectorSharing/read/getCollectionSubscriptions.md deleted file mode 100644 index 4a922cb2..00000000 --- a/src/references/dataProtector/dataProtectorSharing/read/getCollectionSubscriptions.md +++ /dev/null @@ -1,110 +0,0 @@ ---- -title: getCollectionSubscriptions -description: - Fetch all subscriptions for a specific collection or user in iExec. Get - detailed information about subscription activity based on collection ID. ---- - -# getCollectionSubscriptions - -Method to get all subscriptions for: - -- a specific collection -- a specific user - -## Usage - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const collectionActiveSubscriptions = - await dataProtectorSharing.getCollectionSubscriptions({ - collectionId: 9, - }); -``` - -## Parameters - -```ts twoslash -import { type GetCollectionSubscriptionsParams } from '@iexec/dataprotector'; -``` - -### subscriberAddress - -**Type:** `AddressOrENS` - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const userActiveSubscriptions = - await dataProtectorSharing.getCollectionSubscriptions({ - subscriberAddress: '0x246bdf...', // [!code focus] - }); -``` - -### collectionId - -**Type:** `number` - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const collectionActiveSubscriptions = - await dataProtectorSharing.getCollectionSubscriptions({ - collectionId: 9, // [!code focus] - }); -``` - -### includePastSubscriptions - -**Type:** `boolean` -**Default:** `false` - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const userRentals = await dataProtectorSharing.getCollectionSubscriptions({ - subscriberAddress: '0x246bdf...', - includePastSubscriptions: true, // [!code focus] -}); -``` - -## Return Value - -```ts twoslash -import { type GetCollectionSubscriptionsResponse } from '@iexec/dataprotector'; - -// Child types -import { type CollectionSubscription } from '@iexec/dataprotector'; -``` - -[See Type ↗️](https://github.com/iExecBlockchainComputing/dataprotector-sdk/blob/c83e30e6ce8b55ecf8a35ecb4eb1014cd4ecefe9/packages/sdk/src/lib/types/sharingTypes.ts) - - diff --git a/src/references/dataProtector/dataProtectorSharing/read/getCollectionsByOwner.md b/src/references/dataProtector/dataProtectorSharing/read/getCollectionsByOwner.md deleted file mode 100644 index d03a6acd..00000000 --- a/src/references/dataProtector/dataProtectorSharing/read/getCollectionsByOwner.md +++ /dev/null @@ -1,94 +0,0 @@ ---- -title: getCollectionsByOwner -description: - Method to get all collections for a specific user with filtering and - pagination options. ---- - -# getCollectionsByOwner - -Method to get all collections for a specific user. - -## Usage - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const userCollections = await dataProtectorSharing.getCollectionsByOwner({ - owner: '0xa0c15e...', -}); -``` - -## Parameters - -```ts twoslash -import { type GetCollectionsByOwnerParams } from '@iexec/dataprotector'; -``` - -### owner - -**Type:** `AddressOrENS` - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const userCollections = await dataProtectorSharing.getCollectionsByOwner({ - owner: '0xa0c15e...', // [!code focus] -}); -``` - -### includeHiddenProtectedDatas - -**Type:** `boolean` -**Default:** `false` - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const userCollectionsWithAllProtectedData = - await dataProtectorSharing.getCollectionsByOwner({ - owner: '0xa0c15e...', - includeHiddenProtectedDatas: true, // [!code focus] - }); -``` - -## Return Value - -```ts twoslash -import type { GetCollectionsByOwnerResponse } from '@iexec/dataprotector'; - -// Child types -import type { - CollectionWithProtectedDatas, - ProtectedDataInCollection, - SubscriptionParams, - RentingParams, - SellingParams, -} from '@iexec/dataprotector'; -``` - -[See Type ↗️](https://github.com/iExecBlockchainComputing/dataprotector-sdk/blob/c83e30e6ce8b55ecf8a35ecb4eb1014cd4ecefe9/packages/sdk/src/lib/types/sharingTypes.ts) - - diff --git a/src/references/dataProtector/dataProtectorSharing/read/getProtectedDataInCollections.md b/src/references/dataProtector/dataProtectorSharing/read/getProtectedDataInCollections.md deleted file mode 100644 index f708c21a..00000000 --- a/src/references/dataProtector/dataProtectorSharing/read/getProtectedDataInCollections.md +++ /dev/null @@ -1,233 +0,0 @@ ---- -title: getProtectedDataInCollections -description: - Retrieve protected data from collections in iExec. Each protected data can - belong to only one collection at a time, with results ordered by creation - timestamp in descending order. ---- - -# getProtectedDataInCollections - -Method to get protected data that are in collections. - -A protected data can only be in one collection at a time. - -Results are ordered by `creationTimestamp` desc. - -## Usage - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const protectedData = - await dataProtectorSharing.getProtectedDataInCollections(); -``` - -## Parameters - -```ts twoslash -import { type GetProtectedDataInCollectionsParams } from '@iexec/dataprotector'; -``` - -### protectedData - -**Type:** `AddressOrENS` - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const oneProtectedData = - await dataProtectorSharing.getProtectedDataInCollections({ - protectedData: '0x123abc...', // [!code focus] - }); -``` - -### collectionId - -**Type:** `number` - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const protectedDataByCollection = - await dataProtectorSharing.getProtectedDataInCollections({ - collectionId: 12, // [!code focus] - }); -``` - -### collectionOwner - -**Type:** `AddressOrENS` - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const protectedDataByOwner = - await dataProtectorSharing.getProtectedDataInCollections({ - collectionOwner: '0x123...', // [!code focus] - }); -``` - -### createdAfterTimestamp - -**Type:** `number` - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const latestProtectedData = - await dataProtectorSharing.getProtectedDataInCollections({ - createdAfterTimestamp: 1707237580, // Feb 6th, 2024 16:39:40 GMT // [!code focus] - }); -``` - -### isRentable - -**Type:** `boolean` - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const rentableProtectedData = - await dataProtectorSharing.getProtectedDataInCollections({ - isRentable: true, // [!code focus] - }); -``` - -### isForSale - -**Type:** `boolean` - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const protectedDataForSale = - await dataProtectorSharing.getProtectedDataInCollections({ - isForSale: true, // [!code focus] - }); -``` - -### isDistributed - -**Type:** `boolean` - -Used to filter protected data that are either for sale, renting or part of a -subscription. - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const protectedDataForSale = - await dataProtectorSharing.getProtectedDataInCollections({ - isDistributed: true, // [!code focus] - }); -``` - -### page - -**Type:** `number` - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const protectedData = await dataProtectorSharing.getProtectedDataInCollections({ - collectionId: 12, - page: 3, // [!code focus] - pageSize: 25, -}); -``` - -### pageSize - -**Type:** `number` -**Range:** `[10...1000]` - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const protectedData = await dataProtectorSharing.getProtectedDataInCollections({ - collectionId: 12, - page: 3, - pageSize: 25, // [!code focus] -}); -``` - -## Return Value - -```ts twoslash -import type { GetProtectedDataInCollectionsResponse } from '@iexec/dataprotector'; - -// Child types -import type { - ProtectedDataInCollection, - RentingParams, - SellingParams, -} from '@iexec/dataprotector'; -``` - -[See Type ↗️](https://github.com/iExecBlockchainComputing/dataprotector-sdk/blob/c83e30e6ce8b55ecf8a35ecb4eb1014cd4ecefe9/packages/sdk/src/lib/types/sharingTypes.ts) - - diff --git a/src/references/dataProtector/dataProtectorSharing/read/getProtectedDataPricingParams.md b/src/references/dataProtector/dataProtectorSharing/read/getProtectedDataPricingParams.md deleted file mode 100644 index 8a613842..00000000 --- a/src/references/dataProtector/dataProtectorSharing/read/getProtectedDataPricingParams.md +++ /dev/null @@ -1,69 +0,0 @@ ---- -title: getProtectedDataPricingParams -description: - Get pricing parameters for renting a specific protected data in iExec. - Retrieve rental price and duration to determine the cost and terms for data - access. ---- - -# getProtectedDataPricingParams - -Method to get all distribution params for a protected data. - -## Usage - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const pricingParams = await dataProtectorSharing.getProtectedDataPricingParams({ - protectedData: '0x123abc...', -}); -``` - -## Parameters - -```ts twoslash -import { type GetProtectedDataPricingParams } from '@iexec/dataprotector'; -``` - -### protectedData - -**Type:** `AddressOrENS` - -Address of the protected data you'd like to get the pricing params for. - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const pricingParams = await dataProtectorSharing.getProtectedDataPricingParams({ - protectedData: '0x123abc...', // [!code focus] -}); -``` - -## Return Value - -```ts twoslash -import type { GetProtectedDataPricingParamsResponse } from '@iexec/dataprotector'; - -// Child types -import type { SubscriptionParams, RentingParams } from '@iexec/dataprotector'; -``` - -[See Type ↗️](https://github.com/iExecBlockchainComputing/dataprotector-sdk/blob/c83e30e6ce8b55ecf8a35ecb4eb1014cd4ecefe9/packages/sdk/src/lib/types/sharingTypes.ts) - - diff --git a/src/references/dataProtector/dataProtectorSharing/read/getRentals.md b/src/references/dataProtector/dataProtectorSharing/read/getRentals.md deleted file mode 100644 index 3297a896..00000000 --- a/src/references/dataProtector/dataProtectorSharing/read/getRentals.md +++ /dev/null @@ -1,107 +0,0 @@ ---- -title: getRentals -description: - Retrieve all rentals for a specific protected data or user in iExec. Access - detailed rental information based on the protected data address. ---- - -# getRentals - -Method to get all rentals for: - -- a specific protected data -- a specific user - -## Usage - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const protectedDataActiveRentals = await dataProtectorSharing.getRentals({ - protectedData: '0x123abc...', -}); -``` - -## Parameters - -```ts twoslash -import { type GetRentalsParams } from '@iexec/dataprotector'; -``` - -### renterAddress - -**Type:** `AddressOrENS` - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const userActiveRentals = await dataProtectorSharing.getRentals({ - renterAddress: '0x246bdf...', // [!code focus] -}); -``` - -### protectedData - -**Type:** `AddressOrENS` - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const protectedDataActiveRentals = await dataProtectorSharing.getRentals({ - protectedData: '0x123abc...', // [!code focus] -}); -``` - -### includePastRentals - -**Type:** `boolean` -**Default:** `false` - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const userRentals = await dataProtectorSharing.getRentals({ - renterAddress: '0x246bdf...', - includePastRentals: true, // [!code focus] -}); -``` - -## Return Value - -```ts twoslash -import { type GetRentalsResponse } from '@iexec/dataprotector'; - -// Child types -import type { ProtectedDataRental } from '@iexec/dataprotector'; -``` - -[See Type ↗️](https://github.com/iExecBlockchainComputing/dataprotector-sdk/blob/c83e30e6ce8b55ecf8a35ecb4eb1014cd4ecefe9/packages/sdk/src/lib/types/sharingTypes.ts) - - diff --git a/src/references/dataProtector/dataProtectorSharing/renting.md b/src/references/dataProtector/dataProtectorSharing/renting.md deleted file mode 100644 index 90495442..00000000 --- a/src/references/dataProtector/dataProtectorSharing/renting.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -title: Data Sharing - Renting -description: - Renting options for distributing protected data allow consumers to access data - for a set price and duration. The Data Sharing smart contract ensures renter - protection, guaranteeing access for the agreed term and enforcing rental - terms, even if modified by the owner. ---- - -# Data Sharing - Renting - -Rental agreements are one of the options given for distributing a collection -owner's protected data. A rental agreement has the following attributes: - -**Rental Price** - -The collection owner allows a consumer to pay a set price to access the data. -This is a one-time up-front cost. - -**Rental Duration** - -The collection owner allows the renter access to the data for a set period of -time. - -## Renter Protection - -The Data Sharing smart contract ensures the renter maintains access for the -duration of their rental term. Once the rental term is up, the renter loses -access to the protected data. This assurance is critical to the renting paradigm -to ensure trust between the data owner and the renter. - -## Modifying Rental Terms - -The collection owner has a few options once they list protected data for rent: - -- The owner may remove the rental terms and effectively de-list the protected - data -- The owner may also modify the rental price or duration - -Making either of these chances is effective immediately but only for future -rentals. The Data Sharing smart contract enforces any ongoing rental agreements -until the terms expire. - - diff --git a/src/references/dataProtector/dataProtectorSharing/renting/removeProtectedDataFromRenting.md b/src/references/dataProtector/dataProtectorSharing/renting/removeProtectedDataFromRenting.md deleted file mode 100644 index 92e8e7c1..00000000 --- a/src/references/dataProtector/dataProtectorSharing/renting/removeProtectedDataFromRenting.md +++ /dev/null @@ -1,72 +0,0 @@ ---- -title: removeProtectedDataFromRenting -description: - The removeProtectedDataFromRenting method allows the collection owner to - remove a protected data item from being rented. Active rentals will still be - honored until their rental period ends. ---- - -# removeProtectedDataFromRenting - -Method to remove a protected data from renting. - -If there are still active rentals to the protected data, these rentals will be -honored until the end of their rental period. - -## Usage - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const notForRentingAnymoreResult = - await dataProtectorSharing.removeProtectedDataFromRenting({ - protectedData: '0x123abc...', - }); -``` - -## Parameters - -```ts twoslash -import { type RemoveProtectedDataFromRentingParams } from '@iexec/dataprotector'; -``` - -### protectedData - -**Type:** `AddressOrENS` - -Address of the protected data you'd like to remove from renting. - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const notForRentingAnymoreResult = - await dataProtectorSharing.removeProtectedDataFromRenting({ - protectedData: '0x123abc...', // [!code focus] - }); -``` - -## Return Value - -```ts twoslash -import { type SuccessWithTransactionHash } from '@iexec/dataprotector'; -``` - -See -[`SuccessWithTransactionHash`](/references/dataProtector/types#successwithtransactionhash) - - diff --git a/src/references/dataProtector/dataProtectorSharing/renting/rentProtectedData.md b/src/references/dataProtector/dataProtectorSharing/renting/rentProtectedData.md deleted file mode 100644 index cfd1516c..00000000 --- a/src/references/dataProtector/dataProtectorSharing/renting/rentProtectedData.md +++ /dev/null @@ -1,145 +0,0 @@ ---- -title: rentProtectedData -description: - The rentProtectedData method allows you to rent a protected data item by - specifying the price and duration. If the parameters don't match the current - listing, the SDK will not submit the transaction to avoid paying gas fees for - a transaction that would revert. ---- - -# rentProtectedData - -Method to rent a protected data. - -## Usage - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const rentResult = await dataProtectorSharing.rentProtectedData({ - protectedData: '0x123abc...', - price: 1, // 1 nRLC - duration: 60 * 60 * 24 * 2, // 172,800 sec = 2 days -}); -``` - -::: tip - -Technically, `price` and `duration` parameters could be avoided. It is mainly a -protection against front-running "attacks", that is, if the collection owner -changes the price **at the same time** you rent the protected data, you would -end up paying more than expected. Passing the `price` here allows the SDK to -ensure you're paying the right price. If prices don't match, the SDK will throw -an error. - -::: - -## Parameters - -```ts twoslash -import { type RentProtectedDataParams } from '@iexec/dataprotector'; -``` - -### protectedData - -**Type:** `AddressOrENS` - -Address or ENS of the protected data that you'd like rent. - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const rentResult = await dataProtectorSharing.rentProtectedData({ - protectedData: '0x123abc...', // [!code focus] - price: 1, // 1 nRLC - duration: 60 * 60 * 24 * 2, // 172,800 sec = 2 days -}); -``` - -### price - -**Type:** `number` - -Price of the rental for the protected data that you expect to rent. This -parameter ensures that you will not be front-run by the owner of the protected -data. The unit is in nano RLC (nRLC). - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const rentResult = await dataProtectorSharing.rentProtectedData({ - protectedData: '0x123abc...', - price: 1, // 1 nRLC // [!code focus] - duration: 60 * 60 * 24 * 2, // 172,800 sec = 2 days -}); -``` - -::: tip - -To get the renting price of the given protected data, you can use -[getProtectedDataPricingParams](/references/dataProtector/dataProtectorSharing/read/getProtectedDataPricingParams). - -::: - -### duration - -**Type:** `number` - -Duration of the rental for the protected data that you expect to rent. This -parameter ensures that you will not be front-run by the owner of the protected -data. The unit is in seconds. - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const rentResult = await dataProtectorSharing.rentProtectedData({ - protectedData: '0x123abc...', - price: 1, // 1 nRLC - duration: 60 * 60 * 24 * 2, // 172,800 sec = 2 days // [!code focus] -}); -``` - -::: tip - -To get the renting duration of the given protected data, you can use -[getProtectedDataPricingParams](/references/dataProtector/dataProtectorSharing/read/getProtectedDataPricingParams). - -::: - -## Return Value - -```ts twoslash -import { type SuccessWithTransactionHash } from '@iexec/dataprotector'; -``` - -See -[`SuccessWithTransactionHash`](/references/dataProtector/types#successwithtransactionhash) - - diff --git a/src/references/dataProtector/dataProtectorSharing/renting/setProtectedDataRentingParams.md b/src/references/dataProtector/dataProtectorSharing/renting/setProtectedDataRentingParams.md deleted file mode 100644 index d66a297c..00000000 --- a/src/references/dataProtector/dataProtectorSharing/renting/setProtectedDataRentingParams.md +++ /dev/null @@ -1,122 +0,0 @@ ---- -title: setProtectedDataRentingParams -description: - The setProtectedDataRentingParams method allows you to set or update the - renting parameters (price and duration) for a protected data item. If the data - isn't listed for rent yet, it will be set for renting with the provided terms. ---- - -# setProtectedDataRentingParams - -Method to update a protected data renting params. - -If the protected data is not yet available for renting, it will be set for -renting. - -## Usage - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const setForRentingResult = - await dataProtectorSharing.setProtectedDataRentingParams({ - protectedData: '0x123abc...', - price: 1, // 1 nRLC - duration: 60 * 60 * 24 * 30, // 30 days - }); -``` - -## Parameters - -```ts twoslash -import { type SetProtectedDataRentingParams } from '@iexec/dataprotector'; -``` - -### protectedData - -`AddressOrENS` - -Address of the protected data you'd like to set renting parameters. - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const setForRentingResult = - await dataProtectorSharing.setProtectedDataRentingParams({ - protectedData: '0x123abc...', // [!code focus] - price: 1, // 1 nRLC - duration: 60 * 60 * 24 * 30, // 30 days - }); -``` - -### price - -`number` - -The price in nano RLC (nRLC) you ask from someone who wants to rent the -protected data. - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const setForRentingResult = - await dataProtectorSharing.setProtectedDataRentingParams({ - protectedData: '0x123abc...', - price: 1, // 1 nRLC // [!code focus] - duration: 60 * 60 * 24 * 30, // 30 days - }); -``` - -### duration - -`number` - -The duration of the rental in seconds. - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const setForRentingResult = - await dataProtectorSharing.setProtectedDataRentingParams({ - protectedData: '0x123abc...', - price: 1, // 1 nRLC - duration: 60 * 60 * 24 * 30, // 30 days // [!code focus] - }); -``` - -## Return Value - -```ts twoslash -import { type SuccessWithTransactionHash } from '@iexec/dataprotector'; -``` - -See -[`SuccessWithTransactionHash`](/references/dataProtector/types#successwithtransactionhash) - - diff --git a/src/references/dataProtector/dataProtectorSharing/renting/setProtectedDataToRenting.md b/src/references/dataProtector/dataProtectorSharing/renting/setProtectedDataToRenting.md deleted file mode 100644 index c9033977..00000000 --- a/src/references/dataProtector/dataProtectorSharing/renting/setProtectedDataToRenting.md +++ /dev/null @@ -1,124 +0,0 @@ ---- -title: setProtectedDataToRenting -description: - The setProtectedDataToRenting method allows a protected data item to be listed - for rent. This method sets the price and duration for future rentals. If the - data is already listed for rent, it updates the terms accordingly. ---- - -# setProtectedDataToRenting - -Method to allow a protected data to be rented. - -If you call this method on a protected data that is already set for renting, it -will update the `price` and `duration` parameters, and will apply to future -rentals. - -## Usage - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const setForRentingResult = - await dataProtectorSharing.setProtectedDataToRenting({ - protectedData: '0x123abc...', - price: 1, // 1 nRLC - duration: 60 * 60 * 24 * 30, // 30 days - }); -``` - -## Parameters - -```ts twoslash -import { type SetProtectedDataToRentingParams } from '@iexec/dataprotector'; -``` - -### protectedData - -**Type:** `AddressOrENS` - -Address of the protected data you'd like to set renting parameters for. - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const setForRentingResult = - await dataProtectorSharing.setProtectedDataToRenting({ - protectedData: '0x123abc...', // [!code focus] - price: 1, // 1 nRLC - duration: 60 * 60 * 24 * 30, // 30 days - }); -``` - -### price - -**Type:** `number` - -The price in nano RLC (nRLC) you ask from someone who wants to rent the -protected data. - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const setForRentingResult = - await dataProtectorSharing.setProtectedDataToRenting({ - protectedData: '0x123abc...', - price: 1, // 1 nRLC // [!code focus] - duration: 60 * 60 * 24 * 30, // 30 days - }); -``` - -### duration - -**Type:** `number` - -The duration of the rental in seconds. - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const setForRentingResult = - await dataProtectorSharing.setProtectedDataToRenting({ - protectedData: '0x123abc...', - price: 1, // 1 nRLC - duration: 60 * 60 * 24 * 30, // 30 days // [!code focus] - }); -``` - -## Return Value - -```ts twoslash -import { type SuccessWithTransactionHash } from '@iexec/dataprotector'; -``` - -See -[`SuccessWithTransactionHash`](/references/dataProtector/types#successwithtransactionhash) - - diff --git a/src/references/dataProtector/dataProtectorSharing/selling.md b/src/references/dataProtector/dataProtectorSharing/selling.md deleted file mode 100644 index b9f4c257..00000000 --- a/src/references/dataProtector/dataProtectorSharing/selling.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -title: Data Sharing - Selling -description: - Learn how to list protected data for sale, transfer ownership permanently - through blockchain transactions, and manage data listing operations. ---- - -# Data Sharing - Selling - -The owner of protected data may list the data for sale. Upon completion of a -sale, ownership of the protected data transfers to the buyer. This is a -permanent operation enforced by the blockchain and executed by the Data Sharing -smart contract. The data owner may de-list the protected data at any point until -a sale is completed. The new owner of the protected data has full rights to -distribute the protected data through any channels they desire. - - diff --git a/src/references/dataProtector/dataProtectorSharing/selling/buyProtectedData.md b/src/references/dataProtector/dataProtectorSharing/selling/buyProtectedData.md deleted file mode 100644 index 9969ce89..00000000 --- a/src/references/dataProtector/dataProtectorSharing/selling/buyProtectedData.md +++ /dev/null @@ -1,171 +0,0 @@ ---- -title: buyProtectedData -description: - Allows a user to purchase protected data that is listed for sale. Upon - successful purchase, the buyer gains full ownership and can distribute or keep - the data as desired. ---- - -# buyProtectedData - -Method to buy a protected data that is for sale. - -"Buying" here means to get ownership of the protected data. - -After buying a protected data, you'll be free to distribute it again at your own -terms, or to keep it for yourself. - -## Usage - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const { txHash } = await dataProtectorSharing.buyProtectedData({ - protectedData: '0x123abc...', - price: 1, -}); -``` - -## Parameters - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -import { type BuyProtectedDataParams } from '@iexec/dataprotector'; -``` - -### protectedData - -**Type:** `AddressOrENS` - -Address of the protected data you'd like to buy. - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const { txHash } = await dataProtectorSharing.buyProtectedData({ - protectedData: '0x123abc...', // [!code focus] - price: 1, -}); -``` - -### price - -**Type:** `number` - -Price of the protected data that you expect to buy. This parameter ensures that -you will not be front-run by the owner of the protected data. The unit is in -nano RLC (nRLC). - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const { txHash } = await dataProtectorSharing.buyProtectedData({ - protectedData: '0x123abc...', - price: 1, // [!code focus] -}); -``` - -### addToCollectionId - -**Type:** `number` - -Collection ID to which you'd like to transfer the ownership of the protected -data. -The Data Sharing smart contract will still be the technical owner of the -protected data, but you'll fully own it as you own the collection to which it'll -transferred. If you use this param the `addOnlyAppWhitelist` is mandatory -because you must specify which `addOnlyAppWhitelist` will be able to consume -your protected data. - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const { txHash } = await dataProtectorSharing.buyProtectedData({ - protectedData: '0x123abc...', - price: 1, - addToCollectionId: 12, // [!code focus] - addOnlyAppWhitelist: '0xdef456...', -}); -``` - -### addOnlyAppWhitelist - -**Type:** `AddressOrENS` - -Address of the whitelist smart contract that contains applications allowed to -consume the protected data. - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const { txHash } = await dataProtectorSharing.buyProtectedData({ - protectedData: '0x123abc...', - price: 1, - addToCollectionId: 12, - addOnlyAppWhitelist: '0xdef456...', // [!code focus] -}); -``` - -::: tip - -For this `addOnlyAppWhitelist`, you are free to use -`0x256bcd881c33bdf9df952f2a0148f27d439f2e64` that contains apps created for the -purpose of Content Creator usecase-demo. This `addOnlyAppWhitelist` is managed -by iExec. - -For more details on how to create and manage appsWhitelist, see -[Apps whitelist](/references/dataProtector/advanced/apps-whitelist). - -::: - -## Return Value - -```ts twoslash -import { type SuccessWithTransactionHash } from '@iexec/dataprotector'; -``` - -See -[`SuccessWithTransactionHash`](/references/dataProtector/types#successwithtransactionhash) - - diff --git a/src/references/dataProtector/dataProtectorSharing/selling/removeProtectedDataForSale.md b/src/references/dataProtector/dataProtectorSharing/selling/removeProtectedDataForSale.md deleted file mode 100644 index 6044f308..00000000 --- a/src/references/dataProtector/dataProtectorSharing/selling/removeProtectedDataForSale.md +++ /dev/null @@ -1,68 +0,0 @@ ---- -title: removeProtectedDataForSale -description: - Method to remove a protected data from sale listing, preventing further - purchase transactions. ---- - -# removeProtectedDataForSale - -Method to remove a protected data for sale. - -## Usage - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const notForSaleAnymoreResult = - await dataProtectorSharing.removeProtectedDataForSale({ - protectedData: '0x123abc...', - }); -``` - -## Parameters - -```ts twoslash -import { type RemoveProtectedDataForSaleParams } from '@iexec/dataprotector'; -``` - -### protectedData - -**Type:** `AddressOrENS` - -Address of the protected data that you'd like to remove for sale. - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const notForSaleAnymoreResult = - await dataProtectorSharing.removeProtectedDataForSale({ - protectedData: '0x123abc...', // [!code focus] - }); -``` - -## Return Value - -```ts twoslash -import { type SuccessWithTransactionHash } from '@iexec/dataprotector'; -``` - -See -[`SuccessWithTransactionHash`](/references/dataProtector/types#successwithtransactionhash) - - diff --git a/src/references/dataProtector/dataProtectorSharing/selling/setProtectedDataForSale.md b/src/references/dataProtector/dataProtectorSharing/selling/setProtectedDataForSale.md deleted file mode 100644 index 2d642382..00000000 --- a/src/references/dataProtector/dataProtectorSharing/selling/setProtectedDataForSale.md +++ /dev/null @@ -1,95 +0,0 @@ ---- -title: setProtectedDataForSale -description: - Allows a data owner to list their protected data for sale by setting a price. - Upon successful sale, ownership is transferred to the buyer, who can choose - their own pricing or retain the data for personal use." ---- - -# setProtectedDataForSale - -Method to set a protected data for sale. - -During a successful sale, **the ownership** of the protected data **is -transferred** to the buyer. The buyer will then be able to set their own pricing -parameters, or simply keep the protected data for their own use. - -## Usage - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const setForSaleResult = await dataProtectorSharing.setProtectedDataForSale({ - protectedData: '0x123abc...', - price: 2, // 2 nRLC -}); -``` - -## Parameters - -```ts twoslash -import { type SetProtectedDataForSaleParams } from '@iexec/dataprotector'; -``` - -### protectedData - -**Type:** `AddressOrENS` - -Address of the protected data that you'd like to set for sale. - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const setForSaleResult = await dataProtectorSharing.setProtectedDataForSale({ - protectedData: '0x123abc...', // [!code focus] - price: 2, // 2 nRLC -}); -``` - -### price - -**Type:** `number` - -The price in nano RLC (nRLC) you ask from someone who wants to buy the protected -data. - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const setForSaleResult = await dataProtectorSharing.setProtectedDataForSale({ - protectedData: '0x123abc...', - price: 2, // 2 nRLC // [!code focus] -}); -``` - -## Return Value - -```ts twoslash -import { type SuccessWithTransactionHash } from '@iexec/dataprotector'; -``` - -See -[`SuccessWithTransactionHash`](/references/dataProtector/types#successwithtransactionhash) - - diff --git a/src/references/dataProtector/dataProtectorSharing/subscription.md b/src/references/dataProtector/dataProtectorSharing/subscription.md deleted file mode 100644 index f2f2d913..00000000 --- a/src/references/dataProtector/dataProtectorSharing/subscription.md +++ /dev/null @@ -1,64 +0,0 @@ ---- -title: Data Sharing - Subscription -description: - Learn how to manage subscription agreements for protected data on the iExec - platform. Understand subscription pricing and duration, along with options for - modifying terms and protecting subscribers' access. ---- - -# Data Sharing - Subscription - -Subscription agreements are one of the options for distributing a collection -owner's protected data. Similar to the rental distribution terms, a subscription -agreement has the following attributes: - -**Subscription Price** - -The collection owner allows a subscriber to pay a set price to access the data. -The subscription fee is a one-time payment, not a recurring one. Subscriptions -do not auto-renew. - -**Subscription Duration** - -The collection owner allows the subscriber access to the data for a set period -of time. - -## The Subscription Bundle - -Where subscriptions differ from rental distribution terms is that a subscription -may cover more than one protected data. We use the term `subscription bundle` -for this grouping of data. The Data Sharing smart contract supports various -different methods for altering the contents of a subscription bundle. Once a -user purchases a subscription to the bundle, they retain access to all protected -data in the bundle until their subscription term expires. The owner may add new -data to the bundle but may not remove protected data from the bundle as long as -there remains at least one subscriber to it. - -## Subscriber Protection - -The Data Sharing smart contract ensures the subscriber maintains access for the -duration of their subscription term. Once the subscription expires, the consumer -loses access to all protected data. The subscriber has the option to pay the -subscription fee again to retain access. The data owner may update the -subscription fee and duration, but any data included in the subscription remains -available. This assurance is critical to the subscription paradigm to ensure -trust between the data owner and the subscriber. - -## Modifying Subscription Terms - -The collection owner has a few options to manage their subscription bundles: - -- The owner may remove the subscription terms and effectively de-list the - subscription bundle -- The owner may modify the subscription price or duration -- The owner may add additional protected data to the subscription -- The owner may remove protected data from the subscription only if there are no - active subscribers - -Making any of these changes is effective immediately. For any existing -subscribers, updates to the subscription terms take effect upon renewal of the -subscription. - - diff --git a/src/references/dataProtector/dataProtectorSharing/subscription/removeProtectedDataFromSubscription.md b/src/references/dataProtector/dataProtectorSharing/subscription/removeProtectedDataFromSubscription.md deleted file mode 100644 index fa54fcc2..00000000 --- a/src/references/dataProtector/dataProtectorSharing/subscription/removeProtectedDataFromSubscription.md +++ /dev/null @@ -1,83 +0,0 @@ ---- -title: removeProtectedDataFromSubscription -description: - Remove a protected data from your subscription in iExec. Stop providing the - data to current and future subscribers, removing it from subscription access. ---- - -# removeProtectedDataFromSubscription - -Method to remove a protected data from your subscription. - -## Usage - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const { txHash } = - await dataProtectorSharing.removeProtectedDataFromSubscription({ - protectedData: '0x123abc...', - }); -``` - -## Pre-conditions - -- You must be the owner of the collection of which the protected data is - currently part of. -- There should be no active subscriptions to this collection. -- The protected data should be part of your subscription. - -## Parameters - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -import { type RemoveProtectedDataFromSubscriptionParams } from '@iexec/dataprotector'; -``` - -### protectedData - -**Type:** `AddressOrENS` - -Address of the protected data you'd like to remove from subscription. - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const { txHash } = - await dataProtectorSharing.removeProtectedDataFromSubscription({ - protectedData: '0x123abc...', // [!code focus] - }); -``` - -## Return Value - -```ts twoslash -import { type SuccessWithTransactionHash } from '@iexec/dataprotector'; -``` - -See -[`SuccessWithTransactionHash`](/references/dataProtector/types#successwithtransactionhash) - - diff --git a/src/references/dataProtector/dataProtectorSharing/subscription/setProtectedDataToSubscription.md b/src/references/dataProtector/dataProtectorSharing/subscription/setProtectedDataToSubscription.md deleted file mode 100644 index f35b16a6..00000000 --- a/src/references/dataProtector/dataProtectorSharing/subscription/setProtectedDataToSubscription.md +++ /dev/null @@ -1,72 +0,0 @@ ---- -title: setProtectedDataToSubscription -description: - Add your protected data to a subscription on the iExec platform. Allow active - subscribers to access your data easily by linking it to your subscribers to - access your data easily. ---- - -# setProtectedDataToSubscription - -Method to set a protected data as part of your subscription. - -Any user who has an active subscription to your collection will be able to -consume this protected data. - -## Usage - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const setToSubscriptionResult = - await dataProtectorSharing.setProtectedDataToSubscription({ - protectedData: '0x123abc...', - }); -``` - -## Parameters - -```ts twoslash -import { type SetProtectedDataToSubscriptionParams } from '@iexec/dataprotector'; -``` - -### protectedData - -**Type:** `AddressOrENS` - -Address of the protected data you'd like to be part of your subscription. - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const setToSubscriptionResult = - await dataProtectorSharing.setProtectedDataToSubscription({ - protectedData: '0x123abc...', // [!code focus] - }); -``` - -## Return Value - -```ts twoslash -import { type SuccessWithTransactionHash } from '@iexec/dataprotector'; -``` - -See -[`SuccessWithTransactionHash`](/references/dataProtector/types#successwithtransactionhash) - - diff --git a/src/references/dataProtector/dataProtectorSharing/subscription/setSubscriptionParams.md b/src/references/dataProtector/dataProtectorSharing/subscription/setSubscriptionParams.md deleted file mode 100644 index d31e44a2..00000000 --- a/src/references/dataProtector/dataProtectorSharing/subscription/setSubscriptionParams.md +++ /dev/null @@ -1,120 +0,0 @@ ---- -title: setSubscriptionParams -description: - Set subscription parameters for your data collection on the iExec platform. - Define pricing, duration, and manage access to your protected data efficiently - using the Data Sharing smart contract. ---- - -# setSubscriptionParams - -Method to set subscription parameters for a given collection of yours. - -## Usage - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const setSubscriptionParamsResult = - await dataProtectorSharing.setSubscriptionParams({ - collectionId: 12, - price: 2, // 2 nRLC - duration: 60 * 60 * 24 * 30, // 30 days - }); -``` - -## Parameters - -```ts twoslash -import { type SetSubscriptionParams } from '@iexec/dataprotector'; -``` - -### collectionId - -**Type:** `number` - -Collection ID to which you'd like to set the subscription params. - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const setSubscriptionParamsResult = - await dataProtectorSharing.setSubscriptionParams({ - collectionId: 12, // [!code focus] - price: 2, // 2 nRLC - duration: 60 * 60 * 24 * 30, // 30 days - }); -``` - -### price - -**Type:** `number` - -The price in nano RLC (nRLC) it's going to cost a subscriber to access your -collection. - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const setSubscriptionParamsResult = - await dataProtectorSharing.setSubscriptionParams({ - collectionId: 12, - price: 2, // 2 nRLC // [!code focus] - duration: 60 * 60 * 24 * 30, // 30 days - }); -``` - -### duration - -**Type:** `number` - -The duration (in seconds) for a period of subscription. - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const setSubscriptionParamsResult = - await dataProtectorSharing.setSubscriptionParams({ - collectionId: 12, - price: 2, // 2 nRLC - duration: 60 * 60 * 24 * 30, // 30 days // [!code focus] - }); -``` - -## Return Value - -```ts twoslash -import { type SuccessWithTransactionHash } from '@iexec/dataprotector'; -``` - -See -[`SuccessWithTransactionHash`](/references/dataProtector/types#successwithtransactionhash) - - diff --git a/src/references/dataProtector/dataProtectorSharing/subscription/subscribeToCollection.md b/src/references/dataProtector/dataProtectorSharing/subscription/subscribeToCollection.md deleted file mode 100644 index 7b7f0c50..00000000 --- a/src/references/dataProtector/dataProtectorSharing/subscription/subscribeToCollection.md +++ /dev/null @@ -1,141 +0,0 @@ ---- -title: subscribeToCollection -description: - Subscribe to a collection on iExec and gain access to both current and future - protected data. Manage your subscription with a fixed price and duration, with - no automatic renewal, using the Data Sharing smart contract. ---- - -# subscribeToCollection - -Method to subscribe to a collection. - -You subscribe for a certain price and duration. **The subscription will not -automatically renew.** - -With an active subscription, you'll have access to current **and future** -protected data. - -## Usage - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const { txHash } = await dataProtectorSharing.subscribeToCollection({ - collectionId: 12, - price: 1, // 1 nRLC - duration: 60 * 60 * 24 * 2, // 172,800 sec = 2 days -}); -``` - -::: tip - -Technically, `price` and `duration` parameters could be avoided. It is mainly a -protection against front-running "attacks", that is, if the collection owner -changes the price **at the same time** you subscribe to the collection, you -would end up paying more than expected. Passing the `price` here allows the SDK -to ensure you're paying the right price. If prices don't match, the SDK will -throw an error. - -::: - -## Pre-conditions - -- The collection must be available for subscription, that is, the collection - owner must have set a price and a duration. - -## Parameters - -```ts twoslash -import { type SubscribeToCollectionParams } from '@iexec/dataprotector'; -``` - -### collectionId - -**Type:** `number` - -Collection ID to which you'd like to subscribe. - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const { txHash } = await dataProtectorSharing.subscribeToCollection({ - collectionId: 12, // [!code focus] - price: 1, // 1 nRLC - duration: 60 * 60 * 24 * 2, // 172,800 sec = 2 days -}); -``` - -### price - -**Type:** `number` - -Price of the rental for the protected data that you expect to rent. This -parameter ensures that you will not be front-run by the owner of the protected -data. The unit is in nano RLC (nRLC). - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const { txHash } = await dataProtectorSharing.subscribeToCollection({ - collectionId: 12, - price: 1, // 1 nRLC // [!code focus] - duration: 60 * 60 * 24 * 2, // 172,800 sec = 2 days -}); -``` - -### duration - -**Type:** `number` - -Duration of the rental for the protected data that you expect to rent. This -parameter ensures that you will not be front-run by the owner of the protected -data. The unit is in seconds. - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -const { txHash } = await dataProtectorSharing.subscribeToCollection({ - collectionId: 12, - price: 1, // 1 nRLC - duration: 60 * 60 * 24 * 2, // 172,800 sec = 2 days // [!code focus] -}); -``` - -## Return Value - -```ts twoslash -import { type SuccessWithTransactionHash } from '@iexec/dataprotector'; -``` - -See -[`SuccessWithTransactionHash`](/references/dataProtector/types#successwithtransactionhash) - - diff --git a/src/references/dataProtector/getting-started.md b/src/references/dataProtector/getting-started.md index a7921cf3..233d77a0 100644 --- a/src/references/dataProtector/getting-started.md +++ b/src/references/dataProtector/getting-started.md @@ -52,53 +52,6 @@ minimal working project ### Instantiate SDK -Depending on your project's requirements, you can instantiate the SDK using the -umbrella module for full functionality or opt for one of the submodules to -access specific sets of features. - -#### Instantiate Using the Umbrella Module - -For projects requiring the full functionality of the SDK, including both core -and sharing functions. - -::: code-group - -```ts twoslash [Browser] -declare global { - interface Window { - ethereum: any; - } -} -// ---cut--- -import { IExecDataProtector } from '@iexec/dataprotector'; - -const web3Provider = window.ethereum; -// Instantiate using the umbrella module for full functionality -const dataProtector = new IExecDataProtector(web3Provider); - -const dataProtectorCore = dataProtector.core; -const dataProtectorSharing = dataProtector.sharing; -``` - -```ts twoslash [NodeJS] -import { IExecDataProtector, getWeb3Provider } from '@iexec/dataprotector'; - -// Get Web3 provider from a private key -const web3Provider = getWeb3Provider('YOUR_PRIVATE_KEY'); - -// Instantiate using the umbrella module for full functionality -const dataProtector = new IExecDataProtector(web3Provider); - -const dataProtectorCore = dataProtector.core; // access to core methods -const dataProtectorSharing = dataProtector.sharing; // access to methods -``` - -::: - -#### Instantiate Only the `Core` Module - -For projects focusing solely on core data protection functions. - ::: code-group ```ts twoslash [Browser] @@ -121,47 +74,12 @@ import { IExecDataProtectorCore, getWeb3Provider } from '@iexec/dataprotector'; // Get Web3 provider from a private key const web3Provider = getWeb3Provider('YOUR_PRIVATE_KEY'); -// Instantiate only the Core module +// Instantiate the Core module const dataProtectorCore = new IExecDataProtectorCore(web3Provider); ``` ::: -#### Instantiate Only the `Sharing` Module - -For projects that need access management functions specifically. - -::: code-group - -```ts twoslash [Browser] -declare global { - interface Window { - ethereum: any; - } -} -// ---cut--- -import { IExecDataProtectorSharing } from '@iexec/dataprotector'; - -const web3Provider = window.ethereum; -// Instantiate only the Sharing module -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -``` - -```ts twoslash [NodeJS] -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -// Get Web3 provider from a private key -const web3Provider = getWeb3Provider('YOUR_PRIVATE_KEY'); - -// Instantiate only the Sharing module -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -``` - -::: - #### Instantiate Without a Web3 Provider For projects that only require read functions, you can instantiate the SDK @@ -170,15 +88,10 @@ without a Web3 provider. ::: code-group ```ts twoslash [Singleton Modules] -import { - IExecDataProtectorSharing, - IExecDataProtectorCore, -} from '@iexec/dataprotector'; +import { IExecDataProtectorCore } from '@iexec/dataprotector'; // Instantiate only the Core module for read-only core methods const dataProtectorCore = new IExecDataProtectorCore(); -// Instantiate only the Sharing module for read-only sharing methods -const dataProtectorSharing = new IExecDataProtectorSharing(); ``` ```ts twoslash [Umbrella Module] @@ -189,8 +102,6 @@ const dataProtector = new IExecDataProtector(); // Access to read-only core methods const dataProtectorCore = dataProtector.core; -// Access to read-only sharing methods -const dataProtectorSharing = dataProtector.sharing; ``` ::: @@ -198,7 +109,7 @@ const dataProtectorSharing = dataProtector.sharing; #### Advanced Configuration To add optional parameters, see -[advanced configuration](/references/dataProtector/advanced/advanced-configuration). +[advanced configuration](/references/dataProtector/advanced-configuration). ::: info @@ -208,9 +119,7 @@ protected data in the experimental **intel TDX** environment. For more details see: -- [configure DataProtector TDX](/references/dataProtector/advanced/advanced-configuration#iexecoptions) -- [create TDX protected data](/references/dataProtector/dataProtectorCore/protectData#usage) -- [process TDX protected data](/references/dataProtector/dataProtectorCore/processProtectedData#workerpool) +- [process TDX protected data](/references/dataProtector/methods/processProtectedData#workerpool) ⚠️ Keep in mind: TDX mode is experimental and can be subject to instabilities or discontinuity. @@ -233,18 +142,6 @@ discontinuity. githubLabel="Sandbox Github" /> - -