"meta" a public file describing the file meta information. The protected content is stored in a secure manner. You can share this address with everyone. They won't be able to access the protected content. Only read the file metadata.
"acl" a smart contract address for controlling all the file access permissions and rules for the .
Grant permission to another device
Create a new account for node 2:
Generate the token for node 2 account 0xFb0bC1AC4a627fcdd215b7eF9617172276a402d0:
Attempt to read the protected file with node 2 account credentials (token):
Note: Replace [meta] and [token] in the query string with the meta hash and token string you generated.
Where:
meta is the protected's file public meta address: QmbVtvd1rD9pDHpx7AUqrsh3CoCMW3Na3g4fAwXJxyaawz
token is your auth token generated by /user/signin request
Output:
This error is expected because the file owner never actually granted permission to Lightstreams node 2 account: 0xFb0bC1AC4a627fcdd215b7eF9617172276a402d0.
Let's grant Leth node 2 a read permission.
Granting a READ permission
From Node 1 account run:
Where:
acl corresponds to the smart contract address provided after we published the file
to is the account we are granting access to
permission is the permission to grant, it may be: ['read', 'write', 'admin', 'noaccess']
Try to access the file again
Reading the meta file
In case you want to get information about the privately stored file, you can do so using the /storage/meta route.
This returns public information about the file, without revealing its content.
Output:
Note:
filename is the original filename when file was uploaded
ext is the original file extension
owner who uploaded the file
hash the hash of the protected file stored in IPFS (not the public Meta file hash)
acl address of the contract handling file permissions
Congratulations! You just shared a private file over the internet in a peer-to-peer manner.
curl --request GET 'http://localhost:9092/storage/stream?meta=[meta]&token=[token]'
{"error":{
"message": "no READ access. Account '0xFb0bC1AC4a627fcdd215b7eF9617172276a402d0' is unable to access Smart Vault protected file 'QmXT5yfwk9zpVHZZ9WYzAFiSV3N2YAx8nFqd5w3t2jrsvo' with public meta 'QmbVtvd1rD9pDHpx7AUqrsh3CoCMW3Na3g4fAwXJxyaawz'.",
"code":"TOKEN_DENIED"
}