feat: Reject Incorrect Wallet Signature - #171
Merged
Merged
Conversation
ONEONUORA
approved these changes
Feb 24, 2026
ONEONUORA
left a comment
Contributor
There was a problem hiding this comment.
Nice implementation @Olowodarey
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.
This PR replaces the placeholder signature validation logic in the wallet login flow with real Ed25519 cryptographic verification using the
ringcrate.It also adds five focused integration tests to ensure that any mismatch between a wallet’s public key and the provided signature correctly results in a
401 Unauthorizedresponse.Problem
The
wallet_loginhandler previously contained a stubbed signature check that only rejected the literal string:Any other string — including signatures produced by a completely different private key — would be accepted.
This meant an attacker could impersonate any wallet address, creating a serious authentication vulnerability.
Solution
1️⃣ Real Ed25519 Signature Verification
Updated
src/auth.rsto perform proper cryptographic validation:wallet_addressis treated as the hex-encoded Ed25519 public keysignatureis the hex-encoded Ed25519 signatureAny verification failure (including wrong key, corrupted bytes, wrong message, or malformed input) now correctly returns:
2️⃣ Dependency Updates
Updated
Cargo.toml:Included in:
[dependencies](used inauth.rs)[dev-dependencies](used in integration tests)Test Coverage
Added 5 integration tests validating:
401 Unauthorized401 Unauthorized401 Unauthorized401 UnauthorizedThese tests ensure authentication fails securely under all mismatch conditions.
closes #136