Sailfish Secrets
API DocumentationStoredSecretRequest Class
(Sailfish::Secrets::StoredSecretRequest)Allows a client request a secret from the system's secure secret storage service More...
Header: | #include <Secrets/storedsecretrequest.h> |
Inherits: | Sailfish::Secrets::Request |
Properties
- identifier : Sailfish::Secrets::Secret::Identifier
- secret : const Sailfish::Secrets::Secret
- userInteractionMode : Sailfish::Secrets::SecretManager::UserInteractionMode
- 3 properties inherited from Sailfish::Secrets::Request
Public Functions
StoredSecretRequest(QObject *parent = Q_NULLPTR) | |
~StoredSecretRequest() | |
Sailfish::Secrets::Secret::Identifier | identifier() const |
Sailfish::Secrets::Secret | secret() const |
void | setIdentifier(const Sailfish::Secrets::Secret::Identifier &ident) |
void | setUserInteractionMode(Sailfish::Secrets::SecretManager::UserInteractionMode mode) |
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 | identifierChanged() |
void | secretChanged() |
void | userInteractionModeChanged() |
- 3 signals inherited from Sailfish::Secrets::Request
Detailed Description
Allows a client request a secret from the system's secure secret storage service
This class allows clients to request the Secrets service to retrieve a secret identified by a given identifier(). The identifier() will identify either a standalone or collection-stored secret.
If the application making the request is the creator of the secret, or alternatively if the user has granted the application permission to read the specific secret, then the Secrets service will instruct the storage plugin to retrieve the secret.
If the application is not the creator of the secret and the user has not yet been asked if the application should have permission to read the secret, 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 secret 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 secret (or the collection in which the secret is stored, if the secret is not a standalone secret) is currently unlocked; however, if the secret (or 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 secret (which may support ApplicationInteraction
if the secret is an application-specific secret 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 the data contained in the secret is actually a cryptographic key created via the Sailfish::Crypto
library, then only those components of the key which were allowed for retrieval via Sailfish::Crypto::Key::setComponentConstraints()
will be able to be retrieved, even if the calling application is the owner of the secret. For more information about that topic, please see the documentation for the Sailfish::Crypto
library.
An example of retrieving a collection-stored secret follows:
Sailfish::Secrets::SecretManager sm; Sailfish::Secrets::StoredSecretRequest ssr; ssr.setManager(&sm); ssr.setIdentifier(Sailfish::Secrets::Secret::Identifier("ExampleSecret", "ExampleCollection")); ssr.setUserInteractionMode(Sailfish::Secrets::SecretManager::SystemInteraction); ssr.startRequest(); // status() will change to Finished when complete
Property Documentation
identifier : Sailfish::Secrets::Secret::Identifier
Access functions:
Sailfish::Secrets::Secret::Identifier | identifier() const |
void | setIdentifier(const Sailfish::Secrets::Secret::Identifier &ident) |
Notifier signal:
void | identifierChanged() |
secret : const Sailfish::Secrets::Secret
Access functions:
Sailfish::Secrets::Secret | secret() const |
Notifier signal:
void | secretChanged() |
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
StoredSecretRequest::StoredSecretRequest(QObject *parent = Q_NULLPTR)
Constructs a new StoredSecretRequest object with the given parent.
StoredSecretRequest::~StoredSecretRequest()
Destroys the StoredSecretRequest
Sailfish::Secrets::Secret::Identifier StoredSecretRequest::identifier() const
Returns the identifier of the secret which the client wishes to retrieve
Note: Getter function for property identifier.
See also setIdentifier().
[virtual]
Sailfish::Secrets::SecretManager *StoredSecretRequest::manager() const
See also setManager().
[virtual]
Sailfish::Secrets::Result StoredSecretRequest::result() const
Sailfish::Secrets::Secret StoredSecretRequest::secret() const
Returns the secret which was retrieved for the client
Note: Getter function for property secret.
[virtual]
void StoredSecretRequest::setManager(Sailfish::Secrets::SecretManager *manager)
See also manager().
[virtual]
void StoredSecretRequest::startRequest()
[virtual]
Sailfish::Secrets::Request::Status StoredSecretRequest::status() const
Sailfish::Secrets::SecretManager::UserInteractionMode StoredSecretRequest::userInteractionMode() const
Returns the user interaction mode required when retrieving the secret (e.g. if a custom lock code must be requested from the user)
Note: Getter function for property userInteractionMode.
See also setUserInteractionMode().