OAuthSession

@Serializable
data class OAuthSession(val accessToken: String, val refreshToken: String, val did: String?, val handle: String?, val pdsUrl: String?, val tokenEndpoint: String, val revocationEndpoint: String? = null, val clientId: String? = null, val dpopPrivateKey: ByteArray, val dpopPublicKey: ByteArray, val authServerNonce: String? = null, val clockOffsetSeconds: Long = 0, val pdsNonce: String? = null, val issuer: String? = null, val clientAuthKid: String? = null, val clientAuthMethod: String? = null, val refreshInDoubt: Boolean = false)

Persisted OAuth session state. Contains everything needed to make authenticated XRPC requests and refresh the session when the access token expires.

The DPoP keypair is serialized as raw byte arrays (PKCS8 private key + X509 public key) rather than as JWK JSON. The consumer's OAuthSessionStore implementation is responsible for encrypting these at rest (e.g. via EncryptedSharedPreferences on Android).

did, handle, and pdsUrl are nullable to accommodate the signup flow's brief window between token exchange and identity hydration. Once hydration completes (or its bounded retry budget exhausts) the session is re-persisted with whatever values resolved. The login flow always populates all three eagerly.

Constructors

Link copied to clipboard
constructor(accessToken: String, refreshToken: String, did: String?, handle: String?, pdsUrl: String?, tokenEndpoint: String, revocationEndpoint: String? = null, clientId: String? = null, dpopPrivateKey: ByteArray, dpopPublicKey: ByteArray, authServerNonce: String? = null, clockOffsetSeconds: Long = 0, pdsNonce: String? = null, issuer: String? = null, clientAuthKid: String? = null, clientAuthMethod: String? = null, refreshInDoubt: Boolean = false)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The id of the client signing key this session is bound to, once a TokenEndpointTransport has reported one for a confidential client. Set once and never replaced: the authorization server deletes a session that is refreshed with a different key.

Link copied to clipboard

The client's token_endpoint_auth_method as last reported by the TokenEndpointTransport ("none" or "private_key_jwt"), or null when no transport has reported one. Tells a consumer which session lifetime the authorization server applies.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val did: String?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The authorization server's issuer identifier. null on sessions stored before it was recorded; the origin of tokenEndpoint is used then.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

true while a refresh has been sent with this refreshToken and no definitive answer has come back, so the token may already be spent. Only maintained for a transport whose TokenEndpointTransport.tracksRefreshOutcome is set.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int