Skip to content

fix(ed25519): Remove fmt::Debug implementation for PrivateKey#4662

Merged
sergei-boiko-trustwallet merged 2 commits intomasterfrom
fix/ed25519-private-key-debug
Mar 6, 2026
Merged

fix(ed25519): Remove fmt::Debug implementation for PrivateKey#4662
sergei-boiko-trustwallet merged 2 commits intomasterfrom
fix/ed25519-private-key-debug

Conversation

@sergei-boiko-trustwallet
Copy link
Copy Markdown
Contributor

This pull request primarily removes Debug trait implementations for key types in the ed25519 module and cleans up related tests and imports. The changes simplify the codebase by eliminating unnecessary or potentially unsafe debug output for sensitive key material, and improve test assertions for error handling.

Removal of Debug Implementations and Related Code

  • Removed the Debug trait implementation for the PrivateKey struct in ed25519/private.rs, reducing the risk of accidentally logging sensitive information.
  • Removed the Debug trait derivation from the KeyPair struct in ed25519/keypair.rs.

Test Improvements and Cleanup

  • Removed the test_debug test case, which previously checked debug output for key types and signatures, and updated the test_keypair_from_invalid_bytes test to use assertion macros for error handling instead of unwrapping.

Import Cleanup

  • Removed the unused import of KeyPairTrait from the test module in ed25519/mod.rs.
  • Removed the unused import of std::fmt from ed25519/private.rs.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes Debug implementations/derivations from ed25519 key types to reduce the risk of accidentally logging sensitive key material, and updates ed25519 tests/imports accordingly.

Changes:

  • Removed the manual Debug implementation for ed25519::PrivateKey.
  • Removed #[derive(Debug)] from ed25519::KeyPair.
  • Simplified tests by removing test_debug and cleaning up unused imports / invalid-bytes assertions.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
rust/tw_keypair/src/ed25519/private.rs Removes Debug impl (and related std::fmt import) from PrivateKey.
rust/tw_keypair/src/ed25519/keypair.rs Removes #[derive(Debug)] from KeyPair.
rust/tw_keypair/src/ed25519/mod.rs Cleans up test imports, removes debug-focused test, and adjusts invalid-bytes assertions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 24, 2026

Binary size comparison

➡️ aarch64-apple-ios: 14.34 MB

➡️ aarch64-apple-ios-sim: 14.34 MB

➡️ aarch64-linux-android: 18.77 MB

➡️ armv7-linux-androideabi: 16.20 MB

➡️ wasm32-unknown-emscripten: 13.68 MB

@sergei-boiko-trustwallet sergei-boiko-trustwallet merged commit 5874307 into master Mar 6, 2026
16 checks passed
@sergei-boiko-trustwallet sergei-boiko-trustwallet deleted the fix/ed25519-private-key-debug branch March 6, 2026 07:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants