- Add SessionRefresher interface for token refresh abstraction - Update ProtonMailClient to auto-refresh on 401 responses - Add DoWithContext method for context-aware HTTP requests - Update SessionManager with RefreshTokenWithContext method - Update LoginWithCredentials and LoginInteractive to accept context - Add checkAuthenticatedWithManager helper for commands needing session manager - All API methods now support proper cancellation via context.Context Files changed: - internal/api/client.go - Auto-refresh on 401, context support - internal/auth/session.go - Context-aware refresh and login methods - internal/auth/interface.go - SessionRefresher interface - cmd/mail.go, cmd/draft.go, cmd/folders.go - Updated to use new helpers - cmd/auth.go - Context support for login commands Co-Authored-By: Paperclip <noreply@paperclip.ing>
12 lines
334 B
Go
12 lines
334 B
Go
package auth
|
|
|
|
import "context"
|
|
|
|
// SessionRefresher defines the interface for refreshing authentication tokens.
|
|
// This allows the API client to automatically refresh tokens on 401 responses.
|
|
type SessionRefresher interface {
|
|
RefreshToken() error
|
|
RefreshTokenWithContext(ctx context.Context) error
|
|
GetSession() (*Session, error)
|
|
}
|