0.0.1 • Published 7 years ago

userspace v0.0.1

Weekly downloads
3
License
Apache-2.0
Repository
github
Last release
7 years ago

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

new UserSpace(muDID)

Instantiates a user space

Returns: UserSpace - self

ParamTypeDescription
muDIDMuPortA 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

ParamTypeDescription
keyStringthe 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

ParamTypeDescription
keyStringthe key
valueStringthe value

userSpace.remove(key) ⇒ Boolean

Remove the value for the given key

Kind: instance method of UserSpace
Returns: Boolean - true if successful

ParamTypeDescription
keyStringthe 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

ParamTypeDescription
addressStringan ethereum address