Struct noosphere::NoosphereContext
source · pub struct NoosphereContext { /* private fields */ }Expand description
A NoosphereContext holds configuration necessary to initialize and store Noosphere data. It also keeps a running list of active SphereContext instances to avoid the expensive action of repeatedly opening and closing a handle to backing storage for spheres that are being accessed regularly.
Implementations§
source§impl NoosphereContext
impl NoosphereContext
sourcepub fn new(configuration: NoosphereContextConfiguration) -> Result<Self>
pub fn new(configuration: NoosphereContextConfiguration) -> Result<Self>
Initialize a NoosphereContext with a NoosphereContextConfiguration
sourcepub async fn create_key(&self, key_name: &str) -> Result<()>
pub async fn create_key(&self, key_name: &str) -> Result<()>
Create a key in the locally available platform key storage, associating it with the given human-readable key name
sourcepub async fn has_key(&self, key_name: &str) -> Result<bool>
pub async fn has_key(&self, key_name: &str) -> Result<bool>
Check if a key has been created, given its human-readable key name
sourcepub async fn create_sphere(&self, owner_key_name: &str) -> Result<SphereReceipt>
pub async fn create_sphere(&self, owner_key_name: &str) -> Result<SphereReceipt>
Create a sphere, generating an authorization for the specified owner key to administer the sphere over time
sourcepub async fn join_sphere(
&self,
sphere_identity: &Did,
local_key_name: &str,
authorization: Option<&Authorization>
) -> Result<()>
pub async fn join_sphere( &self, sphere_identity: &Did, local_key_name: &str, authorization: Option<&Authorization> ) -> Result<()>
Join a sphere by DID identity, given a local key and an Authorization proving that the key may operate on the sphere. This action will initalize the local sphere workspace, but none of the sphere data will be available until the local application syncs with a gateway that has the sphere data.
sourcepub async fn get_sphere_channel(
&self,
sphere_identity: &Did
) -> Result<PlatformSphereChannel>
pub async fn get_sphere_channel( &self, sphere_identity: &Did ) -> Result<PlatformSphereChannel>
Access a SphereChannel associated with the given sphere DID identity. The related sphere must already have been initialized locally (either by creating it or joining one that was created elsewhere). The act of creating or joining will initialize a SphereChannel, but if such a channel has not already been initialized, accessing it with this method will cause it to be initialized and a reference kept by this NoosphereContext.