Options
All
  • Public
  • Public/Protected
  • All
Menu

Module pkh-did-resolver

PKH DID method resolver

npm npm Twitter

This package contains did:pkh method resolver implementation. Please refer to the specification for details about how this DID method works.

Usage

This package is used as a plugin to the did-resolver library, which is the primary interface for resolving DIDs.

Installation

$ npm install pkh-did-resolver

Resolving a PKH DID

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

const pkhResolver = getResolver()
const resolver = new Resolver(pkhResolver)

const didResolutionResult = await resolver.resolve('did:pkh:eip155:1:0xab16a96d359ec26a11e2c2b3d8f8b8942d5bfcdb')

Result:

{
  "didDocument": {
    "assertionMethod": [
      "did:pkh:eip155:1:0xab16a96d359ec26a11e2c2b3d8f8b8942d5bfcdb#blockchainAccountId",
    ],
    "authentication": [
      "did:pkh:eip155:1:0xab16a96d359ec26a11e2c2b3d8f8b8942d5bfcdb#blockchainAccountId",
    ],
    "id": "did:pkh:eip155:1:0xab16a96d359ec26a11e2c2b3d8f8b8942d5bfcdb",
    "verificationMethod": [{
      "blockchainAccountId": "eip155:1:0xab16a96d359ec26a11e2c2b3d8f8b8942d5bfcdb",
      "controller": "did:pkh:eip155:1:0xab16a96d359ec26a11e2c2b3d8f8b8942d5bfcdb",
      "id": "did:pkh:eip155:1:0xab16a96d359ec26a11e2c2b3d8f8b8942d5bfcdb#blockchainAccountId",
      "type": "EcdsaSecp256k1RecoveryMethod2020",
    }],
  },
  "didDocumentMetadata": {},
  "didResolutionMetadata": {
    "contentType": "application/did+json",
  },
}

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

Apache-2.0 OR MIT

Index

Variables

Const DID_JSON

DID_JSON: "application/did+json" = "application/did+json"

Const DID_LD_JSON

DID_LD_JSON: "application/did+ld+json" = "application/did+ld+json"

Const SECPK1_NAMESPACES

SECPK1_NAMESPACES: string[] = ['eip155', 'bip122']

Const TZ_NAMESPACE

TZ_NAMESPACE: "tezos" = "tezos"

Functions

toDidDoc

  • toDidDoc(did: string, accountId: string): any