iExec recently unveiled new developer tools to address the use case of ‘Privacy-Enhancing Marketing’. These tools are the iExec DataProtector and iExec Web3Mail. These developer tools, existing as simple-to-use npm code packets, aim to revolutionize the way DApps handle data privacy and communication. This article will deep-dive into the technical functions of DataProtector and Web3Mail.
The iExec DataProtector is a tool designed to protect user data by utilizing an encryption mechanism and managing access rights through smart contracts. Data owners can grant permission to applications, enabling them to use data — without actually disclosing the data itself.
This tool is an efficient solution for handling data; it bundles and simplifies iExec dataset functionalities such as data encryption and access rights management. Furthermore, DataProtector facilitates the retrieval of all protected data associated with a specific owner or a specific data schema (see below an example of data schema). It also provides the user with the capability to revoke one or all access rights to data. In other words, data owners have the ability to dynamically manage and control access permissions, which ensures robust security and privacy of their data, with a user-friendly tool.
In the iExec ecosystem, a dataset is a Non-Fungible Token (NFT) used as a governing mechanism for confidential data. In the iExec Marketplace, dataset providers create and sign ‘datasetorders’ which specify the governance of the dataset, e.g. which Dapp can use the dataset. In DataProtector, data owners define higher-level access rules that are automatically translated into datasetorders.
DataProtector can easily be integrated into any software project (Quick start) to make protected data seamlessly accessible to authorized Confidential Computing applications.
DataProtector relies on:
1/ a DataProtector smart contract that interacts with DatasetRegistry smart contract to create dataset;
2/ a DataProtector subgraph, an off-chain server that continually observes events on blockchain, and then stores, indexes, and retrieves data protected by DataProtector, and uses the following components of iExec protocol:
1/ protectData encrypts users’ data and records ownership on a smart contract.
To protect his data, a user calls the protectData function by providing the data data as input. Optionally, the user can also specify a name for the data, which will be public information and remain unencrypted. If no name is provided, it is assigned as “Untitled”.
Here, an example of a data object:
data:
{
email: 'example@gmail.com',
SMTPserver: {
port: 5000,
smtp_server: 'smtp.gmail.com'
}
}
In this example, the data object consists of two keys: email and SMTPserver. The value of email is example@gmail.com. The value of SMTPserver comprises two other key/value pairs: port with the value 5000 and smtp_server with the value smtp.gmail.com.
Then, the protectData function runs the following steps:
dataSchema:
{
"email": "string",
"SMTPserver": {
"port": "int",
"smtp_server": "string"
}
}
2. Create an archive of data which is seen as a folder. In this folder, a file is created for each key. The type of each file matches the type of the corresponding key and the file contains the corresponding value specified in the data. It is possible to have sub-data that correspond to the sub key/value pairs of a key. This key is created as a folder in which a file is created for each sub-key/value pair. The global folder is zipped into an archive.
Here, the corresponding archive of the previous data example:
Example: right part to include
This tree structure allows you to protect any type of data such as files, text, image, and more. Additionally, the resulting archive can be easily uploaded to any storage platform, facilitating data storage and retrieval processes.
3. Generate an encryption key and encrypt the archive. The AES-256-CBC standard encryption scheme is used in this encryption. Then, the encrypted archive is pushed into the IPFS public storage.
4. Send to the DataProtector smart contract the data schema along with classic datasets creation arguments:
5. Push the encryption secret key to the SMS.
6. Return to the user the protectedData and metadata values.
2/ grantAccess that authorizes an application to use users’ data without ever revealing the data itself.
A data owner uses the grantAccess function to authorize an application and a requester to access his or her protected data. This function takes as inputs protectedData, authorizedApp and authorizedUser that are the addresses of the protected data, the application and the user respectively. Then, the grantAccess function runs the following steps:
3/ revokeAllAccessObservable that revokes all applications’ access to a specific protected data.
The revokeAllAccessObservable function is called by a data owner with the protectedData value and optionally, the authorizedApp filter and/or the authorizedUser filter. Then, the revokeAllAccessObservable function runs the following steps:
4/ revokeOneAccess that revokes an application's access to a specific protected dataset.
The revokeOneAccess function is similar to the revokeAllAccessObservable function except that the revocation is for one access. A data owner calls revokeOneAccess with grantedAccess as input to initiate the revocation of this access. The grantedAccess value can be obtained from the fetchGrantedAccess function. Then, revokeOneAccess runs the following steps:
5/ fetchProtectedData that retrieves encrypted data protected by DataProtector.
A user calls the fetchProtectedData function with optionally, an owner filter (to obtain only the encrypted data of a particular user) and/or a dataSchema filter (to retrieve the encrypted data with a specific schema). Then, the fetchProtectedData function processes the following steps:
6/ fetchGrantedAccess that provides the list of accesses granted on a specific protected data.
The fetchGrantedAccess function has a similar mechanism to the fetchProtectedData function except that the request is for the granted accesses of a given protected data. This request works as follows:
Using DataProtector, Web3Mail is a tool for developers to create applications that enable sending an email to Ethereum account holders without knowing their email address. By leveraging this tool, end-users can eliminate the requirement of sharing their email address with multiple third parties, significantly mitigating the risks associated with data breaches and spam.
Web3Mail relies on DataProtector to protect email addresses and interact with the iExec protocol, the sendEmail DApp and mailjet service to send emails.
In the iExec Marketplace, application providers create and sign ‘apporders’ that specify the governance of the application, e.g. the fee for each execution of the DApp. In Web3Mail, the sendEmail DApp is already deployed and the corresponding apporder has been signed and published in the iExec Marketplace. The sendEmail DApp takes the subject and the content of the email as requester secrets and sends an email to the protected email address.
In the iExec protocol, the requester secrets are parameters only exposed to authorized applications inside enclaves and never leave them. In Web3Mail, only sendEmail DApp can access the subject and the content of emails.
First of all, the Ethereum account holders use DataProtector to protect their email addresses and grant permission to other users to send them emails. An Ethereum account holder can specify a predetermined limit for accessing his protected email. Once this limit is reached, the account holder must call the grantAccess function of DataProtector to grant permission for further emails to be sent to him.
For each protected email, a dataset has been created and the corresponding datasetorder has been signed and published in the iExec Marketplace and indexed by the Graph.
Web3Mail comprises of two functions:
A user invokes the sendEmail function to send an email to an authorized Ethereum account holder, who can be retrieved using the fetchMyContacts function. The user specifies the email subject emailSubject, the email content emailContent and the protected email address protectedData.
The sendEmail function creates and signs an order called ‘requestorder’ to request an execution of the sendEmail DApp. Therefore, the process of this function is similar to creating a request for a task in the iExec protocol.
In the iExec ecosystem, a task is an instance where computing power is required. The task is the execution of a deal between a datasetorder, an apporder, a requestorder and a workerpoolorder, indicating which workers are available for which category of tasks. In Web3Mail, a task is an execution of sendEmail DApp with the protected email as dataset, the email subject and the email content as requester secrets.
sendEmail processes the following steps:
DataProtector and so Web3Mail utilize the Confidential Computing (CC) developed by iExec. The SMS used in iExec CC is a centralized component in which users send their secrets, e.g. the secret key for encrypting data.
When a secret is received, the SMS creates a secure session within the CAS (Configuration and Attestation Service), pushes in the secret and grants the application associated with the requestorder to access it.
However, due to the centralized nature of the SMS, there exists a potential single point of failure. If either the CAS or the SMS undergo an update or is down, there is a risk of losing the stored secrets.
To address this concern, iExec is actively working towards decentralizing the SMS, thereby mitigating the aforementioned issue and enhancing overall system resilience.
It is important to note that Web3Mail utilizes Mailjet services, employing an intermediate email address to facilitate the sending of emails. The level of trust in Web3Mail is directly linked to the trust placed in both the mailjet service and iExec operating it and having the ability to access the email addresses and the email content.