Skip to content

Added auth token fix for retroshare mobile#336

Open
defnax wants to merge 2 commits into
RetroShare:masterfrom
defnax:auth-token-v3
Open

Added auth token fix for retroshare mobile#336
defnax wants to merge 2 commits into
RetroShare:masterfrom
defnax:auth-token-v3

Conversation

@defnax

@defnax defnax commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Walkthrough - Secure API Token Authentication

We have designed and implemented a safer authentication mechanism for RetroShare's JSON API. The PGP/profile password is no longer transmitted in the Authorization headers of REST requests, nor is it registered as the API token. Instead, we dynamically derive a secure API token client-side and authorize it upon login.


Changes

1. C++ Core (libretroshare)

  • rsinit.h: Marked attemptLogin as manualwrapper to exclude it from automatic API wrapper generation.
  • jsonapi.cpp: Implemented a manual wrapper for /rsLoginHelper/attemptLogin that deserializes optional apiUser and apiPass fields, calls attemptLogin, and registers the client's custom credentials using authorizeUser(apiUser, apiPass) if the login is successful.

2. Dart API Wrapper (Retroshare-Wrapper)

  • retroshare.dart: Updated requestLogIn and requestAccountCreation to accept optional apiUser and apiPass arguments and include them in the request body parameters.

3. Mobile Client (rs-mobile)

  • pubspec.yaml:
    • Added the crypto package dependency.
  • auth.dart:
    • Added deriveApiToken helper function using sha256(locationId:password) to dynamically compute secure API credentials.
    • Modified getinitializeAuth to verify credentials using deriveApiToken.
    • Updated login and signup methods to derive the secure credentials and pass them during registration/login calls.

Verification Results

  • All components compiled successfully with zero errors.
  • Dependencies were resolved correctly with flutter pub get.

@defnax

defnax commented Jul 19, 2026

Copy link
Copy Markdown
Contributor Author

@G10h4ck

@defnax

defnax commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

Hope merged soon i need continue on retroshare mobile

Comment thread src/retroshare/rsinit.h Outdated
@G10h4ck

G10h4ck commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

did you test it on at least a couple of platforms?

@defnax

defnax commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

i tesed with rs mobile flutter with windows desktop(w10) and android (Samsung) no issue

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants