Sailfish Secrets
API DocumentationFindSecretsRequest Class
(Sailfish::Secrets::FindSecretsRequest)Allows a client find the identifiers of secrets which match a specific filter from the system's secure secret storage service More...
Header: | #include <Secrets/findsecretsrequest.h> |
Inherits: | Sailfish::Secrets::Request |
Properties
|
|
- 3 properties inherited from Sailfish::Secrets::Request
Public Functions
FindSecretsRequest(QObject *parent = Q_NULLPTR) | |
~FindSecretsRequest() | |
QString | collectionName() const |
Sailfish::Secrets::Secret::FilterData | filter() const |
Sailfish::Secrets::SecretManager::FilterOperator | filterOperator() const |
QVector<Sailfish::Secrets::Secret::Identifier> | identifiers() const |
void | setCollectionName(const QString &name) |
void | setFilter(const Sailfish::Secrets::Secret::FilterData &filter) |
void | setFilterOperator(Sailfish::Secrets::SecretManager::FilterOperator op) |
void | setStoragePluginName(const QString &pluginName) |
void | setUserInteractionMode(Sailfish::Secrets::SecretManager::UserInteractionMode mode) |
QString | storagePluginName() const |
Sailfish::Secrets::SecretManager::UserInteractionMode | userInteractionMode() const |
Reimplemented Public Functions
virtual Sailfish::Secrets::SecretManager * | manager() const |
virtual Sailfish::Secrets::Result | result() const |
virtual void | setManager(Sailfish::Secrets::SecretManager *manager) |
virtual void | startRequest() |
virtual Sailfish::Secrets::Request::Status | status() const |
virtual void | waitForFinished() |
- 6 public functions inherited from Sailfish::Secrets::Request
Signals
void | collectionNameChanged() |
void | filterChanged() |
void | filterOperatorChanged() |
void | identifiersChanged() |
void | storagePluginNameChanged() |
void | userInteractionModeChanged() |
- 3 signals inherited from Sailfish::Secrets::Request
Detailed Description
Allows a client find the identifiers of secrets which match a specific filter from the system's secure secret storage service
The filter specifies metadata field/value pairs, and will be matched against secrets in the storage plugin identified by the specified storagePluginName() according to the given filterOperator().
If a collection() is specified to search within, and the calling application is the creator of the collection, or alternatively if the user has granted the application permission to read from the collection, then the Secrets service will instruct the storage plugin to search the collection for matching secrets.
However, if the application is not the creator of the collection and the user has not yet been asked if the application should have permission to read the collection, then a system-mediated access control UI flow may be triggered to obtain the user's permission (unless the given userInteractionMode() is PreventInteraction
in which case the request will fail).
If the collection uses an encryption key derived from the system device-lock, then the value will be able to be retrieved without any other UI flow being required if the collection is currently unlocked; however, if the collection uses an encryption key derived from a custom lock, then the custom lock authentication key will be obtained from the user via an authentication flow determined by the authentication plugin used for that collection (which may support ApplicationInteraction
if the collection is an application-specific collection using an ApplicationSpecificAuthentication
plugin, but otherwise will be a system-mediated UI flow, unless the userInteractionMode() specified is PreventInteraction
in which case the request will fail).
If no collection() is specified to search within, then only those standalone secrets which the application owns (that is, created) or has been granted explicit permission to access will be matched against the filter and potentially returned.
An example of searching for secrets in a collection which match a filter follows:
Secret::FilterData filter; filter.insert(QLatin1String("domain"), testSecret.filterData(QLatin1String("sailfishos.org"))); filter.insert(QLatin1String("example"), testSecret.filterData(QLatin1String("true"))); Sailfish::Secrets::SecretManager sm; Sailfish::Secrets::FindSecretsRequest fsr; fsr.setManager(&sm); fsr.setCollectionName(QLatin1String("ExampleCollection")); fsr.setStoragePluginName(Sailfish::Secrets::SecretManager::DefaultEncryptedStoragePluginName); fsr.setFilter(filter); fsr.setFilterOperator(Sailfish::Secrets::SecretManager::OperatorAnd); fsr.setUserInteractionMode(Sailfish::Secrets::SecretManager::PreventInteraction); fsr.startRequest(); // status() will change to Finished when complete
Property Documentation
collectionName : QString
Access functions:
QString | collectionName() const |
void | setCollectionName(const QString &name) |
Notifier signal:
void | collectionNameChanged() |
filter : Sailfish::Secrets::Secret::FilterData
Access functions:
Sailfish::Secrets::Secret::FilterData | filter() const |
void | setFilter(const Sailfish::Secrets::Secret::FilterData &filter) |
Notifier signal:
void | filterChanged() |
filterOperator : Sailfish::Secrets::SecretManager::FilterOperator
Access functions:
Sailfish::Secrets::SecretManager::FilterOperator | filterOperator() const |
void | setFilterOperator(Sailfish::Secrets::SecretManager::FilterOperator op) |
Notifier signal:
void | filterOperatorChanged() |
identifiers : const QVector<Sailfish::Secrets::Secret::Identifier>
Access functions:
QVector<Sailfish::Secrets::Secret::Identifier> | identifiers() const |
Notifier signal:
void | identifiersChanged() |
storagePluginName : QString
Access functions:
QString | storagePluginName() const |
void | setStoragePluginName(const QString &pluginName) |
Notifier signal:
void | storagePluginNameChanged() |
userInteractionMode : Sailfish::Secrets::SecretManager::UserInteractionMode
Access functions:
Sailfish::Secrets::SecretManager::UserInteractionMode | userInteractionMode() const |
void | setUserInteractionMode(Sailfish::Secrets::SecretManager::UserInteractionMode mode) |
Notifier signal:
void | userInteractionModeChanged() |
Member Function Documentation
FindSecretsRequest::FindSecretsRequest(QObject *parent = Q_NULLPTR)
Constructs a new FindSecretsRequest object with the given parent.
FindSecretsRequest::~FindSecretsRequest()
Destroys the FindSecretsRequest
QString FindSecretsRequest::collectionName() const
Returns the name of the collection that the client wishes to search for secrets matching some filter
Note: Getter function for property collectionName.
See also setCollectionName().
Sailfish::Secrets::Secret::FilterData FindSecretsRequest::filter() const
Returns the filter which will be used when searching for matching secrets
Note: Getter function for property filter.
See also setFilter().
Sailfish::Secrets::SecretManager::FilterOperator FindSecretsRequest::filterOperator() const
Returns the filter operator which will be used when searching for matching secrets
Note: Getter function for property filterOperator.
See also setFilterOperator().
QVector<Sailfish::Secrets::Secret::Identifier> FindSecretsRequest::identifiers() const
Returns the identifiers of secrets which matched the filter.
Note: Getter function for property identifiers.
[virtual]
Sailfish::Secrets::SecretManager *FindSecretsRequest::manager() const
See also setManager().
[virtual]
Sailfish::Secrets::Result FindSecretsRequest::result() const
void FindSecretsRequest::setCollectionName(const QString &name)
Sets the name of the collection that the client wishes to search for secrets matching some filter to name
Note: if the name is empty, then standalone secrets will be searched instead.
Note: Setter function for property collectionName.
See also collectionName().
void FindSecretsRequest::setFilter(const Sailfish::Secrets::Secret::FilterData &filter)
Sets the filter which will be used when searching for matching secrets to filter
The filter consists of key/value pairs which will be matched according to the specified filterOperation().
For example, a Secret which has filter data which includes the following two entries: "website"="sailfishos.org","type"="CryptoCertificate" will match the filter {"website"="sailfishos.org","type"="UsernamePassword"}
if the filterOperator() is OperatorOr
(since the secret metadata does match one of the filter values) but not if it is OperatorAnd
(since the secret metadata doesn't match both filter values).
Note: Setter function for property filter.
See also filter().
void FindSecretsRequest::setFilterOperator(Sailfish::Secrets::SecretManager::FilterOperator op)
Sets the filter operator which will be used when searching for matching secrets to op
If the filter operator is AND then all keys must exist in the filter data stored for the secret, and all values for those keys must match the values specified in the input filter.
If the filter operator is OR then at least one of the keys must exist in the filter data stored for the secret, where that key's value must match the value specified for that key in the input filter.
Note: Setter function for property filterOperator.
See also filterOperator().
[virtual]
void FindSecretsRequest::setManager(Sailfish::Secrets::SecretManager *manager)
See also manager().
void FindSecretsRequest::setStoragePluginName(const QString &pluginName)
Sets the name of the storage plugin within which the client wishes to use to find secrets to pluginName
Note: Setter function for property storagePluginName.
See also storagePluginName().
[virtual]
void FindSecretsRequest::startRequest()
[virtual]
Sailfish::Secrets::Request::Status FindSecretsRequest::status() const
QString FindSecretsRequest::storagePluginName() const
Returns the name of the storage plugin within which the client wishes to find secrets
Note: Getter function for property storagePluginName.
See also setStoragePluginName().
Sailfish::Secrets::SecretManager::UserInteractionMode FindSecretsRequest::userInteractionMode() const
Returns the user interaction mode required when filtering the secrets (e.g. if a custom lock code must be requested from the user)
Note: Getter function for property userInteractionMode.
See also setUserInteractionMode().