# Bitcoin Signer

> A distraction-free desktop application for logging into websites using Bitcoin message signing.

Unlike standard Bitcoin wallets that burden users with transaction management, network fees, mempools, UTXO tracking, and rolling change addresses, **Bitcoin Signer** is 95% simpler. It is purpose-built for **web authentication** (BIP-137 message signing), allowing you to sign challenge nonces and login strings in seconds.

Inspired by desktop password managers (KeePassXC / 1Password) and the Electrum wallet, the entire application fits cleanly in a **single viewport with zero vertical scrolling**.

---

## Streamlined Desktop Experience

1. **Top Identity Table (Instant Activation)**:
   - Columnar table displaying your Bitcoin identities (Nickname, Address, and Format).
   - **Click any row** to highlight it and immediately put it in use for signing. No dialogs or extra buttons required.
2. **Real-Time Signature Generation (No "Sign" Button)**:
   - Type or paste your challenge string into the **Message to Sign** box.
   - The BIP-137 signature is generated automatically and immediately as you type.
3. **Click-Anywhere Copy (No "Copy" Button)**:
   - Simply **click anywhere on the signature box** to copy the signature to your clipboard.
   - Includes a discreet corner copy icon with immediate visual confirmation (`✓ Copied`).
4. **Single-Viewport Layout**:
   - Zero scrolling required. Everything (identities table, input message box, and output signature box) fits within the window height.

---

## Security & Anti-Rainbow Table Architecture

$$\text{Decryption Key} = \text{PBKDF2-HMAC-SHA256}(\text{Password}, \text{App Salt} + \text{Install Salt}, \text{iterations}=300{,}000)$$

1. **Application Salt**: Hardcoded domain-separation salt preventing cross-database rainbow table reuse.
2. **Install Salt**: Unique 256-bit cryptographically secure random salt generated on vault setup and stored on the device.
3. **PBKDF2 (300k iterations)**: Protects against offline brute force even if the user chooses a simple password.
4. **AES-256-GCM**: Authenticated encryption with unique 12-byte IV per write, guaranteeing confidentiality and instant tamper detection.
5. **Zero-Knowledge Memory**: Private keys only exist decrypted in isolated main process memory while the vault is actively unlocked. Locking immediately zeroes memory buffers.
6. **Cross-Platform Storage**:
   - Linux: `~/.config/bitcoinsigner/vault.enc.json`
   - Windows: `%APPDATA%\bitcoinsigner\vault.enc.json`

---

## Installation & Running

### Prerequisites
- Node.js (v18+) & npm

### Commands
```bash
# 1. Install dependencies
npm install

# 2. Run core cryptography & API tests
npm test

# 3. Launch native desktop application
npm start

# 4. Or preview in browser
npm run web
# Open http://localhost:3333
```

---

## Packaging for Distribution

You can package Bitcoin Signer into standalone installers for Linux and Windows:

```bash
# Build for Linux (AppImage & deb)
npx electron-builder --linux

# Build for Windows (.exe installer & portable)
npx electron-builder --win
```

---

## License
MIT
