key( index, successCallback, errorCallback ) method

This function gets the key corresponding to the given index.

Syntax

key( index, successCallback, errorCallback )

Parameters

Name Type Description
index number The index of the store for which to get the key.Valid indices are integers from zero (the first index), up to, but not including, the length of the store. If the index is out of bounds, then the success callback is invoked with null as the parameter.
successCallback sap.EncryptedStorage~keySuccessCallback If successful, the successCallback is invoked with the key as the parameter.
errorCallback sap.EncryptedStorage~errorCallback If there is an error, the errorCallback is invoked with an ErrorInfo object as the parameter.

Example

// This example shows how to get the key for the last item.
var store = new sap.EncryptedStorage("storeName", "storePassword");
var errorCallback = function( error ){
   alert("An error occurred: " + JSON.stringify(error));
}
var keySuccessCallback = function(key) {
   alert("Last key is " + key);
}
var lengthSuccessCallback = function(length) {
   store.key(length - 1, keySuccessCallback, errorCallback);
}
store.length(lengthSuccessCallback, errorCallback);

Source

encryptedstorage.js, line 78.