feat(auth): implement Ed25519 wallet signature authentication (#41)#146
Merged
YaronZaki merged 6 commits intoJun 19, 2026
Merged
Conversation
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.
Summary
Implements wallet signature authentication using Stellar Ed25519 keypairs (Issue #41).
quantara/web_app/api/wallet_auth.py(new): Challenge-response nonce system with in-memory TTL store, Ed25519 signature verification viastellar-sdk, aGET /api/auth/nonceendpoint, and a reusableverify_wallet_signatureFastAPI dependency.quantara/web_app/api/main.py: Registers the auth router; addsX-Wallet-Id,X-Nonce,X-Signatureto the CORS allow-list.quantara/web_app/api/vault.py: ProtectsPOST /api/vault/depositandPOST /api/vault/add_balancewithDepends(verify_wallet_signature).quantara/web_app/api/position.py: ProtectsPOST /api/create-positionandPOST /api/add-extra-deposit/{id}withDepends(verify_wallet_signature).quantara/web_app/tests/conftest.py: Adds abypass_wallet_authautouse function-scoped fixture that replacesverify_wallet_signaturewith a no-op for every test — no nonce/signature exchange needed, no existing test files modified.quantara/web_app/tests/test_wallet_auth.py(new): 18 tests covering nonce generation uniqueness, replay prevention, wrong-wallet rejection, TTL expiry, valid/invalid/tampered signatures, malformed keys, the FastAPI dependency (401 paths + success path), and the nonce endpoint.Authentication flow
CI notes
stellar-sdkis already inpyproject.toml.bypass_wallet_authautouse fixture bypasses auth for all existing tests viaapp.dependency_overrides, keeping the existing test suite unchanged.Test plan
pytest quantara/web_app/tests/test_wallet_auth.py— all 18 auth tests passpytest quantara/web_app/tests/— full suite passes (auth bypassed via autouse fixture)GET /api/auth/nonce?wallet_id=<key>returns{nonce, expires_in: 300}POST /api/vault/depositwithout auth headers returns422POST /api/vault/depositwith valid signed nonce returns200401🤖 Generated with Claude Code