IsValid checks if the API key is valid
()
| 48 | |
| 49 | // IsValid checks if the API key is valid |
| 50 | func (k *APIKey) IsValid() bool { |
| 51 | now := time.Now() |
| 52 | return !k.IsRevoked && now.Before(k.ExpiresAt) |
| 53 | } |
| 54 | |
| 55 | // HasScope checks if the API key has the required scope |
| 56 | func (k *APIKey) HasScope(scope string) bool { |
no outgoing calls