Access authentication


Is it possible to add a file into IPFS so that only authenticated peers can access it? If yes, what is the recommended method for authentication?


Short answer: Not directly.

Longer answer:

At a file level, no authentication capabilities are available in IPFS. You can achieve this at the application level by first encrypting files before adding them to IPFS and giving the key and file hash only to authorized users. Your application will need to be responsible for user management and for distributing these keys.

If you only ever want trusted nodes to communicate with each other you can use the private network experimental feature.
Note: Nodes that belong to a private swarm can only communicate with other private swarm members with the same key, you will be unable to communicate with the main IPFS network with this feature enabled.