.NET wrapper package for safe-api.
safe_app is a native library which exposes high level API for application development on SAFE Network. It exposes API for authorisation and to manage data on the network.
Maintainer: Ravinder Jangra (firstname.lastname@example.org)
|Azure DevOps||.NET Core MacOS, Android x86_64, iOS|
|Azure DevOps||.NET Core Linux|
|AppVeyor||.NET Core Windows|
Table of Contents
- Supported Platforms
- API Usage
- Useful resources
- Further Help
This project contains the C# bindings and API wrappers for the safe_app and mock safe_authenticator. The native libraries, bindings and API wrapper are built and published as a NuGet package. The latest version can be fetched from the MaidSafe.SafeApp NuGet package.
At a very high level, this package includes:
- C# API for devs for easy app development.
- safe-api and mock safe_authenticator bindings. These bindings are one to one mapping to the FFI functions exposed from safe_api and safe_authenicator native libraries.
- Native libraries generated from safe-api containing required logic to connect, read and write data on the SAFE Network.
- Xamarin.Android ( >=5.0. ABI: armeabi-v7a, x86_64)
- Xamarin.iOS ( >= 1.0, ABI: ARM64, x64)
- .NET Standard 2.0 (for usage via portable libs)
- .NET Core 2.2 (for use via .NET Core targets. Runtime support limited to x64)
- .NET Framework 4.7.2 (for use via classic .NET Framework targets. Platform support limited to x64)
To develop desktop and mobile apps for the SAFE Network install the latest MaidSafe.SafeApp package from NuGet.
This package provides support for mock and non-mock network. By default, non-mock API are used in the package.
Using Mock API
- Mock API can be used by adding a
SAFE_APP_MOCKflag in your project properties at Properties > Build > conditional compilation symbols.
- When the mock feature is used, a local mock vault file is generated which simulates network operations used to store and retrieve data. The app will then interface with this file rather than the live SAFE network.
- Applications must be authenticated via the SAFE Authenticator to work with the SAFE Network.
- The desktop authenticator is packed and shipped with the SAFE browser.
- On mobile devices, use the SAFE Authenticator mobile application.
The documentation for the latest
safe_app_csharp API is available at docs.maidsafe.net/safe_app_csharp.
We use DocFX to generate static HTML API documentation pages from XML code comments. The API docs are generated and published automatically during the CI build.
To generate a local copy of the API docs, install DocFX and run the following command:
- SafeApp: C# API for safe_api
- Fetch, Inspect, Files, Keys, Wallet, XorUrl
- safe_api and safe_app IPC bindings generated from safe_api and safe_client_libs
- Contains native libraries for the platform
- Mock Safe authentication C# API
- mock safe_authenticator bindings generated from safe_client_libs
- Classes required for mock auth functionality
- SafeApp.Core: Contains
- Constants used in SafeApp
- Binding utilities and helper functions
Interoperability between C# managed and unmanaged code
Platform invoke is a service that enables managed code to call unmanaged functions that are implemented in dynamic link libraries or native libraries. It locates and invokes an exported function and marshals its arguments (integers, strings, arrays, structures, and so on) across the interoperation boundary as needed. Check links in useful resources section to know more about how P/Invoke works in different .NET environments and platforms.
Interfacing with Safe Client Libs
The package uses native code written in Rust and compiled into platform specific code. Learn more about the safe_client_libs in the SAFE client libraries wiki.
Instructions to update the bindings can be found in the Update Bindings file.
We use shared unit tests for
safe_app and mock
safe_authenticator API which can be run on all supported platforms.
Instructions to generate the NuGet package can be found in the Package Instructions file.
- Visual Studio 2017 or later editions with the following workloads installed:
- Docfx - to generate the API documentation
- Cake - Cross-platform build script tool used to build the projects and run the tests.
As an open source project we're excited to accept contributions to the code from outside of MaidSafe, and are striving to make that as easy and clean as possible.
With enforced linting and commit style clearly laid out, as well as a list of more accessible issues for any project labeled with Help Wanted.
- Using High-Performance C++ Libraries in Cross-Platform Xamarin.Forms Applications
- Native interoperability
- Interop with Native Libraries
- Using Native Libraries in Xamarin.Android
- Referencing Native Libraries in Xamarin.iOS
Copyrights in the SAFE Network are retained by their contributors. No copyright assignment is required to contribute to this project.
This SAFE Network library is dual-licensed under the Modified BSD (LICENSE-BSD https://opensource.org/licenses/BSD-3-Clause) or the MIT license (LICENSE-MIT https://opensource.org/licenses/MIT) at your option.