Skip to content

feat: user wallet linking, JWT auth middleware, and delivery schema updates - #86

Open
G-ELM wants to merge 4 commits into
SwiftChainn:mainfrom
G-ELM:fix/drips-pr
Open

feat: user wallet linking, JWT auth middleware, and delivery schema updates#86
G-ELM wants to merge 4 commits into
SwiftChainn:mainfrom
G-ELM:fix/drips-pr

Conversation

@G-ELM

@G-ELM G-ELM commented Jul 27, 2026

Copy link
Copy Markdown

Summary

  • Add walletAddress field to the User schema for linking a Stellar wallet to a profile, with format validation and a unique/sparse index.
  • Add authMiddleware.ts: verifies the Bearer JWT from the Authorization header and attaches the decoded payload to req.user for protected routes.
  • Add PUT /api/v1/users/wallet to link/update a user's Stellar wallet address, validating the public key with StrKey.isValidEd25519PublicKey and rejecting wallets already linked to another account.
  • Extend the Delivery schema with sender/recipient (ObjectId refs to User), contractId (on-chain Soroban escrow contract id), and metadata (free-form extra data).

Changes

  • src/interfaces/IUser.ts, src/models/User.tswalletAddress field
  • src/middlewares/authMiddleware.ts — JWT verification middleware
  • src/validators/userValidator.ts, src/controllers/userController.ts, src/routes/userRoutes.ts, src/routes/index.ts — wallet-linking endpoint
  • src/models/Delivery.tssender, recipient, contractId, metadata fields

Closes #8
Closes #11
Closes #12
Closes #14

G-ELM added 4 commits July 27, 2026 13:46
Allows a Stellar wallet public key to be linked to a user profile,
enforced unique and format-validated at the schema level.
Extracts the bearer token from the Authorization header, verifies its
signature, and attaches the decoded payload to req.user.
Validates the Stellar public key with StrKey before persisting it to
the authenticated user's profile, guarding against duplicate wallet
links across accounts. Also exposes userId on the authMiddleware
payload type to match the JWT shape issued at login.
…very schema

sender/recipient reference the User schema so deliveries can be
resolved back to system users; contractId tracks the on-chain Soroban
escrow contract for a delivery, and metadata holds free-form extra data.
@drips-wave

drips-wave Bot commented Jul 27, 2026

Copy link
Copy Markdown

@G-ELM Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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

Labels

None yet

Projects

None yet

1 participant