feat: implement Milestone 3 integration points

Add comprehensive integration capabilities to Pop CLI:

- Multi-account support with named profiles
- Webhook management with signature verification
- External PGP key management (import/export/encrypt/decrypt/sign/verify)
- CLI plugin system for extensibility
- Complete documentation in README.md

All compilation errors fixed and build verified CLEAN.

Security review delegated to FRE-5202.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
2026-05-12 17:31:58 -04:00
parent e7e77fcc20
commit bf26cd3ed6
16 changed files with 3566 additions and 85 deletions

192
README.md
View File

@@ -8,6 +8,10 @@ A ProtonMail CLI tool written in Go, similar to gog.
- **Session Management**: Secure token storage in `~/.config/pop/`
- **ProtonMail API Client**: REST client with rate limiting and error handling
- **PGP Encryption**: Full support for ProtonMail's PGP encryption via gopenpgp v2
- **Multi-Account Support**: Named account profiles for managing multiple ProtonMail accounts
- **Webhook Management**: Real-time notifications via webhook subscriptions
- **External PGP Key Management**: Import, export, encrypt, decrypt, sign, and verify with external PGP keys
- **CLI Plugin System**: Extend Pop functionality with external plugins
## Installation
@@ -23,6 +27,8 @@ make install
## Usage
### Authentication
```bash
# Initialize login (interactive mode with masked password prompt)
pop login
@@ -34,20 +40,126 @@ pop session
pop logout
```
### Multi-Account Support
```bash
# List all accounts
pop accounts list
# Add a new account
pop accounts add work --email work@example.com --default
# Add with custom API URL
pop accounts add personal --email personal@protonmail.ch --api-url https://api.protonmail.ch
# Switch default account
pop accounts default work
# View account details
pop accounts show work
# Remove an account
pop accounts remove old-account
```
### Webhook Management
```bash
# List all webhooks
pop webhook list
# Add a webhook
pop webhook add notifications --url https://example.com/webhook --events mail.received,mail.sent
# Verify webhook signatures
pop webhook verify
# Remove a webhook
pop webhook remove wh_1234567890
```
### PGP Key Management
```bash
# List all imported keys
pop pgp list
# Import a key from file
pop pgp import key.asc --trust full
# Export a key
pop pgp export ABCD1234 --output mykey.asc
# Encrypt data
pop pgp encrypt ABCD1234 --plaintext "Secret message"
# Decrypt data
pop pgp decrypt ABCD1234 --encrypted "-----BEGIN PGP MESSAGE-----..."
# Sign data
pop pgp sign ABCD1234 --plaintext "Message to sign" --passphrase "my passphrase"
# Verify a signature
pop pgp verify ABCD1234 --message "Original message" --signature "-----BEGIN PGP SIGNATURE-----..."
# Remove a key
pop pgp remove ABCD1234
```
### Plugin Management
```bash
# List all plugins
pop plugin list
# Enable a plugin
pop plugin enable myplugin
# Disable a plugin
pop plugin disable myplugin
```
## Project Structure
```
pop/
├── cmd/
│ ├── root.go # CLI root command
── auth.go # Authentication commands
── auth.go # Authentication commands
│ ├── mail.go # Email management
│ ├── draft.go # Draft management
│ ├── contact.go # Contact management
│ ├── attachment.go # Attachment handling
│ ├── folder.go # Folder management
│ ├── label.go # Label management
│ ├── accounts.go # Multi-account support
│ ├── webhook.go # Webhook management
│ ├── pgp.go # PGP key management
│ ├── plugin.go # Plugin management
│ └── thread.go # Thread management
├── internal/
│ ├── auth/ # Session management
│ │ └── session.go
│ ├── config/ # Configuration handling
│ │ └── config.go
── api/ # ProtonMail API client
└── client.go
── api/ # ProtonMail API client
└── client.go
│ ├── mail/ # Mail-related functionality
│ │ └── mail.go
│ ├── contact/ # Contact management
│ │ └── contact.go
│ ├── attachment/ # Attachment handling
│ │ └── attachment.go
│ ├── labels/ # Label management
│ │ └── labels.go
│ ├── accounts/ # Multi-account support
│ │ └── accounts.go
│ ├── webhook/ # Webhook management
│ │ └── webhook.go
│ ├── pgp/ # PGP key management
│ │ └── pgp.go
│ └── plugin/ # Plugin system
│ └── plugin.go
├── .github/
│ └── workflows/
│ └── ci.yml # CI/CD pipeline
@@ -83,6 +195,80 @@ Session data is stored in `~/.config/pop/session.json`:
}
```
### Multi-Account Configuration
Accounts are stored in `~/.config/pop/accounts.json`:
```json
[
{
"name": "work",
"email": "work@example.com",
"api_base_url": "https://api.protonmail.ch",
"default": true,
"created_at": "2024-01-01T00:00:00Z"
}
]
```
### Webhook Configuration
Webhooks are stored in `~/.config/pop/webhooks.json`:
```json
[
{
"id": "wh_1234567890",
"name": "notifications",
"url": "https://example.com/webhook",
"events": ["mail.received", "mail.sent"],
"secret": "abc123...",
"active": true,
"created_at": "2024-01-01T00:00:00Z"
}
]
```
### PGP Key Configuration
PGP keys are stored in `~/.config/pop/pgp_keys.json` with key files in `~/.config/pop/pgp_keys/`:
```json
[
{
"key_id": "ABCD1234",
"fingerprint": "ABCD1234567890ABCD1234567890ABCD1234",
"emails": ["user@example.com"],
"trust_level": "full",
"can_encrypt": true,
"can_sign": true,
"armor_file": "/home/user/.config/pop/pgp_keys/ABCD1234.asc"
}
]
```
### Plugin Configuration
Plugins are stored in `~/.config/pop/plugins.json` with binaries in `~/.config/pop/plugins/`:
```json
[
{
"name": "myplugin",
"version": "1.0.0",
"description": "My custom plugin",
"binary": "/home/user/.config/pop/plugins/pop-myplugin",
"enabled": true,
"commands": [
{
"name": "mycommand",
"description": "My custom command"
}
]
}
]
```
## Development
```bash