userspace v0.0.1
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 = require('userspace')
UserSpace.open(web3.eth.accounts[0]).then(userspace => {
// Code goes here...
})
UserSpace
Kind: global class
- UserSpace
- new UserSpace(muDID)
- instance
- .get(key) ⇒ String
- .getAll() ⇒ Object
- .set(key, value) ⇒ Boolean
- .remove(key) ⇒ Boolean
- static
new UserSpace(muDID)
Instantiates a user space
Returns: UserSpace - self
Param | Type | Description |
---|---|---|
muDID | MuPort | A MuPort DID instance |
userSpace.get(key) ⇒ String
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 |
userSpace.getAll() ⇒ Object
Get all of the items in the userspace
Kind: instance method of UserSpace
Returns: Object - an object containing all items
userSpace.set(key, value) ⇒ Boolean
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 |
userSpace.remove(key) ⇒ Boolean
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.open(address) ⇒ UserSpace
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 |
7 years ago