Follow these steps to install Secure Storage into your app.
Don't have a Secure Storage subscription? Try it free now.
If you have not already setup Ionic Enterprise in your app, follow the one-time setup steps.
Next, install the plugin:
NOTE: npm 7+ is recommended. For previous versions, install
@ionic-native/coreas a dependency.
In Angular, start by defining the
SQLite class as provider in one of your component modules. We recommend your
AppModule for usage across your app:
@ionic-enterprise/secure-storage/ngx into your file and inject it into your constructor:
Initializing the database can be done immediately in the constructor:
Begin by importing Secure Storage into one of your component source files then create a state variable for the database:
Next, initialize the database immediately and create the database tables:
Begin by importing Secure Storage into one of your components:
Next, create a ref object for the database instance, then initialize the database immediately:
Insert data into a database table:
Read data from a database table:
Close the database:
Delete the database (provide the same configuration details used when creating it):
Transactions are strongly recommended for performance reasons, especially when using encryption, and are also critical for building atomic operations that only commit to the database if all statements execute correctly.
Transactions can be performed one statement at a time using
Or can be performed in a batch