chore: update crypto public key#2042
Conversation
Codecov Report❌ Patch coverage is @@ Coverage Diff @@
## main #2042 +/- ##
==========================================
+ Coverage 93.68% 93.70% +0.01%
==========================================
Files 145 145
Lines 9426 9470 +44
==========================================
+ Hits 8831 8874 +43
- Misses 595 596 +1 🚀 New features to boost your workflow:
|
|
Hi, this is WorkflowBot.
|
fa52b43 to
9ac3442
Compare
WalkthroughAdded DER/X.690 encoding helpers and two PublicKey serializers to export compressed ECDSA (secp256k1) SubjectPublicKeyInfo (DER/hex); widened SDK Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes 🚥 Pre-merge checks | ✅ 1 | ❌ 4❌ Failed checks (3 warnings, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 📋 Issue PlannerLet us write the prompt for your AI agent so you can ship faster (with fewer bugs). View plan for ticket: ✨ Finishing Touches🧪 Generate unit tests (beta)
⚔️ Resolve merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 3217c3bb-9b94-4e8a-929b-8cb77048a2b3
📒 Files selected for processing (4)
CHANGELOG.mdsrc/hiero_sdk_python/crypto/public_key.pysrc/hiero_sdk_python/utils/key_utils.pytests/unit/keys_public_test.py
AntonioCeppellini
left a comment
There was a problem hiding this comment.
Great work @MonaaEid :D, i think this should work fine, i just suggested a couple of cases in tests
Up to standards ✅🟢 Issues
|
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
tests/unit/keys_public_test.py (1)
288-313: 🛠️ Refactor suggestion | 🟠 MajorMissing test for
to_string_der_ecdsa_compressed().The byte exporter is well-tested, but the public hex wrapper
to_string_der_ecdsa_compressed()is not exercised. A regression in casing, prefixing, or delegation would still pass this suite.🧪 Suggested test
+def test_to_string_der_ecdsa_compressed_matches_bytes(ecdsa_keypair): + _, pub = ecdsa_keypair + public_key = PublicKey(pub) + + value = public_key.to_string_der_ecdsa_compressed() + + assert isinstance(value, str) + assert value == public_key.to_bytes_der_ecdsa_compressed().hex()As per coding guidelines, "PRIORITY 1 - Protect Against Breaking Changes: Assert return types where relevant" and "PRIORITY 3 - Comprehensive Coverage: Unit tests should be extensive."
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 102a2c9d-26a5-4d3b-9540-aff67fb4ea42
📒 Files selected for processing (2)
CHANGELOG.mdtests/unit/keys_public_test.py
|
Hello, this is the OfficeHourBot. This is a reminder that the Hiero Python SDK Office Hours are scheduled in approximately 4 hours (14:00 UTC). This session provides an opportunity to ask questions regarding this Pull Request. Details:
Disclaimer: This is an automated reminder. Please verify the schedule here for any changes. From, |
|
Converting to draft while changes requested above |
|
Hi, this is WorkflowBot.
|
1435de8 to
7452cfa
Compare
Signed-off-by: MonaaEid <monaa_eid@hotmail.com>
7452cfa to
01968e6
Compare
Signed-off-by: MonaaEid <monaa_eid@hotmail.com>
9453aeb to
06c217e
Compare
|
@MonaaEid Can you resolve the open conversations to help speed up review time? Thank you so much! |
Signed-off-by: MonaaEid <monaa_eid@hotmail.com>
Description:
This PR introduces DER encoding helpers and compressed DER export support for ECDSA secp256k1 public keys, along with updates to the key type alias and improvements to key utility handling.The most important changes are:
Added DER encoding helper methods (
_encode_der_length,_encode_der_oid,_encode_der_sequence,_encode_der_bit_string) and a method to export ECDSA secp256k1 public keys in compressed DER SPKI format (to_bytes_der_ecdsa_compressed) toPublicKey, with corresponding string export (to_string_der_ecdsa_compressed). (src/hiero_sdk_python/crypto/public_key.py)Changed the
Keytype alias inkey_utils.pyto refer to the SDK's baseKeyclassAdded unit tests for DER encoding helpers.
Related issue(s):
Fixes #2041
Checklist