Docs

Kotlin: Push, attestation and crashes

Register devices for push, prove requests come from your real app, and report crashes with the Kotlin SDK.

Updated Oct 24, 2026

Register devices for push, prove requests come from your real app, and report crashes. Every call runs as the client's signed-in user, so your project's policies and row-level security apply. Types and members are listed in source order; each one links to its HTTP endpoint where it maps to one.

#Types and members

SovariaPush

Push notifications for the signed-in app user. Register the FCM token after sign-in: Sending happens on your server or in a function with the service role key (api.push.send), never from the app.

class SovariaPush(private val client: Sovaria)

SovariaPush.register

Register (or move to this user) a push token.

suspend fun register(token: String, platform: String, provider: String? = null, appId: String? = null,
                     topics: List<String>? = null, locale: String? = null): PushDevice

provider is fcm (default on Android) or apns; the token is tied to the client's Sovaria.device.

SovariaPush.unregister

Drop a token (sign-out, notifications turned off).

suspend fun unregister(token: String)

Safe to call twice.

SovariaPush.devices

suspend fun devices(): List<PushDevice>

SovariaPush.subscribe

suspend fun subscribe(deviceRowId: String, topics: List<String>): PushDevice

SovariaPush.unsubscribe

suspend fun unsubscribe(deviceRowId: String, topics: List<String>): PushDevice

PushDevice

class PushDevice(val id: String, val platform: String, val provider: String, val topics: List<String>, val raw: Map<String, Any?>)

PushDevice.from

fun from(json: Any?): PushDevice

AttestationProvider

Produces platform evidence for an attestation challenge: the fields of POST /api/v1/attest/exchange. On Android, implement it with Play Integrity (the SDK stays free of Google Play dependencies): Use DebugAttestationProvider on emulators and CI.

interface AttestationProvider

AttestationProvider.evidence

suspend fun evidence(challenge: String): Map<String, Any?>

DebugAttestationProvider

Stands in for a device on emulators and CI. Create the token in the console (Mobile › App attestation › Debug tokens); never ship it in a release build.

class DebugAttestationProvider(private val debugToken: String) : AttestationProvider

DebugAttestationProvider.evidence

override suspend fun evidence(challenge: String): Map<String, Any?>

AttestationManager

Keeps a valid attestation token and refreshes it before it expires. The client sends it as X-Sovaria-Attestation and fetches a new one after a 401 APP_ATTESTATION_REQUIRED (same as Dart and Swift).

class AttestationManager internal constructor(
    private val client: Sovaria,
    val provider: AttestationProvider,
    private val marginMs: Long = 60_000,
)

AttestationManager.token

The current token, fetching one first when there is none or it is about to expire.

suspend fun token(): String?

Null when attestation fails, so requests still go out (the project may only be monitoring).

AttestationManager.refresh

Fetch a new token now; concurrent callers share one request.

suspend fun refresh(): String?

AttestationManager.clear

fun clear()

SovariaCrashes

App crash reporting. Uncaught exceptions (Thread.setDefaultUncaughtExceptionHandler) and anything you pass to capture are grouped into issues in the console (Monitor › Crashes). Each report carries the error type, message, stack, release, platform, device, the last 50 breadcrumbs and the signed-in user (the server takes the user from the request token). A fatal crash can't be sent while the process is dying, so it is written to the offline store and sent on the next launch (call install early, with a durable store). Handled capture reports send in the background. v1 covers managed (JVM/Kotlin) exceptions and capture. Native NDK/signal crashes (SIGSEGV) need a dedicated signal-safe reporter and are a planned addition.

class SovariaCrashes internal constructor(private val client: Sovaria)

SovariaCrashes.installed

A property.

@Volatile var installed

SovariaCrashes.install

Start capturing.

fun install(release: String? = null, environment: String? = null, store: OfflineStore? = null)

Pass a durable store (or enable offline first) so a fatal crash survives to the next launch.

SovariaCrashes.uninstall

fun uninstall()

SovariaCrashes.addBreadcrumb

Add a breadcrumb (a step that led up to a crash).

fun addBreadcrumb(category: String, message: String)

SovariaCrashes.capture

Report a handled error.

fun capture(
    error: Throwable, handled: Boolean = true, tags: Map<String, String> = emptyMap(),
    extra: Map<String, Any?> = emptyMap(), fingerprint: String? = null,
): Boolean

Returns false if crash reporting isn't installed.

SovariaCrashes.flush

Send queued reports now.

suspend fun flush()