2.0.0 • Published 4 months ago

peer-did-resolver v2.0.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
4 months ago

Peer DID Resolver

This library is intended to represent domains accessed through https as Decentralized Identifiers and retrieve an associated DID Document

It supports the proposed did:peer method spec It requires the did-resolver library, which is the primary interface for resolving DIDs.

Resolving a DID document

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

import { Resolver } from 'did-resolver'
import { getResolver } from 'peer-did-resolver'

const peerResolver = getResolver()

const didResolver = new Resolver({
    ...peerResolver
    //...you can flatten multiple resolver methods into the Resolver
})

didResolver.resolve('did:peer:2.Ez6LSpSrLxbAhg2SHwKk7kwpsH7DM7QjFS5iK6qP87eViohud.Vz6MkqRYqQiSgvZQdnBytw86Qbs2ZWUkGv22od935YF4s8M7V.SeyJ0IjoiZG0iLCJzIjoiaHR0cHM6Ly9leGFtcGxlLmNvbS9lbmRwb2ludDEiLCJyIjpbImRpZDpleGFtcGxlOnNvbWVtZWRpYXRvciNzb21la2V5MSJdLCJhIjpbImRpZGNvbW0vdjIiLCJkaWRjb21tL2FpcDI7ZW52PXJmYzU4NyJdfQ').then(doc => console.log(doc))

// You can also use ES7 async/await syntax
;(async () => {
    const doc = await didResolver.resolve('did:peer:2.Ez6LSpSrLxbAhg2SHwKk7kwpsH7DM7QjFS5iK6qP87eViohud.Vz6MkqRYqQiSgvZQdnBytw86Qbs2ZWUkGv22od935YF4s8M7V.SeyJ0IjoiZG0iLCJzIjoiaHR0cHM6Ly9leGFtcGxlLmNvbS9lbmRwb2ludDEiLCJyIjpbImRpZDpleGFtcGxlOnNvbWVtZWRpYXRvciNzb21la2V5MSJdLCJhIjpbImRpZGNvbW0vdjIiLCJkaWRjb21tL2FpcDI7ZW52PXJmYzU4NyJdfQ')
    console.log(doc)
})();
1.0.2

4 months ago

1.0.0

4 months ago

2.0.0

4 months ago

1.0.1

1 year ago