-
Notifications
You must be signed in to change notification settings - Fork 25
fix: Use pubkey instead of pubKey in encrypted key JSON
#721
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Claude finished @dknopik's task —— View job Code Review CompleteTasks
SummaryThis PR successfully standardizes the encrypted key JSON format to use Positive Observations1. Correct Use of Serde Alias
2. Clear Documentation 3. Adequate Test Coverage
4. Scope Verification Detailed ReviewCode Quality ✅
Security ✅
Performance ✅
Testing ✅
Documentation ✅
/// If the pubkey was provided along the encrypted key in a "pubKey" attribute, it is verified
Should be: /// If the pubkey was provided along the encrypted key in a "pubkey" attribute (also accepts
/// legacy "pubKey" for backward compatibility), it is verified
Minor Suggestions1. Comment Update Needed ( The doc comment on the /// If the pubkey was provided along the encrypted key in a "pubKey" attribute, it is verified
This should be updated to reflect that both field names are accepted: /// If the pubkey was provided along the encrypted key (as "pubkey" or legacy "pubKey"), it is verified
2. Optional: Add Serialization Test Consider adding a test that explicitly verifies new keys are serialized with #[test]
fn test_encrypt_uses_lowercase_pubkey() {
let key = Rsa::generate(2048).unwrap();
let password = "test";
let encrypted = EncryptedKey::encrypt(&key, password).unwrap();
let json = serde_json::to_string(&encrypted).unwrap();
assert!(json.contains(r#""pubkey":"#));
assert!(!json.contains(r#""pubKey":"#));
}This would document the expected serialization behavior explicitly. ConclusionThis is a well-implemented fix that correctly addresses issue #712. The use of Recommendation: Approve with the minor doc comment improvement suggested above. |
anchor/common/operator_key/test_keys/encrypted_private_key_legacy.json
Outdated
Show resolved
Hide resolved
diegomrsantos
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Issue Addressed
pubkeyandpubKeyin encrypted_private_key.json #712Proposed Changes
#[serde(alias = "pubKey")]to allow deserializing old keys while serialising with the new namepubkey