Storing Encrypted Data on ComposeDB With Lit Protocol

The integration between Lit Protocol and Ceramic allows developers to build applications that provide users with more control over their data and privacy.

Storing Encrypted Data on ComposeDB With Lit Protocol

We’re excited to announce the integration of Lit Protocol and Ceramic, enabling developers to store encrypted data on ComposeDB. This integration allows developers to build applications that provide users with more control over their data and privacy.

What is Lit Protocol?

Lit Protocol is a decentralized key management system that allows users to encrypt their data and control who has access to it. Lit Protocol’s access control system gives users granular control over who can access and use their data.

Along with flexible access control features, Lit also offers tooling around multi-party computation (MPC). MPC enables secure reading and writing of data between blockchains and off-chain platforms, such as programmable signing that allows developers to build distributed serverless functions that have event listening capabilities to create specific triggers for executing programmatic signing, and much more.

Why integrate Lit Protocol and Ceramic Network?

The integration between Lit Protocol and Ceramic allows developers to build applications that provide users with more control over their data and privacy.

The Ceramic protocol is built on decentralized event streams, where user accounts (enabled by decentralized identifiers, or DIDs) cryptographically sign data events and submit them to the network. These events are stored in the Interplanetary File System (IPFS) using the IPLD protocol, and organized into readable streams. Each stream is flexible enough to store many types of content. Therefore, Ceramic is home to a diversity of different data use cases such as user profiles, posts, relations to other entities and more.

Due to Ceramic's open readability, any participating node can read from any stream in the network. Therefore, encrypting data using Lit Protocol and saving it on Ceramic is a common (and necessary) integration for many teams.

A Peek Under the Hood

Given Ceramic’s architecture, Lit Protocol’s access control capabilities allow developers to gate access to content based on highly flexible conditions. For instance, developers may want to allow their users the ability to grant read access to all addresses that hold a specific NFT or ERC20 asset. With Lit Protocol, developers allow their users to assign access control conditions that are associated with the encrypted object when generated. The Lit nodes confirm those conditions have been satisfied using the user’s wallet signature when they request access. This offers a seamless user flow for the end user, whereas (without Lit Protocol) users might otherwise be required to manually decrypt or re-encode their encrypted data for other users they want to grant access to.

How to Use Lit Protocol to Encrypt Messages and Save Them to Ceramic

To use Lit Protocol to encrypt messages and save them to Ceramic using ComposeDB, you can follow the tutorial here. This tutorial uses a message board example application to show you how to create encrypted messages using Lit Protocol and save message instances to the Ceramic Network using ComposeDB.

In the tutorial, you’ll learn how to:

  • Create ComposeDB schemas and deploy those models on a local Ceramic node
  • Authenticate users on Ceramic to allow them to author their own documents
  • Encrypt data with Lit Protocol and write mutation queries to save the encrypted data to ComposeDB using GraphQL
  • Decrypt data using Lit Protocol based on specific access control logic

What do you need to get started?

As outlined in the tutorial, the only dependencies you’ll need are:

Want to Learn More about Building on Ceramic?


Build an AI Chatbot on Ceramic

Build an AI-powered Chatbot and save message history to ComposeDB by following this ComposeDB Tutorial.

How to Use and Store Composable Attestations with Ceramic and Ethereum Attestation Service

Walk through a tutorial on how to generate attestations (using Ethereum Attestation Service) and store them on ComposeDB.

ComposeDB API Sandbox

Use the ComposeDB API Sandbox to test example queries on a real dataset.

Create a Social App on ComposeDB

The Social App ComposeDB Starter will help you get started building your own social app.

Let us know what you think about our integration with Lit Protocol on the Forum!