From 42bd9cd05817032f3e523dbbc120d0e601528c13 Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Fri, 16 Jan 2026 13:53:59 +0000 Subject: [PATCH] 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 --- hscontrol/state/state.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hscontrol/state/state.go b/hscontrol/state/state.go index b31b79fd..61dbe7b5 100644 --- a/hscontrol/state/state.go +++ b/hscontrol/state/state.go @@ -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)