Back to blog

How to Use Private IPFS

How to Use Private IPFS

Steve

IPFS has been the go-to offchain storage method for thousands of crypto and blockchain applications. Its combination of content addressability, immutability, and decentralization has made it ideal for referencing data that is too large to be stored onchain. While it does meet the needs of many applications, it does fall short when it comes to sensitive information. All data on IPFS is public, so if you want to store private or sensitive data, then you generally need to encrypt it first. However, as we have mentioned before, storing encrypted data on a public network is not privacy. Encryption is constantly moving and being broken, improved, then broken again. True privacy is not allowing any access to the data unless authorized.

This is why we built Private IPFS, and why it’s so important to the crypto space. Instead of using another cloud provider, you can reduce context switching and simply use Pinata for both your public and private file needs! Currently, Private IPFS is only hosted with Pinata, but we plan to implement private peer-to-peer networks so you can connect your own infra to Pinata (let us know if you’re interested!).

Using Private IPFS today is a breeze with our SDK. The upload class has both public and private methods.

const file = new File(["Super secrets"], "secrets.txt")
const { cid } = await pinata.upload.private.file(file)

Once a file is stored on Private IPFS, you can’t access it like a normal IPFS file through a Gateway. Instead, a temporary access link needs to be created, which, once again, the SDK makes simple by accepting a cid for the private file and the number of seconds the link is valid for (expires).

const link = await pinata.gateways.private.createAccessLink({
	cid: "bafkreic7v3isflp7ugn6ehqcqhlf2zbckwex5chwjaes3zqaijetaygdcu",
	expires: 180
})

You can also directly access the content using the get method.

const { data } = await pinata.gateways.private.get(cid)
// "Super secrets"

Private IPFS is ideal for when you need to store data that only an authorized person can access. We’ve already been using it in applications like CONCEALMINT, which provide a way to mint Private NFTs, as well as Farcaster Frames like Candyroad where you can sell digital files inside a frame. The possibilities are endless, but don’t take our word for it! Try Private IPFS today and see what you can build with it.

Happy Pinning!

Subscribe to paid plan image

Share this post:

Stay up to date

Join our newsletter for the latest stories & product updates from the Pinata community.