Resolve DID Documents from DIDs in the Lorena namespace. This is is a plug-in for the Decentralized Identity Foundation did-resolver.
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"}
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')
MIT