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

tsjs-did-siriusid

v0.0.4

Published

ProximaX SiriusId DID Method implementation

Downloads

2

Readme

tsjs-did-siriusid

This is the ProximaX SiriusId DID Method library based on the specification, which allows you to do the following

  • Registering, updating and resolving the identifier.

Requirements

  • NodeJS 10.x
  • Typescript >= 3.5.3

Installing the library

Install using npm:

npm install tsjs-did-siriusid

or using yarn:

yarn add tsjs-did-siriusid

Getting started

Initiates the registry provider

const registryProvider = new SiriusChainProvider(
  'http://bctestnet1.brimstone.xpxsirius.io:3000'
);

Initiates the storage provider

const storageProvider = new IpfsStorageProvider(
  'http://ipfs1-dev.xpxsirius.io:5001'
);

Initiates an instance of the SiriusId

const siriusId = await SiriusId.createInstance(registryProvider, storageProvider);

Creates an identity

const identity = await siriusId.create();

// Keep this master private key for future operations
const masterPrivateKey = identity.account.privateKey;

// did method of Sirius id
console.log(identity.did);

// did document in JSON_LD
console.log(identity.didDocument);
// the qr code represents Sirius id
console.log(identity.qrCode);
// the master account registered in Sirius Chain
console.log(identity.account);

Resolves the identity

const did = 'did:sirius:2U6DTLvttXXsJjcDhLvGXKAgsUzf7HUT9kUns1iqCc';
const didDocument = await siriusId.resolve(did);

Updates the identity document with the public profile

const publicProfile = {
name: 'Thomas Tran 3',
email: '[email protected]',
country: 'AU',
phoneNumber: null,
};

// store in ipfs
const profileContent = JSON.stringify(publicProfile);

const docStream = StreamHelper.string2Stream(profileContent);

const publicProfileResource = await storageProvider.save(docStream);


// generate public profile service section
// and update the did document
const identity = await siriusId.update(account.privateKey, document => {
  // clear public profile otherwise it will use the existing one
  document.services = document.services.find(s => s.type !== SIRIUS_ID_PUBLIC_PROFILE_ENTITY);
  
  document.addServiceSection(
      ServiceSection.createPublicProfileService(
        document.did,
        publicProfileResource,
      ),
  );
});

Contributing

Bootstrap your environments

  1. Clone this repository.
git clone https://gitlab.com/thomas.tran/tsjs-did-sirius-id
  1. Install the dependency packages.
npm install

Running tests

npm run test

Build the packages

npm run build

Publish the packages

npm publish --registry http://localhost:4873/

Install Verdaccio as local registry

FAQs

  1. I encountered the following issue when using the library with web frameworks
Cannot resolve module 'net' , 'tls', 'fs', 'buffer', 'crypto'
  • Create patch.js file in the root folder
  • Add the following content to the patch.js file
const fs = require('fs');

function replaceFile(filePath, searchString, replaceString) {
    fs.readFile(filePath, 'utf8', function (err, data) {
        if (err) {
            return console.log(err);
        }
        const result = data.replace(searchString, replaceString);

        fs.writeFile(filePath, result, 'utf8', function (err) {
            if (err) return console.log(err);
        });
    });
}

const f = 'node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/webpack-configs/browser.js';
replaceFile(f, /node: false/g, "node: {fs: 'empty', global: true, crypto: 'empty', tls: 'empty', net: 'empty', process: true, module: false, clearImmediate: false, setImmediate: false}");

f_crypto = 'node_modules/tsjs-xpx-chain-sdk/dist/src/core/crypto/Crypto.js';
replaceFile(f_crypto, 'require(\'crypto\');', 'require(\'crypto-browserify\');');
  • Add the following content to pollfills.js
(window as any).global = window;
global.Buffer = global.Buffer || require('buffer').Buffer;
(window as any).process = {
  env: { DEBUG: undefined },
};
  • Run the command
node patch.js