Files
pop/README.md
Michael Freno 25836e27b9 FRE-680: Initial project scaffold with auth & API client
- Set up Go module with Cobra CLI skeleton
- Implemented login/logout/session commands with 2FA support
- Created ProtonMail API client with rate limiting
- Added config management for ~/.config/pop/
- Configured CI/CD pipeline with GitHub Actions
- Added Makefile for build/test/lint targets

Files:
- main.go, go.mod, go.sum
- cmd/root.go, cmd/auth.go
- internal/auth/session.go
- internal/config/config.go
- internal/api/client.go
- Makefile, README.md, .gitignore
- .github/workflows/ci.yml
2026-04-26 09:45:10 -04:00

116 lines
2.0 KiB
Markdown

# pop
A ProtonMail CLI tool written in Go, similar to gog.
## Features
- **Authentication**: Login/logout with 2FA support
- **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
## Installation
```bash
# Build from source
git clone https://github.com/frenocorp/pop.git
cd pop
make build
# Install
make install
```
## Usage
```bash
# Initialize login (interactive mode)
pop login
# Login with explicit credentials
pop login --email user@proton.me --password secret
# Check current session
pop session
# Logout
pop logout
```
## Project Structure
```
pop/
├── cmd/
│ ├── root.go # CLI root command
│ └── auth.go # Authentication commands
├── internal/
│ ├── auth/ # Session management
│ │ └── session.go
│ ├── config/ # Configuration handling
│ │ └── config.go
│ └── api/ # ProtonMail API client
│ └── client.go
├── .github/
│ └── workflows/
│ └── ci.yml # CI/CD pipeline
├── go.mod
├── go.sum
├── main.go
├── Makefile
└── README.md
```
## Configuration
Configuration is stored in `~/.config/pop/config.json`:
```json
{
"api_base_url": "https://api.protonmail.ch",
"timeout_sec": 30,
"rate_limit_requests": 100,
"rate_limit_window_sec": 60
}
```
Session data is stored in `~/.config/pop/session.json`:
```json
{
"uid": "user-uid",
"access_token": "token",
"refresh_token": "refresh",
"expires_at": 0,
"two_factor_enabled": false
}
```
## Development
```bash
# Build
make build
# Run tests
make test
# Format code
make fmt
# Lint
make lint
# Clean build artifacts
make clean
```
## Dependencies
- [github.com/spf13/cobra](https://github.com/spf13/cobra) - CLI framework
- [github.com/ProtonMail/gopenpgp/v2](https://github.com/ProtonMail/gopenpgp) - PGP crypto
## License
MIT