47 releases (15 breaking)

0.16.1 Jan 30, 2024
0.16.0 Nov 21, 2023
0.15.4 Nov 1, 2023
0.13.1 Jul 21, 2023
0.4.0 Nov 30, 2022

#339 in Filesystem


Used in 2 crates

MIT/Apache

760KB
16K SLoC

API Stability: Alpha

Noosphere

This is the entrypoint for most language-specific distributable packages the deal with accessing the Noosphere. It contains language-specific bindings and platform-sensitive behavior to provide a common set of high-level APIs.

Building Headers

To build the C FFI headers:

cargo run --features=headers --example generate_header

lib.rs:

This crate is a high-level entrypoint for embedders of the Noosphere protocol. Embedders may use [NoosphereContext] to initialize a singleton that enables manaing spheres, including creating new ones and joining existing ones.

#
let noosphere = NoosphereContext::new(NoosphereContextConfiguration {
    storage: NoosphereStorage {
        path: NoosphereStoragePath::Scoped("/path/to/block/storage".into()),
        config: NoosphereStorageConfig::default(),
    },
    security: NoosphereSecurity::Insecure {
        path: "/path/to/key/storage".into(),
    },
    network: NoosphereNetwork::Http {
        gateway_api: Some(Url::parse("http://example.com")?),
        ipfs_gateway_url: None,
    },
})?;

noosphere.create_key("my-key").await?;

let SphereReceipt { identity, mnemonic } = noosphere.create_sphere("my-key").await?;
    
// identity is the sphere's DID
// mnemonic is a recovery phrase that must be stored securely by the user

let mut sphere_channel = noosphere.get_sphere_channel(&identity).await?;
let sphere = sphere_channel.mutable();

// Write something to the sphere's content space
sphere.write("foo", &ContentType::Text, "bar".as_bytes(), None).await?;
sphere.save(None).await?;
// Sync the sphere with the network via a Noosphere gateway
sphere.sync().await?;

Dependencies

~19–37MB
~623K SLoC