Previous Topic: ExampleNext Topic: SetCurrentWalletFromEncoding()


SetCurrentCardByIndex()

The client sets the current card to be the one with the given index in the current wallet.

Note: This is a deprecated function use ImportArcotID() instead.

Syntax

boolean SetCurrentCardByIndex(index)

Parameters

The following are the parameters of this method:

Parameter

Type

Description

index

integer

The index number of the card you wish to set. Usually "0" since there is only one card in a wallet.

Returns

If the method is successful, it returns TRUE. If the method is unsuccessful, it returns FALSE.

Example

var arcotClient = new ArcotClient();
var walletnameString = "GuestUser";
var b64walletString  = "MII0yAIBAAwHY3Rnb29kMTCCNDcwgjQzAgEBDAR
                        jYXJkoIHFMB8GCmCGSAGG+UYJAQEwEQQAAgEBAg
                        ILAgICAegCAgMYBIGhMIGeAgEAMA4GCmCGSA GG+
                    UYJAgAFAASBiDCBhQJBAMzNUdGcaBZsiAt/88Dk9...";

// Wallet will be saved to either hard disk or USB
arcotClient.SetAttribute("WalletInMemory", false);

// Set the current wallet
arcotClient.SetCurrentWalletFromEncoding(b64walletString);

// Set the card at index 0 as the current (and only) card in the wallet
var returnValue = arcotClient.SetCurrentCardByIndex(0);
if (returnValue)
{
    if (arcotClient.AddCurrentCardToWallet(walletnameString))
    {
        document.write("<P>Card added to wallet successfully</P>");
    }
    else
    {
        document.write("<P>Failed to add card to wallet</P>");
    }
}