I am working on an app that allows users to share files with their friends. I use orbitdb to store IPNS hashes for mutability. The access control works with asymetric encryption and every “file” has the following structure
-> this file is encrypted with symetric encryption
-> those files contain the symetric key encrypted with the public key of every device that can read the file
-> those files contain the ipns private key encrypted with the public key of every device that can write to the file
I have no problem adding this to ipfs, but I have a concern on how to update a file.
There are 2 basic scenarios of updates:
- The file itself changes, this means updating the /data file, since the keys can stay the same
- Giving a user the ability to read/write to the file, where there is a new key added to one of the key directories /dataKeys/some-new-hash or /ipnsKeys/some-new-hash
Lets take example 2: How can I add a new key without uploading all other keys and the data file again? (Thats the main question, because with large files or many keys this will take a while and even consume a lot of data if you are on mobile)
I know that the ipfs hash changes due to how the content addressable web works, thats why I use IPNS to store the new hash after each update.
Right now I use ipfs.add to upload the file and I read the docs about the mutable file system, but the write/rm/… methods seam only to work with paths like /some/path/… and not with ipfs hashes.
I hope someone can help me clean up my confusion