The PowerAuth Mobile JS SDK provides a simple cache API via PowerAuthStorageUtils for string key–value storage.
-
PowerAuthStorageType.SECURE- iOS: PowerAuth Keychain (Keychain service
com.wultra.powerauth.jssdk.storageutils.secure) - Android: PowerAuth Keychain (encrypted, backed by Android Keystore)
- iOS: PowerAuth Keychain (Keychain service
-
PowerAuthStorageType.STANDARD- iOS: UserDefaults suite
com.wultra.powerauth.jssdk.storageutils.standard - Android: SharedPreferences file
com.wultra.powerauth.jssdk.storageutils.standard
- iOS: UserDefaults suite
Store a string value under a key.
Retrieve a string value. Returns undefined when the key is missing.
Check whether a key is present.
Remove a key. Returns true if the key existed.
import { PowerAuthStorageUtils, PowerAuthStorageType } from 'react-native-powerauth-mobile-sdk';
// Secure storage (Keychain / Android Keystore-backed)
await PowerAuthStorageUtils.setString('session', '{"token":"abc"}', PowerAuthStorageType.SECURE);
const secureValue = await PowerAuthStorageUtils.getString('session', PowerAuthStorageType.SECURE);
// Standard storage (UserDefaults / SharedPreferences)
await PowerAuthStorageUtils.setString('theme', 'dark', PowerAuthStorageType.STANDARD);
const exists = await PowerAuthStorageUtils.exists('theme', PowerAuthStorageType.STANDARD);
const removed = await PowerAuthStorageUtils.remove('theme', PowerAuthStorageType.STANDARD);WRONG_PARAMETER: invalid input (e.g., empty key, invalid storage type)ENCRYPTION_ERROR: secure storage operation failed