QtDataSync  4.2.0
A simple offline-first synchronisation framework, to synchronize data of Qt applications between devices
Public Member Functions | List of all members
QtDataSync::KeyStorePlugin Class Referenceabstract

The keystore plugin to be implemented to provide custom keystores. More...

#include <keystore.h>

Public Member Functions

virtual bool keystoreAvailable (const QString &provider) const =0
 Check if the keystore type identified by the provider is currently accessible. More...
 
virtual KeyStorecreateInstance (const QString &provider, const Defaults &defaults, QObject *parent=nullptr)=0
 Create an instance of a keystore for the given provider and parent. More...
 

Detailed Description

The keystore plugin to be implemented to provide custom keystores.

The plugin that must be implemented to create a KeyStore plugin. The plugins IID is QtDataSync_KeyStorePlugin_Iid. The plugin most have a json file with the following layout:

{
"Keys" : [ "provider1", "provder2", ... ]
}

Each string in the Keys array is the name of a kind of keystore that is provided from that plugin. Most plugins provide onyl one type of keystore, so for most cases you have only 1 element in the list. Please note that the plugin must be able to handle all these providers when passed to it's methods.

For more details on how to implement such a plugin, have a look at: The High-Level API: Writing Qt Extensions

See also
KeyStore

Definition at line 78 of file keystore.h.

Member Function Documentation

◆ createInstance()

QtDataSync::KeyStorePlugin::createInstance ( const QString provider,
const Defaults defaults,
QObject parent = nullptr 
)
pure virtual

Create an instance of a keystore for the given provider and parent.

Parameters
providerThe type of keystore to be created
defaultsThe defaults of the current datasync instance. Shoudl be passed to the keystore constructor
parentThe parent for the keystore. Should be set as the QObject::parent of the newly created keystore
Returns
A newly created keystore instance for the given provider.

This method must be threadsafe

After the availablility of a provider has been checked via keystoreAvailable(), this method is called to actually create an instance. You should always return a valid keystore for all valid providers, and don't need to perform additional validity checks. It is save to return nullptr in case the store cannot be created. The providers passed to this method are the ones defined in the json file.

See also
KeyStorePlugin::keystoreAvailable, KeyStore::KeyStore()

◆ keystoreAvailable()

QtDataSync::KeyStorePlugin::keystoreAvailable ( const QString provider) const
pure virtual

Check if the keystore type identified by the provider is currently accessible.

Parameters
providerThe provider type the check
Returns
true if the keystore backend for the given provider is available, false if not.

This method must be threadsafe

This method should check if the given keystore is accessible, i.e. if the user has enabled it. If a keystore is available, it should be possible to open and use it without any errors (assuming the user allows access for keystores that have it). The providers passed to this method are the ones defined in the json file.

See also
KeyStorePlugin::createInstance

The documentation for this class was generated from the following files: