Skip to content

snowpine-io/polkadot-did-driver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Polkadot/Kusama DID Resolver Driver

This repository contains a DID resolver driver for Polkadot and Kusama on-chain identities, compatible with the DIF Universal Resolver. It allows resolution of DIDs based on Polkadot and Kusama on-chain identities.

Features

  • Resolves DIDs for both Polkadot People (did:dot) and Kusama People (did:ksm) networks
  • Supports identity information including display names, legal names, email, web, and social media handles
  • Compatible with W3C DID specifications
  • Built with TypeScript for type safety and better developer experience

Dev Setup

The driver can be run either as a standalone HTTP server or as part of the Universal Resolver stack.

Prerequisites

  • Node.js 20 or higher
  • pnpm 8 or higher

Run with Node

  1. Install dependencies:
pnpm install
  1. Build the project:
pnpm run build
  1. Start the server:
pnpm run start

By default, the server will listen on port 3000.

API Usage

Example Requests

Resolve a Polkadot DID:

curl -H "Accept: application/did+json" http://localhost:3000/1.0/identifiers/did:dot:16SDAKg9N6kKAbhgDyxBXdHEwpwHUHs2CNEiLNGeZV55qHna

Example response:

{
    "didResolutionMetadata": {
        "contentType": "application/did+ld+json"
    },
    "didDocumentMetadata": {},
    "didDocument": {
        "@context": [
            "https://www.w3.org/ns/did/v1"
        ],
        "id": "did:dot:16SDAKg9N6kKAbhgDyxBXdHEwpwHUHs2CNEiLNGeZV55qHna",
        "alsoKnownAs": [
            "Gav",
            "Dr. Gavin James Wood"
        ],
        "verificationMethod": [
            {
                "id": "did:dot:16SDAKg9N6kKAbhgDyxBXdHEwpwHUHs2CNEiLNGeZV55qHna#controller",
                "type": "Ed25519VerificationKey2018",
                "controller": "did:dot:16SDAKg9N6kKAbhgDyxBXdHEwpwHUHs2CNEiLNGeZV55qHna",
                "publicKeyBase58": "16SDAKg9N6kKAbhgDyxBXdHEwpwHUHs2CNEiLNGeZV55qHna"
            }
        ],
        "service": [
            {
                "id": "did:dot:16SDAKg9N6kKAbhgDyxBXdHEwpwHUHs2CNEiLNGeZV55qHna#display",
                "type": "Display",
                "serviceEndpoint": "Gav"
            },
            {
                "id": "did:dot:16SDAKg9N6kKAbhgDyxBXdHEwpwHUHs2CNEiLNGeZV55qHna#legal",
                "type": "Legal",
                "serviceEndpoint": "Dr. Gavin James Wood"
            },
            {
                "id": "did:dot:16SDAKg9N6kKAbhgDyxBXdHEwpwHUHs2CNEiLNGeZV55qHna#email",
                "type": "Email",
                "serviceEndpoint": "[email protected]"
            },
            {
                "id": "did:dot:16SDAKg9N6kKAbhgDyxBXdHEwpwHUHs2CNEiLNGeZV55qHna#web",
                "type": "Web",
                "serviceEndpoint": "https://gavwood.com/"
            },
            {
                "id": "did:dot:16SDAKg9N6kKAbhgDyxBXdHEwpwHUHs2CNEiLNGeZV55qHna#twitter",
                "type": "Twitter",
                "serviceEndpoint": "@gavofyork"
            },
            {
                "id": "did:dot:16SDAKg9N6kKAbhgDyxBXdHEwpwHUHs2CNEiLNGeZV55qHna#github",
                "type": "Github",
                "serviceEndpoint": "gavofyork"
            }
        ]
    }
}

Resolve a Kusama DID:

curl -X GET http://localhost:3000/1.0/identifiers/did:ksm:DNAWidYc1jgbwYhUEFbdP3hwZVSv5mGZ4cnWrr9kV3DpAFu

Supported DID Method Specifications

Polkadot DIDs (did:dot)

  • Method Name: dot
  • Method-Specific Identifier: SS58 address of the Polkadot account
  • Example: did:dot:16SDAKg9N6kKAbhgDyxBXdHEwpwHUHs2CNEiLNGeZV55qHna

Kusama DIDs (did:ksm)

  • Method Name: ksm
  • Method-Specific Identifier: SS58 address of the Kusama account
  • Example: did:ksm:DNAWidYc1jgbwYhUEFbdP3hwZVSv5mGZ4cnWrr9kV3DpAFu

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published