Sailfish OS
  • Info
  • User Experience
  • Cases
  • Community
  • Developers
  • Contact
  • Get Sailfish OS
Select Page
  • Info
  • User Experience
  • Cases
  • Community
  • Developers
  • Contact
  • Get Sailfish OS

Sailfish Secrets

API Documentation
  • API Documentation
  • Libsailfishapp
  • Sailfish Silica
    • Documentation
    • Icon Reference
  • Sailfish Components
    • Sailfish Accounts
    • Sailfish Bluetooth
    • Sailfish Contacts
    • Sailfish Crypto
    • Sailfish Gallery
    • Sailfish Media
    • Sailfish Pickers
    • Sailfish Secrets
    • Sailfish Share
    • Sailfish Telephony
    • Sailfish Webview
    • Amber Web Authorization
    • Amber MPRIS
  • Nemo QML Plugins
    • Configuration
    • Contacts
    • D-Bus
    • Keepalive
    • Notifications
    • Thumbnailer
  • Sailfish Middleware
    • MDM Framework
    • MDM Policy Framework
    • User Manager Daemon
  • API Documentation
  • Libsailfishapp
  • Sailfish Silica
    • Documentation
    • Icon Reference
  • Sailfish Components
    • Sailfish Accounts
    • Sailfish Bluetooth
    • Sailfish Contacts
    • Sailfish Crypto
    • Sailfish Gallery
    • Sailfish Media
    • Sailfish Pickers
    • Sailfish Secrets
    • Sailfish Share
    • Sailfish Telephony
    • Sailfish Webview
    • Amber Web Authorization
    • Amber MPRIS
  • Nemo QML Plugins
    • Configuration
    • Contacts
    • D-Bus
    • Keepalive
    • Notifications
    • Thumbnailer
  • Sailfish Middleware
    • MDM Framework
    • MDM Policy Framework
    • User Manager Daemon

Contents

  • Public Types
  • Properties
  • Public Functions
  • Reimplemented Public Functions
  • Signals
  • Detailed Description

LockCodeRequest Class

(Sailfish::Secrets::LockCodeRequest)

Allows a client to request that the system service either unlock, lock, or modify the lock code associated with the device, an extension plugin, a standalone secret or a collection. More...

Header: #include <Secrets/lockcoderequest.h>
Inherits: Sailfish::Secrets::Request
  • List of all members, including inherited members

Public Types

enum LockCodeRequestType { QueryLockStatus, ModifyLockCode, ProvideLockCode, ForgetLockCode }
enum LockCodeTargetType { MetadataDatabase, ExtensionPlugin }
enum LockStatus { Unknown, Unsupported, Unlocked, Locked }

Properties

  • interactionParameters : Sailfish::Secrets::InteractionParameters
  • lockCodeRequestType : LockCodeRequestType
  • lockCodeTarget : QString
  • lockCodeTargetType : LockCodeTargetType
  • lockStatus : const LockStatus
  • userInteractionMode : Sailfish::Secrets::SecretManager::UserInteractionMode
  • 3 properties inherited from Sailfish::Secrets::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 &params)
void setLockCodeRequestType(LockCodeRequestType type)
void setLockCodeTarget(const QString &targetName)
void setLockCodeTargetType(LockCodeTargetType type)
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 interactionParametersChanged()
void lockCodeRequestTypeChanged()
void lockCodeTargetChanged()
void lockCodeTargetTypeChanged()
void lockStatusChanged()
void userInteractionModeChanged()
  • 3 signals inherited from Sailfish::Secrets::Request

Detailed Description

Allows a client to request that the system service either unlock, lock, or modify the lock code associated with the device, an extension plugin, a standalone secret or a collection.

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 secrets bookkeeping database of the device, an extension plugin, a custom-locked collection or a standalone secret specified by the lockCodeTargetType() and lockCodeTarget() parameters. This operation is only valid for custom-locked collections or secrets when performed by a non-privileged application.

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. The datum will then be re-encrypted with a key derived from the new lock code.

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 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 datum.

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 datum will be locked.

An example of modifying the lock code used for a custom-locked collection follows:

 // Require an alpha-numeric lock code to be provided
 Sailfish::Secrets::InteractionParameters uiParams;
 uiParams.setInputType(Sailfish::Secrets::InteractionParameters::AlphaNumericInput);
 uiParams.setEchoMode(Sailfish::Secrets::InteractionParameters::PasswordEcho);

 // Request that the collection be re-keyed.
 Sailfish::Secrets::SecretManager sm;
 Sailfish::Secrets::LockCodeRequest lcr;
 lcr.setManager(&sm);
 lcr.setLockCodeRequestType(Sailfish::Secrets::LockCodeRequest::ModifyLockCode);
 lcr.setLockCodeTargetType(Sailfish::Secrets::LockCodeRequest::ExtensionPlugin);
 lcr.setLockCodeTarget(QLatin1String("Some custom-locked collection"));
 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::Secrets::InteractionParameters

Access functions:

InteractionParameters interactionParameters() const
void setInteractionParameters(const InteractionParameters &params)

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()

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

LockCodeRequest::LockCodeRequest(QObject *parent = Q_NULLPTR)

Constructs a new LockCodeRequest object with the given parent.

LockCodeRequest::~LockCodeRequest()

Destroys the LockCodeRequest

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::Secrets::SecretManager *LockCodeRequest::manager() const

See also setManager().

[virtual] Sailfish::Secrets::Result LockCodeRequest::result() const

void LockCodeRequest::setInteractionParameters(const InteractionParameters &params)

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

The name may identify either a custom-locked collection, a custom-locked standalone secret, an extension plugin or the bookkeeping database, depending on the value of the lockCodeTargetType().

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

Only privileged applications (usually, the system settings application) can perform lock code operations on the bookkeeping database.

Only the owner of a collection or standalone-secret can perform lock code operations on that collection or secret.

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::Secrets::SecretManager *manager)

See also manager().

[virtual] void LockCodeRequest::startRequest()

[virtual] Sailfish::Secrets::Request::Status LockCodeRequest::status() const

Sailfish::Secrets::SecretManager::UserInteractionMode LockCodeRequest::userInteractionMode() const

Returns the user interaction mode required when retrieving lock codes from the user

Note: Getter function for property userInteractionMode.

See also setUserInteractionMode().

[virtual] void LockCodeRequest::waitForFinished()

  • Legal
  • Contact Us
  • Jolla Mobile Ltd © 2025

  • Facebook
  • Twitter
  • Mastodon
  • YouTube
  • LinkedIn