UserSpace
Warning: This project is under active development, APIs are subject to change.
This is a library which allows you to set, get, and remove data associated with an ethereum account. It can be used to store identity data, user settings, etc. by dapps that use a web3 enabled browser. The data will be retrievable as long as the user has access to the private key for the used ethereum account. Data is backed up using an identity hub.
Take a look at the demo to get a feeling of how it works!
Usage
Simply install using npm
$ npm install userspace
and then import into your project
const UserSpace = UserSpace
UserSpace
Kind: global class
- UserSpace
- new UserSpace(muDID)
- instance
- .get(key) ⇒
String
- .getAll() ⇒
Object
- .set(key, value) ⇒
Boolean
- .remove(key) ⇒
Boolean
- .get(key) ⇒
- static
new UserSpace(muDID)
Instantiates a user space
Returns: UserSpace
- self
Param | Type | Description |
---|---|---|
muDID | MuPort |
A MuPort DID instance |
String
userSpace.get(key) ⇒ Get the value of the given key
Kind: instance method of UserSpace
Returns: String
- the value associated with the key
Param | Type | Description |
---|---|---|
key | String |
the key |
Object
userSpace.getAll() ⇒ Get all of the items in the userspace
Kind: instance method of UserSpace
Returns: Object
- an object containing all items
Boolean
userSpace.set(key, value) ⇒ Set a value for the given key
Kind: instance method of UserSpace
Returns: Boolean
- true if successful
Param | Type | Description |
---|---|---|
key | String |
the key |
value | String |
the value |
Boolean
userSpace.remove(key) ⇒ Remove the value for the given key
Kind: instance method of UserSpace
Returns: Boolean
- true if successful
Param | Type | Description |
---|---|---|
key | String |
the key |
UserSpace
UserSpace.open(address) ⇒ Opens the user space associated with the given address
Kind: static method of UserSpace
Returns: UserSpace
- the userspace instance for the given address
Param | Type | Description |
---|---|---|
address | String |
an ethereum address |