🪐Permissioned IPFS
Learn how to use Cherty for permissioned IPFS! Store and retrieve data using CIDs, with all of the verifiability and immutability benefits that come with IPFS, while controlling access.
Access Routes
Cherty uses access routes for permissioned IPFS resources, establishing a role-based permission system defining user access. An access route has the following properties:
cid
The content identifier of the resource with permissions being defined in this access route.
owner
admins
An array of public account objects defining admins, who are able to add or remove viewers from this access route.
viewers
An array of public account objects defining users who are able to view this resource.
The interpretation of an access route is that the CID's data is "copied to" the owner's account and they are able manage permissions for this copy. If another user establishes an access route for the same data, they are able to independently manage access. Thus, multiple access routes for the same CID may exist but they must have different owners.
For security, it is necessary that an access route may not be created owned by an account unless that account either (1) provides the data, or (2) is listed as a viewer or admin on another access route for the same data. Thus, possession of a CID is not sufficient to gain access to the data represented by that CID.
Usage Examples
See permissioned-ipfs api examples for a demo of how to use these endpoints.
To learn more about how Cherty handles identity, see Authentication.
Upload data: /api/upload
Type: POST
Protected: Yes (requires authorization header)
Accepts: Data stream
Returns: CID
This route uploads data and stores it to your account, then returns the CID.
Download Data: /api/file/cid
Type: GET
Protected: Yes (requires authorization header)
Accepts: CID
Returns: Binary data stream
This route takes a CID and, if you have access, retrieves the data.
List Access Routes: /api/access_routes/CID
Type: GET
Protected: Yes (requires authorization header)
Accepts: CID
Returns: Binary data stream
View permissions for a given CID. This route accepts a CID and returns all access routes visible to the authenticated account (ie. all routes where this account is the owner, or an admin or viewer).
Example response:
Edit Permissions: /api/edit_permissions
Type: GET
Protected: yes
Accepts: CID, Owner, Permissions Object, Mode ('add' / 'remove' / 'subtract')
Permissions object contains admins and viewers keys. Each is an array with either id_objects or id_cids or a mix of the two. Example:
Add mode will add the listed admins and viewers to the existing permissions, remove mode will remove them if they currently have access, and set mode will replace the existing permissions with the new list.
Last updated