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.
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.body const sig = rec.signature const verify = await senderPubkey.verify(msgBody, sig) // Print message const bytes = await privateKey.decrypt(msgBody) const body = new TextDecoder().decode(bytes) console.log(body)
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
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.