This repository was archived by the owner on Sep 8, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
feat: restructure Web3Mail documentation and add integration guide #299
Merged
ErwanDecoster
merged 4 commits into
main
from
feature/better-web3mail-integration-guide
Jul 31, 2025
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
38be907
feat: restructure Web3Mail documentation and add integration guide
ErwanDecoster 2de9308
fix: update example email and message content in integration guide
ErwanDecoster b7ba464
fix: update integration guide with focus in code examples
ErwanDecoster f73a56e
Merge branch 'main' into feature/better-web3mail-integration-guide
ErwanDecoster File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,120 @@ | ||
| --- | ||
| description: | ||
| Integrate iExec Web3Mail to enable secure and private email communication via | ||
| blockchain-based access control, ensuring user privacy and decentralized email | ||
| control | ||
| --- | ||
|
|
||
| # iExec Web3Mail Integration Guide | ||
|
|
||
| ## Overview | ||
|
|
||
| Integrating **iExec Web3Mail** enables secure and private email communication | ||
| using blockchain-based access control. This allows users to send and receive | ||
| emails while maintaining full control over their data. | ||
|
|
||
| The integration process consists of the following steps: | ||
|
|
||
| 1. **Get your user to protect their email address via the iExec Data Protector | ||
| SDK.** | ||
| 2. **Create the protected data via the iExec Data Protector SDK.** | ||
| 3. **Grant access via the Data Protector SDK to authorize users to send | ||
| emails.** | ||
| 4. **Send emails securely using the Web3Mail SDK.** | ||
|
|
||
| ## 1. Get your users to protect their email address | ||
|
|
||
| To enable messaging via Web3Mail, you need your users to protect their email | ||
| address using iExec's Data Protector. | ||
|
|
||
| An **email address** is protected and encrypted using iExec's technology. This | ||
| ensures that it remains **encrypted and private**, so only **authorized | ||
| senders** can contact the user **without revealing their actual email address**. | ||
| By **protecting their email address with iExec**, users ensure that only | ||
| **authorized applications and users** can send them emails. | ||
|
|
||
| ### Steps: | ||
|
|
||
| - Ask the user to protect their email address using the Data Protector SDK. | ||
| - The protected data address will be used as an identifier for sending emails. | ||
| - Users maintain full control over who can send them emails and can revoke | ||
| access at any time. | ||
|
|
||
| ::: tip | ||
|
|
||
| - Once the email address is protected, all authorized senders can send emails | ||
| without knowing the actual email address. | ||
| - The recipient can revoke access at any time to stop receiving emails from | ||
| specific senders. | ||
|
|
||
| ::: | ||
|
|
||
| ## 2. Create the protected data with data protector SDK | ||
|
|
||
| Your users need to protect their email address using iExec's Data Protector to | ||
| ensure privacy and security. | ||
|
|
||
| <!-- prettier-ignore --> | ||
| ```ts twoslash | ||
| import { IExecDataProtectorCore, getWeb3Provider } from '@iexec/dataprotector'; | ||
|
|
||
| const web3Provider = getWeb3Provider('PRIVATE_KEY'); | ||
| const dataProtectorCore = new IExecDataProtectorCore(web3Provider); | ||
| const protectedData = await dataProtectorCore.protectData({ // [!code focus:5] | ||
| data: { | ||
| email: 'example@gmail.com', // User's email address | ||
| }, | ||
| }); | ||
| ``` | ||
|
|
||
| ## 3. Grant access via data protector SDK | ||
|
|
||
| To allow specific users or applications to send emails, you must explicitly | ||
| grant access. | ||
|
|
||
| <!-- prettier-ignore --> | ||
| ```ts twoslash | ||
| import { IExecDataProtectorCore, getWeb3Provider } from '@iexec/dataprotector'; | ||
|
|
||
| const web3Provider = getWeb3Provider('PRIVATE_KEY'); | ||
| const dataProtectorCore = new IExecDataProtectorCore(web3Provider); | ||
| const grantedAccess = await dataProtectorCore.grantAccess({ // [!code focus:10] | ||
| protectedData: '0x123abc...', // Protected email data address | ||
| authorizedApp: '0x456def...', // Web3Mail app address | ||
| authorizedUser: '0x789cba...', // Ethereum address of the authorized sender | ||
|
ErwanDecoster marked this conversation as resolved.
ErwanDecoster marked this conversation as resolved.
|
||
| pricePerAccess: 3, // Cost per email (in iExec tokens) | ||
| numberOfAccess: 10, // Allowed email count | ||
| onStatusUpdate: ({ title, isDone }) => { | ||
| console.log(title, isDone); | ||
| }, | ||
| }); | ||
| ``` | ||
|
|
||
| ## 4. Send emails via Web3Mail SDK | ||
|
|
||
| Once authorized, a user can send emails via Web3Mail SDK. | ||
|
|
||
| <!-- prettier-ignore --> | ||
| ```ts twoslash | ||
| import { IExecWeb3mail, getWeb3Provider } from '@iexec/web3mail'; | ||
|
|
||
| const web3Provider = getWeb3Provider('PRIVATE_KEY'); | ||
| const web3mail = new IExecWeb3mail(web3Provider); | ||
| const sendEmail = await web3mail.sendEmail({ // [!code focus:7] | ||
| protectedData: '0x123abc...', // Protected email data address | ||
|
ErwanDecoster marked this conversation as resolved.
|
||
| emailSubject: 'My email subject', | ||
| emailContent: 'My email content', | ||
| senderName: 'Arthur', | ||
| contentType: 'text/html', // or 'text/plain' | ||
| }); | ||
| ``` | ||
|
|
||
| ## Conclusion | ||
|
|
||
| By integrating **iExec Web3Mail**, you ensure privacy, security, and | ||
| decentralized control over your email communication. Your users decide who can | ||
| send them emails and set a cost for access while keeping their email address | ||
| hidden. | ||
|
|
||
| For further support, join the iExec community on | ||
| [Discord](https://discord.com/invite/pbt9m98wnU). | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.