Package-level declarations

Types

Link copied to clipboard
external interface DeviceStorage

This object is used to access the device's local storage.

Link copied to clipboard
class DeviceStorageError(message: String)

This class will be used in setWithResult and other extensions for DeviceStorage to represent special error happen in operations of DeviceStorage

Link copied to clipboard
value class DeviceStorageErrorMessage(val text: String)

This value class represent strongly-typed errors of DeviceStorage operations and required to separate it with string args

Link copied to clipboard
external class SecureStorage

This class provides access to the secure local storage, which is persistent and tied to the user's Telegram account. Data stored in secure storage is accessible only to the Web App that saved it.

Link copied to clipboard
class SecureStorageError(message: String)

This class will be used in setWithResult and other extensions for DeviceStorage to represent special error happen in operations of DeviceStorage

Link copied to clipboard
value class SecureStorageErrorMessage(val text: String)

This value class represent strongly-typed errors of DeviceStorage operations and required to separate it with string args

Functions

Link copied to clipboard
suspend fun DeviceStorage.clear(): Boolean

Clears all key-value pairs from the storage. This function suspends until the result is available and returns the result directly or throws an exception if an error occurred.

suspend fun SecureStorage.clear(): Boolean

Clears all key-value pairs from secure storage. This suspending function handles the result directly and throws an exception if an error occurs.

Link copied to clipboard
suspend fun DeviceStorage.clearWithResult(): <Error class: unknown class><Boolean>

Clears all key-value pairs from the storage. This function uses a CompletableDeferred to handle the asynchronous callback and returns a Result object.

suspend fun SecureStorage.clearWithResult(): <Error class: unknown class><Boolean>

Clears all key-value pairs from the secure storage using a CompletableDeferred and returns a Result.

Link copied to clipboard
suspend fun DeviceStorage.getItem(key: String): String?

Retrieves the value associated with a key. This function suspends until the result is available and returns the result directly or throws an exception if an error occurred.

suspend fun SecureStorage.getItem(key: String): <Error class: unknown class><String?, Boolean>

Retrieves the value associated with a key from secure storage. This function uses a callback-based approach for handling the asynchronous result of the operation.

Link copied to clipboard
suspend fun DeviceStorage.getWithResult(key: String): <Error class: unknown class><String?>

Retrieves the value associated with a key. This function uses a CompletableDeferred to handle the asynchronous callback and returns a Result object.

suspend fun SecureStorage.getWithResult(key: String): <Error class: unknown class><<Error class: unknown class><String?, Boolean>>

Retrieves the value associated with a key from secure storage using a CompletableDeferred and returns a Result. This suspending function encapsulates the asynchronous operation of retrieving a value and provides a structured way to handle both successful retrieval and potential errors. It uses a CompletableDeferred to manage the asynchronous result.

Link copied to clipboard

Removes the key-value pair associated with a key. This function suspends until the result is available and returns the result directly or throws an exception if an error occurred.

Removes the key-value pair associated with a key from secure storage. This suspending function handles the result directly and throws an exception if an error occurs.

Link copied to clipboard
suspend fun DeviceStorage.removeWithResult(key: String): <Error class: unknown class><Boolean>

Removes the key-value pair associated with a key. This function uses a CompletableDeferred to handle the asynchronous callback and returns a Result object.

suspend fun SecureStorage.removeWithResult(key: String): <Error class: unknown class><Boolean>

Removes the key-value pair associated with a key from secure storage using a CompletableDeferred and returns a Result.

Link copied to clipboard

Restores the value associated with a key in secure storage. This suspending function handles the result directly and throws an exception if an error occurs.

Link copied to clipboard
suspend fun SecureStorage.restoreWithResult(key: String): <Error class: unknown class><String?>

Restores the value associated with a key in secure storage using a CompletableDeferred and returns a Result.

Link copied to clipboard
suspend fun DeviceStorage.setItem(key: String, value: String): Boolean

Stores a key-value pair. This function suspends until the result is available and returns the result directly or throws an exception if an error occurred.

suspend fun SecureStorage.setItem(key: String, value: String): Boolean

Stores a key-value pair in secure storage. This suspending function handles the result directly and throws an exception if an error occurs.

Link copied to clipboard
suspend fun DeviceStorage.setWithResult(key: String, value: String): <Error class: unknown class><Boolean>

Stores a key-value pair. This function uses a CompletableDeferred to handle the asynchronous callback and returns a Result object.

suspend fun SecureStorage.setWithResult(key: String, value: String): <Error class: unknown class><Boolean>

Stores a key-value pair in secure storage using a CompletableDeferred and returns a Result.