Ditto 3.0.3-alpha2
Static Public Member Functions | Public Attributes | List of all members
ditto::Identity Class Referenceabstract

The various identity configurations that you can use when initializing a Ditto instance. More...

#include <Identity.hpp>

Inheritance diagram for ditto::Identity:
ditto::ManualIdentity ditto::OfflinePlaygroundIdentity ditto::OnlinePlaygroundIdentity ditto::OnlineWithAuthenticationIdentity ditto::SharedKeyIdentity

Static Public Member Functions

static std::shared_ptr< OfflinePlaygroundIdentityOfflinePlayground (std::string app_id="", uint64_t site_id=0)
 Construct a new OfflinePlaygroundIdentity. More...
 
static std::shared_ptr< OnlineWithAuthenticationIdentityOnlineWithAuthentication (std::string app_id, std::shared_ptr< AuthenticationCallback > callback, bool enable_ditto_cloud_sync=true, std::string custom_auth_url="")
 Construct a new OnlineWithAuthenticationIdentity. More...
 
static std::shared_ptr< OnlinePlaygroundIdentityOnlinePlayground (std::string app_id, std::string token, bool enable_ditto_cloud_sync=true)
 Construct a new OnlinePlaygroundIdentity. More...
 
static std::shared_ptr< SharedKeyIdentitySharedKey (std::string app_id, std::string shared_key, uint64_t site_id=0)
 Construct a new SharedKeyIdentity. More...
 
static std::shared_ptr< ManualIdentityManual (std::string certificate_config)
 Construct a new ManualIdentity. More...
 

Public Attributes

IdentityType type
 

Detailed Description

The various identity configurations that you can use when initializing a Ditto instance.

The different supported identities and when they should be used are as follows:

Member Function Documentation

◆ Manual()

std::shared_ptr< ManualIdentity > ditto::Identity::Manual ( std::string  certificate_config)
static

Construct a new ManualIdentity.

Parameters
[in]configa base64-encoded string representation of a certificate bundle.

◆ OfflinePlayground()

std::shared_ptr< OfflinePlaygroundIdentity > ditto::Identity::OfflinePlayground ( std::string  app_id = "",
uint64_t  site_id = 0 
)
static

Construct a new OfflinePlaygroundIdentity.

Parameters
[in]app_idthe ID of the app. If you are developing multiple apps, use distinct names to ensure they do not attempt to connect and sync with each other.
[in]site_idthe site ID for the device. Use this to identity different users or devices. Site IDs are persisted between sessions when using a development identity. Site IDs should be unique and not reused by different users or devices.

◆ OnlinePlayground()

std::shared_ptr< OnlinePlaygroundIdentity > ditto::Identity::OnlinePlayground ( std::string  app_id,
std::string  token,
bool  enable_ditto_cloud_sync = true 
)
static

Construct a new OnlinePlaygroundIdentity.

Parameters
[in]appIDa UUID identifying this app registration on the Ditto portal, which can be found at https://portal.ditto.live.
[in]tokena shared token used to set up the OnlinePlayground session. This token is provided by the Ditto portal when setting up the application.
[in]enable_ditto_cloud_syncif true, auto-configure sync with Ditto Cloud.

◆ OnlineWithAuthentication()

std::shared_ptr< OnlineWithAuthenticationIdentity > ditto::Identity::OnlineWithAuthentication ( std::string  app_id,
std::shared_ptr< AuthenticationCallback callback,
bool  enable_ditto_cloud_sync = true,
std::string  custom_auth_url = "" 
)
static

Construct a new OnlineWithAuthenticationIdentity.

Parameters
[in]appIDa UUID identifying this app registration on the Ditto portal, which can be found at https://portal.ditto.live.
[in]callbacka handler for when Ditto requires (re)authentication.
[in]enable_ditto_cloud_syncif true, auto-configure sync with Ditto Cloud.
[in]custom_auth_urlif specified, use a custom authentication service instead of Ditto Cloud.

◆ SharedKey()

std::shared_ptr< SharedKeyIdentity > ditto::Identity::SharedKey ( std::string  app_id,
std::string  shared_key,
uint64_t  site_id = 0 
)
static

Construct a new SharedKeyIdentity.

Parameters
[in]app_idthe ID of the app, specified in domain format, e.g. "app.ditto.live". All peers must use the same app ID to communicate.
[in]shared_keya base64-encoded DER private key. Refer to Ditto documentation for details about generating shared keys.
[in]site_idthe site ID for the device. For shared key mode, this can be left unspecified to choose a random number.