Giter VIP home page Giter VIP logo

did-resolver's Introduction

Lorena DID Resolver

Build Status Coverage Status

Resolve DID Documents from DIDs in the Lorena namespace. This is is a plug-in for the Decentralized Identity Foundation did-resolver.

Network configurations (static data)

There are two static methods (no blockchain calls) which are useful for retrieving endpoints for different Lorena networks:

getInfoForNetwork('labdev')
getInfoForDid('did:lor:labdev:2nQtiQG6Cgm1GYTBaaKAgr76uY7iSexUkqX')

... and both return the same data:

{ "type": "substrate", "blockchainEndpoint": "wss://labdev.substrate.lorena.tech", "matrixEndpoint": "https://labdev.matrix.lorena.tech"}

DID Resolver (retrieve DID Document from blockchain data)

The Lorena DID resolver exposes a function called getResolver which will return an object containing one of these key/value pairs.

import { Resolver } from 'did-resolver'
import LorenaDidResolver from '@lorena-ssi/did-resolver'

// returns an object of { methodName: resolveFunction}
lorResolver = LorenaDidResolver.getResolver()

// If you are using only one method you can simply pass the result of `getResolver()` into the constructor
const resolver = new Resolver(lorResolver)

The resolver presents a simple resolve() function that returns a ES6 Promise returning the DID document.

resolver.resolve('did:lor:and:2nQtiQG6Cgm1GYTBaaKAgr76uY7iSexUkqX/some/path#fragment=123').then(doc => console.log)

// You can also use ES7 async/await syntax
const doc = await resolver.resolve('did:lor:and:2nQtiQG6Cgm1GYTBaaKAgr76uY7iSexUkqX/some/path#fragment=123')

Outside of the standard resolve() method, LorenaDidResolver also provides a simple method to retrieve the public key for a DID, whether stored directly on the blockchain, in a DID Document, or through IPLD.

const pubKey = LorenaDidResolver.getPublicKeyForDid('did:lor:maxtest:2nQtiQG6Cgm1GYTBaaKAgr76uY7iSexUkqX')

License

MIT

did-resolver's People

Contributors

celeduc avatar crossi704 avatar

Watchers

Crypto Benkei avatar James Cloos avatar dotas avatar

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.