Files
The Files SDK offers developers the functionality of an encrypted IPFS drive. It creates a list of references and secret keys to files stored on IPFS, where each file is encrypted with its own secret. This way, if one secret key is compromised, there is no compromise of the entire drive.
Note: The list of files and secrets is only visible to the Wallet.
Here is a step-by-step guide on how to work with files in NotVault using TypeScript:
Import the necessary libraries:
Instantiate the NotVault and Files classes:
Add a new file:
Use the
add
method of thefiles
instance to add a file to the vault.The method requires the filename and the content of the file. The content should be in Base64 format when dealing with binary data.
The method also accepts a callback function that reports the progress of the upload operation.
Retrieve the contents of a file given its CID:
Use the
get
method of thefiles
instance to retrieve a file from the vault using its Content Identifier (CID).
List all the files linked to a specific wallet:
Use the
list
method of thefiles
instance to retrieve a list of all files linked to the specific wallet in the vault.
Remove a file from a private list:
Use the
remove
method of thefiles
instance to remove a file from the vault using its Content Identifier (CID).
By following these steps, you can manage your files within the NotVault environment securely and efficiently.
Last updated