Sailfish Crypto
API DocumentationLockCodeRequest Class
(Sailfish::Crypto::LockCodeRequest)Allows a client to request that the system service either unlock, lock, or modify the lock code associated with a plugin. More...
Header: | #include <Crypto/lockcoderequest.h> |
Inherits: | Sailfish::Crypto::Request |
Public Types
enum | LockCodeRequestType { QueryLockStatus, ModifyLockCode, ProvideLockCode, ForgetLockCode } |
enum | LockCodeTargetType { MetadataDatabase, ExtensionPlugin } |
enum | LockStatus { Unknown, Unsupported, Unlocked, Locked } |
Properties
|
|
- 4 properties inherited from Sailfish::Crypto::Request
Public Functions
LockCodeRequest(QObject *parent = Q_NULLPTR) | |
~LockCodeRequest() | |
InteractionParameters | interactionParameters() const |
LockCodeRequestType | lockCodeRequestType() const |
QString | lockCodeTarget() const |
LockCodeTargetType | lockCodeTargetType() const |
LockStatus | lockStatus() const |
void | setInteractionParameters(const InteractionParameters ¶ms) |
void | setLockCodeRequestType(LockCodeRequestType type) |
void | setLockCodeTarget(const QString &targetName) |
void | setLockCodeTargetType(LockCodeTargetType type) |
Reimplemented Public Functions
virtual QVariantMap | customParameters() const |
virtual Sailfish::Crypto::CryptoManager * | manager() const |
virtual Sailfish::Crypto::Result | result() const |
virtual void | setCustomParameters(const QVariantMap ¶ms) |
virtual void | setManager(Sailfish::Crypto::CryptoManager *manager) |
virtual void | startRequest() |
virtual Sailfish::Crypto::Request::Status | status() const |
virtual void | waitForFinished() |
- 8 public functions inherited from Sailfish::Crypto::Request
Signals
void | interactionParametersChanged() |
void | lockCodeRequestTypeChanged() |
void | lockCodeTargetChanged() |
void | lockCodeTargetTypeChanged() |
void | lockStatusChanged() |
- 4 signals inherited from Sailfish::Crypto::Request
Detailed Description
Allows a client to request that the system service either unlock, lock, or modify the lock code associated with a plugin.
Note: most clients will never need to use this class, as the other request types automatically trigger locking and relocking flows as required.
The operation will be applied to the plugin specified by the lockCodeTarget(). Only some plugins support these operations, and in some cases only privileged applications (such as the system settings application) may be permitted to perform these operations.
If the lockCodeRequestType() specified is QueryLockStatus then the service will return whether the specified target plugin or metadata database is locked and requires a lock code to be entered.
If the lockCodeRequestType() specified is ModifyLockCode then the user will be prompted (via a system-mediated user interaction flow) for the current lock code, and if that matches the existing lock code, they will then be prompted for the new lock code.
If the lockCodeRequestType() specified is ProvideLockCode then the user will be prompted (via a system-mediated user interaction flow) for the current lock code, which will be used to unlock the plugin.
If the lockCodeRequestType() specified is ForgetLockCode then if the datum is currently unlocked, the user will be prompted (via a system-mediated user interaction flow) for the current lock code, and if it matches the actual lock code, the plugin will be locked.
An example of modifying the lock code used for a particular plugin follows:
// Require an alpha-numeric lock code to be provided Sailfish::Crypto::InteractionParameters uiParams; uiParams.setInputType(Sailfish::Crypto::InteractionParameters::AlphaNumericInput); uiParams.setEchoMode(Sailfish::Crypto::InteractionParameters::PasswordEcho); // Request that the collection be re-keyed. Sailfish::Crypto::CryptoManager cm; Sailfish::Crypto::LockCodeRequest lcr; lcr.setManager(&cm); lcr.setLockCodeRequestType(Sailfish::Crypto::LockCodeRequest::ModifyLockCode); lcr.setLockCodeTargetType(Sailfish::Crypto::LockCodeRequest::ExtensionPlugin); lcr.setLockCodeTarget(QLatin1String("some.crypto.extension.plugin.name")); lcr.setInteractionParameters(uiParams); lcr.startRequest(); // status() will change to Finished when complete
Member Type Documentation
enum LockCodeRequest::LockCodeRequestType
enum LockCodeRequest::LockCodeTargetType
enum LockCodeRequest::LockStatus
Property Documentation
interactionParameters : Sailfish::Crypto::InteractionParameters
Access functions:
InteractionParameters | interactionParameters() const |
void | setInteractionParameters(const InteractionParameters ¶ms) |
Notifier signal:
void | interactionParametersChanged() |
lockCodeRequestType : LockCodeRequestType
Access functions:
LockCodeRequestType | lockCodeRequestType() const |
void | setLockCodeRequestType(LockCodeRequestType type) |
Notifier signal:
void | lockCodeRequestTypeChanged() |
lockCodeTarget : QString
Access functions:
QString | lockCodeTarget() const |
void | setLockCodeTarget(const QString &targetName) |
Notifier signal:
void | lockCodeTargetChanged() |
lockCodeTargetType : LockCodeTargetType
Access functions:
LockCodeTargetType | lockCodeTargetType() const |
void | setLockCodeTargetType(LockCodeTargetType type) |
Notifier signal:
void | lockCodeTargetTypeChanged() |
lockStatus : const LockStatus
Access functions:
LockStatus | lockStatus() const |
Notifier signal:
void | lockStatusChanged() |
Member Function Documentation
LockCodeRequest::LockCodeRequest(QObject *parent = Q_NULLPTR)
Constructs a new LockCodeRequest object with the given parent.
LockCodeRequest::~LockCodeRequest()
Destroys the LockCodeRequest
[virtual]
QVariantMap LockCodeRequest::customParameters() const
See also setCustomParameters().
InteractionParameters LockCodeRequest::interactionParameters() const
Returns the user input parameters which should be used when requesting the secret data from the user
Note: Getter function for property interactionParameters.
See also setInteractionParameters().
LockCodeRequestType LockCodeRequest::lockCodeRequestType() const
Returns the type of lock code operation being requested
Note: Getter function for property lockCodeRequestType.
See also setLockCodeRequestType().
QString LockCodeRequest::lockCodeTarget() const
Returns the name of the target to which the lock code operation should be applied
Note: Getter function for property lockCodeTarget.
See also setLockCodeTarget().
LockCodeTargetType LockCodeRequest::lockCodeTargetType() const
Returns the type of the target of the lock code operation
Note: Getter function for property lockCodeTargetType.
See also setLockCodeTargetType().
LockStatus LockCodeRequest::lockStatus() const
Returns the current lock status of the target plugin or metadata database
The value will only be valid if the request's operation is QueryLockStatus
. Per-plugin lock status information is also reported from PluginInfoRequest.
Note: Getter function for property lockStatus.
[virtual]
Sailfish::Crypto::CryptoManager *LockCodeRequest::manager() const
See also setManager().
[virtual]
Sailfish::Crypto::Result LockCodeRequest::result() const
[virtual]
void LockCodeRequest::setCustomParameters(const QVariantMap ¶ms)
See also customParameters().
void LockCodeRequest::setInteractionParameters(const InteractionParameters ¶ms)
Sets the user input parameters which should be used when requesting the lock code from the user to params
Note: specifying user input parameters implies that system-mediated user interaction flows are allowed by the calling application, and are required by the collection or standalone secret for which the lock code is being requested.
Note: Setter function for property interactionParameters.
See also interactionParameters().
void LockCodeRequest::setLockCodeRequestType(LockCodeRequestType type)
Sets the type of lock code operation being requested to type
Note: Setter function for property lockCodeRequestType.
See also lockCodeRequestType().
void LockCodeRequest::setLockCodeTarget(const QString &targetName)
Sets the name of the target to which the lock code operation should be applied to name
Note: Setter function for property lockCodeTarget.
See also lockCodeTarget().
void LockCodeRequest::setLockCodeTargetType(LockCodeTargetType type)
Sets the type of the target of the lock code operation to type
Some plugins must be unlocked prior to use, and such plugins should document their semantics for their intended clients.
Note: Setter function for property lockCodeTargetType.
See also lockCodeTargetType().
[virtual]
void LockCodeRequest::setManager(Sailfish::Crypto::CryptoManager *manager)
See also manager().