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

plc-did-resolver

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

plc-did-resolver

Resolve DID documents from PLC Directory

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

npm npm codecov

Plc DID Resolver

This library is intended to resolve PLC DIDs and retrieve an associated DID Document from the "PLC Directory"

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

This DID Method is not considered "decentralized" at all, and will likely be replaced in the future.

DID Document

The DID resolver takes the DID and retrieves a document from the PLC Directory associated with that DID.

A minimal DID Document might contain the following information:

{
 		"@context": ["https://www.w3.org/ns/did/v1", "https://w3id.org/security/suites/secp256k1-2019/v1"],
 		"id": "did:plc:wuyiqd25zhsut5a2gc46iqoi",
 		"alsoKnownAs": ["at://okaynick.bsky.social"],
 		"verificationMethod": [{
 			"id": "#atproto",
 			"type": "EcdsaSecp256k1VerificationKey2019",
 			"controller": "did:plc:wuyiqd25zhsut5a2gc46iqoi",
 			"publicKeyMultibase": "zQYEBzXeuTM9UR3rfvNag6L3RNAs5pQZyYPsomTsgQhsxLdEgCrPTLgFna8yqCnxPpNT7DBk6Ym3dgPKNu86vt9GR"
 		}],
 		"service": [{
 			"id": "#atproto_pds",
 			"type": "AtprotoPersonalDataServer",
 			"serviceEndpoint": "https://bsky.social"
 		}]
 	}

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

const plcResolver = getResolver()

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

didResolver.resolve('did:plc:wuyiqd25zhsut5a2gc46iqoi').then(doc => console.log(doc))

// You can also use ES7 async/await syntax
;(async () => {
    const doc = await didResolver.resolve('did:plc:wuyiqd25zhsut5a2gc46iqoi')
    console.log(doc)
})();

FAQs

Package last updated on 26 Apr 2023

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