Provides libraries to interface with SAFE network via terminal or headless system, abstracting away necessary state and IPC concerns while allowing the flexibility of redirecting and piping with standard terminal commands.
This summary may appear as the obvious expectation for a CLI binary, but it's meant to point out the contrast to the initial implementation which keeps the user tied to a CLI process, failing to provide the flexibility to interprocess with other commands. Additionally, user is disconnected from network plus loses App state upon exiting CLI process.
Primary components:
In this document you'll see the term file descriptor
which is meant to be a generic cross-platform term for differing platform IPC implementations
- Handles single instance management and IPC
- Following Chromium's example, on Windows IPC and single instance management will be handled with named mutex
- Following Chromium's example, on Linux IPC and single instance management will be handled with Unix domain socket
- Single instance per operating system
- polls unique file descriptor for data writes
- holds Authenticator instance in memory
- One unique instance per application
- polls unique file descriptor for data writes
- holds App instance handle in memory
- global command binary to interface with authenticator process and CLI application processes
$ safenetwork create_acc <locator> <password> <invite>
Initiates program to create secure credentials on network. On completion, if Authenticator
process running, credentials sent via file descriptor to Authenticator
process, where create_acc
is called and Authenticator
struct is held in memory.
If Authenticator
process isn't running, Authenticator
process started with input credentials.
$ safenetwork login <locator> <password>
User inputs credentials, which are sent via file descriptor to Authenticator
process, where login
is called and Authenticator struct is held in memory.
If Authenticator
process isn't running, Authenticator
process started with input credentials.
$ safenetwork initialise <app_info and permissions as JSON>
Spawns process for CLI Application
, generates AppExchangeInfo
struct based on parsed JSON input, to be held in memory.
$ safenetowrk authorise <app_info.id> <permissions as JSON>
Request sent to file descriptor, based on app info id, associated with CLI Application
which then encodes auth request and sends to Authenticator
via Authenticator
-associated file descriptor.after approval CLI Application
process will receive AuthGranted struct
$ safenetwork registered <app_info.id>
Request sent to CLI Application
process via associated file descriptor based on app info ID. A registered session is created, connecting Authorised application to network, returning an App struct which maintains connection and allows data manipulations to be made on the network. App struct held in memory in associated CLI Application
process, which is listening for further SAFE network data operations.
$ safenetwork quick_app
As a convenience to human users, default CLI Application
is initialised, authorised with default permissions, and registered on network.
$ safenetwork upload <file path> <app_info.id>
File path string is sent via file descriptor to CLI Application
process, where file buffer is retrieved and uploaded to network.
If no app ID is supplied, file is uploaded via default CLI application
created with safenetwork quick_app