JUCE  v5.1.1-3-g1a0b28c73
JUCE API
TracktionMarketplaceStatus Class Referenceabstract

An implementation of the OnlineUnlockStatus class which talks to the Tracktion Marketplace server. More...

#include <juce_TracktionMarketplaceStatus.h>

Inheritance diagram for TracktionMarketplaceStatus:
Collaboration diagram for TracktionMarketplaceStatus:

Public Member Functions

 TracktionMarketplaceStatus ()
 
bool applyKeyFile (String keyFileContent)
 Attempts to perform an unlock using a block of key-file data provided. More...
 
UnlockResult attemptWebserverUnlock (const String &email, const String &password)
 Contacts the webserver and attempts to perform a registration with the given user details. More...
 
bool doesProductIDMatch (const String &returnedIDFromServer) override
 
Time getExpiryTime () const
 Returns the Time when the keyfile expires. More...
 
virtual StringArray getLocalMachineIDs ()
 Returns a list of strings, any of which should be unique to this physical computer. More...
 
virtual String getProductID ()=0
 This must return your product's ID, as allocated by the store. More...
 
virtual RSAKey getPublicKey ()=0
 This must return the RSA public key for authenticating responses from the server for this app. More...
 
URL getServerAuthenticationURL () override
 
virtual String getState ()=0
 This method must retrieve the last state that was provided by the saveState method. More...
 
String getUserEmail () const
 Returns the user's email address if known. More...
 
String getWebsiteName () override
 
var isUnlocked () const
 Returns true if the product has been successfully authorised for this machine. More...
 
void load ()
 Attempts to load the status from the state retrieved by getState(). More...
 
String readReplyFromWebserver (const String &email, const String &password) override
 
void save ()
 Triggers a call to saveState which you can use to store the current unlock status in your app's settings. More...
 
virtual void saveState (const String &)=0
 This method must store the given string somewhere in your app's persistent properties, so it can be retrieved later by getState(). More...
 
void setUserEmail (const String &usernameOrEmail)
 Optionally allows the app to provide the user's email address if it is known. More...
 

Detailed Description

An implementation of the OnlineUnlockStatus class which talks to the Tracktion Marketplace server.

For details about how to use this class, see the docs for the base class: OnlineUnlockStatus. Basically, you need to inherit from it, and implement all the pure virtual methods to tell it about your product.

See also
OnlineUnlockStatus, OnlineUnlockForm, KeyGeneration

Constructor & Destructor Documentation

◆ TracktionMarketplaceStatus()

TracktionMarketplaceStatus::TracktionMarketplaceStatus ( )

Member Function Documentation

◆ applyKeyFile()

bool OnlineUnlockStatus::applyKeyFile ( String  keyFileContent)
inherited

Attempts to perform an unlock using a block of key-file data provided.

You may wish to use this as a way of allowing a user to unlock your app by drag-and-dropping a file containing the key data, or by letting them select such a file. This is often needed for allowing registration on machines without internet access.

◆ attemptWebserverUnlock()

UnlockResult OnlineUnlockStatus::attemptWebserverUnlock ( const String email,
const String password 
)
inherited

Contacts the webserver and attempts to perform a registration with the given user details.

The return value will either be a success, or a failure with an error message from the server, so you should show this message to your user.

Because this method blocks while it contacts the server, you must run it on a background thread, not on the message thread. For an easier way to create a GUI to do the unlocking, see OnlineUnlockForm.

◆ doesProductIDMatch()

bool TracktionMarketplaceStatus::doesProductIDMatch ( const String returnedIDFromServer)
overridevirtual

Implements OnlineUnlockStatus.

◆ getExpiryTime()

Time OnlineUnlockStatus::getExpiryTime ( ) const
inlineinherited

Returns the Time when the keyfile expires.

If a the key file obtained has an expiry time, isUnlocked will return false and this will return a non-zero time. The interpretation of this is up to your app but could be used for subscription based models or trial periods.

◆ getLocalMachineIDs()

virtual StringArray OnlineUnlockStatus::getLocalMachineIDs ( )
virtualinherited

Returns a list of strings, any of which should be unique to this physical computer.

When testing whether the user is allowed to use the product on this machine, this list of tokens is compared to the ones that were stored on the webserver.

The default implementation of this method will simply call MachineIDUtilities::getLocalMachineIDs(), which provides a default version of this functionality.

◆ getProductID()

virtual String OnlineUnlockStatus::getProductID ( )
pure virtualinherited

This must return your product's ID, as allocated by the store.

◆ getPublicKey()

virtual RSAKey OnlineUnlockStatus::getPublicKey ( )
pure virtualinherited

This must return the RSA public key for authenticating responses from the server for this app.

You can get this key from your marketplace account page.

◆ getServerAuthenticationURL()

URL TracktionMarketplaceStatus::getServerAuthenticationURL ( )
overridevirtual

Implements OnlineUnlockStatus.

◆ getState()

virtual String OnlineUnlockStatus::getState ( )
pure virtualinherited

This method must retrieve the last state that was provided by the saveState method.

On first-run, it should just return an empty string.

◆ getUserEmail()

String OnlineUnlockStatus::getUserEmail ( ) const
inherited

Returns the user's email address if known.

◆ getWebsiteName()

String TracktionMarketplaceStatus::getWebsiteName ( )
overridevirtual

Implements OnlineUnlockStatus.

◆ isUnlocked()

var OnlineUnlockStatus::isUnlocked ( ) const
inlineinherited

Returns true if the product has been successfully authorised for this machine.

The reason it returns a variant rather than a bool is just to make it marginally more tedious for crackers to work around. Hopefully if this method gets inlined they'll need to hack all the places where you call it, rather than just the function itself.

Bear in mind that each place where you check this return value will need to be changed by a cracker in order to unlock your app, so the more places you call this method, the more hassle it will be for them to find and crack them all.

◆ load()

void OnlineUnlockStatus::load ( )
inherited

Attempts to load the status from the state retrieved by getState().

Call this somewhere in your app's startup code.

◆ readReplyFromWebserver()

String TracktionMarketplaceStatus::readReplyFromWebserver ( const String email,
const String password 
)
overridevirtual

Implements OnlineUnlockStatus.

◆ save()

void OnlineUnlockStatus::save ( )
inherited

Triggers a call to saveState which you can use to store the current unlock status in your app's settings.

◆ saveState()

virtual void OnlineUnlockStatus::saveState ( const String )
pure virtualinherited

This method must store the given string somewhere in your app's persistent properties, so it can be retrieved later by getState().

◆ setUserEmail()

void OnlineUnlockStatus::setUserEmail ( const String usernameOrEmail)
inherited

Optionally allows the app to provide the user's email address if it is known.

You don't need to call this, but if you do it may save the user typing it in.


The documentation for this class was generated from the following file: