22 releases (12 breaking)

new 0.29.1 Jun 17, 2021
0.28.1 Jun 15, 2021
0.21.0 Mar 16, 2021
0.17.0 Dec 23, 2020
Download history 11/week @ 2021-02-25 24/week @ 2021-03-04 15/week @ 2021-03-11 4/week @ 2021-03-18 28/week @ 2021-03-25 15/week @ 2021-04-01 47/week @ 2021-04-08 58/week @ 2021-04-15 21/week @ 2021-04-22 57/week @ 2021-04-29 19/week @ 2021-05-06 29/week @ 2021-05-13 80/week @ 2021-05-20 37/week @ 2021-05-27 26/week @ 2021-06-03 107/week @ 2021-06-10

192 downloads per month

MIT OR BSD-3-Clause and GPL-3.0 licenses

425KB
9K SLoC

The Safe API

MaidSafe website Safe Dev Forum Safe Network Forum

Table of contents

Description

This crate provides all that's needed by any Rust application which intends to connect and read/write data on The Safe Network.

A Rust Safe application can make use of the sn_api crate to be able to not only read/write data on the Safe Network but also to send/receive authorisation requests to the Safe Authenticator (see https://hub.safedev.org/discover for additional info of the Authenticator). You can find more information about the Authenticator in MaidSafe reference implementation sn_authd.

Safe app authorisation flow

The following diagram depicts how each of the client side components fit in the Safe applications ecosystem.

Safe API ecosystem

The API

The Safe API provides all the functions needed to communicate with the The Safe Network and the Safe Authenticator. If you are developing a Rust application for Safe, this is all you need as a dependency from your app.

There are currently three different APIs provided by this crate:

  1. The API for regular Safe applications which read and write data to Safe. This API exposes all the functions needed to manipulate data, with the additional auth_app to obtain a key-pair from sn_authd, and connect for connecting to Safe (providing a key-pair if write access is required by the app).
  2. An API for Authenticator apps, like sn_authd which makes use of this API. This is a small API which exposes functions to create, read and update a private container on Safe where to store the set of key-pairs the user administers for his/her apps, as well as some utilities to parse/generate messages that can be received/sent on an RPC mechanism like what sn_authd does with JSON-RPC over QUIC. The container with key-pairs is stored on Safe at a location derived from a passphrase and password provided by the user.
  3. API to communicate with an Authenticator through JSON-RPC over QUIC. This can be used by apps which can manage an Authenticator app, as an example CLI uses this API to start/stop authd, to send a request to create a Safe, to allow/deny an app authorisation request, to lock/unlock a Safe, etc. The $ safe auth commands act simply as the user interface for the sn_authd using this API to communicate with it.

Further Help

You can discuss development-related questions on the Safe Dev Forum. If you are just starting to develop an application for the Safe Network, it's very advisable to visit the Safe Network Dev Hub where you will find a lot of relevant information.

License

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.

Contributing

Want to contribute? Great 🎉

There are many ways to give back to the project, whether it be writing new code, fixing bugs, or just reporting errors. All forms of contributions are encouraged!

For instructions on how to contribute, see our Guide to contributing.

Dependencies

~36MB
~805K SLoC