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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@keetanetwork/asn1-napi-rs

v1.2.0

Published

KeetaNetwork ASN.1 TypeScript-Rust NAPI library

Downloads

4,671

Readme

@keetanetwork/asn1-napi-rs

ci_status lint_status

About

This project utilizes napi-rs to build native Rust functionality that can be consumed in NodeJS. This library specifically addresses ASN.1 encoding and decoding for the @keetanetwork/node project. It contains all critical functionality for encoding/decoding ASN.1 BER for all KeetaNet node functionality.

Install this package

npm install @keetanetwork/asn1-napi-rs

Note: You will need a GitHub personal access token added to your ~/.npmrc file like so:

//npm.pkg.github.com/:_authToken=YOUR_TOKEN

Supported Environments

| | node14 | node16 | node18 | | ---------------- | ------ | ------ | ------ | | Windows x64 | ✓ | ✓ | ✓ | | Windows x32 | ✓ | ✓ | ✓ | | Windows arm64 | ✓ | ✓ | ✓ | | macOS x64 | ✓ | ✓ | ✓ | | macOS arm64 | ✓ | ✓ | ✓ | | Linux x64 gnu | ✓ | ✓ | ✓ | | Linux x64 musl | ✓ | ✓ | ✓ | | Linux arm gnu | ✓ | ✓ | ✓ | | Linux arm64 gnu | ✓ | ✓ | ✓ | | Linux arm64 musl | ✓ | ✓ | ✓ | | Android arm64 | ✓ | ✓ | ✓ | | Android armv7 | ✓ | ✓ | ✓ | | FreeBSD x64 | ✓ | ✓ | ✓ |

Requirements

  • Install the latest Rust (Minimum supported v1.60.0)
  • Install Node.js@14+ which fully supported Node-API

Setup

Once prerequisites are installed, you can setup the initial project easily using:

make node_modules

Building

You can build the entire project or just the rust using the following:

make

Testing

All JavaScript/TypeScript tests are located in the tests directory within the project root. All Rust tests are located in a test module in the file containing the code to be tested. With ava, run make test to testing native addon.

make test

And you will see:

$ make test
running [number] tests
test asn1::test::test_asn1_into_bytes ... ok
test asn1::test::test_asn1_into_date ... ok
...

  ✔ integer › JS number to ASN1 conversion
  ✔ integer › ASN1 to Js number conversion from byte code
  ✔ integer › ASN1 to Js number conversion from base64
  ✔ integer › ASN1 to Js number conversion round trip
  ...

  [number] tests passed

Benchmarking

There are a few benchmarks of critical functionality available which tests the Rust implementations of functions against their TypeScript counterparts. You can run these tests using:

make do-bench

And you will see:

Running "Encode/Decode Block from Buffer" suite...
Progress: 100%

  Rust ASN1toJS - JStoASN1 Test Block:
    25 048 ops/s, ±3.18%   | fastest

  JavaScript ASN1toJS - JStoASN1 Test Block:
    1 817 ops/s, ±4.89%    | slowest, 92.75% slower

Finished 2 cases!
  Fastest: Rust ASN1toJS - JStoASN1 Test Block
  Slowest: JavaScript ASN1toJS - JStoASN1 Test Block
...

Functionality

Key function exports:

  • JStoASN1
  • ASN1toJS
  • ASN1BigIntToBuffer
  • ASN1IntegerToBigInt

CI/CD

With GitHub Actions, each commit and pull request will be built and tested automatically in [node@14, node@16, @node18] x [macOS, Linux, Windows] matrix.

Release

Releases are managed through GitHub actions. Once ready, tag a release like so using the semantic versioning style prefixed with a "v":

# Creates an annotated tag
git tag -s -a "v1.x.x" -m ":bookmark: v1.x.x"
# Pushes tags to remote
git push --tags

Then, create a release in GitHub which will trigger the GitHub action and deploy new GitHub NPM package for the release. The rest will be done for you and you can then require the new version as usual in the project this library is used in.