SecureStorage QML Type

Stores data encrypted into the system keychain. More...

Import Statement: import ArcGIS.AppFramework.SecureStorage 1.0



  • error( string errorMessage)


Detailed Description

This code sample demonstrates usage of the SecureStorage component.

Item {
        TextField {
                id: key
                placeholderText: "Enter key"

        TextField {
                id: value
                placeholderText: "Enter value"
                anchors.left: key.right

        //Click on the button to store data in the keychain
        Button {
                id: secureButton
                text: qsTr("Secure Data")
                onClicked: {
                anchors.topMargin: 10 * AppFramework.displayScaleFactor

        //Click on the button to retrieve data
        Button {
                id: retrieveButton
                text: qsTr("Retrieve Data")
                onClicked: {
                        retrieveData.text = qsTr("Value: ") + SecureStorage.value(key.text)
                anchors.topMargin: 10 * AppFramework.displayScaleFactor

        //Display retrieved data
        Text {
                id: retrieveData
                anchors.topMargin: 10 * AppFramework.displayScaleFactor

        //Display maximum key length supported by the operating system
        Text {
                id: maximumKeyLength
                text: qsTr("Maximum Key Length: ") + SecureStorage.maximumKeyLength
                anchors.topMargin: 10 * AppFramework.displayScaleFactor

        //Display maximum value length supported by the operating system
        Text {
                id: maximumValueLength
                text: qsTr("Maximum Value Length: ") + SecureStorage.maximumValueLength
                anchors.topMargin: 10 * AppFramework.displayScaleFactor

Property Documentation

[read-only] connectedToBackend : bool

Returns true if the SecureStorage component is connected to a secure kernel in the OS to store the information. In most cases, you should expect this property to return true on every platform but Linux.

Text {
        id: connectedSecurely
        Layout.fillWidth: true
        font.pointSize: 10
        Layout.preferredWidth: parent.width
        wrapMode: Text.Wrap
        horizontalAlignment: Text.AlignLeft
        text: qsTr("Connected to a secure kernel: ") + SecureStorage.connectedToBackend

[read-only] maximumKeyLength : int

Returns the maximum key length supported by the operating system.

If the key you need to store is larger than the key length, consider splitting and storing the key separately.

[read-only] maximumValueLength : int

Returns the maximum value length supported by the operating system.

If the value you need to store is larger than the value length, consider splitting and storing the value separately.

Signal Documentation

error( string errorMessage)

Signal emitted when an error is encountered when executing the setValue or value methods.

Method Documentation

bool setValue(key, var value)

Stores data in the keychain associated with the provided key.

If you use the same key twice, the previous value associated with the key will be overwritten.

If you enter a valid key with an empty string, it will remove the key present in the keychain.

The key parameter

The key to be used to retrieve the value. This key cannot be null or an empty string.

Be aware that Android will encounter an exception if certain special characters, such as /, are used in keys.

The value parameter

The value to encrypt and store.

See also value().

var value(key)

Retrieves data associated with the key.

The key parameter

The key to return the encrypted value for.

See also setValue().

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.