Remove dead code, secure debug endpoints, fix encapsulation

This commit is contained in:
Alexander
2026-04-10 13:07:26 +02:00
parent 4abd4e68dc
commit 17cde479c3
5 changed files with 25 additions and 63 deletions
+16 -16
View File
@@ -7,22 +7,15 @@ import (
// Credential represents an Anthropic API credential loaded from a JSON file.
type Credential struct {
ID string
Email string
AccessToken string
RefreshToken string
ExpiresAt time.Time
FilePath string
CooldownUntil time.Time
nextRefreshAfter time.Time
mu sync.Mutex
}
// IsExpired returns true if the credential's access token has expired.
func (c *Credential) IsExpired() bool {
c.mu.Lock()
defer c.mu.Unlock()
return time.Now().After(c.ExpiresAt)
ID string
Email string
AccessToken string
RefreshToken string
ExpiresAt time.Time
FilePath string
CooldownUntil time.Time
nextRefreshAfter time.Time
mu sync.Mutex
}
// IsOnCooldown returns true if the credential is currently on cooldown.
@@ -39,6 +32,13 @@ func (c *Credential) SetCooldown(duration time.Duration) {
c.CooldownUntil = time.Now().Add(duration)
}
// ClearCooldown removes any active cooldown on the credential.
func (c *Credential) ClearCooldown() {
c.mu.Lock()
defer c.mu.Unlock()
c.CooldownUntil = time.Time{}
}
// Token returns the current access token.
func (c *Credential) Token() string {
c.mu.Lock()