Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dhaiwat10/priv-key-precommit
A simple precommit hook that checks for the presence of an Ethereum private key in your codebase
https://github.com/dhaiwat10/priv-key-precommit
commit ethereum husky key precommit priv private protection
Last synced: 2 months ago
JSON representation
A simple precommit hook that checks for the presence of an Ethereum private key in your codebase
- Host: GitHub
- URL: https://github.com/dhaiwat10/priv-key-precommit
- Owner: Dhaiwat10
- Created: 2022-05-07T04:02:33.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-05-11T04:52:20.000Z (over 2 years ago)
- Last Synced: 2024-09-13T01:31:07.232Z (3 months ago)
- Topics: commit, ethereum, husky, key, precommit, priv, private, protection
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/priv-key-precommit
- Size: 130 KB
- Stars: 28
- Watchers: 3
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# priv-key-precommit
A simple precommit hook that checks for the presence of an Ethereum private key in your codebase.
## Usage
1. Install the package
```bash
yarn add -D priv-key-precommit
```2. Create a script in your `package.json`
```json
"scripts": {
"priv-key-check": "priv-key-precommit"
}
```3. Install husky (or a similar pre-commit hook manager)
```bash
npx husky-init && yarn
```4. Edit the contents of `.husky/pre-commit`
```sh
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"npm run priv-key-check
```5. Try commiting your code. It won't let you commit your code if it finds a private key in your codebase.
```bash
❯ git commit -m 'test'> priv:check
> priv-key-precommit🚨 Found 1 instance(s) of private keys. Aborting commit.
=> .env.example
husky - pre-commit hook exited with code 1 (error)
```