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

@jpmorganchase/onyx-ssi-sdk

v0.0.1

Published

SSI SDK for Onyx W3C Verifiable Credentials

Downloads

5

Readme

Onyx SSI SDK

Create SSI Ecosystems following W3C Standards for Verifiable Credentials and DIDs

  • Create and verify Verifiable Credentials and Verifiable Presentations
  • Support for did:ethr and did:key
  • Support for JWT as digital proof
  • Support for Verifiable Credential Schemas

How to Use REPO

Prerequisites

  • Nodejs v16

Installation

npm install @jpmorganchase/onyx-ssi-sdk

Build

This project is built to support both CommonJS and ECMAScript Module Formats

The CommonJS format is configured in configs/tsconfig.cjs.json and the ECMAScript is configured in configs/tsconfig.esm.json

npm install
npm run build

Tests

Unit Tests: npm run test

Hardhat:

npx hardhat compile
npx hardhat test

Navigating the SDK

  • DID Management: Create, Resolve, Update, and Delete the 2 supported DID Methods (did:key and did:ethr)
  • Credential Schema Management: Example of 4 Credential Types and their schemas as well as helper methods for Schema Management
  • JWT Signatures: Sign Verifiable Credentials as JWTs
  • Issuer: All functionality required to be a Credential Issuer
  • Holder: All functionality required to be a Credential Holder
  • Verifier: All functionality to perform basic Credential verification
  • KeyUtils: Helper functions for SDK supported keys

Full SSI Ecosystem Example

For examples of how to use the SDK, check out our onyx-ssi-sdk-examples repo

Below code shows the Issuance, Claiming, and Verification of W3C Credential/Presentation.


//DID Key
const didKey = new KeyDIDMethod()

//DID Ethr configs
const ethrProvider = {
    name: 'maticmum', 
    rpcUrl: 'https://rpc-mumbai.maticvigil.com/', 
    registry: "0x41D788c9c5D335362D713152F407692c5EEAfAae"}
   
console.log('-----------------VC Issuance---------------')
       
//create DID for Issuer (did:ethr)
const didEthr = new EthrDIDMethod(ethrProvider)
const issuerEthrDid = await didEthr.create();
   
//create DID for Holder of Credential (did:key)
const holderDID = await didKey.create();
   
//create DID for VC to support Revocation of Credential
const vcDID = await didEthr.create();
   
//Create a 'Proof of Name' VC
const subjectData = {
    "name": "Ollie"
}
   
//Additonal parameters can be added to VC including:
//vc id, expirationDate, credentialStatus, credentialSchema, etc
const additionalParams = {
    id: vcDID.did,
    expirationDate: "2024-01-01T19:23:24Z",
}
   
const vc = await createCredential(
    issuerEthrDid.did, holderDID.did, subjectData, PROOF_OF_NAME, additionalParams)
console.log(JSON.stringify(vc, null, 2))
   
const jwtService = new JWTService()
const jwtVC = await jwtService.signVC(issuerEthrDid, vc)
console.log(jwtVC)
   
console.log('-----------------VC Presentation---------------')
   
//Create Presentation from VC JWT
const vp = await createPresentation(holderDID.did, [jwtVC])
console.log(JSON.stringify(vp, null, 2))
   
const jwtVP = await jwtService.signVP(holderDID, vp)
console.log(jwtVP)
   
console.log('----------------------VERIFY VC/VP------------------')
       
//create DID resolvers
const ethrResolver = getEthrResolver(ethrProvider)
const keyResolver = getKeyResolver()
const didResolver = new Resolver({
    ...ethrResolver, 
    ...keyResolver})
   
   
//Verify VC JWT from Issuer
const resultVc = await verifyCredentialJWT(jwtVC, didResolver)
console.log(resultVc)
       
//Verify VP JWT from Holder
const resultVp = await verifyPresentationJWT(jwtVP, didResolver)
console.log(resultVp)

Open Source Identity Packages

Standards and Specifications