mirror of
https://github.com/juanfont/headscale.git
synced 2026-04-23 09:08:44 +02:00
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:
@@ -998,6 +998,11 @@ func (s *State) GetAPIKey(displayPrefix string) (*types.APIKey, error) {
|
|||||||
return s.db.GetAPIKey(prefix)
|
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.
|
// ExpireAPIKey marks an API key as expired.
|
||||||
func (s *State) ExpireAPIKey(key *types.APIKey) error {
|
func (s *State) ExpireAPIKey(key *types.APIKey) error {
|
||||||
return s.db.ExpireAPIKey(key)
|
return s.db.ExpireAPIKey(key)
|
||||||
|
|||||||
Reference in New Issue
Block a user