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...
Inherits IDisposable, and IEquatable< DittoIdentity >.
Inherited by DittoSDK.DittoManual, DittoSDK.DittoOfflinePlayground, DittoSDK.DittoOnlinePlayground, DittoSDK.DittoOnlineWithAuthentication, and DittoSDK.DittoSharedKey.
|
void | Dispose () |
|
bool | RequiresOfflineLicenseToken () |
| Determines whether Ditto instances created with a certain identity type require an offline license token to be able to sync data with remote peers. Only offline Ditto instances, created with OfflinePlayground, Development, Manual, or SharedKey identities require an offline license token to be provided.
|
|
override bool | Equals (object obj) |
|
bool | Equals (DittoIdentity other) |
|
override int | GetHashCode () |
|
|
static bool | operator== (DittoIdentity left, DittoIdentity right) |
|
static bool | operator!= (DittoIdentity left, DittoIdentity right) |
|
static DittoOfflinePlayground | OfflinePlayground (string appId="", uint siteId=0) |
| Creates an OfflinePlayground identity using the provided app identifier and site identifier. If an app identifier or site identifier isn't provided then the SDK will use generated values for them.
|
|
static DittoOnlineWithAuthentication | OnlineWithAuthentication (string appId, IDittoAuthenticationDelegate authDelegate, bool enableDittoCloudSync=true, string customAuthURL="") |
| Creates an OnlineWithAuthentication identity.
|
|
static DittoOnlinePlayground | OnlinePlayground (string appId, string token, bool enableDittoCloudSync=true) |
| Creates an OnlinePlayground identity.
|
|
static DittoSharedKey | SharedKey (string appId, string sharedKey, uint siteId=0) |
| Creates a SharedKey identity using the provided app identifier, private key and site identifier. If a site identifier isn't provided then the SDK will generate a random value.
|
|
static DittoManual | Manual (string certificateConfig) |
| Creates a Manual identity using the provided certificate config.
|
|
|
readonly DittoIdentityType | Type |
| The type of the identity.
|
|
readonly string | CustomAuthURL |
| A base64 encoded DER representation of a private key, which is shared between devices for a single app.
|
|
readonly bool | EnableDittoCloudSync |
| If true , sync with Ditto Cloud will be auto-configured.
|
|
readonly uint | SiteId |
| The site ID.
|
|
|
string | AppId [get] |
| Gets the app identifier.
|
|
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 an OfflinePlayground or an OnlinePlayground identity and then change to using an OnlineWithAuthentication (or SharedKey/Manual identity when you are ready to deploy Ditto to production.
◆ Manual()
static DittoManual DittoSDK.DittoIdentity.Manual |
( |
string | certificateConfig | ) |
|
|
inlinestatic |
Creates a Manual
identity using the provided certificate config.
- Parameters
-
certificateConfig | A base64 encoded string representation of a certificate bundle. |
- Returns
- A manual
DittoIdentity
.
◆ OfflinePlayground()
static DittoOfflinePlayground DittoSDK.DittoIdentity.OfflinePlayground |
( |
string | appId = "", |
|
|
uint | siteId = 0 ) |
|
inlinestatic |
Creates an OfflinePlayground
identity using the provided app identifier and site identifier. If an app identifier or site identifier isn't provided then the SDK will use generated values for them.
- Parameters
-
appId | Use this to ensure that connections between devices are only established if they share the same app name. |
siteId | Use this to identity different users or devices. Site identifiers are persisted between sessions when using a development identity. Site identifiers should be unique and not reused by different users or devices. |
- Returns
- An OfflinePlayground
DittoIdentity
.
◆ OnlinePlayground()
static DittoOnlinePlayground DittoSDK.DittoIdentity.OnlinePlayground |
( |
string | appId, |
|
|
string | token, |
|
|
bool | enableDittoCloudSync = true ) |
|
inlinestatic |
Creates an OnlinePlayground
identity.
OnlinePlayground
identities should be used when you want to test a Ditto Cloud app without secure authentication("Playground mode"). This mode offers only weak through a shared token and must only be used for development.
- Parameters
-
appId | A UUID identifying this app registration on the Ditto portal, which can be found at https://portal.ditto.live. |
token | A shared token used to set up the OnlinePlayground session. This token is provided by the Ditto portal when setting up the application. |
enableDittoCloudSync | If true , auto-configure sync with Ditto Cloud. |
- Returns
- An online playground
DittoIdentity
.
◆ OnlineWithAuthentication()
static DittoOnlineWithAuthentication DittoSDK.DittoIdentity.OnlineWithAuthentication |
( |
string | appId, |
|
|
IDittoAuthenticationDelegate | authDelegate, |
|
|
bool | enableDittoCloudSync = true, |
|
|
string | customAuthURL = "" ) |
|
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
-
appId | A UUID identifying this app registration on the Ditto portal, which can be found at https://portal.ditto.live. |
authDelegate | A handler for when Ditto requires (re-)authentication. |
enableDittoCloudSync | If true , auto-configure sync with Ditto Cloud. |
customAuthURL | If specified, use a custom authentication service instead of Ditto Cloud. |
- Returns
- An OnlineWithAuthentication
DittoIdentity
.
◆ RequiresOfflineLicenseToken()
bool DittoSDK.DittoIdentity.RequiresOfflineLicenseToken |
( |
| ) |
|
|
inline |
Determines whether Ditto instances created with a certain identity type require an offline license token to be able to sync data with remote peers. Only offline Ditto instances, created with OfflinePlayground, Development, Manual, or SharedKey identities require an offline license token to be provided.
- Returns
- True if the identity type requires an offline license token to sync data.
◆ SharedKey()
static DittoSharedKey DittoSDK.DittoIdentity.SharedKey |
( |
string | appId, |
|
|
string | sharedKey, |
|
|
uint | siteId = 0 ) |
|
inlinestatic |
Creates a SharedKey
identity using the provided app identifier, private key and site identifier. If a site identifier isn't provided then the SDK will generate a random value.
- Parameters
-
appId | Use this to ensure that connections between devices are only established if they share the same app identifier. |
sharedKey | A base64 DER-encoded private key. Refer to the Ditto documentation for full requirements for shared keys and how to generate them. |
siteId | Use this to identity different users or devices. Site identifiers are persisted between sessions when using a development identity. Site identifiers should be unique and not reused by different users or devices. |
- Returns
- A shared key
DittoIdentity
.
◆ 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.
◆ SiteId
readonly uint DittoSDK.DittoIdentity.SiteId |
The site ID.
Use this to identity different users or devices. Site identifiers are persisted between sessions if using a development identity.
Site identifiers should be unique and not reused by different users or devices.
◆ AppId
string DittoSDK.DittoIdentity.AppId |
|
get |
Gets the app identifier.
Connections between devices are only established if they share the same app identifier.