Socket
Socket
Sign inDemoInstall

uport-persona

Package Overview
Dependencies
Maintainers
4
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

uport-persona

A library for creating, updating and reading attributes and claims on uport personas.


Version published
Weekly downloads
0
decreased by-100%
Maintainers
4
Weekly downloads
 
Created
Source

uPort Persona

A library for creating, updating and reading attributes and claims on uport personas. It's intended as an easy interface to the uport-registry, allowing developers to focus on the actual data instead of the datastructure of the object stored in the registry.

The primary interface for accessing persona data is through the Registry object.

Example usage

Importing

import { Registry } from 'uport-persona';

Configuring Registry

To use the Registry instantiate it like this:

const registry = new Registry()

You can pass in various options in a settings object:

import Web3 from 'web3'
const registry = new Registry( {
    web3prov: new Web3.providers.HttpProvider("http://localhost:8545"),
    ipfs: {host: 'localhost', port: 5001, protocol: 'http'}, // Pass in a configuration object or a ipfs-api compliant provider
    registryAddress: '0x...'
})

Returning profile information for an ethereum address

Simply call the registry.getPublicProfile(...) method and you will be returned a promise containing the public uport profile.

registry.getPublicProfile('0x06b4915f423117e3c71d671edcbbabd2a0222236').then((profile) => {
    console.log(profile)
})

To receive a more advanced Persona object that will let you query the profile based on who issued the claims use registry.getPersona(...) method and you will be returned a promise containing the Persona object.

registry.getPersona('0x06b4915f423117e3c71d671edcbbabd2a0222236').then((persona) => {
    console.log(persona)
})

Running tests

Simply run

$ npm test

Documentation

Registry

Class representing a uPort Registry.

Kind: global class

registry.constructor() ⇒ Object

Class constructor. Creates a new Registry object. The registryAddress is an optional argument and if not specified will be at the moment set to the default ropsten network uport-registry.

Kind: instance method of Registry
Returns: Object - self

ParamTypeDescription
settings.ipfsObjectOptional custom ipfs provider (defaults to infura)
settings.web3provWeb3ProviderOptional web3 provider object (defaults to infura ropsten node)
settings.registryAddressStringOptional ethereum address of a uport contract

registry.getPublicProfile() ⇒ Promise.<JSON, Error>

Gets the public profile JSON object stored in IPFS for the given address.

Kind: instance method of Registry
Returns: Promise.<JSON, Error> - A promise that returns the JSON object stored in IPFS for the given address

registry.getPersona() ⇒ Promise.<PublicPersona, Error>

Gets the the data stored in IPFS for the given object and creates a PublicPersona object.

Kind: instance method of Registry
Returns: Promise.<PublicPersona, Error> - A promise that returns a new PublicPersona object.

registry.getPersonas() ⇒ Promise.<PublicPersona, Error>

Gets the data stored in IPFS for an array of given addresses and creates an array of PublicPersona objects.

Kind: instance method of Registry
Returns: Promise.<PublicPersona, Error> - A promise that returns an array of new PublicPersona objects.

PublicPersona

Class representing PublicPersona, extends PersonaInterface

Kind: global class

publicPersona.constructor(publicProfile, address) ⇒ Object

Class constructor. Creates a new PublicPersona object.

Kind: instance method of PublicPersona
Returns: Object - self

ParamTypeDescription
publicProfileJSONPublic Profile on IPFS
addressStringThe identity address

publicPersona.profile() ⇒ Object

A getter which returns a simple Profile Object

Kind: instance method of PublicPersona

FAQs

Package last updated on 31 Dec 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc