dartvex_auth2_convex 0.1.1
dartvex_auth2_convex: ^0.1.1 copied to clipboard
Convex Auth (@convex-dev/auth v2) adapter for Dartvex. Sign in with Convex Auth methods and keep rotating sessions in sync with the client.
Changelog #
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
[Unreleased] #
0.1.1 - 2026-11-20 #
Changed #
- Requires
dartvex^0.4.2, aligned with the other Dartvex packages (0.4.2 only changes documentation; the network-outage fix this adapter relies on shipped in 0.4.1).
0.1.0 - 2026-11-20 #
Added #
ConvexAuthSessionProvider, anAuthProviderfor Convex Auth (@convex-dev/auth2.0) sessions. It starts a session from a sign-in mutation or an adopted token bundle, then refreshes it throughrefreshSessionand revokes it throughsignOut.- Concurrent refreshes share one request.
onSessionChangedreports every rotation, so the app can persist it. It may be asynchronous: saves run one at a time, in order; a new session is handed to the Convex client only once saved, andlogout()completes once the stored session was removed.sessionSavedcompletes when the queued saves are done. A save that failed is made again at the next change, andlogout()throws when the stored session could not be removed (calling it again retries the removal). Severallogout()calls made at once are one logout: one sign-out request, one removal, and the same result for every caller.- A background refresh is tied to the session it refreshes: when the
server reports that session gone, a
login()to another one that is still in flight goes on. - The provider revokes a session only when it is another server session
than the one in use (
ConvexAuthSession.sessionId), so adopting a later rotation of the current session keeps it alive. A staged session that anotheradoptSessionor alogout()discards is revoked. onBackgroundErrorreceives the errors ofonSessionChangedand failed background revocations.
ConvexAuthSignIn, with named constructors for the built-in username/password, email/password, password recovery and anonymous methods.ConvexAuthHttpClient, which calls Convex mutations over the HTTP API. A plainhttp://deployment URL is refused unless the host is the local machine orallowInsecureHttpis set.ConvexAuthSession, which converts the token bundle to and from JSON and exposes thesessionIdof its access token.ConvexAuthException,ConvexAuthSignInException(the method'suserErrorcode) andConvexAuthSessionEndedException(implementsAuthSessionEndedError). TheirmessageandtoString()never contain text written by the server (a response body, a function's error message); that text is available asserverMessageandlogLines. Thecodeof aConvexAuthSignInExceptionis only set for a code-shapeduserError.error; free text stays inuserError.- Requires
dartvex0.4.1, which keeps the session through a network outage (a retryableConvexAuthExceptionduring a refresh) instead of signing the user out once the one-minute access token has expired. Validated on an Android device (Pixel 7 Pro): sign-up and sign-in errors, rotation, background, network loss, app killed during a session write, logout, revocation by another client and refresh token replay.