Method to initialize a secure storage
The init method creates a Volatile storage instance and initializes it with a secure storage. If the given storage name already exists, the init method reads the content of the Permanent storage and places it in the volatile storage instance.
Each data contained in the storage is identified by a unique key. The storage can contain either a string or a data.
For Android, beginning with the Secure Storage SDK version 5.0.0, you should use the SecureStorage.createSecureStorage API instead of the deprecated init static method to initialize a secure storage.
A mobile application can create several storages and gives each storage a different file name. Each storage is private for the mobile application that created it; Therefore, storages cannot be shared between several applications.
Methods to manage the volatile storage
Volatile Storage Management lists the available methods to read, add, or remove data from the volatile storage.
Methods to manage the permanent storage
Permanent Storage Management lists the available methods to manage the permanent storage.
Method | Description |
---|---|
Write storage | Write data to be stored from the volatile storage to the permanent storage. |
Delete storage | Delete the permanent storage. |
The UNREADABLE_STORAGE and STORAGE_CORRUPTED exceptions on Android or the unreadableStorage and storageCorrupted errors on iOS are non-recoverable exceptions that could have been caused by events outside of the scope of the SDK (like missing a decryption key after a backup/restore of the device). When you catch these exceptions and errors, use the methods in Volatile Storage Management and Permanent Storage Management to delete the permanent storage and clear the volatile storage. Afterward, you should initialize the secure storage again. The data will be lost.
Android Exceptions
When an error occurs on Android, a SecureStorageSDKException is thrown. This exception consists of an error code and, if the exception is an internal error, the cause of the exception.