Introducing the User Mailbox API - Send messages between any users or public key owners

developers Aug 14, 2020

Our mission at Textile is to help developers explore their ideas... faster. We've found time and time again, that there are a few problem areas all developers eventually hit when building on the Web3 stack. User messaging is one of them. Simple peer to peer messaging is useful when trying to build features such as social invites, private key exchange, notifications, and others.

Today we're introducing User Mailboxes — to help any Web3 application more easily build features where their users need to send or receive secure messages. The Mailbox API provides an always-on endpoint to leave messages for peers even when they are offline.

This collection of new APIs are built on Textile Threads and are designed to support private-key encryption, so only the recipient and sender will ever know the contents of their messages.

How Textile Mailboxes work

Developers using the Textile libraries with the Textile Hub already have free access to end-user mailboxes in their application. Any users created by developer applications can initiate a new mailbox with a single command in your app. Mailboxes contain sentmail, encrypted by the sender's key, and an inbox containing encrypted copies of all messages sent to that user. Users can send messages to any other mailbox just by knowing the recipient's public key. Mailboxes are scoped within a single application per user.

Using mailboxes allows your app to easily send invites, private messages, read receipts, and other app-specific messages between your users. Mailboxes can enhance p2p messaging by providing peers an always-on endpoint to leave updates for peers when recipients are offline. We saw the need for this API originating from many teams building at HackFS, so we are excited to make it a reality for developers to start using immediately.

// Check mailbox
const rec = await user.listInboxMessages()

// Verify sender's signature
const msgBody = rec[0].body
const sig = rec[0].signature
const verify = await senderPubkey.verify(msgBody, sig)

// Print message
const bytes = await privateKey.decrypt(msgBody)
const body = new TextDecoder().decode(bytes)


Built on Threads

Like Buckets before, mailboxes build on the Threads protocol (an event-sourced database protocol that runs on IPFS). And just like Buckets, we will be working on polishing and making this system useful to projects on and off the Textile Hub. Interoperability FTW!

As seen in the wild

We're excited to share that Fleek is already building on the Mailbox API, enabling new features in the Space Daemon. Lots to look forward to there!

Learn more

You can read more about Mailboxes in the Textile documentation. Or,

Textile mailboxes currently support all ed25519 base keys but we will be expanding the available user model(s) soon. If you have a particular need or interest, follow or contribute to the ticket on GitHub.

Contact 💥

Great! You've successfully subscribed.
Great! Next, complete checkout for full access.
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.