Signatures
Learn how to use Pinata to cryptographically sign CIDs
In a post-AI world it will become more and more evident that every piece of content will need a cryptographic signature to verify it’s authenticity. Pinata is taking steps in this direction with the Signatures API and the Content Addressable Gateway Plugin.
Signature Standard
Pinata is using the EIP-712 signature standard for signing CIDs with the following domain and types.
address
- Type:
address
The wallet address of the user singing the CID
cid
- Type:
string
The target CID to be signed
date
- Type:
string
The date the target CID was first uploaded to Pinata
Creating a Signature
In order to sign a CID you can use any library that support EIP-712 signing, like the example below with viem.
Adding Signature to CID
In order to attach a signature to a CID the following requirements must be met:
- The CID being signed is owned by the signer
- The CID being signed was first uploaded by the signer
- The CID must not already have an existing signature with Pinata
After creating the signature with the previous step you can add it to the CID with the add method in the SDK.
Getting a Signature for a CID
There are two ways you can an existing signature for a CID: the get method in the SDK or the Content Addressable Gateway Plugin.
Content Addressable Gateway Plugin
After installing the plugin you can simply request a CID through the Dedicated Gateway and get the signature in the header pinata-signauture
.
SDK
You can also use the get method to get a signature for a given CID.
This method will check all CIDs on Pinata and will return a signature if it exists
Verifying a Signature
Since the signatures are using the EIP-712 standard you can use a library like Viem to verify with the same typed data used to create it.
Removing a Signature for a CID
To delete an existing signautre for a given CID you can use the delete method.