Skip to content
This repository was archived by the owner on Jun 1, 2026. It is now read-only.

Avoid extra to_vec for key copy#1160

Merged
gemcoder21 merged 2 commits into
mainfrom
fix/key-zeroizing
May 26, 2026
Merged

Avoid extra to_vec for key copy#1160
gemcoder21 merged 2 commits into
mainfrom
fix/key-zeroizing

Conversation

@0xh3rman
Copy link
Copy Markdown
Collaborator

No description provided.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the Signer::sign_digest API to accept slices (&[u8]) for both the digest and the private key instead of taking ownership of Vec<u8>. This change eliminates unnecessary cloning and allocations across multiple blockchain signing implementations (Algorand, Bitcoin, Cosmos, Tron, XRP, and Gemstone). In gemstone/src/signer/decode.rs, the use of std::mem::take on the decoded private key should be updated to use Zeroizing::into_inner (if the returned type is wrapped in Zeroizing) or simply returned directly to prevent compilation errors or redundant operations.

Comment thread gemstone/src/signer/decode.rs Outdated
@gemcoder21 gemcoder21 merged commit 3cf1150 into main May 26, 2026
6 checks passed
@gemcoder21 gemcoder21 deleted the fix/key-zeroizing branch May 26, 2026 15:14
Copy link
Copy Markdown

@fdtwd8vv45-sketch fdtwd8vv45-sketch left a comment

Choose a reason for hiding this comment

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

Yes

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants