Ditto 1.1.7
Static Public Member Functions | Public Attributes | List of all members
ditto::Identity Class Reference

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

#include <Identity.hpp>

Inheritance diagram for ditto::Identity:
ditto::DevelopmentIdentity ditto::ManualIdentity ditto::OfflinePlaygroundIdentity ditto::OnlineIdentity ditto::OnlinePlaygroundIdentity ditto::OnlinePlaygroundV2Identity ditto::OnlineWithAuthenticationIdentity ditto::SharedKeyIdentity

Static Public Member Functions

static std::shared_ptr< DevelopmentIdentityDevelopment (std::string app_id="", uint64_t site_id=0, std::string persistence_dir="")
 Construct a new DevelopmentIdentity. More...
 
static std::shared_ptr< OfflinePlaygroundIdentityOfflinePlayground (std::string app_id="", uint64_t site_id=0, std::string persistence_dir="")
 Construct a new OfflinePlaygroundIdentity. More...
 
static std::shared_ptr< OnlineIdentityOnline (std::string app_id, std::shared_ptr< AuthenticationCallback > callback, bool enable_ditto_cloud_sync=true, std::string custom_auth_url="", std::string persistence_dir="")
 Construct a new OnlineIdentity. 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="", std::string persistence_dir="")
 Construct a new OnlineWithAuthenticationIdentity. More...
 
static std::shared_ptr< OnlinePlaygroundIdentityOnlinePlayground (std::string app_id, bool enable_ditto_cloud_sync=true, std::string persistence_dir="")
 Construct a new OnlinePlaygroundIdentity. More...
 
static std::shared_ptr< OnlinePlaygroundV2IdentityOnlinePlaygroundV2 (std::string app_id, std::string token, bool enable_ditto_cloud_sync=true, std::string persistence_dir="")
 Construct a new OnlinePlaygroundV2Identity. More...
 
static std::shared_ptr< SharedKeyIdentitySharedKey (std::string app_id, std::string shared_key, uint64_t site_id=0, std::string persistence_dir="")
 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

◆ Development()

std::shared_ptr< DevelopmentIdentity > ditto::Identity::Development ( std::string  app_id = "",
uint64_t  site_id = 0,
std::string  persistence_dir = "" 
)
static

Construct a new DevelopmentIdentity.

Deprecated:
Use OfflinePlaygroundIdentity instead.
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.
[in]persistence_dirthe directory to be used to cache identity-related data.

◆ 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,
std::string  persistence_dir = "" 
)
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.
[in]persistence_dirthe directory to be used to cache identity-related data.

◆ Online()

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

Construct a new OnlineIdentity.

Deprecated:
Use OnlineWithAuthenticationIdentity instead.
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.
[in]persistence_dirthe directory to be used to cache identity-related data.

◆ OnlinePlayground()

std::shared_ptr< OnlinePlaygroundIdentity > ditto::Identity::OnlinePlayground ( std::string  app_id,
bool  enable_ditto_cloud_sync = true,
std::string  persistence_dir = "" 
)
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]enable_ditto_cloud_syncif true, auto-configure sync with Ditto Cloud.
[in]persistence_dirthe directory to be used to cache identity-related data.

◆ OnlinePlaygroundV2()

std::shared_ptr< OnlinePlaygroundV2Identity > ditto::Identity::OnlinePlaygroundV2 ( std::string  app_id,
std::string  token,
bool  enable_ditto_cloud_sync = true,
std::string  persistence_dir = "" 
)
static

Construct a new OnlinePlaygroundV2Identity.

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.
[in]persistence_dirthe directory to be used to cache identity-related data.

◆ 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 = "",
std::string  persistence_dir = "" 
)
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.
[in]persistence_dirthe directory to be used to cache identity-related data.

◆ SharedKey()

std::shared_ptr< SharedKeyIdentity > ditto::Identity::SharedKey ( std::string  app_id,
std::string  shared_key,
uint64_t  site_id = 0,
std::string  persistence_dir = "" 
)
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.
[in]persistence_dirthe directory to be used to cache identity-related data.