mirror of
https://github.com/pocket-id/pocket-id.git
synced 2025-12-09 09:13:15 +03:00
[PR #339] [MERGED] feat: store keys as JWK on disk #858
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/pocket-id/pocket-id/pull/339
Author: @ItalyPaleAle
Created: 3/15/2025
Status: ✅ Merged
Merged: 3/18/2025
Merged by: @stonith404
Base:
main← Head:keys-as-jwk📝 Commits (10+)
493fd66feat: Store keys as JWK on diskba6eb8aMerge branch 'main' of https://github.com/pocket-id/pocket-id into keys-as-jwkfbf5e00Merge branch 'main' into keys-as-jwk92f3f02Merge branch 'keys-as-jwk' of https://github.com/ItalyPaleAle/pocket-id into keys-as-jwkc0de960Fix 1ca26af1Fixed token generation/verification too3a741c4Merge branch 'main' of https://github.com/pocket-id/pocket-id into keys-as-jwk5c2aaf4Switch to a separate file for migrationsb519e3bAdded unit tests for migrationsf18d778More unit tests📊 Changes
10 files changed (+1184 additions, -151 deletions)
View changed files
📝
backend/go.mod(+14 -4)📝
backend/go.sum(+23 -8)📝
backend/internal/bootstrap/bootstrap.go(+2 -0)➕
backend/internal/bootstrap/jwk_migration.go(+133 -0)➕
backend/internal/bootstrap/jwk_migration_test.go(+190 -0)📝
backend/internal/controller/well_known_controller.go(+2 -2)📝
backend/internal/service/jwt_service.go(+255 -101)➕
backend/internal/service/jwt_service_test.go(+546 -0)📝
backend/internal/service/test_service.go(+7 -36)📝
backend/internal/utils/file_util.go(+12 -0)📄 Description
Part of #322
This converts the format of keys stored on disk to JWK and it allows reading keys containing RSA, ECDSA, or EdDSA keys (note: while non-RSA keys can be read, at this stage I don't believe they can be used to sign/verify JWTs... that will be a subsequent PR)
If a PEM-encoded key is found on disk, it is converted to JWK upon startup.
Lastly, completes a perf improvement started with #327: the JWKS endpoint now returns data that is always cached, making it significantly faster (and reducing the amount of heap allocations on every invocation)
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.