Inbox Entries
Inboxes allow users to receive encrypted entries, either from external or internal sources.
-
Internal sources are people who have access to an Inbox, or are simply registered in a given Context. Those users are known to your application, and their entries can be linked to their accounts.
-
External sources are people from the outside; they do not have an account linked with your app. For example, someone who fills out an online contact form without the need to create an account.
The key difference between Inboxes and other PrivMX Modules is that people don't need accounts in your app to be able to submit entries.
About Entries
The structure of an entry and a brief description of its elements is outlined in the following table:
| Field | Type | Encrypted | Description |
|---|---|---|---|
data | binary | Content of the entry | |
files | File[] | List of attached files | |
authorPubKey | string | Public key of the author |
Define Data Structure
Inbox's architecture does not require you to use a specific data structure inside the entries. Before working with Inboxes, define the structure of your entries.
We recommend future-proofing your entries by choosing an easily modifiable format. It is a good idea to include both a type and a version field in the structure.
Example: Form with Text Answer
The type field allows future support for different types of entries like: "select_answer", or "multi_select".
And in case of changing the schema, you can always distinguish between them using "version" field.
Remember that this is only an example and you should consider your app's requirements and limitations.
Sample code on this page is based on the initial assumptions.
Public Access to an Inbox
PrivMX Endpoint client provides different ways to connect to a Bridge instance.
When using "public" connection (connectPublic(...)) you don't have to pass a private key. A random private key will be generated for each connection.
The public connection provides only the methods related to sending Inbox entries and retrieving public metadata related to the Inbox.
Connect to the Public Inbox API
Reading Inbox Public View
getInboxPublicView(...) gets all the data stored inside the Inbox' publicMeta.
Submitting Entries
Adding a Simple Entry (without Files)
Adding an Entry with Files
Fetching Entries
Fetching Entries requires a secure private connection.
Reading Simple Text Entries
Reading Entries Containing Files
We use cookies on our website. We use them to ensure proper functioning of the site and, if you agree, for purposes such as analytics, marketing, and targeting ads.