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 🙏

© 2024 – Pkg Stats / Ryan Hefner

ebsi-did

v0.0.1

Published

Create and manage DID documents for ethereum-based EBSI addresses

Downloads

6

Readme

npm npm Join the chat at Twitter Follow

Ebsi-DID Library

DID Specification | ERC-1056 | Getting Started

FAQ and helpdesk support

This library conforms to ERC-1056 and is intended to use Ethereum addresses as fully self-managed Decentralized Identifiers (DIDs), it allows you to easily create and manage keys for these identities. It also lets you sign standards compliant JSON Web Tokens (JWT) that can be consumed using the DID-JWT library.

This library can be used to create a new ebsi-did identity. It allows ebsi-did identities to be represented as an object that can perform actions such as updating its did-document, signing messages, and verifying messages from other dids.

Use this if you are looking for the easiest way to start using ebsi-did identities, and want high-level abstractions to access its entire range of capabilities. It encapsulates all the functionality of ebsi-did-resolver and ethr-did-registry.

A DID is an Identifier that allows you to lookup a DID document that can be used to authenticate you and messages created by you.

Ebsi-DID provides a scalable identity method for Ethereum addresses that gives any Ethereum address the ability to collect on-chain and off-chain data. Because Ebsi-DID allows any Ethereum key pair to become an identity, it is more scalable and privacy-preserving than smart contract based identity methods, like our previous Proxy Contract.

This particular DID method relies on the Ethr-Did-Registry. The Ethr-DID-Registry is a smart contract that facilitates public key resolution for off-chain (and on-chain) authentication. It also facilitates key rotation, delegate assignment and revocation to allow 3rd party signers on a key's behalf, as well as setting and revoking off-chain attribute data. These interactions and events are used in aggregate to form a DID's DID document using the Ebsi-Did-Resolver.

An example of a DID document resolved using the Ethr-Did-Resolver:

{
  '@context': 'https://w3id.org/did/v1',
  id: 'did:ebsi:0xb9c5714089478a327f09197987f16f9e5d936e8a',
  publicKey: [{
       id: 'did:ebsi:0xb9c5714089478a327f09197987f16f9e5d936e8a#key-1',
       type: 'Secp256k1VerificationKey2018',
       controller: 'did:ebsi:0xb9c5714089478a327f09197987f16f9e5d936e8a',
       ethereumAddress: '0xb9c5714089478a327f09197987f16f9e5d936e8a'}],
  authentication: [
       'did:ebsi:0xb9c5714089478a327f09197987f16f9e5d936e8a#key-1'
       ]
}

On-chain refers to something that is resolved with a transaction on a blockchain, while off-chain can refer to anything from temporary payment channels to IPFS.

It supports the proposed Decentralized Identifiers spec from the W3C Credentials Community Group.

DID Method

A "DID method" is a specific implementation of a DID scheme that is identified by a method name. In this case, the method name is ethr, and the method identifier is an Ethereum address.

To encode a DID for an Ethereum address, simply prepend did:ethr:

For example:

did:ebsi:0xf3beac30c498d9e26865f34fcaa57dbb935b0d74

Configuration

import EthrDID from 'ebsi-did'

// Assume web3 object is configured either manually or injected using metamask


const ebsiDid = new EbsiDID({address: '0x...', privateKey: '...', provider})

| key | description| required | |-----|------------|----------| |address|Ethereum address representing Identity| yes | |registry| registry address (defaults to 0xdca7ef03e98e0dc2b855be647c39abe984fcf21b) | no | |provider| web3 provider | no | |web3| preconfigured web3 object | no | |rpcUrl| JSON-RPC endpoint url | no | |signer| Signing function| either signer or privateKey | |privateKey| Hex encoded private key | yes* |

Note An instance created using only an address can only be used to encapsulate an external ebsi-did (one where there is no access to the private key). This instance will not have the ability to sign anything, but it can be used for a subset of actions:

  • provide its own address (ebsiDid.address)
  • provide the full DID string (ebsiDid.did)
  • lookup its owner await ebsiDid.lookupOwner()
  • verify a JWT await ebsiDid.verifyJwt(jwt)