Add API key management system with support for multiple keys#212
Open
Rambomst wants to merge 1 commit into
Open
Add API key management system with support for multiple keys#212Rambomst wants to merge 1 commit into
Rambomst wants to merge 1 commit into
Conversation
- Introduced new PostgreSQL and SQLite migrations to create `api_keys` table for managing multiple API keys per integration or device. - Added handlers (`CreateAPIKeyHandler`, `RegenerateAPIKeyHandler`, `RevokeAPIKeyHandler`, and `GetAPIKeysHandler`) for API key CRUD operations. - Replaced the legacy single `api_key` row in `settings` with the new table while ensuring backward compatibility for legacy keys. - Implemented a prefix-based lookup and bcrypt hashing for secure and efficient API key verification. - Updated UI to include API key management features: create, list, regenerate, and revoke API keys. - Enhanced integration tests to cover API key CRUD operations, authentication, and legacy key migration. - Refactored CSRF middleware to ensure session-based authentication for API key management operations. - Added localization strings and updated templates for API key management UI elements.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Some of the recentish changes seem to have removed the ability to see the existing API keys, since I have baked them into firmware and wanted to add more devices I needed to either be able to see the existing key (not possible) or generate an additional one.
I don't really want to have to go and compile new firmware for my devices so...
This replaces the single API key with multiple named keys. You can add one per device, see when each was last used, and regenerate or revoke them individually. The existing key is migrated over and keeps working until you revoke it.
api_keystable (migration 021, SQLite + Postgres)Disclaimer: All non-english translations are completely AI generated, and an AI coding assistant was used during development.