state: add GetAPIKeyByID method

Add GetAPIKeyByID method to the state layer, delegating to the existing
database layer function. This enables API key lookup by ID in addition
to the existing prefix-based lookup.

Updates #2986
This commit is contained in:
Kristoffer Dalby 2026-01-16 13:53:59 +00:00
parent 515a22e696
commit d575b89c67

View file

@ -998,6 +998,11 @@ func (s *State) GetAPIKey(displayPrefix string) (*types.APIKey, error) {
return s.db.GetAPIKey(prefix)
}
// GetAPIKeyByID retrieves an API key by its database ID.
func (s *State) GetAPIKeyByID(id uint64) (*types.APIKey, error) {
return s.db.GetAPIKeyByID(id)
}
// ExpireAPIKey marks an API key as expired.
func (s *State) ExpireAPIKey(key *types.APIKey) error {
return s.db.ExpireAPIKey(key)