Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

peaq-did-resolver

Package Overview
Dependencies
Maintainers
0
Versions
1
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.0
  • latest
  • Source
  • npm
  • Socket score

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

FAQs

Package last updated on 12 Nov 2024

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc