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

@qiwitech/mastersuite

v0.1.3

Published

Masterchain JS suite

Downloads

11

Readme

Masterchain JS suite

Suite for Masterchain blockchain platform.

Precaution

This software may work with sensitive cryptographic data such as passwords, certificates and private keys. To prevent such data to be accidentally exposed, compromised or lost, always be sure to check your execution environment.

Contents

This is a NPM monorepo maintained using Yarn with Workspaces.

This meta-package contains the following packages:

@qiwitech/masterchain

@qiwitech/cryptopro

@qiwitech/gostcrypto

Installation

Needless to say, you need Node.js to be installed.

Also, Yarn is needed, since its Workspaces are used.

yarn install --production=false

Note that devDependencies are not installed with NODE_ENV=production, so it's necessary to override the environment on first installation, especially on CI/CD runner.

Browser note

To use Crypto-Pro CAdES browser plugin, you should load its vendor script cadesplugin_api.js which isn't included to this package.

<script type="text/javascript" src="https://www.cryptopro.ru/sites/default/files/products/cades/cadesplugin_api.js"></script>

Testing

Warning!

Do not run auto-tests in environments where any sensitive cryptographic data are available, such as certificates or private keys. You may lose them accidentally, without the possibility of recovery, due to clean-up process. Also, some other data could be encrypted and/or signed on your behalf automatically without any prompt, possibly compromising your keys. Additionally, test certificates may be automatically installed into your personal certificate store.

Automatic

There are 3 levels of Mocha tests:

  • High-level test suites which provide automation and configuration.
  • Tasty integration tests.
  • Karma module tests.

Before running tests, you need to add some hosts into Crypto-Pro whitelist for test runner not to stuck waiting for popup from Crypto-Pro CAdES Browser plugin.

The whitelist could be edited on special page of corresponding Chrome extension. Current list is:

http://localhost
http://localhost:8765
http://localhost:9876

After that, in Windows Registry, inside HKEY_CURRENT_USER\Software\Crypto Pro\CAdESplugin must be a key named TrustedSites of type REG_MULTI_SZ containing URLs listed above, separated by two zero bytes. See the exact format in whitelist.reg.

See cryptopro's README.md for more info.

yarn test

See test/runner.js for details.

Manual

yarn start

Open http://localhost:8888/masterchain.html in a browser for manual testing.

Examples

Start using Crypto-Pro

import { cryptopro, masterchain } from '@qiwitech/mastersuite';
import { Web3 } from 'web3';

const web3 = new Web3(
	new Web3.providers.HttpProvider('...')
);

const plugin = await cryptopro.getPlugin(window),
	helper = await cryptopro.createHelper(plugin),
	crypto = {
		subtle: await cryptopro.createSubtleCrypto(helper)
	};

const client = new masterchain.Client(web3, crypto);

Start using gostCrypto

import { gostcrypto, masterchain } from '@qiwitech/mastersuite';
import { Web3 } from 'web3';

const web3 = new Web3(
	new Web3.providers.HttpProvider('...')
);

const client = new masterchain.Client(web3, gostcrypto);

Create account

let account = await client.createAccount();
// NOTE account.address is already exists.

if (account.certificateRequest) {
	// NOTE account.privateKey is null, account.sendTransaction throws,
	// we need to issue and install certificate first.

	downloadBlob(
		account.certificateRequest.name,
		account.certificateRequest.blob
	);

	// TODO send downloaded file to CA and upload issued certificate.

	const file = ...,
		x509 = await readFile(file);
	account = await client.certificateToAccount(x509);
}

account.sendTransaction(...);