Skip to content
Resolve DID documents for secp256k1 public keys
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.babelrc
.gitignore
LICENSE
README.md
package.json
yarn.lock

README.md

secp256k1 DID Resolver

This library is intended to use secp256k1 public keys as Decentralized Identifiers and wrap them in a DID Dcument

It supports the proposed Decentralized Identifiers spec from the W3C Credentials Community Group.

It requires the did-resolver library, which is the primary interface for resolving DIDs.

DID method

To encode a DID for a secp256k1 public key, simply prepend did:secp256k1:

eg:

did:secp256k1:03fdd57adec3d438ea237fe46b33ee1e016eda6b585c3e27ea66686c2ea5358479

Both compressed or uncompressed public keys are supported but compressed ones are much shorter.

Resolving a DID document

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

import resolve from 'did-resolver'
import registerResolver from 'secp256k1-did-resolver'

registerResolver()

resolve('did:secp256k1:03fdd57adec3d438ea237fe46b33ee1e016eda6b585c3e27ea66686c2ea5358479').then(doc => console.log)

// You can also use ES7 async/await syntax
const doc = await resolve('did:secp256k1:03fdd57adec3d438ea237fe46b33ee1e016eda6b585c3e27ea66686c2ea5358479')
You can’t perform that action at this time.