Ditto  1.0.14
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...

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

Static Public Member Functions

static DevelopmentIdentity Development (std::string app_id="", uint64_t site_id=0, std::string persistence_dir="")
 Construct a new DevelopmentIdentity. More...
 
static OfflinePlaygroundIdentity OfflinePlayground (std::string app_id="", uint64_t site_id=0, std::string persistence_dir="")
 Construct a new OfflinePlaygroundIdentity. More...
 
static OnlineIdentity 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="")
 Construct a new OnlineIdentity. More...
 
static OnlineWithAuthenticationIdentity 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="")
 Construct a new OnlineWithAuthenticationIdentity. More...
 
static OnlinePlaygroundIdentity OnlinePlayground (std::string app_id, bool enable_ditto_cloud_sync=true, std::string persistence_dir="")
 Construct a new OnlinePlaygroundIdentity. More...
 
static SharedKeyIdentity SharedKey (std::string app_id, std::string shared_key, uint64_t site_id=0, std::string persistence_dir="")
 Construct a new SharedKeyIdentity. More...
 
static ManualIdentity Manual (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()

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()

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()

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()

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()

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.

◆ OnlineWithAuthentication()

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()

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.