@node-cli/secret
v1.2.13
Published
Secret is a CLI tool that can encode or decode a file with a password
Readme
Node CLI secret package
Secret is a command line tool that can encode or decode a file with a password. It also exposes a library to be used in other projects.
Installation as a CLI
> npm install --global @node-cli/secretInstallation as a library
> cd your-project
> npm install @node-cli/secretUsage as a library
Encrypt a string with a password
import { encrypt } from "@node-cli/secret";
const encrypted = encrypt("password", "Hello World");Decrypt a string with a password
import { decrypt } from "@node-cli/secret";
const decrypted = decrypt("password", encrypted);Hash a password with a default salt
import { hashPassword } from "@node-cli/secret";
const hashed = hashPassword("password");
// hashed === "some-default-salt:some-hex-stringHash a password with a custom salt
import { createSalt, hashPassword } from "@node-cli/secret";
const salt = createSalt(42);
const hashed = hashPassword("password", salt);
// hashed === "some-salt:some-hex-stringVerify a password against a hash
import { hashPassword, verifyPassword } from "@node-cli/secret";
const hashed = hashPassword("password");
const isVerified = verifyPassword("password", hashed);
// isVerified === trueUsage as a CLI
NOTE: The password is not stored anywhere, it is only used to encrypt or decrypt the file and will be prompted each time.
Encrypt a file
> secret --encrypt README.md README.md.encDecrypt a file
> secret --decrypt README.md.enc README.mdGet help
> search --helpLicense
MIT © Arno Versini
