PushClient

Implementation of PushClient that provides Push notification functionality. This client handles Push credential management and notification handling.

Parameters

configuration

The Push configuration.

storage

The PushStorage implementation to use. If null, a default SQLPushStorage will be created.

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard

Creates a Push Credential from a standard pushauth:// URI (typically from a QR code).

Link copied to clipboard
suspend fun approveBiometricNotification(notificationId: String, authenticationMethod: String): Result<Boolean>

Approve a biometric push notification. This method approves the authentication request for the given biometric notification with the provided authentication method.

Link copied to clipboard
suspend fun approveChallengeNotification(notificationId: String, challengeResponse: String): Result<Boolean>

Approve a challenge-based push notification. This method approves the authentication request for the given challenge notification with the provided challenge response.

Link copied to clipboard
suspend fun approveNotification(notificationId: String): Result<Boolean>

Approve a push notification. This method approves the authentication request for the given notification.

Link copied to clipboard
suspend fun cleanupNotifications(credentialId: String? = null): Result<Int>

Manually trigger notification cleanup based on the configured cleanup mode. This method can be used to clean up notifications outside of the automatic cleanup process.

Link copied to clipboard
open suspend override fun close()

Clean up resources used by the Push client. This method clears caches and then calls the parent close method.

Link copied to clipboard
suspend fun deleteCredential(credentialId: String): Result<Boolean>

Delete a Push credential by ID. This method removes the credential from local storage but does not delete it from the server.

Link copied to clipboard
suspend fun denyNotification(notificationId: String): Result<Boolean>

Deny a push notification. This method denies the authentication request for the given notification.

Link copied to clipboard

Get all push notifications. This method returns all stored push notifications, regardless of their status.

Link copied to clipboard
suspend fun getCredential(credentialId: String): Result<PushCredential?>

Get a Push credential by ID.

Link copied to clipboard

Get all Push credentials.

Link copied to clipboard
suspend fun getDeviceToken(): Result<String?>

Get the current device token.

Link copied to clipboard
suspend fun getNotification(notificationId: String): Result<PushNotification?>

Get a push notification by ID.

Link copied to clipboard

Get all pending push notifications. This method returns all notifications that have not been approved or denied.

Link copied to clipboard
protected open suspend override fun initializeClient()

Initialize the Push client.

Link copied to clipboard
suspend fun processNotification(remoteMessage: RemoteMessage): Result<PushNotification?>

Process a push notification message from Firebase Cloud Messaging. This method extracts data from the RemoteMessage and creates a PushNotification object.

Process a push notification message received as a string. This method parses the string message data (typically a JWT) and creates a PushNotification object.

suspend fun processNotification(messageData: Map<String, Any>): Result<PushNotification?>

Process a push notification message. This method parses the message data and creates a PushNotification object.

Link copied to clipboard

Save a Push credential.

Link copied to clipboard
suspend fun setDeviceToken(deviceToken: String, credentialId: String? = null): Result<Boolean>

Set the device token for push notifications. This method should be called when the device token changes. It updates the token locally and on the server using the specific PushHandler for the credential's platform. If it fails to update the token locally, the method will not attempt to update it on the server.