Sessions

interface Sessions

The Sessions interface provides methods for authenticating, updating, or revoking sessions, and properties to retrieve the existing session token (opaque or JWT).

Types

Link copied to clipboard
data class AuthParams(val sessionDurationMinutes: UInt? = null)

Data class used for wrapping parameters used with Sessions authentication

Link copied to clipboard
data class RevokeParams(val forceClear: Boolean = false)

Data class used for wrapping parameters used with Sessions revocation

Properties

Link copied to clipboard
abstract val onChange: StateFlow<SessionData?>

Exposes a flow of session data

Link copied to clipboard
abstract val sessionJwt: String?
Link copied to clipboard
abstract val sessionToken: String?

Functions

Link copied to clipboard
abstract suspend fun authenticate(authParams: Sessions.AuthParams): AuthResponse
abstract fun authenticate(authParams: Sessions.AuthParams, callback: (AuthResponse) -> Unit)

Authenticates a Session and updates its lifetime by the specified session_duration_minutes. If the session_duration_minutes is not specified, a Session will not be extended

Link copied to clipboard
abstract fun getSync(): SessionData?

Get the locally persisted session

Link copied to clipboard
abstract fun onChange(callback: (SessionData?) -> Unit)

Assign a callback that will be called when the session data changes

Link copied to clipboard
abstract suspend fun revoke(params: Sessions.RevokeParams = RevokeParams()): BaseResponse
abstract fun revoke(params: Sessions.RevokeParams = RevokeParams(), callback: (BaseResponse) -> Unit)

Revoke a Session and immediately invalidate all its tokens.

Link copied to clipboard
abstract fun updateSession(sessionToken: String, sessionJwt: String)

Updates the current session with a sessionToken and sessionJwt