
Security News
Feross on TBPN: How North Korea Hijacked Axios
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.
@typinghare/trick
Advanced tools
Trick is a CLI tool that helps you safely encrypt sensitive files (such as .env, API keys, or credentials) so they can be stored in Git repositories and easily restored on other machines or servers.
It uses OpenSSL (AES-256-CBC + PBKDF2) under the hood and keeps encryption keys outside your repository.
.trick/ directory# npm
npm install -g @typinghare/trick
# pnpm
pnpm add -g @typinghare/trick
# yarn
yarn add -g @typinghare/trick
Requirements
- Node.js ≥ 18
opensslavailable in your system PATH
Sensitive files are usually added to .gitignore to avoid accidental leaks.
But that means:
Trick encrypts those files, allowing you to commit the encrypted versions safely, while keeping passphrases out of Git entirely.
Run this inside your project:
trick init
This creates a trick.config.json in your project root.
A target is a named group of files to encrypt together.
trick add MyTarget .env api_key.conf
List all targets:
trick list
Each target has its own passphrase file stored locally (not in Git).
trick set-passphrase MyTarget
This creates a file at:
~/.config/trick/passphrases/MyTarget
600⚠️ Important Back up your passphrase files. Losing them means losing access to your encrypted data.
trick encrypt MyTarget
Encrypted files are written to:
.trick/<original-path>.enc
Example output:
🟩 Encrypted: .env -> .trick/.env.enc
🟩 Encrypted: api_key.conf -> .trick/api_key.conf.enc
You can now commit the .trick/ directory safely.
Copy or recreate the passphrase file:
~/.config/trick/passphrases/MyTarget
Run:
trick decrypt MyTarget
Files are restored to their original locations.
You can mark targets as default, so you don’t need to specify them every time.
trick add-default MyTarget
List default targets:
trick list-defaults
Now you can simply run:
trick encrypt
trick decrypt
trick.config.jsonExample:
{
"targets": {
"MyTarget": {
"files": [".env", "api_key.conf"]
}
},
"trickRootDirectory": ".trick",
"passphraseDirectory": "~/.config/trick/passphrases",
"defaultTargetNames": ["MyTarget"],
"encryption": {
"iterationCount": 100000
}
}
| Field | Description |
|---|---|
targets | Mapping of target names to file lists |
trickRootDirectory | Where encrypted files are stored |
passphraseDirectory | Where passphrase files live |
defaultTargetNames | Targets used when none specified |
encryption.iterationCount | PBKDF2 iteration count |
| Command | Description |
|---|---|
trick init | Initialize configuration |
trick config | Print current config |
trick add <target> [files...] | Add files to a target |
trick remove <target> [files...] | Remove files from a target |
trick remove <target> --target | Remove a target |
trick list | List targets and files |
trick set-passphrase <target> | Create passphrase file |
trick encrypt [targets...] | Encrypt files |
trick decrypt [targets...] | Decrypt files |
trick add-default [targets...] | Add default targets |
trick list-defaults | Show default targets |
Encryption uses:
Passphrases:
Losing passphrases = losing access to encrypted files
MIT
FAQs
Save credential files to remote safely and easily.
We found that @typinghare/trick demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.

Security News
OpenSSF has issued a high-severity advisory warning open source developers of an active Slack-based campaign using impersonation to deliver malware.

Research
/Security News
Malicious packages published to npm, PyPI, Go Modules, crates.io, and Packagist impersonate developer tooling to fetch staged malware, steal credentials and wallets, and enable remote access.