Skip to content

Implement Wallet Authentication System#15

Merged
jaykayudo merged 6 commits intomainfrom
feeature/auth-process
Apr 19, 2025
Merged

Implement Wallet Authentication System#15
jaykayudo merged 6 commits intomainfrom
feeature/auth-process

Conversation

@jaykayudo
Copy link
Contributor

Description

This PR implements a secure authentication system for Starknet wallet users, enabling cryptographic verification of user identity through signature validation. The system handles user registration, login, and session management using Starknet-specific signature verification.

Key Features

Signature Verification

  • Implemented SignatureUtils class with methods to:
    • Generate typed data format for login messages
    • Create properly structured signature requests
    • Verify Starknet signatures against public keys

User Authentication Flow

  • Created SignInSerializer to validate incoming authentication requests:
    • Validates signature format and structure
    • Verifies cryptographic signatures against provided public keys
    • Handles login validation failures with appropriate exceptions
    • Blocks login attempts for inactive users

User Management

  • Implemented login_or_register_user service method:
    • Finds existing users or creates new accounts based on public key
    • Returns both user data and registration status

Token Management

  • Added generate_auth_token_data to create secure JWT tokens:
    • Generates access tokens with expiration times
    • Creates refresh tokens for session management
    • Returns structured token data for client use

Related Issue

Fixes #13

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Performance improvement
  • Code refactoring
  • Documentation update
  • Test coverage improvement
  • CI/CD related changes

How Has This Been Tested?

  • Unit tests
  • Integration tests
  • Manual testing

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Security Considerations

  • This PR introduces no security concerns
  • This PR modifies authentication/authorization
  • This PR handles sensitive data
  • This PR modifies financial transaction logic

Performance Impact

  • This PR has no significant performance impact
  • This PR improves performance
  • This PR may impact performance negatively (explain why it's necessary)

@jaykayudo jaykayudo self-assigned this Apr 19, 2025
@jaykayudo jaykayudo added INTERNAL The issue is for the project maintainers difficulty:medium labels Apr 19, 2025
@jaykayudo jaykayudo merged commit 39b47b8 into main Apr 19, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

difficulty:medium INTERNAL The issue is for the project maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement Login and Signup Functionality Using Starknet Signatures

1 participant