Giter VIP home page Giter VIP logo

uport-registry's Introduction

uPort Registry

The uport registry is a contract which is used in the uport system to link attributes to identities. This repo contains the contract code as well as a library for interacting with the registry.

Deployed Contracts

The registry has been deployed at the following locations:

  • Ropsten Testnet: 0x41566e3a081f5032bdcad470adb797635ddfe1f0
  • Kovan: 0x5f8e9351dc2d238fb878b6ae43aa740d62fc9758
  • Rinkeby: 0x2cc31912b2b0f3075a87b3640923d45a26cef3ee
  • Mainnet: 0xab5c8051b9a1df1aab0149f8b0630848b7ecabf6

Installation

$ npm i --save uport-registry

Using the contract

By installing this library you get access to a truffle-contract compatible json file. You can import this into your project to use the uport registry on any network it is deployed on, truffle-contract will automatically detect which network you are on. Use the following code to get the deployed instance of the registry:

const registryArtifact = require('uport-registry')
const Contract = require('truffle-contract')
const Registry = Contract(registryArtifact)
Registry.setProvider(web3prov)
let registry = Registry.deployed()

The contract has two functions set and get.

Set

Setting a value can be done in the following way:

let key = 'myKey'     // a string (bytes32) value used for namespacing
let subject = 0x123.. // an address, if you want to register something to
                      // your own identity you should use your own address.
let value = 'myValue' // a string (bytes32), the data you want to register.
                      // Could be an ipfs hash for example.
registry.set(key, subject, value)

Note that when you register something the account you send the transaction from gets set as the issuer of the registered data.

Get

To get data out of the registry you can do the following:

let key = 'myKey'     // a string (bytes32) value used for namespacing
let issuer = 0x123... // an address, the account that registered the data
let subject = 0x123.. // an address, the account that the data is registered to

registry.get.call(key, issuer, subject).then((value) => {
  // value is the registered data.
})

Note that if you are looking for self issued data issuer and subject will be the same address

Development of this code base

Clone the repo and install yarn on your system. run yarn install to install all node_modules.

Compiling

After making changes to the contract use yarn compile-contract to create the json artifact.

Running tests

yarn test

Note: The tests currently timeout instead of throwing exceptions

Deployment

To deploy the registry we used truffle, but our deploy script has a special option in order to specify the previous version of the registry. So to deploy a new version of the registry, do the following:

truffle migrate --network <name of eth network> --prevAddr <address of previous registry version>

uport-registry's People

Contributors

coder5876 avatar dependabot[bot] avatar localredhead avatar niran avatar oed avatar pelle avatar silentcicero avatar vor0220 avatar zachferland avatar zmitton avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

uport-registry's Issues

Nondescript error when using get/set functions

Hi,
I am building an application that uses uport and registry, while setting or getting key/value pairs on the registry I keep getting this error

UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 4): ReferenceError: document is not defined

Any help is greatly appreciated.

Swapping ipfs-js with browser-ipfs is confusing

In package.json, the ipfs-js module is swapped with browser-ipfs when bundled by a browser module builder, like webpack or browserify. It is incredibly confusing to read code that says it imports ipfs-js but actually imports browser-ipfs behind the scenes. The packages don't have the same exports, particularly utils. Is there any reason not to pick one and stick with it?

How to run tests?

I'm not getting far with uport-persona package and digging into the code, trying to run the tests for uport-registry they all just timeout.

I'm running an ipfs node and testrpc and trying to run the tests with npm run test.

What gives? What do I need to run to have the test pass? Geth? Which parameters?

Pardon my ignorance re. Ethereum ecosystem and tools, I have no idea what I need to setup to up and running.

Regarding privacy of data

Hi, this is probably the wrong place to ask a query but I couldn't find a better option.

In the About section, it is mentioned that uPort identity is stored as a JSON structure (IPFS) and a hash of that on the blockchain. Isn't is possible for someone to simply query the smart contracts and get the list of hash available and open them on ipfs to extract customer data by going through non-empty blocks, which can raise a privacy issue.

I wanted to understand if uPort has an encryption mechanism to safegaurd data of people.

Sorry if this is not the correct place, but if someone replies then TIA.

uPort-connect address

I see in the documentation we're supposed to use an address as the second parameter to a set call, but which address is this? I'm using the uport-connect library and am getting returned:
{ '@context': 'http://schema.org', '@type': 'Person', publicKey: '8854e2d2f5e5b01b0a5a018bd90f6936b7ea46f7ff108ca21', publicEncKey: 'xZAgm0v4gNpy5CCbcdKxC1VJMxuobpdITXr0hwCdRyg=', address: '2okWJAH3cY49CWcb4fRqUDy9QKJQpyfSoEc' }
Which of these is supposed to be the subject parameter?

When I use the publicKey I get:

(node:18521) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): RangeError: Invalid array length

When I use the address I get:

(node:18483) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): BigNumber Error: new BigNumber() not a number: 2okWJAH3cY49CWcb4fRqUDy9QKJQpyfSoEc

or am I completely off base?

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.