Every item in the meeco vault has the capability of having multiple files attached to it. The attachments are always attached to the item via a slot with the slot_typeattachment. Assuming you have created an item already (such as the one you may have created in the getting-started page) and have the .item.config file still, lets create another item with that same config so as not to conflict with other steps later on in this guide.
the next step is to create an attachment-config.yaml file with the following content.
kind:FileAttachmentmetadata:item_id:e8670e6c-8a95-43ff-a8d1-08805f612250# (target item id from .item2.yaml)spec:label:'Secret test webm video'file:'./test.webm'
Note: The slot's encrypted_value in this case is a new encryption key which has been encrypted with the user's own private data encryption key. The reason the file gets encrypted with a new data encryption key instead of directly with the user's existing private data encryption key has to do with sharing. By using this method when sharing, instead of having to re-encrypt the whole file with another data encryption key the slot's encrypted_value can simply be decrypted then re-encrypted with the data encryption key used for sharing.
Downloading the Attached File
To download an attached file the CLI needs to know the item's id and the slot's id, this is so the CLI can decrypt the data encryption key from the encrypted_value of the slot (as mentioned above). Both of these values can be found in the .attach-response.yaml file under slots[0].id and slots[0].item_id.
Sharing an attachment simply works the same way you would share any other slot. First you will need to have a connection to another user, see the directions in the "Connections and Sharing" page to set up a connection first. Assuming you have a connection set up already and have the second user's info in a .bob.yaml file...
Using the file-storage-browser or file-storage-node Packages
The above flow is a great start to understanding how everything works however for actual product implementation these npm packages are likely to be more useful so please head to the following links and check out the README.md files there.