🔐 feat: Add token export/import for ephemeral environments

- Add token CLI subcommand with export/import operations
- Enable OAuth2 token persistence across clean environments
- Support for containers, CI/CD, and ephemeral compute workflows
- Compress tokens with gzip and encode as base64 for env vars
- Automatic token restoration from CULL_GMAIL_TOKEN_CACHE
- Secure file permissions (600) on restored tokens
- Add comprehensive error handling for token operations
- Update dependencies: base64, flate2, serde_json

This feature enables cull-gmail to run in ephemeral environments
like Docker containers and CI/CD pipelines without re-authentication
by exporting tokens once and restoring them via environment variables.
This commit is contained in:
Jeremiah Russell
2025-10-21 07:31:45 +01:00
committed by Jeremiah Russell
parent 6334ba6c13
commit 2bee42d7ba
5 changed files with 606 additions and 0 deletions

View File

@@ -51,4 +51,13 @@ pub enum Error {
/// Invalid message age specification
#[error("Invalid message age: {0}")]
InvalidMessageAge(String),
/// Token not found or missing
#[error("Token error: {0}")]
TokenNotFound(String),
/// File I/O error with context
#[error("File I/O error: {0}")]
FileIo(String),
/// Serialization/deserialization error
#[error("Serialization error: {0}")]
SerializationError(String),
}