key-store-plugin
Mobile icon

Key Store Plugin

Supported
Stable version 2.4.0 (Compatible with OutSystems 11)
Other versions available for 10
Uploaded
 on 8 May
 by 
OutSystems
5.0
 (6 ratings)
key-store-plugin

Key Store Plugin

Documentation
2.4.0

Check out the Key Store Plugin in the product documentation.


2.3.0

Key Store Plugin


The Key Store Plugin allows your application to securely store, get and remove secrets (key-value pairs) such as usernames, passwords, tokens, certificates or other sensitive information (strings) on iOS & Android devices.


After adding the plugin to your app, you should follow the good practice of verifying if the plugin is available during runtime in your app to prevent the app from crashing. Use the Logic > Client Actions > KeyStorePlugin > CheckKeyStorePlugin action to check for the plugin availability. If the plugin isn't available to the app, display an error to your users.


Plugin functionalities


The Key Store Plugin allows you to do the following:

  • Set, get and remove your secrets;

  • Choose if you want authentication to access your secrets (available from version 2.3.0);

  • Migrate the key-value pairs stored in a previous version to a new version of the plugin (only for Android, available from version 2.3.0).


Set, get and remove your secrets


To create your key-value pair you can use the client action SetValue:

  1. Add the SetValue client action after the Start node;

  2. Handle the response from the client action. After the SetValue, add an If;

  3. Set the Condition of the If to SetValue.Success;

  4. In the False branch of the If, add a Message, set the message type to Error and set a Message to be shown to end users.


After setting your key-value pair, you can access them using the GetValue client action:

  1. Add the GetValue action after the Start node;

  2. Handle the response from the client action. After the GetValue, add an If;

  3. Set the Condition of the If to GetValue.Success; Then, you can handle the response by assigning its value to a local variable.

  4. In the False branch of the If, add a Message, set the message type to Error and set a Message to be shown to end users.


In case you want to remove a key-value pair that you previously created, you can do it using the RemoveKey client action:

  1. Add the RemoveKey action after the Start node;

  2. Handle the response from the client action. After the RemoveKey, add an If;

  3. Set the Condition of the If to RemoveKey.Success;

  4. In the False branch of the If, add a Message, set the message type to Error and set a Message to be shown to end users.



Choose if you want authentication to access your secrets


From version 2.3.0, you can set if you want additional authentication to access your key-value pairs by setting the value for KeyAuthentication in the SetValue client action. By default, no authentication is required to access the pair (False). If True, the access to the pair will require an additional user authentication method. This authentication method will depend on the user’s device lock screen settings.





Migrate the key-value pairs stored in a previous version to a new version of the plugin



As the KeyAuthentication variable is only available from the version 2.3.0, you can use the MigratedKeysAuthentication preference to migrate your secrets from an older version of the plugin (starting from 2.2.0). The value used on this preference will be applied to KeyAuthentication for all your key-value pairs. By default, no authentication is required to access the pair (False). If True, the access to the pair will require an additional user authentication method. This authentication method will depend on the user’s device lock screen settings.



Known issues and workarounds

Check the following known issues and possible workarounds.

 

Compatibility with operative systems

For both iOS and Android. 


2.2.2


This plugin allows your application to securely store secrets such as usernames, passwords, tokens, certificates or other sensitive information (strings) on iOS & Android devices.

The component basically lets you store, get, and remove strings, for each of these functionalities the component has an action that I will explain right ahead. But first, we’ll see how to check if the plugin works.


CheckKeyStorePlugin

So with the CheckKeyStorePlugin you can verify if the plugin is available on your application with the device, basically what you need to do is to use this action before you use the others to see if the plugin is available to use in your device, if there is no problem the action will return true in the Success attribute, otherwise it will return false and the error output will be filled with the code of the error and the error message.




SetValue

The SetValue action is the action that will let you store the secret information in your device, in order to do it you should choose the store name and pass it to the Store attribute, also you need to choose a secret key to lock the secret information this will be passed to the Key attribute, and of course you need to pass the secret information that you want to lock to the Value attribute.

As output, you will have the same Success and Error as before.




GetValue

If you have the need to get the stored data this is the function to use. You basically you need to have the store name and key that were used before to store the data and pass it to the Store and Key inputs of this action, it’s as simple as that. If the action is successful it will return you the stored data through the Value attribute otherwise you’ll receive the error.





RemoveValue

The RemoveValue action deletes the stored value and also deletes the key, to do it as well as the previous action you will need the store name and the key then it will return true if the process was successful or false otherwise pretty much the same as the action before.