getItem

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.

Return

The value associated with the key, or null if the key is not found.

Parameters

key

The key to retrieve the value for.

Throws

If an error occurs during the operation.


suspend fun SecureStorage.getItem(key: String): Either<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.

Parameters

key

The key to retrieve the value for.

callback

A callback function that is called when the operation is complete. The first argument is an error object (a SecureStorageError if an error occurred, or null otherwise), the second argument is the retrieved value (a String or null if the key is not found), and the third argument is a boolean indicating whether the value can be restored (useful if the value was previously removed and might be restorable).