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

passworld

v1.0.1

Published

A library and CLI to encrypt/decrypt files and directories with passwords.

Downloads

5

Readme

passworld

A library and CLI to encrypt/decrypt files and directories with passwords.

How does it work?

First, you tell passworld what you want to encrypt and give it a password. It uses scrypt to derive two keys from your password. It encrypts your file or directory with the first key using secretbox. Then it encrypts the result from the previous step with the second key using AES-GCM. If the encryption target is a directory, passworld creates a tar archive, encrypts that, and rm -rs the directory.

The output, or "bundle", contains the ciphertext (doubly encrypted file or directory), two CSPRNG scrypt salts, two CSPRNG encryption nonces, and an authentication tag for AES-GCM.

When you want to decrypt something, you hand passworld the bundle and your password. It derives the second key from your password and the second salt in the bundle. Then it decrypts the ciphertext with the second key and the second nonce in the bundle using AES-GCM. It performs similar steps to recover the first key and subsequently decrypts using secretbox. When you tell passworld to decrypt a tar archive, it should extract it following decryption and then remove it. Your plaintext file or directory should now be in the filesystem.

A note on security

I'll try to keep Node and dependency versions up to date/bump them when security vulnerabilities are addressed. If you discover a vulnerability in passworld, let me know! Refer to the contributing section to see how you can help.

WARNING: passworld hasn't received a formal security audit so use it at your own risk and beware of 🐉🐉!

Install

npm i [-g] passworld

For development

Make sure you have nvm installed.

Then git clone the repo, cd into it, nvm i, and npm i [-g].

Usage

Note: each JS example assumes top-level async/await and each CLI command prompts you for a password.

Encrypt a file

Encrypt a file and overwrite it with the encrypted contents.

JS

await passworld.encrypt('/path/to/file', 'password', { gzip })

CLI

$ passworld encrypt [-z] path/to/file

Options

gzip [-z]

Compress before encryption.

Encrypt a directory

Create a tar archive of a directory, encrypt it, write the encrypted contents to /path/to/dir.{tar|tgz}, and remove the original directory.

JS

await passworld.encrypt('/path/to/dir', 'password', { gzip })

CLI

$ passworld encrypt [-z] path/to/dir

Options

gzip [-z]

Compress before encryption.

Note: the encrypted tar archive will have extension .tgz instead of .tar.

Decrypt a file

Decrypt a file and overwrite it with the plaintext contents.

JS

await passworld.decrypt('/path/to/file', 'password')

CLI

$ passworld decrypt /path/to/file

Decrypt a directory

Decrypt an encrypted tar archive, extract the original directory, and remove the archive.

JS

await passworld.decrypt('/path/to/dir.{tar|tgz}', 'password')

CLI

$ passworld decrypt /path/to/dir.{tar|tgz}

"Recrypt" a file or directory

Decrypt a file or directory and encrypt it again.

This command prompts you for two passwords: the first for decryption and the second for encryption.

If you enter an empty password the second time, passworld will use the same password to encrypt.

CLI

$ passworld recrypt [-z] /path/to/*

Options

gzip [-z]

Compress before encryption.

Documentation

npm run doc

Test

npm test

Lint

npm run lint

Contributing

Please do!

If you find a bug, want a feature added, or just have a question, feel free to open an issue. In addition, you're welcome to create a pull request addressing an issue. You should push your changes to a feature branch and request merge to develop.

Make sure linting and tests pass and coverage is 💯 before creating a pull request!