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

test-justencrypt

v0.0.5

Published

JustEncrypt =========== [![Latest Stable Version](https://badge.fury.io/js/justencrypt.svg)](https://www.npmjs.org/package/justencrypt) [![Build Status](https://travis-ci.org/btccom/justencrypt-js.png?branch=master)](https://travis-ci.org/btccom/justencry

Downloads

9

Readme

JustEncrypt

Latest Stable Version Build Status Sauce Test Status

Sauce Test Status

This package is being tested against;

  • NodeJS:
    • 0.11
    • 0.12
    • 5.11
    • 6.3.0
    • 7.1.0
  • Browser:
    • Google Chrome 48 / latest
    • Firefox 49 / latest
    • Safari 10.0 / latest
    • Edge 14.14393
    • IE 11.103
    • Android 4.4
    • Android 5.0
    • iPhone OS X 10.10

Usage

All functions return promises to make it easy to automatically use webworkers or WebCrypto API in browsers that support it!

KeyDerivation

// iterations is optional and defaults to 35k iterations
justencrypt.KeyDerivation.computeSync(new Buffer(rawPassword, 'utf8'), saltBuffer, iterations)
    .then(function(keyBuffer) {
        console.log(keyBuffer.toString('base64'));
    });

Encryption

The result of encrypt is encoded as iter || saltLen8 || salt || iv || tag || ct,
when this is fed into decrypt it will be able decode the salt and iterations used.

// iterations is optional and defaults to 35k iterations
justencrypt.Encryption.encryptSync(new Buffer(rawPassword, 'utf8'), dataBuffer, iterations)
    .then(function(encryptedBuffer) {
        console.log(encryptedBuffer.toString('base64'));
    });

justencrypt.Encryption.decryptSync(encryptedBuffer, new Buffer(rawPassword, 'utf8'))
    .then(function(decryptedDataBuffer) {
        console.log(decryptedDataBuffer.toString('base64'));
    });

EncryptionMnemonic

To make the result of encrypt human readable (so it is easier to write down) it's possible to encode it as an mnemonic.
We're using the Bitcoin BIP39 way of encoding entropy to mnemonic, but ignoring the (weak) password protection BIP39 originally had.
We also ensure the data is padded correctly.

IMPORTANT: This is only meant to be used to encode results of encrypt, don't use this for anything else!

var mnemonicString = justencrypt.EncryptionMnemonic.encode(encryptedBuffer);
var encryptedBuffer = justencrypt.EncryptionMnemonic.decode(mnemonicString);

Development / Contributing

You should have mocha, istanbul and grunt-cli installed globally, if not run npm install -g mocha instanbul grunt-cli.
Also recommended to have phantomjs >= 1.9.8 on $PATH to speed up the asmcrypto.js build; https//github.com/Medium/phantomjs/releases/download/v1.9.19/phantomjs-1.9.8-linux-x86_64.tar.bz2

Unit Tests are created with Mocha and can be ran with npm test (or mocha)

We also run jshint and jscs, these are automatically ran by travis-ci for every commit and pull request.

jshint main.js lib/ test/ && jscs main.js lib/ test/

or simply npm run-script lint

Uglify

If you're planning to uglify/minify the javascript yourself, make sure to exclude the following variable names from being mangled:
['Buffer', 'sha512_asm', 'asm']

License

JustEncrypt is released under the terms of the MIT license. See LICENCE.md for more information or see http://opensource.org/licenses/MIT.