convergencelabs / convergence-project

The project used for Convergence Project Management and Issue Reporting
https://convergence.io
42 stars 5 forks source link

Simplify handshake / authentication protocol #219

Closed mmacfadden closed 3 years ago

mmacfadden commented 3 years ago

Versions

Description The handshake / authentication messages in the protocol is overly complex and contain fields that have never been used. This could be consolidated into a single step which will reduce the likelihood of bugs and make the process slightly more efficient.

Breaking Change

This is a breaking change in the protocol.

This change also removes the need for the distinction between being connected vs authenticated. The following API was removed:

ConvergenceSession.isAuthenticated(): Boolean

Users should now just call ConvergenceSession.isConnected() or ConvergenceDomain.isConnected.

class AuthenticatedEvent {}

Users should listen for a ConnectedEvent instead. This signifies that the connection and authentication have succeeded.

class AuthenticationFailed {}

Users should listen for a ConnectionFailed event and inspect the code / message to find out why the connection failed. If the reason was authentication, then the code will be "authentication_failed".