fix: cache parsed PEM private key to avoid re-parsing per request#124
Closed
Bortlesboat wants to merge 1 commit intocoinbase:masterfrom
Closed
fix: cache parsed PEM private key to avoid re-parsing per request#124Bortlesboat wants to merge 1 commit intocoinbase:masterfrom
Bortlesboat wants to merge 1 commit intocoinbase:masterfrom
Conversation
Parse the PEM private key once during client initialization and reuse it for subsequent JWT generation. Previously, load_pem_private_key() was called on every REST and WebSocket request, performing redundant ASN.1/DER parsing. The private_key parameter is optional and backward-compatible — callers that don't pass it still get the original parsing behavior. Fixes #121
🟡 Heimdall Review Status
|
JTCombs95-commits
approved these changes
Mar 6, 2026
|
Review Error for JTCombs95-commits @ 2026-03-06 21:19:28 UTC |
Author
|
Quick follow-up from my side: I’m treating review-required PRs as top priority this week. If you want any specific changes, rebase, or split, I can turn them around quickly. |
Author
|
Reopened this fix from a live fork in #128 after this PR was closed when the original head repo disappeared. The code path still reproduces cleanly on current \master\, so the replacement PR carries the same optimization plus focused regression coverage and fresh review context. |
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.
Summary
APIBase.__init__()instead of on every requestbuild_rest_jwt()andbuild_ws_jwt()via an optionalprivate_keyparameterprivate_keyget the original parsing behaviorload_pem_private_key()ASN.1/DER parsing on every HTTP requestFixes #121