💽Storage Module
The Storage module, accessible via ssx.storage
, provides functionality to store and retrieve data in Kepler. Kepler is architected as a decentralized storage system that uses DIDs and Authorization Capabilities to define where your data lives, and who has access. Any DID controller (e.g. people, applications, DAOs) can administer their own Kepler Orbit.
Background
Some of the functions for the KeplerStorage Module are written in Rust and made available to the SDK through WebAssembly. This allows for a more secure and performant implementation of these functions using SpruceID's audited Rust libraries.
Getting Started
By using Kepler via the storage module within SSX, you hereby agree to the Kepler Developer Terms found here.
To use the storage module within SSX, you will need to configure the modules
parameter in the SSX configuration object.
Below is an example of initializing a SSX instance with the storage enabled:
Below are descriptions of the configuration parameters for the storage module:
Parameter | Type | Description | default |
---|---|---|---|
|
| A prefix to be used for all keys stored in the storage service. |
|
|
| A list of Kepler hosts to use for the storage service. |
|
|
| A flag to indicate whether to create a new orbit if one does not exist. If this is off, a createOrbit call must happen for the user to have an orbtit created. |
|
Orbit Creation (Optional)
Orbits are the namespace that is created by a user to store data. They are the source of authority in their orbit — they authorize other dids and keys to read and write data to their orbit.
You'll need to create an orbit to store data for your user. If you've configured the autoCreateNewOrbit
parameter to true
, then an orbit will be created automatically when you sign in, if a user does not have one. If you've configured it to false
, then you'll need to manually create an orbit (see activateSession and hostOrbit methods).
Methods
activateSession
Checks if an orbit exists for the user.
Here is an example of how to use it:
delegate
Delegates the stored data.
Here is an example of how to use it:
delete
Deletes the stored value associated with a specific key.
Here is an example of how to use it:
deleteAll
Deletes all stored key-value pairs in the storage.
The prefix
parameter is optional. If given, it will delete all data in that prefix. Default to empty string.
Here is an example of how to use it:
get
Gets the stored value associated with a specific key.
Here is an example of how to use it:
generateSharingLink
Generates a link pointing to stored content.
Here is an example of how to use it:
hostOrbit
Creates an orbit for the user manually.
Here is an example of how to use it:
list
Lists all the keys currently stored.
Here is an example of how to use it:
put
Stores a value with a specific key.
Here is an example of how to use it:
retrieveSharingLink
Retrieves content given a shareBase64 string.
Here is an example of how to use it:
Last updated