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.
Use this storage to save sensitive data like access tokens or user preferences that should persist across sessions. Keep in mind that storage size is limited to 2 kilobytes.
For non-sensitive data, consider using DeviceStorage.
See also
Functions
Clears all key-value pairs from the secure storage.
Clears all key-value pairs from secure storage. This suspending function handles the result directly and throws an exception if an error occurs.
Clears all key-value pairs from the secure storage using a CompletableDeferred and returns a Result.
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.
Removes the key-value pair associated with a key from secure storage.
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.
Removes the key-value pair associated with a key from secure storage using a CompletableDeferred and returns a Result.
Restores the value associated with a key in secure storage. This is useful if the value was previously removed using removeItem and needs to be retrieved again. Note that restoring a value is only possible if it hasn't been overwritten by a new value for the same key.
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.
Restores the value associated with a key in secure storage using a CompletableDeferred and returns a Result.
Stores a key-value pair in secure storage using a CompletableDeferred and returns a Result.