New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

peaq-did-resolver

Package Overview
Dependencies
Maintainers
0
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

peaq-did-resolver

Resolve DID documents for the peaq network

1.0.1
latest
Source
npm
Version published
Maintainers
0
Created
Source

PEAQ DID Resolver

This package provides methods to resolve a Decentralized Identifier (DID) from the peaq blockchain.

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

TBD

DID Document

A minimal DID Document might contain the following information:

{
  "@context": [
    "https://www.w3.org/ns/did/v1"
  ],
  "id": "did:peaq:5E1WsjiPHvPW5LdhL4h53TTc58YLGDpLeLi6jW8E6ypLeRtB",
  "controller": "did:peaq:5E1WsjiPHvPW5LdhL4h53TTc58YLGDpLeLi6jW8E6ypLeRtB",
  "authentication": [
    "did:peaq:5E1WsjiPHvPW5LdhL4h53TTc58YLGDpLeLi6jW8E6ypLeRtB#keys-1"
  ],
  "verificationMethod": [
    {
      "id": "did:peaq:5E1WsjiPHvPW5LdhL4h53TTc58YLGDpLeLi6jW8E6ypLeRtB#keys-1",
      "type": "Ed25519VerificationKey2020",
      "controller": "did:peaq:5E1WsjiPHvPW5LdhL4h53TTc58YLGDpLeLi6jW8E6ypLeRtB",
      "publicKeyMultibase": "z6Mkke5f4w4df5vLnW92jbxYy4Z3cayFD9XuegRS1TCnAB3x"
    }
  ],
  "service": []
}

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 'peaq-did-resolver'

// getResolver() accepts a DID Resolver server url
const peaqResolver = getResolver("wss://wsspc1-qa.agung.peaq.network")

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

didResolver.resolve("did:peaq:5E1WsjiPHvPW5LdhL4h53TTc58YLGDpLeLi6jW8E6ypLeRtB").then(doc => console.log(doc))

// You can also use ES7 async/await syntax
;(async () => {
    const doc = await didResolver.resolve("did:peaq:5E1WsjiPHvPW5LdhL4h53TTc58YLGDpLeLi6jW8E6ypLeRtB")
    console.log(doc)
})();

Keywords

peaq

FAQs

Package last updated on 11 Mar 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts