
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
@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.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.