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

jni-utils

v1.10.0

Published

Provides some utils used often used in other projects.

Downloads

12

Readme

     ▄█ ███▄▄▄▄    ▄█       ███    █▄      ███      ▄█   ▄█          ▄████████ 
    ███ ███▀▀▀██▄ ███       ███    ███ ▀█████████▄ ███  ███         ███    ███ 
    ███ ███   ███ ███▌      ███    ███    ▀███▀▀██ ███▌ ███         ███    █▀  
    ███ ███   ███ ███▌      ███    ███     ███   ▀ ███▌ ███         ███        
    ███ ███   ███ ███▌      ███    ███     ███     ███▌ ███       ▀███████████ 
    ███ ███   ███ ███       ███    ███     ███     ███  ███                ███ 
    ███ ███   ███ ███       ███    ███     ███     ███  ███▌    ▄    ▄█    ███ 
█▄ ▄███  ▀█   █▀  █▀        ████████▀     ▄████▀   █▀   █████▄▄██  ▄████████▀  
▀▀▀▀▀▀                                                  ▀                      

What is this?

Provides some utils I used often in my current projects. These include a

  • KeyTool with a text UI and a CLI option
  • Wrapper for the Node crypto engine to customized for my purposes
  • Code to easier operate with dates, delays and arrays

Release History

v1.10.0

  • Introduce DateUtils.createDaysForMonthString
  • node (types) version raised to 15.x
  • npm audit fix

v1.9.1

  • DateUtils.intersectDates bugfixed.

v1.9.0

  • Update of TypeScript.
  • Introduction of jest.js

Older Versions

v1.8.0 New today() function. v1.7.2 Messed up the release process again. v1.7.1 Namenormalizer actually exposed. v1.7.0 Namenormalizer added to simplify strings with special characters. v1.6.4 Actual content of v1.6.3 v1.6.3 Bugfixes for Duplicate weeks in days per week function and function for same day. v1.6.2 Improved readme information for JniCrypto usage v1.6.1 Bugfix for getLatestSunday in DateUtils v1.6.0 Simplified hash function added to JniCrypto

Installation

Run npm install for a local installation in your project. npm install jni-utils

How to use

Keytool

Text UI

Use the following command to start the KeyTool text UI from terminal.

    npx jni-keytool

If started for the first time in your project. The tool will ask to create a new set of keys. Without this set of keys the tool will not be able to encrypt/decrypt. If you allow to create the key set. The following menu will appear.

The text UI offers the following 4 options

🔑  J N I   C R Y P T O  (v2.2)
-------------------------------

(1) Recreate your keyset.
(2) Encrypt a text phrase.
(3) Deycrypt encrypted phrase.
(0) Exit.

Please choose an option (1,2,3,0)...

The encrypt text option (2) will create a decyrpted Base 64 encoded text which will always vary. However, given your set of keys is based on the same passphrase as the one used to encrypt, the decryption will always work.

The recreate your keyset option (1) will create a new set of keys, overwritten existing keys, if existing and create a folder ./secrets in the project if not already existing.

CLI-only commands

Creating a pair for keys is also possible without text UI by using the following command:

npx jni-keytool --create-keys "Your passphrase to create a reproducable set of keys"

To encrypt AND base-64 a string via CLI with already created keys:

npx jni-keytool --encrypt-base64 "The string you want to encrypt"

To decrypt an encrypted AND base-64'ed text via CLI with already created keys:

npx jni-keytool --decrypt-base64 "The text you want to decrypt"

JniCrypto

The crypto wrapper for node is available via JniCrypto.Engine and offers the same functionality on coding level as the KeyTool. In fact. The KeyTool obiously makes use of the wrapper.

import { JniCrypto } from "jni-utils";

const crypto = new JniCrypto.Engine();

const encryptedText = crypto.shortEncryptToB64("Simple Text");
const decryptedText = crypto.shortDecryptFromB64(encryptedText);

JniCommon

The util code in the JniCommon is pretty much self-explaining.