Network File System (NFS)

📘

The API Docs have moved to a new website

Go to api.safedev.org to find the latest version of the API Docs.

The NFS API can be used to create directories and files on the SAFE Network.

The NFS API enables the creation of private and public directories. Private directories are encrypted with the user’s MAID keys and thus are only accessible by the user. Public directories are stored as unencrypted data on the network. Public directories can be used to share public data.

Public directories are created mostly to map with a service and long name using the DNS API, making it easy to share.

A directory called SAFEDrive can be used to store data that needs to be shared between multiple apps. This directory exists independently of any app.

When an app is authorised by a user for the first time, SAFE Launcher creates an exclusive directory for that app. This is the app’s root directory, and it's sandboxed such that other apps cannot access its content. So if the app wants to create its own configuration files, directories...etc..., which it does not want to share with other apps, it can put them into its dedicated root directory.

Applications can create directories and files in their dedicated root directory or in the SAFE Drive of the user. To access SAFE Drive, the application must be authorised with the SAFE_DRIVE_ACCESS permission.

NFS API Conventions

FieldDescription
rootPathAn enum representation of the root directory.

Accepted value - app or drive

app specifies the application’s root directory, while drive corresponds to SAFE Drive.

For example, /home/images/ can either refer to /SAFEDrive/home/images/ or /sample-app-root-dir/home/images/ depending on if rootPath refers to drive or app respectively.
directoryPathThe full path of the directory (e.g. /home/images/).
isPrivateA boolean value to indicate whether the directory being created is private or public.
filePathThe full path of the file (e.g. /home/images/sample.png).