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

web3-s2g

v0.1.1

Published

nodejs library for interacting with the Infineon Securiy2Go SmartCard for signing transactions for ethereum blockchain based systems.

Downloads

7

Readme

web3-s2g

A nodejs library for interacting with the Infineon Securiy2Go SmartCard for signing transactions for ethereum blockchain based systems on a nodejs server. Since websites cannot directly interact with USB devices or NFC-Readers (web-nfc does NOT solve this issue in this case) this library works only for nodejs server instance.

Requirements

  • A NFC Card reader that is supported by PCSC lite
  • In order to install the package you need to have installed in the system the pcsclite libraries. For example, in Debian/Ubuntu: apt-get install libpcsclite1 libpcsclite-dev
  • Access to an Ethereum compatible blockchain
  • A Security2Go NFC Card
  • Linux OS - tested with Ubuntu 18 LTS - but most other common Linux distros should do as well
  • libudev and libusb 1.0.8 or later
  • Node.js v10 LTS (tested with v10.15.3)
  • NPM (tested with v6.4.1)

Example in js

const web3 = require('web3');
const web3s2g = require('web3-s2g');

function wait(ms) {
  const start = new Date().getTime();
  let end = start;
  while (end < start + ms) {
    end = new Date().getTime();
  }
}

async function test() {

  console.log('started a test!');
  const cardSigner = new web3s2g.MinervaCardTransactionSigner(1, true);
  const web3Address = 'https://rpc.tau1.artis.network';

  const web3Options = {
    transactionSigner : cardSigner,
  };

  const web3Instance = new web3(web3Address, undefined, web3Options);

  const transaction = {
    from: '0x756269ce7e0285670ecbd234f230645efba049d3' /* requires to be the address of the MinervaCard */,
    to:   '0x3939a535d686da047c589c80538ceb6cffc933ee',
    value: '0x1000',
    gasPrice: web3Instance.utils.toHex('100000000000'), // 100 gwei
    gas:  web3Instance.utils.toHex('21000'),
  };

  console.log('sending transaction...');
  const result = await web3Instance.eth.sendTransaction(transaction);
  console.log('transaction sent!', result);

}

test();
wait(600000);

troubleshooting

Linux

There are known problems with PC/SC Smart Card Daemon (pcscd). Sometimes the cardreader stops working immediatly after plugging it in or booting up the computer. A restart of the daemon can help in this case systemctl restart pcscd