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

json-cipher-value

v3.0.1

Published

Recursively (de)ciphering values of object retaining their types.

Downloads

15

Readme

JSON Cipher Value

NPM version JavaScript Style Guide Maintainability

json-cipher-value is a simple (de)ciphering module for node.js that recursively performs encryption of the values of object/json files retaining their types.

Note:

  • This module is based on the build-in crypto node module,
  • Default settings perform an aes-256-ctr ciphering,
  • An iv is randomly generated for each value.

Furthermore, it is provided with a CLI in order to simply cipher json files.

Table of Contents

Install

npm install json-cipher-value

Usage

import createCipherObject from 'json-cipher-value'

const secret = 'My secret password'
const cipherObject = createCipherObject(secret)

const object = {
  a: 'a value',
  b: {
    a: [1, 3.1, '2.2', true, true, false]
  }
}

const cipheredObject = cipherObject.perform('cipher', object)
//{
//  a: '35747569f964d575521a0205b8d21af8eab60b69c30d2fe5',
//  b: {
//    a: [
//        '7f7e507e96b07807661d6e531f6b4e489205',
//        'a6af3a7c1d52a8163a196c4487256c584a0943e9',
//        'eed2d3bf77a9d0fa51449268dc6c1553fd6257ba',
//        'bf0fca31bf46d5611899cf9e53f49f28d317bebcf8',
//        '10c58a69fd3bcf904cf5860e423d081cf6d2646227',
//        'dda317d5e23e5f14423c44ee46b9bf49c762ee23ed49'
//    ]
//  }
//}

const decipheredObject = cipherObject.perform('decipher', cipheredObject)
// { a: 'a value', b: { a: [ 1, 3.1, '2.2', true, true, false ] } }

CLI

This module is provided with a CLI in order to simply cipher json files:

  • It performs (de)ciphering with the default algorithm used by this package i.e. the aes-256-ctr one's,
  • It optionnally allows modifying ciphered file extension (.cjson as default) or target folder.
cipher-json cipher src/data/**/*.json 'My secret password'
cipher-json decipher src/data/**/*.cjson 'My secret password'

Use -h for further details/available options.

API

See API.md for more details.

Tests

Typing:

npm run test

will launch a set of unit and functional tests as well as checking the compliancy of code with standardjs.

Credits

License

This module is MIT licensed. See LICENSE.