# πŸ” NIP‑49 Key Encrypt/Decrypt & Conversion CLI A tiny, no-fuss command-line tool to **encrypt**, **decrypt**, and **convert** Nostr keys β€” safely and offline. Built for privacy-conscious users who want a secure and user-friendly way to handle their Nostr keys using [NIP‑49](https://github.com/nostr-protocol/nips/blob/master/49.md). --- ## ✨ Features - πŸ” **Encrypt / Decrypt** your Nostr `nsec` keys using a password (NIP‑49) - πŸ” **Convert** private key hex ↔ `nsec` and public key hex ↔ `npub` - 🧭 Friendly CLI with step-by-step wizard prompts - βš™οΈ Pure Python. No compiling, no GUI β€” just run and go - πŸ”’ Secure: works 100% offline β€” no network requests --- ## 🍎 macOS Setup ### βœ… 1. Install Python 3 (via Homebrew) If you don’t already have Python 3: ```bash /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" brew install python ``` Confirm it’s working: ```bash python3 --version ``` πŸ“¦ Installation ```bash πŸ“ 1. Clone the repo git clone https://github.com/btcforplebs/nip49-decrypt.git ``` cd nip49-decrypt ### πŸ§ͺ 2. Create and activate a virtual environment ```bash python3 -m venv venv source venv/bin/activate ``` ### πŸ“¦ 3. Install Python packages ```bash pip install bech32 cryptography ecdsa pynacl If pynacl fails, the script will fall back to cryptography for encryption. ``` ### βœ… 4. Make it executable ```bash chmod +x nip-49decrypt ``` ▢️ Usage From the project directory, run: ```bash ./nip-49decrypt ``` You’ll see a friendly menu: ```bash Choose an action: (d) Decrypt an encrypted key with password (e) Encrypt a private key with password (h) Convert private key hex to nsec (p) Convert public key hex to npub (q) Quit ``` ### πŸ” Example: Decrypt a Key Select (d) Paste your ncryptsec string Enter your password (input hidden) View your decrypted raw private key and corresponding nsec ### πŸ› οΈ Other Features Convert raw hex β†’ nsec Choose (h) and enter your private key as 64-character hex. Convert public key hex β†’ npub Choose (p) and paste a 66-character (compressed) or 130-character (uncompressed) public key in hex. Encrypt nsec β†’ ncryptsec Choose (e) and paste your private key (hex or nsec). You’ll be prompted for a password, and the script will return a password-encrypted ncryptsec. ### 🧼 To Exit Use (q) or press Ctrl + C at any time. ### πŸ“ Files File Description nip-49decrypt Main Python script README.md This help file venv/ Your virtual environment (optional) ### 🧠 FAQ ❓ Is this secure? βœ… Yes. This script never sends anything over the internet. ❓ Can I run it offline? βœ… 100%. Works without an internet connection. ❓ What if a Python package is missing? πŸ› οΈ The script will detect it and print exact instructions for how to install it. ❓ Can I compile this to a single file? Yes! You can use tools like pyinstaller to build a standalone binary. ### 🀝 Credits Built with ❀️ by plebs, for plebs. Inspired by NIP‑49 and the Nostr community. ### πŸ›‘οΈ License MIT β€” Free for all. Fork, contribute, share.