You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We can use the "typestate pattern" to enforce authentication at compile time. To do this, we can make the ListenBrainz type generic over authentication status using a marker trait (eg. AuthStatus). A ListenBrainz<NotAuthenticated> instance then first has to be authenticated to obtain a ListenBrainz<Authenticated>, which can perform methods that require authentication.
I've implemented a proof-of-concept of this in the feature/static-auth branch.
Thoughts?
The text was updated successfully, but these errors were encountered:
We can use the "typestate pattern" to enforce authentication at compile time. To do this, we can make the
ListenBrainz
type generic over authentication status using a marker trait (eg.AuthStatus
). AListenBrainz<NotAuthenticated>
instance then first has to be authenticated to obtain aListenBrainz<Authenticated>
, which can perform methods that require authentication.I've implemented a proof-of-concept of this in the
feature/static-auth
branch.Thoughts?
The text was updated successfully, but these errors were encountered: