Ditto  1.0.18-alpha1
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
DittoSDK.DittoIdentity Struct Reference

Used to identify a given peer in your network. In practice a peer may be a user, a device, or it might be some other entity in your system. More...

Inheritance diagram for DittoSDK.DittoIdentity:

Public Member Functions

unsafe void Dispose ()
 

Static Public Member Functions

static DittoIdentity Development (string appID="", uint siteId=0, string workingDir="ditto")
 Creates a Development identity using the provided app ID and site ID. If an app ID or site ID isn't provided then the SDK will use generated values for them. More...
 
static DittoIdentity OfflinePlayground (string appID="", uint siteId=0, string workingDir="ditto")
 Creates an OfflinePlayground identity using the provided app ID and site ID. If an app ID or site ID isn't provided then the SDK will use generated values for them. More...
 
static DittoIdentity Online (string appID, IDittoAuthenticationDelegate authDelegate, bool enableDittoCloudSync=true, string customAuthURL="", string workingDir="")
 Deprecated. Please use OnlineWithAuthentication instead. More...
 
static DittoIdentity OnlineWithAuthentication (string appID, IDittoAuthenticationDelegate authDelegate, bool enableDittoCloudSync=true, string customAuthURL="", string workingDir="")
 Creates an OnlineWithAuthentication identity. More...
 
static DittoIdentity OnlinePlayground (string appID, bool enableDittoCloudSync=true, string workingDir="")
 Creates an OnlinePlayground identity. More...
 
static DittoIdentity SharedKey (string appID, string sharedKey, uint siteID=0, string workingDir="ditto")
 Creates a SharedKey identity using the provided app ID, private key and site ID. If a site ID isn't provided then the SDK will generate a random value. More...
 
static DittoIdentity Manual (string certificateConfig)
 Creates a Manual identity using the provided certificate config. More...
 

Public Attributes

readonly DittoIdentityType Type
 The type of the identity. More...
 
readonly string AppID
 The app ID. More...
 
readonly bool EnableDittoCloudSync
 If true, sync with Ditto Cloud will be auto-configured. More...
 
readonly string CustomAuthURL
 A base64 encoded DER representation of a private key, which is shared between devices for a single app. More...
 
readonly uint SiteId
 The site ID. More...
 
readonly string Key
 The shared private key. More...
 
readonly string CertificateConfig
 A base64 encoded string representation of a certificate bundle. More...
 

Detailed Description

Used to identify a given peer in your network. In practice a peer may be a user, a device, or it might be some other entity in your system.

You can get up and running quickly by using a Development or an OnlinePlayground identity and then change to using an OnlineWithAuthentication (or SharedKey/Manual identity when you are ready to deploy Ditto to production.

Member Function Documentation

◆ Development()

static DittoIdentity DittoSDK.DittoIdentity.Development ( string  appID = "",
uint  siteId = 0,
string  workingDir = "ditto" 
)
inlinestatic

Creates a Development identity using the provided app ID and site ID. If an app ID or site ID isn't provided then the SDK will use generated values for them.

Parameters
appIDUse this to ensure that connections between devices are only established if they share the same app name.
siteIdUse 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.
workingDirThe directory that will be used to persist Ditto data relating to the identity and authentication.
Returns
A Development DittoIdentity.

◆ Manual()

static DittoIdentity DittoSDK.DittoIdentity.Manual ( string  certificateConfig)
inlinestatic

Creates a Manual identity using the provided certificate config.

Parameters
certificateConfigA base64 encoded string representation of a certificate bundle.
Returns
A manual DittoIdentity.

◆ OfflinePlayground()

static DittoIdentity DittoSDK.DittoIdentity.OfflinePlayground ( string  appID = "",
uint  siteId = 0,
string  workingDir = "ditto" 
)
inlinestatic

Creates an OfflinePlayground identity using the provided app ID and site ID. If an app ID or site ID isn't provided then the SDK will use generated values for them.

Parameters
appIDUse this to ensure that connections between devices are only established if they share the same app name.
siteIdUse 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.
workingDirThe directory that will be used to persist Ditto data relating to the identity and authentication.
Returns
An OfflinePlayground DittoIdentity.

◆ Online()

static DittoIdentity DittoSDK.DittoIdentity.Online ( string  appID,
IDittoAuthenticationDelegate  authDelegate,
bool  enableDittoCloudSync = true,
string  customAuthURL = "",
string  workingDir = "" 
)
inlinestatic

Deprecated. Please use OnlineWithAuthentication instead.

Creates an Online identity.

Online identities should be used when running Ditto in secure production mode, logging on to Ditto Cloud, or using an on-premises authentication server.User permissions are centrally managed. Sync will not work until a successful login has occurred.

The only required configuration is the application's UUID, which can be found on the Ditto portal where the app is registered, and an authentication delegate.

By default cloud sync is enabled.This means the SDK will sync to a Big Peer in Ditto's cloud when an internet connection is available. This is controlled by the enableDittoCloudSync parameter. If true (default), a suitable wss:// URL will be added to the TransportConfig. To prevent cloud sync, or to specify your own URL later, pass false.

Authentication requests are handled by Ditto's cloud by default, configured in the portal at https://portal.ditto.live.

To use a different or on-premises authentication service, pass a custom HTTPS base URL as the customAuthURL parameter.

Parameters
appIDA UUID identifying this app registration on the Ditto portal, which can be found at https://portal.ditto.live.
authDelegateA handler for when Ditto requires (re-)authentication.
enableDittoCloudSyncIf true, auto-configure sync with Ditto Cloud.
customAuthURLIf specified, use a custom authentication service instead of Ditto Cloud.
workingDirThe directory that will be used to persist Ditto data relating to the identity and authentication.
Returns
An Online<c>DittoIdentity.

◆ OnlinePlayground()

static DittoIdentity DittoSDK.DittoIdentity.OnlinePlayground ( string  appID,
bool  enableDittoCloudSync = true,
string  workingDir = "" 
)
inlinestatic

Creates an OnlinePlayground identity.

OnlinePlayground identities should be used when you want to test a Ditto Cloud app without authentication("Playground mode"). This mode offers no security and must only be used for development.

Parameters
appIDA UUID identifying this app registration on the Ditto portal, which can be found at https://portal.ditto.live.
enableDittoCloudSyncIf true, auto-configure sync with Ditto Cloud.
workingDirThe directory that will be used to persist Ditto data relating to the identity and authentication.
Returns
An online playground DittoIdentity.

◆ OnlineWithAuthentication()

static DittoIdentity DittoSDK.DittoIdentity.OnlineWithAuthentication ( string  appID,
IDittoAuthenticationDelegate  authDelegate,
bool  enableDittoCloudSync = true,
string  customAuthURL = "",
string  workingDir = "" 
)
inlinestatic

Creates an OnlineWithAuthentication identity.

OnlineWithAuthentication identities should be used when running Ditto in secure production mode, logging on to Ditto Cloud, or using an on-premises authentication server.User permissions are centrally managed. Sync will not work until a successful login has occurred.

The only required configuration is the application's UUID, which can be found on the Ditto portal where the app is registered, and an authentication delegate.

By default cloud sync is enabled.This means the SDK will sync to a Big Peer in Ditto's cloud when an internet connection is available. This is controlled by the enableDittoCloudSync parameter. If true (default), a suitable wss:// URL will be added to the TransportConfig. To prevent cloud sync, or to specify your own URL later, pass false.

Authentication requests are handled by Ditto's cloud by default, configured in the portal at https://portal.ditto.live.

To use a different or on-premises authentication service, pass a custom HTTPS base URL as the customAuthURL parameter.

Parameters
appIDA UUID identifying this app registration on the Ditto portal, which can be found at https://portal.ditto.live.
authDelegateA handler for when Ditto requires (re-)authentication.
enableDittoCloudSyncIf true, auto-configure sync with Ditto Cloud.
customAuthURLIf specified, use a custom authentication service instead of Ditto Cloud.
workingDirThe directory that will be used to persist Ditto data relating to the identity and authentication.
Returns
An OnlineWithAuthentication DittoIdentity.

◆ SharedKey()

static DittoIdentity DittoSDK.DittoIdentity.SharedKey ( string  appID,
string  sharedKey,
uint  siteID = 0,
string  workingDir = "ditto" 
)
inlinestatic

Creates a SharedKey identity using the provided app ID, private key and site ID. If a site ID isn't provided then the SDK will generate a random value.

Parameters
appIDUse this to ensure that connections between devices are only established if they share the same app ID.
sharedKeyA base64 DER-encoded private key. Refer to the Ditto documentation for full requirements for shared keys and how to generate them.
siteIDUse 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.
workingDirThe directory that will be used to persist Ditto data relating to the identity and authentication.
Returns
A shared key DittoIdentity.

Member Data Documentation

◆ AppID

readonly string DittoSDK.DittoIdentity.AppID

The app ID.

Use this to ensure that connections between devices are only established if they share the same app ID.

Note that this is only set if the identity is a development identity.

◆ CertificateConfig

readonly string DittoSDK.DittoIdentity.CertificateConfig

A base64 encoded string representation of a certificate bundle.

Note that this is only set if the identity is a manual identity.

◆ CustomAuthURL

readonly string DittoSDK.DittoIdentity.CustomAuthURL

A base64 encoded DER representation of a private key, which is shared between devices for a single app.

Note that this will not be set for all identity types.

◆ EnableDittoCloudSync

readonly bool DittoSDK.DittoIdentity.EnableDittoCloudSync

If true, sync with Ditto Cloud will be auto-configured.

Note that this will not be set to a meaningful value for all identity types. false will represent an unset value for identities where Ditto Cloud sync isn't applicable.

◆ Key

readonly string DittoSDK.DittoIdentity.Key

The shared private key.

Include this in your privately-distributed app to provide security against third parties while allowing your devices to connect to each other.

Note that this is only set if the identity is a shared key identity.

◆ SiteId

readonly uint DittoSDK.DittoIdentity.SiteId

The site ID.

Use this to identity different users or devices. Site IDs are persisted between sessions if using a development identity.

Site IDs should be unique and not reused by different users or devices.

Note that this is only set if the identity is a development identity.

◆ Type

readonly DittoIdentityType DittoSDK.DittoIdentity.Type

The type of the identity.