A lightweight and secure CLI tool for encrypting and decrypting files using AES-256 encryption
npm install safestore
SafeStore is an npm package that allows users to encrypt and decrypt files directly from the command line using a password. It is designed to be lightweight, easy to use, and secure. One of its primary use cases is encrypting .env files before pushing them to version control systems like GitHub. You can now push your env files to GitHub without the hassle of managing secrets in repository settings or storing them locally. Just remember one password to encrypt and decrypt your files - perfect for small projects where you don't want to deal with complex secrets management and data loss in case files are deleted from PC.
npkill help clean up these directories,let's say in frustration there's a real risk of accidentally deleting entire project folders in the cleanup process. While your code might be safely stored on GitHub, your .env files - which are typically gitignored - could be lost forever. Managing these through GitHub Secrets for each project can become tedious and time-consuming. This was the exact problem that inspired SafeStore: now you can simply use npx safe to encrypt your .env files and safely push them to GitHub. Just remember your password, and you'll never lose your environment variables again, even if you accidentally delete your local projects!``bash`
npm install -g safestore
Just run this command:
`bash`
npx safe
It will ask you for the file path, password and operation type.
Or you can use either of these commands:
`bash`
npx safestore encrypt
- : Path to the file you want to encrypt.
- : Path to save the encrypted file.
- : Password to encrypt the file.
Example:
`bash`
npx safestore encrypt .env .env.safe mySecretPassword
for convenient encryption and decryption. The tool will prompt for the password while using predefined file paths:`json
{
"scripts": {
"safe:encrypt": "npx safestore encrypt .env .env.safe",
"safe:decrypt": "npx safestore decrypt .env.safe .env"
}
}
`Then simply run:
`bash
npm run safe:encrypt
or
npm run safe:decrypt
`
You'll only need to enter the password when prompted.$3
`bash
npx safestore decrypt
`
- : Path to the encrypted file.
- : Path to save the decrypted file.
- : Password to decrypt the file.Example:
`bash
npx safestore decrypt .env.safe .env mySecretPassword
`$3
1. Securely Store Environment Variables: Encrypt your .env file before pushing it to a public repository.
- Example:
`bash
npx safestore encrypt .env .env.enc mySecretPassword
git add .env.enc
git commit -m "Add encrypted .env file"
`
2. Backup Sensitive Files: Keep encrypted backups of sensitive files to prevent unauthorized access.
3. Share Encrypted Files: Share encrypted files with collaborators securely. Share the password via a separate secure channel.
4. Prevent Loss of Environment Variables: Use SafeStore to back up your .env` file. Even if your local project is deleted, you can recover the variables by decrypting the file.