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

cipherlib

v0.2.2

Published

AEAD Cryptographic Library

Readme

Cipherlib User Reference (Javascript/nodejs)

April 28, 2025

rev 0.2.0

Introduction

Cipherlib is an Application Programming Interface (API) for nodejs and python3. The API provides cryptographic functions (Methods and Objects) that encrypt plaintext (non-ciphered data) and decrypt ciphertext (encrypted AEAD data) generated by the API.

The API supports AEAD (Authenticated Encryption with Associated Data) based on RFC 5116.

AEAD provides authenticated encryption and the ability to check the integrity and authentication of additional authenticated data (AAD) that is sent without encryption (text sent in the clear).

For background, early work on AEAD was initiated in 2007 with NIST's guidance in their publication 800-38D, "Recommendation for Block Cipher Modes of Operation: Galois/Counter Mode (GCM) and GMAC."

CipherLib supports both CCM (Cipher Counter block chaining mode) and GCM algorithms as defined in RFC 5084 and RFC 7714 with support for AES-128 and AES-256. The default is GCM AES-128 though via an option parameter can be set to preferred. (See Class Method Options below.)

Audience

This document is intended for software designers, architects, and programmers using Javascript programming language via nodejs.

A companion version of this document is available for Python developers.

API Dependencies

node_module dependencies via npm

	use-strict module
	
	

Class Library Example

const CipherLib = require( 'cipherlib' );

async function main() {

	const cipherlib = new CipherLib.CipherLib( );
	
	try { var Payload = await cipherlib.textEncrypt( "Hello World", { "encode":"hex" } ) }
		catch( err ) {
			console.log( err.message );
			process.exit(1);
		};
		
	console.log( Payload );

}

main()

CipherLib Class Methods

Method Promise


textEncrypt( plaintext, { Options: Parameter, ...} ): ( Error, Payload )

payloadDecrypt( Payload, { Options: Parameter, ...} ): ( Error, plaintext )

getAAD ( Payload, { Options: Parameter, ...} ): ( Error, AADtext )

getAuthTag ( Payload, { Options: Parameter, ...} ): ( Error, AuthTag )

authPayload( Payload, AuthTag [, AAD] ): ( Error, Boolean )

resetDefaults( { Options: Parameter, ...} ): ( Error, Boolean )

Events

No generated events. 

Constructors/Prototypes

The constructor allows setting/overriding default options.  

Example, sets the default masterkey file:  

	const CipherLib = require( '../cipherlib' ); 
	
	const cipherlib = new CipherLib.CipherLib( { keyfilepath: '~/mymasterkeyfile' } );
	
		

Class Objects and descriptions

Object Type Description/Details


aad or AAD AEAD Associated data - Variable length (0 up to 2^32 bytes)

				{ aad: 'text is authenticated and stored unencrypted in Payload' }

AuthTag 16 bytes - generated by the cipher algorithm

Ciphertext Variable lengthnciphered plaintext data (1 up to 2*32 bytes)

Nonce 16 bytes padded per PKCS#7

Options aka method options: { optionName: 'optionParameter' } { keyfilepath: '~/mymasterkeyfile' }

Payload Structure for storing AEAD data including: Nonce, Ciphertext, AAD, AuthTag