GlitterWare / Passy

Offline password manager with cross-platform synchronization
https://glitterware.github.io/Passy/
GNU General Public License v3.0
137 stars 21 forks source link

Qr sync fails #72

Closed Groonir closed 11 months ago

Groonir commented 11 months ago

Bug description

Get an error when hosting from desktop and having phone connect to its local hotspot. It happens as soon as the phone scans the QR code

Expected outcome

Passwords update

Steps to reproduce

Create desktop hotspot Connect with phone Host on desktop Scan QR code with phone Profit??

Error log

For desktop

Hosting... done. 
Listening... done.
Sending service info... done.
Receiving hello... done.
Client supports 2.0.0+ synchronization. Starting 2.0.0+ synchronization server... done.
Sending 2.0.0+ synchronization server address... 
Local exception has occurred: Remote disconnected unexpectedly.
Local exception has occurred: Synchronization requested to close while connected.

For phone

Connecting... done.
Receiving service info... done.
Host supports 2.0.0+ synchronization. Sending 2.0.0+ hello... done.
Receiving 2.0.0+ server address... done.
Connecting... done.
Receiving users list... done.
Processing next user... done.
Authenticating... done.
Failed to authenticate. Receiving shared entries... 
Local exception has occurred: Remote disconnected unexpectedly.
Local exception has occurred: 2.0.0+ synchronization host error:
{"error":{"type":"Stale auth","date":"2023-10-27T13:48:32.992307Z","description":"Packet took too long to reach its destination, please check your network conditions"}}

App version

v1.6.0 - Markdown Notes

Submission checklist

GleammerRay commented 11 months ago

Hello @Groonir !

This isn't a problem related to hotspot connection, as it seems as though the client and host are able to communicate properly.

Stale auth means that either it took too long for the authentication packet to arrive or might also be caused by your device time being set to a wrong value. It is important to note that there must be a significant time difference (5 seconds) for this to occur.

Have you tried synchronizing without using hotspot? I would expect it doesn't work that way either. More importantly, do your phone and computer device times and time zones co-align? This might have an impact on the authentication process.

Thank you for your report.

Groonir commented 11 months ago

Thanks for the swift reply! I tried with using the wifi network but they just time out. Maybe this happens due to the computer being connected by an ethernet cable? Time zones are the same on both devices

Edit: also, the time between the qr scan and error is less than a second

Edit 2: tried it on wifi and got the following error on my phone:

Connecting... 
Local exception has occurred: Failed to connect.
SocketException: Connection timed out, host: InternetAddress('10.3.18.31', IPv4), port: 51440
#0      _NativeSocket.connect.<anonymous closure>.<anonymous closure> (dart:io-patch/socket_patch.dart:975)
#1      _RootZone.run (dart:async/zone.dart:1655)
#2      Future.timeout.<anonymous closure> (dart:async/future_impl.dart:882)
#3      Timer._createTimer.<anonymous closure> (dart:async-patch/timer_patch.dart:18)
#4      _Timer._runTimers (dart:isolate-patch/timer_impl.dart:398)
#5      _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:429)
#6      _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:189)
GleammerRay commented 11 months ago

10.3.18.31 does not look like the actual network IP address, unless you are sure that it is. Looks like Passy might failing to access host's networking. Are you sure that your firewall rules allow Passy to communicate fully (both private and public networks)? If you're on Windows, please try this - https://www.minitool.com/news/how-to-allow-a-program-through-firewall-windows-10.html, and see if you can synchronize via Wi-Fi then, after restarting Passy.

Groonir commented 11 months ago

^ misclick

I have followed the article and passy was allowed in public networks and not private ones. I allowed in private also and tried again and still i get this error on my tablet:

Connecting... 
Local exception has occurred: Failed to connect.
SocketException: Connection timed out, host: InternetAddress('10.7.18.174', IPv4), port: 53220
#0      _NativeSocket.connect.<anonymous closure>.<anonymous closure> (dart:io-patch/socket_patch.dart:975)
#1      _RootZone.run (dart:async/zone.dart:1655)
#2      Future.timeout.<anonymous closure> (dart:async/future_impl.dart:882)
#3      Timer._createTimer.<anonymous closure> (dart:async-patch/timer_patch.dart:18)
#4      _Timer._runTimers (dart:isolate-patch/timer_impl.dart:398)
#5      _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:429)
#6      _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:189)

btw i have a vpn on all my devices but i set it to bypass passy or disabled it when trying to sync even if i think it shouldnt interfere

GleammerRay commented 11 months ago

How odd. Still, 10.7.18.174 is not a traditional format of a local IP address. The VPN you are using might be creating a local network to route all connections through, which would explain it.

GleammerRay commented 11 months ago

I apologize for being unable to assist you with setting up synchronization for Passy. In the next release, Passy dedicated synchronization server will be included (already implemented on the dev branch). With that, you will be able to manually set the IP address on both server and client. If you are interested, I can notify you when this feature has been released.

Groonir commented 11 months ago

Thank you for trying! There is no need for that as i get your app from f-droid but thanks for asking!

Groonir commented 11 months ago

Found the solution!

My vpn disables lan traffic by default. Enabled it and everything started working!

GleammerRay commented 11 months ago

Sweet! Hope you enjoy the password manager.