npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@sondreb/did-stellar

v0.0.5

Published

DID Stellar Method

Downloads

21

Readme

did:stellar

npm version License: MIT

A JavaScript library implementing the "did:stellar" Decentralized Identifier (DID) method, which uses Stellar cryptography for DID creation and resolution.

Installation

npm install @sondreb/did-stellar

Overview

This library enables creation and resolution of DIDs using the Stellar blockchain's cryptographic functions. The did:stellar method uses Stellar public keys as identifiers, allowing for seamless integration with the Stellar ecosystem.

Features

  • Create DIDs from Stellar public or private keys
  • Resolve DIDs to standard DID Documents
  • Convert Stellar keys to multibase format for DID Documents
  • Ed25519 key verification and handling

Usage

Importing the Library

import { DidStellar, StrKey } from '@sondreb/did-stellar';

Creating a DID from a Public Key

const publicKeyText = 'GCFXHS4GXL6BVUCXBWXGTITROWLVYXQKQLF4YH5O5JT3YZXCYPAFBJZB';
const didDocument = DidStellar.fromPublicKey(publicKeyText);
console.log(didDocument.id); // 'did:stellar:GCFXHS4GXL6BVUCXBWXGTITROWLVYXQKQLF4YH5O5JT3YZXCYPAFBJZB'

Creating a DID from a Private Key

const privateKeyText = 'SAV76USXIJOBMEQXPANUOQM6F5LIOTLPDIDVRJBFFE2MDJXG24TAPUU7';
const didDocument = DidStellar.fromPrivateKey(privateKeyText);
console.log(didDocument.id); // Will output the DID derived from the public key

Resolving a DID

const did = 'did:stellar:GCFXHS4GXL6BVUCXBWXGTITROWLVYXQKQLF4YH5O5JT3YZXCYPAFBJZB';
const resolution = DidStellar.resolve(did);
console.log(resolution.didDocument); // Full DID Document

Getting a DID Document

const did = 'did:stellar:GCFXHS4GXL6BVUCXBWXGTITROWLVYXQKQLF4YH5O5JT3YZXCYPAFBJZB';
const document = DidStellar.getDocument(did);
console.log(document); // DID Document

Getting a Public Key from a Private Key

const privateKeyText = 'SAV76USXIJOBMEQXPANUOQM6F5LIOTLPDIDVRJBFFE2MDJXG24TAPUU7';
const publicKeyText = DidStellar.getPublicKey(privateKeyText);
console.log(publicKeyText); // Stellar public key

Working with Stellar Keys

The package includes the StrKey utility for handling Stellar key formats:

import { StrKey } from '@sondreb/did-stellar';

// Encode raw bytes to a Stellar public key
const encodedKey = StrKey.encodeEd25519PublicKey(publicKeyBytes);

// Decode a Stellar public key to raw bytes
const decodedBytes = StrKey.decodeEd25519PublicKey(publicKeyText);

// Validate a Stellar public key
const isValid = StrKey.isValidEd25519PublicKey(publicKeyText);

API Reference

DidStellar

static resolve(did: string)

Resolves a DID to a compliant DID Resolution Result.

static fromPublicKey(publicKeyText: string)

Creates a DID Document from a Stellar public key.

static fromPrivateKey(privateKeyText: string)

Creates a DID Document from a Stellar private key.

static getPublicKey(privateKeyText: string)

Derives a Stellar public key from a Stellar private key.

static getDocument(did: string)

Generates a standard DID Document from a did:stellar identifier.

static publicKeyToMultibase(publicKeyBytes: Uint8Array)

Converts a public key to multibase format for use in DID Documents.

StrKey

Utility class for handling Stellar key formats. See full documentation in the code.

DID Document Example

{
  "@context": [
    "https://www.w3.org/ns/did/v1",
    "https://w3id.org/security/suites/ed25519-2020/v1"
  ],
  "id": "did:stellar:GCFXHS4GXL6BVUCXBWXGTITROWLVYXQKQLF4YH5O5JT3YZXCYPAFBJZB",
  "verificationMethod": [
    {
      "id": "did:stellar:GCFXHS4GXL6BVUCXBWXGTITROWLVYXQKQLF4YH5O5JT3YZXCYPAFBJZB#0",
      "type": "Ed25519VerificationKey2020",
      "controller": "did:stellar:GCFXHS4GXL6BVUCXBWXGTITROWLVYXQKQLF4YH5O5JT3YZXCYPAFBJZB",
      "publicKeyMultibase": "z1APN5d6ZRjZQXsVegnYhKBcyifsU96gpVM5FrD3fdJLVd"
    }
  ],
  "authentication": [
    "did:stellar:GCFXHS4GXL6BVUCXBWXGTITROWLVYXQKQLF4YH5O5JT3YZXCYPAFBJZB#0"
  ],
  "assertionMethod": [
    "did:stellar:GCFXHS4GXL6BVUCXBWXGTITROWLVYXQKQLF4YH5O5JT3YZXCYPAFBJZB#0"
  ],
  "capabilityDelegation": [
    "did:stellar:GCFXHS4GXL6BVUCXBWXGTITROWLVYXQKQLF4YH5O5JT3YZXCYPAFBJZB#0"
  ],
  "capabilityInvocation": [
    "did:stellar:GCFXHS4GXL6BVUCXBWXGTITROWLVYXQKQLF4YH5O5JT3YZXCYPAFBJZB#0"
  ],
  "keyAgreement": [
    "did:stellar:GCFXHS4GXL6BVUCXBWXGTITROWLVYXQKQLF4YH5O5JT3YZXCYPAFBJZB#0"
  ]
}

License

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