Represent error as DID resolution result.
Extracts the DIDDocumentMetadata for the 3ID that we have resolved. Requires the latest version of the 3ID ceramic document state as well as the state of the version we are resolving
the StreamState of the version of the 3ID we are resolving
the StreamState of the latest version of the 3ID we are resolving
Converts unix timestamp to ISO string without ms.
Gets the identifier of the version of the did document that was requested. This will correspond to a specific 'commit' of the ceramic document
Return last anchor log entry, or genesis if no anchors found
Report a thrown error as a DID resolution result.
Wraps the content from the Ceramic 3ID document tile and formats it as a proper DIDDocument.
the content from the 3ID Ceramic tile
the did to use when wrapping the document
3ID DID Resolver
Getting started
Installation
$ npm install @ceramicnetwork/3id-did-resolver
Usage
import ThreeIdResolver from '@ceramicnetwork/3id-did-resolver' import { Resolver } from 'did-resolver' // You need an instance of Ceramic to call getResolver. // This can be either @ceramicnetwork/core or @ceramicnetwork/http-client. // You can also set an address for your own ethr-did-registry contract const ceramic = // ... // getResolver will return an object with a key/value pair of { '3': resolver } // where resolver is a function used by the generic did resolver. const threeIdResolver = ThreeIdResolver.getResolver(ceramic) const didResolver = Resolver(threeIdResolver) const doc = await didResolver.resolve('did:ethr:0xf3beac30c498d9e26865f34fcaa57dbb935b0d74') console.log(doc)
Development
Run tests:
$ npm test
Run linter:
npm run lint
Contributing
We are happy to accept small and large contributions. Make sure to check out the Ceramic specifications for details of how the protocol works.
License